From lgiessmann at common-lisp.net Fri Jul 1 09:37:26 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Fri, 01 Jul 2011 02:37:26 -0700 Subject: [isidorus-cvs] r541 - branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values Message-ID: Author: lgiessmann Date: Fri Jul 1 02:37:25 2011 New Revision: 541 Log: gdl-frontend: Widgets: implemented a class that wraps a CSS Color value - instead of the GWT color value, instances of this class throw a InvalidGdlException if a color value is invalid or unsupported Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ColorValue.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/NumUnitValue.java Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ColorValue.java ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ColorValue.java Fri Jul 1 02:37:25 2011 (r541) @@ -0,0 +1,172 @@ +package us.isidor.gdl.anaToMia.Widgets.values; + +import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; + +public class ColorValue { + private String stringValue = null; + + + // some constructors + public ColorValue(){ + this.stringValue = "#000000"; + } + + + public ColorValue(String color) throws InvalidGdlSchemaException{ + String value = color.toLowerCase(); + + if(value.matches("^(maroon|red|orange|yellow|olive|purple|fuchsia|white|lime|green|navy|blue|aqua|teal|black|silver|gray)$")){ + this.stringValue = cssColorToRRGGBB(CssColor.valueOf(value)); + }else if(value.matches("^#[0-9a-f]{6}$")) { + this.stringValue = value; + }else if(value.matches("^#[0-9a-f]{3}$")) { + this.stringValue = "#" + value.charAt(1) + value.charAt(1) + value.charAt(2) + value.charAt(2) + value.charAt(3) + value.charAt(3); + }else if(value.matches("^rgb\\( *\\+?[0-9]{1,3} *, *\\+?[0-9]{1,3} *, *\\+?[0-9]{1,3} *\\)$")){ + String[] rgb = value.substring(4, value.length() - 1).split(","); + this.stringValue = "#" + decToHexIntegerString(rgb[0]) + decToHexIntegerString(rgb[1]) + decToHexIntegerString(rgb[2]); + }else if(value.matches("^rgb\\( *\\+?[0-9]{1,3}% *, *\\+?[0-9]{1,3}% *, *\\+?[0-9]{1,3}% *\\)$")){ + String[] rgb = value.substring(4, value.length() - 1).split(","); + this.stringValue = "#" + percentToHexIntegerString(rgb[0]) + percentToHexIntegerString(rgb[1]) + percentToHexIntegerString(rgb[2]); + }else { + throw new InvalidGdlSchemaException("a ColorValue must be a value of the format #RRGGBB, #RGB, rdg(rrr,ggg,bbb), rgb(rrr%,ggg%,bbb%) or a CssColor, but is " + color); + } + } + + + // converts an integer string of a decimal to a hex representation + private String decToHexIntegerString(String decIntegerString){ + int intValue = Integer.valueOf(decIntegerString.replaceFirst("\\+", "").trim()); + intValue = intValue > 255 ? 255 : intValue; + String result = Integer.toHexString(intValue); + return result.length() == 1 ? "0" + result : result; + } + + + // converts an integer representing a percentage value string + // to a hex representation + private String percentToHexIntegerString(String percentageString){ + String rawValue = percentageString.replaceFirst("%", "").replaceFirst("\\+", "").trim(); + int percentValue = Integer.valueOf(rawValue); + String result = Integer.toHexString((int)(255 * ((float)percentValue / 100))); + return result.length() == 1 ? "0" + result : result; + } + + + public ColorValue(int r, int g, int b) throws InvalidGdlSchemaException { + this("rgb(" + r + "," + g + "," + b + ")"); + } + + + public ColorValue(CssColor color){ + this.stringValue = cssColorToRRGGBB(color); + } + + + // a helper method that parses CssColor instances + // to a string of the format ##RRGGBB + private String cssColorToRRGGBB(CssColor color){ + switch(color){ + case maroon: return "#800000"; + case red: return "#ff0000"; + case orange: return "#ffa500"; + case yellow: return "#ffff00"; + case olive: return "#808000"; + case purple: return "#800080"; + case fuchsia: return "#ff00ff"; + case white: return "#ffffff"; + case lime: return "#00ff00"; + case green: return "#008000"; + case navy: return "#000080"; + case blue: return "#0000ff"; + case aqua: return "#00ffff"; + case teal: return "#008080"; + case black: return "#000000"; + case silver: return "#c0c0c0"; + default: return "#808080"; + } + } + + + // returns a string of the format #RRGGBB + public String getStringValue(){ + return this.stringValue; + } + + + // returns an int array of the form [r, g, b] of the stored + // color value + public int[] getRGBvalue(){ + String r = "" + this.stringValue.charAt(1) + this.stringValue.charAt(2); + String g = "" + this.stringValue.charAt(3) + this.stringValue.charAt(4); + String b = "" + this.stringValue.charAt(5) + this.stringValue.charAt(6); + + return new int[]{Integer.valueOf(r, 16), Integer.valueOf(g, 16), Integer.valueOf(b, 16)}; + } + + + // returns a CSSColor instance of the stored value, if it is + // a value that corresponds to the defined keywords, otherwise + // the return value is null + public CssColor getCssColor(){ + if(this.stringValue.equals("#800000")){ + return CssColor.maroon; + }else if(this.stringValue.equals("#ff0000")){ + return CssColor.red; + }else if(this.stringValue.equals("#ffa500")) { + return CssColor.orange; + }else if(this.stringValue.equals("#ffff00")){ + return CssColor.yellow; + }else if(this.stringValue.equals("#808000")) { + return CssColor.olive; + }else if(this.stringValue.equals("#800080")){ + return CssColor.purple; + }else if(this.stringValue.equals("#ff00ff")) { + return CssColor.fuchsia; + }else if(this.stringValue.equals("#ffffff")){ + return CssColor.white; + }else if(this.stringValue.equals("#00ff00")) { + return CssColor.lime; + }else if(this.stringValue.equals("#008000")) { + return CssColor.green; + }else if(this.stringValue.equals("#000080")) { + return CssColor.navy; + }else if(this.stringValue.equals("#0000ff")) { + return CssColor.blue; + }else if(this.stringValue.equals("#00ffff")) { + return CssColor.aqua; + }else if(this.stringValue.equals("#008080")) { + return CssColor.teal; + }else if(this.stringValue.equals("#000000")) { + return CssColor.black; + }else if(this.stringValue.equals("#c0c0c0")) { + return CssColor.silver; + }else if(this.stringValue.equals("#808080")) { + return CssColor.gray; + }else { + return null; + } + } + + + // represents the color key words that are defined in CSS chapter 4.3.6 + // (http://www.w3.org/TR/CSS21/syndata.html#value-def-color) + public enum CssColor{ + maroon, + red, + orange, + yellow, + olive, + purple, + fuchsia, + white, + lime, + green, + navy, + blue, + aqua, + teal, + black, + silver, + gray + } +} Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/NumUnitValue.java ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/NumUnitValue.java Fri Jul 1 02:37:25 2011 (r541) @@ -0,0 +1,79 @@ +package us.isidor.gdl.anaToMia.Widgets.values; + +import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; + +public class NumUnitValue { + private CssUnit unit = CssUnit.pixel; + private float value = 0f; + + + // some constructors + public NumUnitValue(){} + + + public NumUnitValue(String numUnit) throws InvalidGdlSchemaException { + if(numUnit.endsWith("px")){ + this.value = makeFloat(numUnit, 2); + this.unit = CssUnit.pixel; + }else if (numUnit.endsWith("pt")){ + this.value = makeFloat(numUnit, 2); + this.unit = CssUnit.point; + } else if(numUnit.endsWith("%")){ + this.value = makeFloat(numUnit, 1); + this.unit = CssUnit.percentage; + } else { + throw new InvalidGdlSchemaException("numeric values supported by the GDL containing a unit definition must be of the form (pt|px|%), but found: " + numUnit); + } + } + + + // a helper method that returns a float parsed of the passed stringToParse, + // whereas the tailing endToIgnore characters are ignored + private float makeFloat(String stringToParse, int endToIgnore) throws InvalidGdlSchemaException { + if(stringToParse == null || stringToParse.length() <= endToIgnore){ + throw new InvalidGdlSchemaException("numeric values supported by the GDL containing a unit definition must be of the form (pt|px|%), but found: " + stringToParse); + } + + String str = stringToParse.substring(0, stringToParse.length() - endToIgnore); + + try{ + return Float.valueOf(str); + }catch(NumberFormatException e){ + throw new InvalidGdlSchemaException("numeric values supported by the GDL containing a unit definition must be of the form (pt|px|%), but found: " + stringToParse); + } + } + + + // returns the value represented by this instance as a css string + public String getStringValue(){ + switch(this.unit){ + case pixel: return (int)this.value + "px"; + case point: return (int)this.value + "pt"; + default: return this.value + "%"; + } + } + + + // returns the numeric value as a float + public float getNumValue(){ + if(this.unit == CssUnit.percentage){ + return this.value; + } else { + return (int)this.value; + } + } + + + // returns the CssUnit that is represented by this instance + public CssUnit getUnit(){ + return this.unit; + } + + + // a subset of CSS units that are supported by the GDL + public enum CssUnit { + point, + pixel, + percentage + } +} From lgiessmann at common-lisp.net Fri Jul 1 09:47:43 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Fri, 01 Jul 2011 02:47:43 -0700 Subject: [isidorus-cvs] r542 - branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base Message-ID: Author: lgiessmann Date: Fri Jul 1 02:47:43 2011 New Revision: 542 Log: gdl-frontend: Widgets: implemented a method that gets the GDL border-color, border[-top,-right,-bottom,-left]-color properties Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 1 02:37:25 2011 (r541) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 1 02:47:43 2011 (r542) @@ -8,10 +8,15 @@ import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; import us.isidor.gdl.anaToMia.Widgets.values.AutoNumValue; import us.isidor.gdl.anaToMia.Widgets.values.ClearValue; +import us.isidor.gdl.anaToMia.Widgets.values.ColorValue; +import us.isidor.gdl.anaToMia.Widgets.values.NumUnitValue; + +import com.google.gwt.canvas.dom.client.CssColor; import com.google.gwt.core.client.JsArray; import com.google.gwt.dom.client.Style.Display; import com.google.gwt.dom.client.Style.Float; import com.google.gwt.dom.client.Style.VerticalAlign; +import com.google.gwt.resources.css.ast.CssCompilerException; import com.google.gwt.user.client.ui.AbsolutePanel; import com.google.gwt.user.client.ui.Composite; @@ -48,13 +53,17 @@ // a helper method that returns one occurrence of the type bound to the passed PSI. // If more than one occurrence is available an InvalidGdlSchemaException is thrown. // If nor occurrence is available the return value is null - private Occurrence getNoneOrOneOccurrence(String occurrenceType) throws InvalidGdlSchemaException{ + private Occurrence getNoneOrOneUnscopedOccurrence(String occurrenceType) throws InvalidGdlSchemaException{ JsArray occs = getOccurrences(occurrenceType); + ArrayList unscopedOccs = new ArrayList(); + for(int i = 0; i != occs.length(); ++i){ + if(occs.get(i).getScope().length() == 0) unscopedOccs.add(occs.get(i)); + } - if(occs.length() > 1){ - throw new InvalidGdlSchemaException("The topic " + GdlPsis.getAnyIdOfTopic(this.tmRepresentative) + "must be bound to none or one occurrence of the type " + occurrenceType + "but is bound " + occs.length() + " times to it"); - } else if(occs.length() == 1){ - return occs.get(0); + if(unscopedOccs.size() > 1){ + throw new InvalidGdlSchemaException("The topic " + GdlPsis.getAnyIdOfTopic(this.tmRepresentative) + "must be bound to none or one unscoped occurrence of the type " + occurrenceType + "but is bound " + unscopedOccs.size() + " times to it"); + } else if(unscopedOccs.size() == 1){ + return unscopedOccs.get(0); } else { return null; } @@ -104,7 +113,7 @@ // returns a Display instance of a gdl:display occurrence. // If no gdl:display occurrence is set, the default value is returned public Display getDisplay() throws InvalidGdlSchemaException { - Occurrence displayOcc = getNoneOrOneOccurrence(GdlPsis.OccurrenceType.gdlId); + Occurrence displayOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlId); if(displayOcc != null){ String value = displayOcc.getValue().toLowerCase(); @@ -128,7 +137,7 @@ // returns an AutoNumValue instance of a gdl:z-index occurrence. // If no gdl:z-index occurrence is set, the default value is returned public AutoNumValue getZindex() throws InvalidGdlSchemaException { - Occurrence zOcc = getNoneOrOneOccurrence(GdlPsis.OccurrenceType.gdlZindex); + Occurrence zOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlZindex); if(zOcc != null){ return new AutoNumValue(zOcc.getValue()); } else { @@ -140,7 +149,7 @@ // returns a Float instance of a gdl:float occurrence or the default value for // this property if no gdl:float occurrence is available public Float getFloat() throws InvalidGdlSchemaException { - Occurrence floatOcc = getNoneOrOneOccurrence(GdlPsis.OccurrenceType.gdlFloat); + Occurrence floatOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlFloat); if(floatOcc != null){ String value = floatOcc.getValue().toLowerCase(); @@ -162,7 +171,7 @@ // returns a ClearValue instance of a gdl:clear occurrence or the default value for // this property if no gdl:clear occurrence is available public ClearValue getClear() throws InvalidGdlSchemaException { - Occurrence clearOcc = getNoneOrOneOccurrence(GdlPsis.OccurrenceType.gdlFloat); + Occurrence clearOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlFloat); if(clearOcc != null){ try{ @@ -185,7 +194,7 @@ if(styleClass != null){ vaOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlVerticalAlign, styleClass); } else { - vaOcc = getNoneOrOneOccurrence(GdlPsis.OccurrenceType.gdlVerticalAlign); + vaOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlVerticalAlign); } if(vaOcc == null && styleClass != null){ @@ -217,17 +226,226 @@ } + // returns a NumUnitValue instance that represents the margin of this element. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // or null. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public NumUnitValue getMargin(String styleClass) throws InvalidGdlSchemaException { + Occurrence marginOcc = null; + if(styleClass != null){ + marginOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlMargin, styleClass); + } else { + marginOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlMargin); + } + + if(marginOcc == null && styleClass != null){ + return null; + } else if(marginOcc == null) { + return new NumUnitValue(); + } else { + return new NumUnitValue(marginOcc.getValue()); + } + } + + + // returns a NumUnitValue instance that represents the margin-top of this element. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // or null. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public NumUnitValue getMarginTop(String styleClass) throws InvalidGdlSchemaException { + Occurrence marginOcc = null; + if(styleClass != null){ + marginOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlMarginTop, styleClass); + } else { + marginOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlMarginTop); + } + + if(marginOcc == null && styleClass != null){ + return null; + } else if(marginOcc == null) { + return new NumUnitValue(); + } else { + return new NumUnitValue(marginOcc.getValue()); + } + } + - // gdlMargin [gdl:hover | gdl:focus | gdl:active] - // gdlMarginTop [gdl:hover | gdl:focus | gdl:active] - // gdlMarginRight [gdl:hover | gdl:focus | gdl:active] - // gdlMarginBottom [gdl:hover | gdl:focus | gdl:active] - // gdlMarginLeft [gdl:hover | gdl:focus | gdl:active] - // gdlBorderColor [gdl:hover | gdl:focus | gdl:active] - // gdlBorderColorTop [gdl:hover | gdl:focus | gdl:active] - // gdlBorderColorRight [gdl:hover | gdl:focus | gdl:active] - // gdlBorderColorBottom [gdl:hover | gdl:focus | gdl:active] - // gdlBorderColorLeft [gdl:hover | gdl:focus | gdl:active] + // returns a NumUnitValue instance that represents the margin-right of this element. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // or null. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public NumUnitValue getMarginRight(String styleClass) throws InvalidGdlSchemaException { + Occurrence marginOcc = null; + if(styleClass != null){ + marginOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlMarginRight, styleClass); + } else { + marginOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlMarginRight); + } + + if(marginOcc == null && styleClass != null){ + return null; + } else if(marginOcc == null) { + return new NumUnitValue(); + } else { + return new NumUnitValue(marginOcc.getValue()); + } + } + + + // returns a NumUnitValue instance that represents the margin-bottom of this element. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // or null. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public NumUnitValue getMarginBottom(String styleClass) throws InvalidGdlSchemaException { + Occurrence marginOcc = null; + if(styleClass != null){ + marginOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlMarginBottom, styleClass); + } else { + marginOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlMarginBottom); + } + + if(marginOcc == null && styleClass != null){ + return null; + } else if(marginOcc == null) { + return new NumUnitValue(); + } else { + return new NumUnitValue(marginOcc.getValue()); + } + } + + + // returns a NumUnitValue instance that represents the margin-left of this element. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // or null. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public NumUnitValue getMarginLeft(String styleClass) throws InvalidGdlSchemaException { + Occurrence marginOcc = null; + if(styleClass != null){ + marginOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlMarginLeft, styleClass); + } else { + marginOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlMarginLeft); + } + + if(marginOcc == null && styleClass != null){ + return null; + } else if(marginOcc == null) { + return new NumUnitValue(); + } else { + return new NumUnitValue(marginOcc.getValue()); + } + } + + + // returns a ColorValue instance that represents the color of this element's border. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public ColorValue getBorderColor(String styleClass) throws InvalidGdlSchemaException { + Occurrence colorOcc = null; + if(styleClass != null){ + colorOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlBorderColor, styleClass); + } else { + colorOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderColor); + } + + if(colorOcc == null && styleClass != null){ + return null; + } else if(colorOcc == null) { + return new ColorValue(); + } else { + return new ColorValue(colorOcc.getValue()); + } + } + + + // returns a ColorValue instance that represents the color of this element's border-top. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public ColorValue getBorderTopColor(String styleClass) throws InvalidGdlSchemaException { + Occurrence colorOcc = null; + if(styleClass != null){ + colorOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlBorderTopColor, styleClass); + } else { + colorOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderTopColor); + } + + if(colorOcc == null && styleClass != null){ + return null; + } else if(colorOcc == null) { + return new ColorValue(); + } else { + return new ColorValue(colorOcc.getValue()); + } + } + + + // returns a ColorValue instance that represents the color of this element's border-right. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public ColorValue getBorderRightColor(String styleClass) throws InvalidGdlSchemaException { + Occurrence colorOcc = null; + if(styleClass != null){ + colorOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlBorderRightColor, styleClass); + } else { + colorOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderRightColor); + } + + if(colorOcc == null && styleClass != null){ + return null; + } else if(colorOcc == null) { + return new ColorValue(); + } else { + return new ColorValue(colorOcc.getValue()); + } + } + + + // returns a ColorValue instance that represents the color of this element's border-bottom. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public ColorValue getBorderBottomColor(String styleClass) throws InvalidGdlSchemaException { + Occurrence colorOcc = null; + if(styleClass != null){ + colorOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlBorderBottomColor, styleClass); + } else { + colorOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderBottomColor); + } + + if(colorOcc == null && styleClass != null){ + return null; + } else if(colorOcc == null) { + return new ColorValue(); + } else { + return new ColorValue(colorOcc.getValue()); + } + } + + + // returns a ColorValue instance that represents the color of this element's border-left. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public ColorValue getBorderLeftColor(String styleClass) throws InvalidGdlSchemaException { + Occurrence colorOcc = null; + if(styleClass != null){ + colorOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlBorderLeftColor, styleClass); + } else { + colorOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderLeftColor); + } + + if(colorOcc == null && styleClass != null){ + return null; + } else if(colorOcc == null) { + return new ColorValue(); + } else { + return new ColorValue(colorOcc.getValue()); + } + } + + // gdlBorderStyle [gdl:hover | gdl:focus | gdl:active] // gdlBorderStyleTop [gdl:hover | gdl:focus | gdl:active] // gdlBorderStyleRight [gdl:hover | gdl:focus | gdl:active] Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Fri Jul 1 02:37:25 2011 (r541) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Fri Jul 1 02:47:43 2011 (r542) @@ -2,6 +2,7 @@ import us.isidor.gdl.anaToMia.TmEngine.jtmsBasedEngine.JtmsTmEngine; import us.isidor.gdl.anaToMia.Widgets.isidorus.LoadSchemaCallback; +import us.isidor.gdl.anaToMia.Widgets.values.ColorValue; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; From lgiessmann at common-lisp.net Fri Jul 1 10:10:47 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Fri, 01 Jul 2011 03:10:47 -0700 Subject: [isidorus-cvs] r543 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: base values Message-ID: Author: lgiessmann Date: Fri Jul 1 03:10:46 2011 New Revision: 543 Log: gdl-frontend: Widgets: implemented a method that gets the GDL border-style and border[-top,-right,-bottom,-left]-style properties; changed all fields of enums in the package us.isidoru.gdl.anaToMia.Widgets.values to uppercase characters to avoid conflicts with java keywords, e.g. double (borderstyle), ... Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/BorderStyle.java Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ClearValue.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ColorValue.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/NumUnitValue.java Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 1 02:47:43 2011 (r542) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 1 03:10:46 2011 (r543) @@ -1,22 +1,19 @@ package us.isidor.gdl.anaToMia.Widgets.base; import java.util.ArrayList; - import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMap; import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; import us.isidor.gdl.anaToMia.Widgets.values.AutoNumValue; +import us.isidor.gdl.anaToMia.Widgets.values.BorderStyle; import us.isidor.gdl.anaToMia.Widgets.values.ClearValue; import us.isidor.gdl.anaToMia.Widgets.values.ColorValue; import us.isidor.gdl.anaToMia.Widgets.values.NumUnitValue; - -import com.google.gwt.canvas.dom.client.CssColor; import com.google.gwt.core.client.JsArray; import com.google.gwt.dom.client.Style.Display; import com.google.gwt.dom.client.Style.Float; import com.google.gwt.dom.client.Style.VerticalAlign; -import com.google.gwt.resources.css.ast.CssCompilerException; import com.google.gwt.user.client.ui.AbsolutePanel; import com.google.gwt.user.client.ui.Composite; @@ -180,7 +177,7 @@ throw new InvalidGdlSchemaException("The occurrence " + GdlPsis.OccurrenceType.gdlFloat + " must be set to one of \"none\", \"left\", \"right\" or \"both\", but is \"" + clearOcc.getValue() + "\""); } } else { - return ClearValue.none; + return ClearValue.NONE; } } @@ -446,11 +443,117 @@ } - // gdlBorderStyle [gdl:hover | gdl:focus | gdl:active] - // gdlBorderStyleTop [gdl:hover | gdl:focus | gdl:active] - // gdlBorderStyleRight [gdl:hover | gdl:focus | gdl:active] - // gdlBorderStyleBottom [gdl:hover | gdl:focus | gdl:active] - // gdlBorderStyleLeft [gdl:hover | gdl:focus | gdl:active] + // returns a ColorValue instance that represents the style of this element's border. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public BorderStyle getBorderStyle(String styleClass) throws InvalidGdlSchemaException { + Occurrence styleOcc = null; + if(styleClass != null){ + styleOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlBorderStyle, styleClass); + } else { + styleOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderStyle); + } + + if(styleOcc == null && styleClass != null){ + return null; + } else if(styleOcc == null) { + return BorderStyle.NONE; + } else { + return BorderStyle.valueOf(styleOcc.getValue()); + } + } + + + // returns a ColorValue instance that represents the style of this element's border-top. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public BorderStyle getBorderTopStyle(String styleClass) throws InvalidGdlSchemaException { + Occurrence styleOcc = null; + if(styleClass != null){ + styleOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlBorderTopStyle, styleClass); + } else { + styleOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderTopStyle); + } + + if(styleOcc == null && styleClass != null){ + return null; + } else if(styleOcc == null) { + return BorderStyle.NONE; + } else { + return BorderStyle.valueOf(styleOcc.getValue()); + } + } + + + // returns a ColorValue instance that represents the style of this element's border-right. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public BorderStyle getBorderRightStyle(String styleClass) throws InvalidGdlSchemaException { + Occurrence styleOcc = null; + if(styleClass != null){ + styleOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlBorderRightStyle, styleClass); + } else { + styleOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderRightStyle); + } + + if(styleOcc == null && styleClass != null){ + return null; + } else if(styleOcc == null) { + return BorderStyle.NONE; + } else { + return BorderStyle.valueOf(styleOcc.getValue()); + } + } + + + // returns a ColorValue instance that represents the style of this element's border-bottom. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public BorderStyle getBorderBottomStyle(String styleClass) throws InvalidGdlSchemaException { + Occurrence styleOcc = null; + if(styleClass != null){ + styleOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlBorderBottomStyle, styleClass); + } else { + styleOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderBottomStyle); + } + + if(styleOcc == null && styleClass != null){ + return null; + } else if(styleOcc == null) { + return BorderStyle.NONE; + } else { + return BorderStyle.valueOf(styleOcc.getValue()); + } + } + + + // returns a ColorValue instance that represents the style of this element's border-left. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public BorderStyle getBorderLeftStyle(String styleClass) throws InvalidGdlSchemaException { + Occurrence styleOcc = null; + if(styleClass != null){ + styleOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlBorderLeftStyle, styleClass); + } else { + styleOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderLeftStyle); + } + + if(styleOcc == null && styleClass != null){ + return null; + } else if(styleOcc == null) { + return BorderStyle.NONE; + } else { + return BorderStyle.valueOf(styleOcc.getValue()); + } + } + + + // gdlBorderWidth [gdl:hover | gdl:focus | gdl:active] // gdlBorderWidthTop [gdl:hover | gdl:focus | gdl:active] // gdlBorderWidthRight [gdl:hover | gdl:focus | gdl:active] Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/BorderStyle.java ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/BorderStyle.java Fri Jul 1 03:10:46 2011 (r543) @@ -0,0 +1,14 @@ +package us.isidor.gdl.anaToMia.Widgets.values; + +public enum BorderStyle { + NONE, + HIDDEN, + DOTTED, + DASHED, + SOLID, + DOUBLE, + GROOVE, + RIDGE, + INSET, + OUTSET +} Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ClearValue.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ClearValue.java Fri Jul 1 02:47:43 2011 (r542) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ClearValue.java Fri Jul 1 03:10:46 2011 (r543) @@ -1,8 +1,8 @@ package us.isidor.gdl.anaToMia.Widgets.values; public enum ClearValue { - none, - left, - right, - both + NONE, + LEFT, + RIGHT, + BOTH } Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ColorValue.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ColorValue.java Fri Jul 1 02:47:43 2011 (r542) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ColorValue.java Fri Jul 1 03:10:46 2011 (r543) @@ -13,13 +13,13 @@ public ColorValue(String color) throws InvalidGdlSchemaException{ - String value = color.toLowerCase(); + String value = color.toUpperCase(); - if(value.matches("^(maroon|red|orange|yellow|olive|purple|fuchsia|white|lime|green|navy|blue|aqua|teal|black|silver|gray)$")){ + if(value.matches("^(MAROON|RED|ORANGE|YELLOW|OLIVE|PURPLE|FUCHSIA|WHITE|LIME|GREEN|NAVY|BLUE|AQUA|TEAL|BLACK|SILVER|GRAY)$")){ this.stringValue = cssColorToRRGGBB(CssColor.valueOf(value)); - }else if(value.matches("^#[0-9a-f]{6}$")) { + }else if(value.matches("^#[0-9A-F]{6}$")) { this.stringValue = value; - }else if(value.matches("^#[0-9a-f]{3}$")) { + }else if(value.matches("^#[0-9A-F]{3}$")) { this.stringValue = "#" + value.charAt(1) + value.charAt(1) + value.charAt(2) + value.charAt(2) + value.charAt(3) + value.charAt(3); }else if(value.matches("^rgb\\( *\\+?[0-9]{1,3} *, *\\+?[0-9]{1,3} *, *\\+?[0-9]{1,3} *\\)$")){ String[] rgb = value.substring(4, value.length() - 1).split(","); @@ -66,22 +66,22 @@ // to a string of the format ##RRGGBB private String cssColorToRRGGBB(CssColor color){ switch(color){ - case maroon: return "#800000"; - case red: return "#ff0000"; - case orange: return "#ffa500"; - case yellow: return "#ffff00"; - case olive: return "#808000"; - case purple: return "#800080"; - case fuchsia: return "#ff00ff"; - case white: return "#ffffff"; - case lime: return "#00ff00"; - case green: return "#008000"; - case navy: return "#000080"; - case blue: return "#0000ff"; - case aqua: return "#00ffff"; - case teal: return "#008080"; - case black: return "#000000"; - case silver: return "#c0c0c0"; + case MAROON: return "#800000"; + case RED: return "#ff0000"; + case ORANGE: return "#ffa500"; + case YELLOW: return "#ffff00"; + case OLIVE: return "#808000"; + case PURPLE: return "#800080"; + case FUCHSIA: return "#ff00ff"; + case WHITE: return "#ffffff"; + case LIME: return "#00ff00"; + case GREEN: return "#008000"; + case NAVY: return "#000080"; + case BLUE: return "#0000ff"; + case AQUA: return "#00ffff"; + case TEAL: return "#008080"; + case BLACK: return "#000000"; + case SILVER: return "#c0c0c0"; default: return "#808080"; } } @@ -109,39 +109,39 @@ // the return value is null public CssColor getCssColor(){ if(this.stringValue.equals("#800000")){ - return CssColor.maroon; + return CssColor.MAROON; }else if(this.stringValue.equals("#ff0000")){ - return CssColor.red; + return CssColor.RED; }else if(this.stringValue.equals("#ffa500")) { - return CssColor.orange; + return CssColor.ORANGE; }else if(this.stringValue.equals("#ffff00")){ - return CssColor.yellow; + return CssColor.YELLOW; }else if(this.stringValue.equals("#808000")) { - return CssColor.olive; + return CssColor.OLIVE; }else if(this.stringValue.equals("#800080")){ - return CssColor.purple; + return CssColor.PURPLE; }else if(this.stringValue.equals("#ff00ff")) { - return CssColor.fuchsia; + return CssColor.FUCHSIA; }else if(this.stringValue.equals("#ffffff")){ - return CssColor.white; + return CssColor.WHITE; }else if(this.stringValue.equals("#00ff00")) { - return CssColor.lime; + return CssColor.LIME; }else if(this.stringValue.equals("#008000")) { - return CssColor.green; + return CssColor.GREEN; }else if(this.stringValue.equals("#000080")) { - return CssColor.navy; + return CssColor.NAVY; }else if(this.stringValue.equals("#0000ff")) { - return CssColor.blue; + return CssColor.BLUE; }else if(this.stringValue.equals("#00ffff")) { - return CssColor.aqua; + return CssColor.AQUA; }else if(this.stringValue.equals("#008080")) { - return CssColor.teal; + return CssColor.TEAL; }else if(this.stringValue.equals("#000000")) { - return CssColor.black; + return CssColor.BLACK; }else if(this.stringValue.equals("#c0c0c0")) { - return CssColor.silver; + return CssColor.SILVER; }else if(this.stringValue.equals("#808080")) { - return CssColor.gray; + return CssColor.GRAY; }else { return null; } @@ -151,22 +151,22 @@ // represents the color key words that are defined in CSS chapter 4.3.6 // (http://www.w3.org/TR/CSS21/syndata.html#value-def-color) public enum CssColor{ - maroon, - red, - orange, - yellow, - olive, - purple, - fuchsia, - white, - lime, - green, - navy, - blue, - aqua, - teal, - black, - silver, - gray + MAROON, + RED, + ORANGE, + YELLOW, + OLIVE, + PURPLE, + FUCHSIA, + WHITE, + LIME, + GREEN, + NAVY, + BLUE, + AQUA, + TEAL, + BLACK, + SILVER, + GRAY } } Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/NumUnitValue.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/NumUnitValue.java Fri Jul 1 02:47:43 2011 (r542) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/NumUnitValue.java Fri Jul 1 03:10:46 2011 (r543) @@ -3,7 +3,7 @@ import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; public class NumUnitValue { - private CssUnit unit = CssUnit.pixel; + private CssUnit unit = CssUnit.PIXEL; private float value = 0f; @@ -12,15 +12,16 @@ public NumUnitValue(String numUnit) throws InvalidGdlSchemaException { - if(numUnit.endsWith("px")){ + String value = numUnit.toUpperCase(); + if(value.endsWith("PX")){ this.value = makeFloat(numUnit, 2); - this.unit = CssUnit.pixel; - }else if (numUnit.endsWith("pt")){ + this.unit = CssUnit.PIXEL; + }else if (value.endsWith("PT")){ this.value = makeFloat(numUnit, 2); - this.unit = CssUnit.point; - } else if(numUnit.endsWith("%")){ + this.unit = CssUnit.POINT; + } else if(value.endsWith("%")){ this.value = makeFloat(numUnit, 1); - this.unit = CssUnit.percentage; + this.unit = CssUnit.PERCENTAGE; } else { throw new InvalidGdlSchemaException("numeric values supported by the GDL containing a unit definition must be of the form (pt|px|%), but found: " + numUnit); } @@ -47,20 +48,16 @@ // returns the value represented by this instance as a css string public String getStringValue(){ switch(this.unit){ - case pixel: return (int)this.value + "px"; - case point: return (int)this.value + "pt"; + case PIXEL: return (int)this.value + "px"; + case POINT: return (int)this.value + "pt"; default: return this.value + "%"; } } // returns the numeric value as a float - public float getNumValue(){ - if(this.unit == CssUnit.percentage){ - return this.value; - } else { - return (int)this.value; - } + public int getNumValue(){ + return (int)this.value; } @@ -72,8 +69,8 @@ // a subset of CSS units that are supported by the GDL public enum CssUnit { - point, - pixel, - percentage + POINT, + PIXEL, + PERCENTAGE } } From lgiessmann at common-lisp.net Fri Jul 1 10:26:12 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Fri, 01 Jul 2011 03:26:12 -0700 Subject: [isidorus-cvs] r544 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: base values Message-ID: Author: lgiessmann Date: Fri Jul 1 03:26:12 2011 New Revision: 544 Log: gdl-frontend: Widgets: implemented a method that gets the GDL border-width and border[-top,-right,-bottom,-left]-width properties; added the class AbsoluteNumValue that wraps numeric values that describes px or pt units Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/AbsoluteNumValue.java Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/NumUnitValue.java Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 1 03:10:46 2011 (r543) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 1 03:26:12 2011 (r544) @@ -7,6 +7,7 @@ import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; import us.isidor.gdl.anaToMia.Widgets.values.AutoNumValue; import us.isidor.gdl.anaToMia.Widgets.values.BorderStyle; +import us.isidor.gdl.anaToMia.Widgets.values.AbsoluteNumValue; import us.isidor.gdl.anaToMia.Widgets.values.ClearValue; import us.isidor.gdl.anaToMia.Widgets.values.ColorValue; import us.isidor.gdl.anaToMia.Widgets.values.NumUnitValue; @@ -553,29 +554,144 @@ } - + // returns a ColorValue instance that represents the width of this element's border. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public AbsoluteNumValue getBorderWidth(String styleClass) throws InvalidGdlSchemaException { + Occurrence widthOcc = null; + if(styleClass != null){ + widthOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlBorderWidth, styleClass); + } else { + widthOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderWidth); + } + + if(widthOcc == null && styleClass != null){ + return null; + } else if(widthOcc == null) { + return new AbsoluteNumValue(); + } else { + return new AbsoluteNumValue(widthOcc.getValue()); + } + } + + + // returns a ColorValue instance that represents the width of this element's border-top. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public AbsoluteNumValue getBorderTopWidth(String styleClass) throws InvalidGdlSchemaException { + Occurrence widthOcc = null; + if(styleClass != null){ + widthOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlBorderTopWidth, styleClass); + } else { + widthOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderTopWidth); + } + + if(widthOcc == null && styleClass != null){ + return null; + } else if(widthOcc == null) { + return new AbsoluteNumValue(); + } else { + return new AbsoluteNumValue(widthOcc.getValue()); + } + } + + + // returns a ColorValue instance that represents the width of this element's border-right. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public AbsoluteNumValue getBorderRightWidth(String styleClass) throws InvalidGdlSchemaException { + Occurrence widthOcc = null; + if(styleClass != null){ + widthOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlBorderRightWidth, styleClass); + } else { + widthOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderRightWidth); + } + + if(widthOcc == null && styleClass != null){ + return null; + } else if(widthOcc == null) { + return new AbsoluteNumValue(); + } else { + return new AbsoluteNumValue(widthOcc.getValue()); + } + } + + + // returns a ColorValue instance that represents the width of this element's border-bottom. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public AbsoluteNumValue getBorderBottomWidth(String styleClass) throws InvalidGdlSchemaException { + Occurrence widthOcc = null; + if(styleClass != null){ + widthOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlBorderBottomWidth, styleClass); + } else { + widthOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderBottomWidth); + } + + if(widthOcc == null && styleClass != null){ + return null; + } else if(widthOcc == null) { + return new AbsoluteNumValue(); + } else { + return new AbsoluteNumValue(widthOcc.getValue()); + } + } + + + // returns a ColorValue instance that represents the width of this element's border-left. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public AbsoluteNumValue getBorderLeftWidth(String styleClass) throws InvalidGdlSchemaException { + Occurrence widthOcc = null; + if(styleClass != null){ + widthOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlBorderLeftWidth, styleClass); + } else { + widthOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderLeftWidth); + } + + if(widthOcc == null && styleClass != null){ + return null; + } else if(widthOcc == null) { + return new AbsoluteNumValue(); + } else { + return new AbsoluteNumValue(widthOcc.getValue()); + } + } + // gdlBorderWidth [gdl:hover | gdl:focus | gdl:active] // gdlBorderWidthTop [gdl:hover | gdl:focus | gdl:active] // gdlBorderWidthRight [gdl:hover | gdl:focus | gdl:active] // gdlBorderWidthBottom [gdl:hover | gdl:focus | gdl:active] // gdlBorderWidthLeft [gdl:hover | gdl:focus | gdl:active] + // gdlBorderRadius [gdl:hover | gdl:focus | gdl:active] // gdlBorderTopRightRadius [gdl:hover | gdl:focus | gdl:active] // gdlBorderTopLeftRadius [gdl:hover | gdl:focus | gdl:active] // gdlBorderBottomRightRadius [gdl:hover | gdl:focus | gdl:active] // gdlBorderBottomLeftRadius [gdl:hover | gdl:focus | gdl:active] + // gdlCursor [gdl:hover | gdl:focus | gdl:active] + // gdlWidth [gdl:hover | gdl:focus | gdl:active] // gdlMinWidth [gdl:hover | gdl:focus | gdl:active] // gdlMaxWidth [gdl:hover | gdl:focus | gdl:active] + // gdlHeight [gdl:hover | gdl:focus | gdl:active] // gdlMaxHeight [gdl:hover | gdl:focus | gdl:active] // gdlMinHeight [gdl:hover | gdl:focus | gdl:active] + // gdlPadding [gdl:hover | gdl:focus | gdl:active] // gdlPaddingTop [gdl:hover | gdl:focus | gdl:active] // gdlPaddingRight [gdl:hover | gdl:focus | gdl:active] // gdlPaddingBottom [gdl:hover | gdl:focus | gdl:active] // gdlPaddingLeft [gdl:hover | gdl:focus | gdl:active] + // gdlBackgroundColor [gdl:hover | gdl:focus | gdl:active] + // gdlOverflow [gdl:hover | gdl:focus | gdl:active] } Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/AbsoluteNumValue.java ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/AbsoluteNumValue.java Fri Jul 1 03:26:12 2011 (r544) @@ -0,0 +1,24 @@ +package us.isidor.gdl.anaToMia.Widgets.values; + +import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; + +public class AbsoluteNumValue extends NumUnitValue { + public AbsoluteNumValue() throws InvalidGdlSchemaException{ + super("0px"); + } + + + public AbsoluteNumValue(String value) throws InvalidGdlSchemaException { + String upperValue = value.toUpperCase(); + + if(upperValue.endsWith("PX")){ + super.value = super.makeFloat(upperValue, 2); + super.unit = CssUnit.PIXEL; + }else if (upperValue.endsWith("PT")){ + super.value = super.makeFloat(upperValue, 2); + super.unit = CssUnit.POINT; + }else { + throw new InvalidGdlSchemaException("border width values supported by the GDL containing a unit definition must be of the form (pt|px), but found: " + value); + } + } +} Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/NumUnitValue.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/NumUnitValue.java Fri Jul 1 03:10:46 2011 (r543) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/NumUnitValue.java Fri Jul 1 03:26:12 2011 (r544) @@ -3,8 +3,8 @@ import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; public class NumUnitValue { - private CssUnit unit = CssUnit.PIXEL; - private float value = 0f; + protected CssUnit unit = CssUnit.PIXEL; + protected float value = 0f; // some constructors @@ -14,13 +14,13 @@ public NumUnitValue(String numUnit) throws InvalidGdlSchemaException { String value = numUnit.toUpperCase(); if(value.endsWith("PX")){ - this.value = makeFloat(numUnit, 2); + this.value = makeFloat(value, 2); this.unit = CssUnit.PIXEL; }else if (value.endsWith("PT")){ - this.value = makeFloat(numUnit, 2); + this.value = makeFloat(value, 2); this.unit = CssUnit.POINT; } else if(value.endsWith("%")){ - this.value = makeFloat(numUnit, 1); + this.value = makeFloat(value, 1); this.unit = CssUnit.PERCENTAGE; } else { throw new InvalidGdlSchemaException("numeric values supported by the GDL containing a unit definition must be of the form (pt|px|%), but found: " + numUnit); @@ -30,7 +30,7 @@ // a helper method that returns a float parsed of the passed stringToParse, // whereas the tailing endToIgnore characters are ignored - private float makeFloat(String stringToParse, int endToIgnore) throws InvalidGdlSchemaException { + protected float makeFloat(String stringToParse, int endToIgnore) throws InvalidGdlSchemaException { if(stringToParse == null || stringToParse.length() <= endToIgnore){ throw new InvalidGdlSchemaException("numeric values supported by the GDL containing a unit definition must be of the form (pt|px|%), but found: " + stringToParse); } From lgiessmann at common-lisp.net Fri Jul 1 11:01:40 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Fri, 01 Jul 2011 04:01:40 -0700 Subject: [isidorus-cvs] r545 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: base values Message-ID: Author: lgiessmann Date: Fri Jul 1 04:01:40 2011 New Revision: 545 Log: gdl-frontend: Widgets: implemented some methods that get the GDL [max-,min-][width,height] properties; added the class AutoNumUnitValue that wraps numeric values, which also may be set to auto Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/AutoNumUnitValue.java Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 1 03:26:12 2011 (r544) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 1 04:01:40 2011 (r545) @@ -5,6 +5,7 @@ import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMap; import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; +import us.isidor.gdl.anaToMia.Widgets.values.AutoNumUnitValue; import us.isidor.gdl.anaToMia.Widgets.values.AutoNumValue; import us.isidor.gdl.anaToMia.Widgets.values.BorderStyle; import us.isidor.gdl.anaToMia.Widgets.values.AbsoluteNumValue; @@ -663,33 +664,365 @@ } } - // gdlBorderWidth [gdl:hover | gdl:focus | gdl:active] - // gdlBorderWidthTop [gdl:hover | gdl:focus | gdl:active] - // gdlBorderWidthRight [gdl:hover | gdl:focus | gdl:active] - // gdlBorderWidthBottom [gdl:hover | gdl:focus | gdl:active] - // gdlBorderWidthLeft [gdl:hover | gdl:focus | gdl:active] - - // gdlBorderRadius [gdl:hover | gdl:focus | gdl:active] - // gdlBorderTopRightRadius [gdl:hover | gdl:focus | gdl:active] - // gdlBorderTopLeftRadius [gdl:hover | gdl:focus | gdl:active] - // gdlBorderBottomRightRadius [gdl:hover | gdl:focus | gdl:active] - // gdlBorderBottomLeftRadius [gdl:hover | gdl:focus | gdl:active] + + // returns a NumUnitValue instance that represents the radius of this element's border. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public NumUnitValue getBorderRadius(String styleClass) throws InvalidGdlSchemaException { + Occurrence radiusOcc = null; + if(styleClass != null){ + radiusOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlBorderRadius, styleClass); + } else { + radiusOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderRadius); + } + + if(radiusOcc == null && styleClass != null){ + return null; + } else if(radiusOcc == null) { + return new NumUnitValue(); + } else { + return new NumUnitValue(radiusOcc.getValue()); + } + } - // gdlCursor [gdl:hover | gdl:focus | gdl:active] - // gdlWidth [gdl:hover | gdl:focus | gdl:active] - // gdlMinWidth [gdl:hover | gdl:focus | gdl:active] - // gdlMaxWidth [gdl:hover | gdl:focus | gdl:active] - - // gdlHeight [gdl:hover | gdl:focus | gdl:active] - // gdlMaxHeight [gdl:hover | gdl:focus | gdl:active] - // gdlMinHeight [gdl:hover | gdl:focus | gdl:active] - - // gdlPadding [gdl:hover | gdl:focus | gdl:active] - // gdlPaddingTop [gdl:hover | gdl:focus | gdl:active] - // gdlPaddingRight [gdl:hover | gdl:focus | gdl:active] - // gdlPaddingBottom [gdl:hover | gdl:focus | gdl:active] - // gdlPaddingLeft [gdl:hover | gdl:focus | gdl:active] + // returns a NumUnitValue instance that represents the radius of this element's border-top-left. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public NumUnitValue getBorderTopLeftRadius(String styleClass) throws InvalidGdlSchemaException { + Occurrence radiusOcc = null; + if(styleClass != null){ + radiusOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlBorderTopLeftRadius, styleClass); + } else { + radiusOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderTopLeftRadius); + } + + if(radiusOcc == null && styleClass != null){ + return null; + } else if(radiusOcc == null) { + return new NumUnitValue(); + } else { + return new NumUnitValue(radiusOcc.getValue()); + } + } + + + // returns a NumUnitValue instance that represents the radius of this element's border-top-right. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public NumUnitValue getBorderTopRightRadius(String styleClass) throws InvalidGdlSchemaException { + Occurrence radiusOcc = null; + if(styleClass != null){ + radiusOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlBorderTopRightRadius, styleClass); + } else { + radiusOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderTopRightRadius); + } + + if(radiusOcc == null && styleClass != null){ + return null; + } else if(radiusOcc == null) { + return new NumUnitValue(); + } else { + return new NumUnitValue(radiusOcc.getValue()); + } + } + + + // returns a NumUnitValue instance that represents the radius of this element's border-bottom-left. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public NumUnitValue getBorderBottomLeftRadius(String styleClass) throws InvalidGdlSchemaException { + Occurrence radiusOcc = null; + if(styleClass != null){ + radiusOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlBorderBottomLeftRadius, styleClass); + } else { + radiusOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderBottomLeftRadius); + } + + if(radiusOcc == null && styleClass != null){ + return null; + } else if(radiusOcc == null) { + return new NumUnitValue(); + } else { + return new NumUnitValue(radiusOcc.getValue()); + } + } + + + // returns a NumUnitValue instance that represents the radius of this element's border-bottom-right. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public NumUnitValue getBorderBottomRightRadius(String styleClass) throws InvalidGdlSchemaException { + Occurrence radiusOcc = null; + if(styleClass != null){ + radiusOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlBorderBottomRightRadius, styleClass); + } else { + radiusOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderBottomRightRadius); + } + + if(radiusOcc == null && styleClass != null){ + return null; + } else if(radiusOcc == null) { + return new NumUnitValue(); + } else { + return new NumUnitValue(radiusOcc.getValue()); + } + } + + + // returns a NumUnitValue instance that represents the padding of this element. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public NumUnitValue getPadding(String styleClass) throws InvalidGdlSchemaException { + Occurrence paddingOcc = null; + if(styleClass != null){ + paddingOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlPadding, styleClass); + } else { + paddingOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlPadding); + } + + if(paddingOcc == null && styleClass != null){ + return null; + } else if(paddingOcc == null) { + return new NumUnitValue(); + } else { + return new NumUnitValue(paddingOcc.getValue()); + } + } + + + // returns a NumUnitValue instance that represents the padding of this element's top. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public NumUnitValue getPaddingTop(String styleClass) throws InvalidGdlSchemaException { + Occurrence paddingOcc = null; + if(styleClass != null){ + paddingOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlPaddingTop, styleClass); + } else { + paddingOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlPaddingTop); + } + + if(paddingOcc == null && styleClass != null){ + return null; + } else if(paddingOcc == null) { + return new NumUnitValue(); + } else { + return new NumUnitValue(paddingOcc.getValue()); + } + } + + + // returns a NumUnitValue instance that represents the padding of this element's right. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public NumUnitValue getPaddingRight(String styleClass) throws InvalidGdlSchemaException { + Occurrence paddingOcc = null; + if(styleClass != null){ + paddingOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlPaddingRight, styleClass); + } else { + paddingOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlPaddingRight); + } + + if(paddingOcc == null && styleClass != null){ + return null; + } else if(paddingOcc == null) { + return new NumUnitValue(); + } else { + return new NumUnitValue(paddingOcc.getValue()); + } + } + + + // returns a NumUnitValue instance that represents the padding of this element's bottom. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public NumUnitValue getPaddingBottom(String styleClass) throws InvalidGdlSchemaException { + Occurrence paddingOcc = null; + if(styleClass != null){ + paddingOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlPaddingBottom, styleClass); + } else { + paddingOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlPaddingBottom); + } + + if(paddingOcc == null && styleClass != null){ + return null; + } else if(paddingOcc == null) { + return new NumUnitValue(); + } else { + return new NumUnitValue(paddingOcc.getValue()); + } + } + + + // returns a NumUnitValue instance that represents the padding of this element's left. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public NumUnitValue getPaddingLeft(String styleClass) throws InvalidGdlSchemaException { + Occurrence paddingOcc = null; + if(styleClass != null){ + paddingOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlPaddingLeft, styleClass); + } else { + paddingOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlPaddingLeft); + } + + if(paddingOcc == null && styleClass != null){ + return null; + } else if(paddingOcc == null) { + return new NumUnitValue(); + } else { + return new NumUnitValue(paddingOcc.getValue()); + } + } + + + // returns an AutoNumUnitValue instance that represents the width of this element. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public AutoNumUnitValue getWidth(String styleClass) throws InvalidGdlSchemaException { + Occurrence widthOcc = null; + if(styleClass != null){ + widthOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlWidth, styleClass); + } else { + widthOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlWidth); + } + + if(widthOcc == null && styleClass != null){ + return null; + } else if(widthOcc == null) { + return new AutoNumUnitValue(); + } else { + return new AutoNumUnitValue(widthOcc.getValue()); + } + } + + + // returns an AutoNumUnitValue instance that represents the min-width of this element. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public AutoNumUnitValue getMinWidth(String styleClass) throws InvalidGdlSchemaException { + Occurrence widthOcc = null; + if(styleClass != null){ + widthOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlMinWidth, styleClass); + } else { + widthOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlMinWidth); + } + + if(widthOcc == null && styleClass != null){ + return null; + } else if(widthOcc == null) { + return new AutoNumUnitValue(); + } else { + return new AutoNumUnitValue(widthOcc.getValue()); + } + } + + + // returns an AutoNumUnitValue instance that represents the max-width of this element. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public AutoNumUnitValue getMaxWidth(String styleClass) throws InvalidGdlSchemaException { + Occurrence widthOcc = null; + if(styleClass != null){ + widthOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlMaxWidth, styleClass); + } else { + widthOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlMaxWidth); + } + + if(widthOcc == null && styleClass != null){ + return null; + } else if(widthOcc == null) { + return new AutoNumUnitValue(); + } else { + return new AutoNumUnitValue(widthOcc.getValue()); + } + } + + + // returns an AutoNumUnitValue instance that represents the height of this element. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public AutoNumUnitValue getHeight(String styleClass) throws InvalidGdlSchemaException { + Occurrence heightOcc = null; + if(styleClass != null){ + heightOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlHeight, styleClass); + } else { + heightOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlHeight); + } + + if(heightOcc == null && styleClass != null){ + return null; + } else if(heightOcc == null) { + return new AutoNumUnitValue(); + } else { + return new AutoNumUnitValue(heightOcc.getValue()); + } + } + + + // returns an AutoNumUnitValue instance that represents the min-height of this element. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public AutoNumUnitValue getMinHeight(String styleClass) throws InvalidGdlSchemaException { + Occurrence heightOcc = null; + if(styleClass != null){ + heightOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlMinHeight, styleClass); + } else { + heightOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlMinHeight); + } + + if(heightOcc == null && styleClass != null){ + return null; + } else if(heightOcc == null) { + return new AutoNumUnitValue(); + } else { + return new AutoNumUnitValue(heightOcc.getValue()); + } + } + + + // returns an AutoNumUnitValue instance that represents the max-height of this element. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public AutoNumUnitValue getMaxHeight(String styleClass) throws InvalidGdlSchemaException { + Occurrence heightOcc = null; + if(styleClass != null){ + heightOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlMaxHeight, styleClass); + } else { + heightOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlMaxHeight); + } + + if(heightOcc == null && styleClass != null){ + return null; + } else if(heightOcc == null) { + return new AutoNumUnitValue(); + } else { + return new AutoNumUnitValue(heightOcc.getValue()); + } + } + + + + + + + + // gdlCursor [gdl:hover | gdl:focus | gdl:active] // gdlBackgroundColor [gdl:hover | gdl:focus | gdl:active] Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/AutoNumUnitValue.java ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/AutoNumUnitValue.java Fri Jul 1 04:01:40 2011 (r545) @@ -0,0 +1,46 @@ +package us.isidor.gdl.anaToMia.Widgets.values; + +import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; + +public class AutoNumUnitValue extends NumUnitValue { + public AutoNumUnitValue(){ + super.unit = null; // if unit is null, the default value is auto + super.value = 0f; + } + + + public AutoNumUnitValue(String value) throws InvalidGdlSchemaException{ + String upperString = value.trim().toUpperCase(); + if(upperString.equals("AUTO")){ + super.unit = null; // if unit is null, the default value is auto + super.value = 0f; + }else if(value.endsWith("PX")){ + this.value = makeFloat(value, 2); + this.unit = CssUnit.PIXEL; + }else if (value.endsWith("PT")){ + this.value = makeFloat(value, 2); + this.unit = CssUnit.POINT; + } else if(value.endsWith("%")){ + this.value = makeFloat(value, 1); + this.unit = CssUnit.PERCENTAGE; + } else { + throw new InvalidGdlSchemaException("auto numeric values supported by the GDL containing a unit definition must be of the form (pt|px|%)|auto, but found: " + value); + } + } + + + @Override + public String getStringValue() { + if(super.unit == null){ + return "auto"; + } else { + return super.getStringValue(); + } + } + + + // this method returns true, if the value must be treated as "auto" + public boolean isAuto(){ + return super.unit == null; + } +} From lgiessmann at common-lisp.net Fri Jul 1 11:33:23 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Fri, 01 Jul 2011 04:33:23 -0700 Subject: [isidorus-cvs] r546 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: base values Message-ID: Author: lgiessmann Date: Fri Jul 1 04:33:23 2011 New Revision: 546 Log: gdl-frontend: Widgets: implemented a method that gets the GDL cursor property; Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/CursorValue.java Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 1 04:01:40 2011 (r545) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 1 04:33:23 2011 (r546) @@ -11,6 +11,7 @@ import us.isidor.gdl.anaToMia.Widgets.values.AbsoluteNumValue; import us.isidor.gdl.anaToMia.Widgets.values.ClearValue; import us.isidor.gdl.anaToMia.Widgets.values.ColorValue; +import us.isidor.gdl.anaToMia.Widgets.values.CursorValue; import us.isidor.gdl.anaToMia.Widgets.values.NumUnitValue; import com.google.gwt.core.client.JsArray; import com.google.gwt.dom.client.Style.Display; @@ -174,7 +175,7 @@ if(clearOcc != null){ try{ - return ClearValue.valueOf(clearOcc.getValue().toLowerCase()); + return ClearValue.valueOf(clearOcc.getValue().toUpperCase()); }catch(IllegalArgumentException e){ throw new InvalidGdlSchemaException("The occurrence " + GdlPsis.OccurrenceType.gdlFloat + " must be set to one of \"none\", \"left\", \"right\" or \"both\", but is \"" + clearOcc.getValue() + "\""); } @@ -462,7 +463,12 @@ } else if(styleOcc == null) { return BorderStyle.NONE; } else { - return BorderStyle.valueOf(styleOcc.getValue()); + try{ + return BorderStyle.valueOf(styleOcc.getValue()); + }catch(IllegalArgumentException e){ + String values = "none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset"; + throw new InvalidGdlSchemaException("border-style must be set to one of " + values + ", but is " + styleOcc.getValue()); + } } } @@ -484,7 +490,12 @@ } else if(styleOcc == null) { return BorderStyle.NONE; } else { - return BorderStyle.valueOf(styleOcc.getValue()); + try{ + return BorderStyle.valueOf(styleOcc.getValue()); + }catch(IllegalArgumentException e){ + String values = "none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset"; + throw new InvalidGdlSchemaException("border-top-style must be set to one of " + values + ", but is " + styleOcc.getValue()); + } } } @@ -506,7 +517,12 @@ } else if(styleOcc == null) { return BorderStyle.NONE; } else { - return BorderStyle.valueOf(styleOcc.getValue()); + try{ + return BorderStyle.valueOf(styleOcc.getValue()); + }catch(IllegalArgumentException e){ + String values = "none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset"; + throw new InvalidGdlSchemaException("border-right-style must be set to one of " + values + ", but is " + styleOcc.getValue()); + } } } @@ -528,7 +544,12 @@ } else if(styleOcc == null) { return BorderStyle.NONE; } else { - return BorderStyle.valueOf(styleOcc.getValue()); + try{ + return BorderStyle.valueOf(styleOcc.getValue()); + }catch(IllegalArgumentException e){ + String values = "none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset"; + throw new InvalidGdlSchemaException("border-bottom-style must be set to one of " + values + ", but is " + styleOcc.getValue()); + } } } @@ -550,7 +571,12 @@ } else if(styleOcc == null) { return BorderStyle.NONE; } else { - return BorderStyle.valueOf(styleOcc.getValue()); + try{ + return BorderStyle.valueOf(styleOcc.getValue()); + }catch(IllegalArgumentException e){ + String values = "none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset"; + throw new InvalidGdlSchemaException("border-left-style must be set to one of " + values + ", but is " + styleOcc.getValue()); + } } } @@ -1017,13 +1043,37 @@ } + // returns a CursorValue instance that represents the cursor of this element. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public CursorValue getCursor(String styleClass) throws InvalidGdlSchemaException { + Occurrence cursorOcc = null; + if(styleClass != null){ + cursorOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlCursor, styleClass); + } else { + cursorOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlCursor); + } + + if(cursorOcc == null && styleClass != null){ + return null; + } else if(cursorOcc == null) { + return CursorValue.AUTO; + } else { + try{ + return CursorValue.valueOf(cursorOcc.getValue().toUpperCase().replace("-", "_")); + }catch(IllegalArgumentException e){ + String values = "auto, default, crosshair, pointer, move, n-resize, ne-resize," + + "nw-resize, e-resize, se-resize, s-resize, sw-resize, w-resize," + + "text, wait, help, or progress"; + throw new InvalidGdlSchemaException("cursor must be set to one of " + values + ", but is " + cursorOcc.getValue()); + } + } + } - - // gdlCursor [gdl:hover | gdl:focus | gdl:active] - // gdlBackgroundColor [gdl:hover | gdl:focus | gdl:active] // gdlOverflow [gdl:hover | gdl:focus | gdl:active] Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Fri Jul 1 04:01:40 2011 (r545) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Fri Jul 1 04:33:23 2011 (r546) @@ -3,6 +3,8 @@ import us.isidor.gdl.anaToMia.TmEngine.jtmsBasedEngine.JtmsTmEngine; import us.isidor.gdl.anaToMia.Widgets.isidorus.LoadSchemaCallback; import us.isidor.gdl.anaToMia.Widgets.values.ColorValue; +import us.isidor.gdl.anaToMia.Widgets.values.CursorValue; + import com.google.gwt.core.client.EntryPoint; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; @@ -45,5 +47,7 @@ mainPanel.add(requestButton); + + } } Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/CursorValue.java ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/CursorValue.java Fri Jul 1 04:33:23 2011 (r546) @@ -0,0 +1,21 @@ +package us.isidor.gdl.anaToMia.Widgets.values; + +public enum CursorValue { + AUTO, + DEFAULT, + CROSSHAIR, + POINTER, + MOVE, + N_RESIZE, + NE_RESIZE, + NW_RESIZE, + E_RESIZE, + SE_RESIZE, + S_RESIZE, + SW_RESIZE, + W_RESIZE, + TEXT, + WAIT, + HELP, + PROGRESS +} From lgiessmann at common-lisp.net Fri Jul 1 14:58:03 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Fri, 01 Jul 2011 07:58:03 -0700 Subject: [isidorus-cvs] r547 - branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base Message-ID: Author: lgiessmann Date: Fri Jul 1 07:58:03 2011 New Revision: 547 Log: gdl-frontend: Widgets: implemented a method that gets the GDL background-color property; Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java Fri Jul 1 04:33:23 2011 (r546) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java Fri Jul 1 07:58:03 2011 (r547) @@ -127,7 +127,7 @@ public final static String gdlPaddingLeft = gdl + "padding-left"; public final static String gdlClear = gdl + "clear"; public final static String gdlFloat = gdl + "float"; - public final static String gdlBackGroundColor = gdl + "background-color"; + public final static String gdlBackgroundColor = gdl + "background-color"; public final static String gdlOverflow = gdl + "overflow"; public final static String gdlOrdered = gdl + "ordered"; public final static String gdlListstyleType = gdl + "list-style-type"; Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 1 04:33:23 2011 (r546) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 1 07:58:03 2011 (r547) @@ -1072,9 +1072,32 @@ } + // returns a ColorValue instance that represents the background-color of this element. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public ColorValue getBackgroundColor(String styleClass) throws InvalidGdlSchemaException { + Occurrence colorOcc = null; + if(styleClass != null){ + colorOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlBackgroundColor, styleClass); + } else { + colorOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBackgroundColor); + } + + if(colorOcc == null && styleClass != null){ + return null; + } else if(colorOcc == null) { + return new ColorValue("#ffffff"); + } else { + return new ColorValue(colorOcc.getValue()); + } + } - // gdlBackgroundColor [gdl:hover | gdl:focus | gdl:active] - // gdlOverflow [gdl:hover | gdl:focus | gdl:active] + + + public void setGdlStyle(){ + // TODO: implement + } } From lgiessmann at common-lisp.net Fri Jul 1 15:06:19 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Fri, 01 Jul 2011 08:06:19 -0700 Subject: [isidorus-cvs] r548 - branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base Message-ID: Author: lgiessmann Date: Fri Jul 1 08:06:19 2011 New Revision: 548 Log: gdl-frontend: Widgets: implemented a method that gets the GDL overflow property; Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 1 07:58:03 2011 (r547) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 1 08:06:19 2011 (r548) @@ -16,6 +16,7 @@ import com.google.gwt.core.client.JsArray; import com.google.gwt.dom.client.Style.Display; import com.google.gwt.dom.client.Style.Float; +import com.google.gwt.dom.client.Style.Overflow; import com.google.gwt.dom.client.Style.VerticalAlign; import com.google.gwt.user.client.ui.AbsolutePanel; import com.google.gwt.user.client.ui.Composite; @@ -1093,8 +1094,36 @@ } } - - // gdlOverflow [gdl:hover | gdl:focus | gdl:active] + + // returns an Overflow instance that represents the overflow property of this element. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this + // property is returned. + public Overflow getOverflow(String styleClass) throws InvalidGdlSchemaException { + Occurrence overflowOcc = null; + if(styleClass != null){ + overflowOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlCursor, styleClass); + } else { + overflowOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlCursor); + } + + if(overflowOcc == null && styleClass != null){ + return null; + } else if(overflowOcc == null) { + return Overflow.SCROLL; + } else { + String value = overflowOcc.getValue().toUpperCase(); + if(value.equals("VISIBLE")){ + return Overflow.VISIBLE; + }else if(value.equals("HIDDEN")){ + return Overflow.HIDDEN; + }else if(value.equals("SCROLL")){ + return Overflow.SCROLL; + }else { + throw new InvalidGdlSchemaException("cursor must be set to one of visible, hidden or scroll, but is " + overflowOcc.getValue()); + } + } + } public void setGdlStyle(){ From lgiessmann at common-lisp.net Fri Jul 1 16:05:04 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Fri, 01 Jul 2011 09:05:04 -0700 Subject: [isidorus-cvs] r549 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: base values Message-ID: Author: lgiessmann Date: Fri Jul 1 09:05:04 2011 New Revision: 549 Log: gdl-frontend: Widgets: implemented some methods that set the element's [id, float, clear, background-color] property; added the interface CssValue and created an inheritance to all other self-defined value-classes Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/BorderStyleValue.java - copied, changed from r543, branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/BorderStyle.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/CssValue.java Deleted: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/BorderStyle.java Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/AbsoluteNumValue.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/AutoNumUnitValue.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/AutoNumValue.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ClearValue.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ColorValue.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/CursorValue.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/NumUnitValue.java Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 1 08:06:19 2011 (r548) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 1 09:05:04 2011 (r549) @@ -7,7 +7,7 @@ import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; import us.isidor.gdl.anaToMia.Widgets.values.AutoNumUnitValue; import us.isidor.gdl.anaToMia.Widgets.values.AutoNumValue; -import us.isidor.gdl.anaToMia.Widgets.values.BorderStyle; +import us.isidor.gdl.anaToMia.Widgets.values.BorderStyleValue; import us.isidor.gdl.anaToMia.Widgets.values.AbsoluteNumValue; import us.isidor.gdl.anaToMia.Widgets.values.ClearValue; import us.isidor.gdl.anaToMia.Widgets.values.ColorValue; @@ -18,6 +18,7 @@ import com.google.gwt.dom.client.Style.Float; import com.google.gwt.dom.client.Style.Overflow; import com.google.gwt.dom.client.Style.VerticalAlign; +import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.ui.AbsolutePanel; import com.google.gwt.user.client.ui.Composite; @@ -28,11 +29,13 @@ protected TopicMap tm = null; - @SuppressWarnings("unused") - private GdlVisibleObject() {} + private GdlVisibleObject() { + initWidget(this.mainPanel); + } public GdlVisibleObject(Topic tmRepresentative) throws InvalidGdlSchemaException{ + this(); this.tmRepresentative = tmRepresentative; this.tm = this.tmRepresentative.getTopicMap(); @@ -451,7 +454,7 @@ // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this // property is returned. - public BorderStyle getBorderStyle(String styleClass) throws InvalidGdlSchemaException { + public BorderStyleValue getBorderStyle(String styleClass) throws InvalidGdlSchemaException { Occurrence styleOcc = null; if(styleClass != null){ styleOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlBorderStyle, styleClass); @@ -462,10 +465,10 @@ if(styleOcc == null && styleClass != null){ return null; } else if(styleOcc == null) { - return BorderStyle.NONE; + return BorderStyleValue.NONE; } else { try{ - return BorderStyle.valueOf(styleOcc.getValue()); + return BorderStyleValue.valueOf(styleOcc.getValue()); }catch(IllegalArgumentException e){ String values = "none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset"; throw new InvalidGdlSchemaException("border-style must be set to one of " + values + ", but is " + styleOcc.getValue()); @@ -478,7 +481,7 @@ // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this // property is returned. - public BorderStyle getBorderTopStyle(String styleClass) throws InvalidGdlSchemaException { + public BorderStyleValue getBorderTopStyle(String styleClass) throws InvalidGdlSchemaException { Occurrence styleOcc = null; if(styleClass != null){ styleOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlBorderTopStyle, styleClass); @@ -489,10 +492,10 @@ if(styleOcc == null && styleClass != null){ return null; } else if(styleOcc == null) { - return BorderStyle.NONE; + return BorderStyleValue.NONE; } else { try{ - return BorderStyle.valueOf(styleOcc.getValue()); + return BorderStyleValue.valueOf(styleOcc.getValue()); }catch(IllegalArgumentException e){ String values = "none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset"; throw new InvalidGdlSchemaException("border-top-style must be set to one of " + values + ", but is " + styleOcc.getValue()); @@ -505,7 +508,7 @@ // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this // property is returned. - public BorderStyle getBorderRightStyle(String styleClass) throws InvalidGdlSchemaException { + public BorderStyleValue getBorderRightStyle(String styleClass) throws InvalidGdlSchemaException { Occurrence styleOcc = null; if(styleClass != null){ styleOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlBorderRightStyle, styleClass); @@ -516,10 +519,10 @@ if(styleOcc == null && styleClass != null){ return null; } else if(styleOcc == null) { - return BorderStyle.NONE; + return BorderStyleValue.NONE; } else { try{ - return BorderStyle.valueOf(styleOcc.getValue()); + return BorderStyleValue.valueOf(styleOcc.getValue()); }catch(IllegalArgumentException e){ String values = "none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset"; throw new InvalidGdlSchemaException("border-right-style must be set to one of " + values + ", but is " + styleOcc.getValue()); @@ -532,7 +535,7 @@ // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this // property is returned. - public BorderStyle getBorderBottomStyle(String styleClass) throws InvalidGdlSchemaException { + public BorderStyleValue getBorderBottomStyle(String styleClass) throws InvalidGdlSchemaException { Occurrence styleOcc = null; if(styleClass != null){ styleOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlBorderBottomStyle, styleClass); @@ -543,10 +546,10 @@ if(styleOcc == null && styleClass != null){ return null; } else if(styleOcc == null) { - return BorderStyle.NONE; + return BorderStyleValue.NONE; } else { try{ - return BorderStyle.valueOf(styleOcc.getValue()); + return BorderStyleValue.valueOf(styleOcc.getValue()); }catch(IllegalArgumentException e){ String values = "none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset"; throw new InvalidGdlSchemaException("border-bottom-style must be set to one of " + values + ", but is " + styleOcc.getValue()); @@ -559,7 +562,7 @@ // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this // property is returned. - public BorderStyle getBorderLeftStyle(String styleClass) throws InvalidGdlSchemaException { + public BorderStyleValue getBorderLeftStyle(String styleClass) throws InvalidGdlSchemaException { Occurrence styleOcc = null; if(styleClass != null){ styleOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlBorderLeftStyle, styleClass); @@ -570,10 +573,10 @@ if(styleOcc == null && styleClass != null){ return null; } else if(styleOcc == null) { - return BorderStyle.NONE; + return BorderStyleValue.NONE; } else { try{ - return BorderStyle.valueOf(styleOcc.getValue()); + return BorderStyleValue.valueOf(styleOcc.getValue()); }catch(IllegalArgumentException e){ String values = "none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset"; throw new InvalidGdlSchemaException("border-left-style must be set to one of " + values + ", but is " + styleOcc.getValue()); @@ -1126,6 +1129,54 @@ } + // sets the background-color style property of this element by using the GWT DOM class + public void setBackgroundColor(ColorValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "backgroundColor", value.getCssValue()); + } + } + + + // sets the id property of this element by using the GWT DOM class + public void setId(String id){ + if(id != null){ + DOM.setElementProperty(this.getElement(), "id", id); + } + } + + + // sets the display style property of this element by using the GWT DOM class + public void setDisplay(Display display){ + if(display != null){ + DOM.setStyleAttribute(this.getElement(), "display", display.getCssName()); + } + } + + + // sets the z-index style property of this element by using the GWT DOM class + public void setZindex(AutoNumValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "zIndex", value.getCssValue()); + } + } + + + // sets the float style property of this element by using the GWT DOM class + public void setFloat(Float value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "float", value.getCssName()); + } + } + + + // sets the clear style property of this element by using the GWT DOM class + public void setClear(ClearValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "clear", value.getCssValue()); + } + } + + public void setGdlStyle(){ // TODO: implement } Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Fri Jul 1 08:06:19 2011 (r548) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Fri Jul 1 09:05:04 2011 (r549) @@ -1,11 +1,14 @@ package us.isidor.gdl.anaToMia.Widgets.base; import us.isidor.gdl.anaToMia.TmEngine.jtmsBasedEngine.JtmsTmEngine; +import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic; import us.isidor.gdl.anaToMia.Widgets.isidorus.LoadSchemaCallback; +import us.isidor.gdl.anaToMia.Widgets.values.ClearValue; import us.isidor.gdl.anaToMia.Widgets.values.ColorValue; import us.isidor.gdl.anaToMia.Widgets.values.CursorValue; import com.google.gwt.core.client.EntryPoint; +import com.google.gwt.dom.client.Style.Display; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.user.client.DOM; @@ -49,5 +52,23 @@ + + // only for testing + try{ + Topic tmpRepresentative = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator("http://test.org/test-top")); + Topic gdlBackgroundColor = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlBackgroundColor)); + tmpRepresentative.createOccurrence(gdlBackgroundColor, "red", null); + + GdlVisibleObject tmp = new GdlVisibleObject(tmpRepresentative) { + }; + + tmp.setPixelSize(300, 300); + //DOM.setStyleAttribute(tmp.getElement(), "backgroundColor", "lime"); + + this.mainPanel.add(tmp); + Window.alert(CursorValue.CROSSHAIR.getCssValue()); + }catch(Exception e){ + Window.alert(">> e >> " + e.getClass() + " >> " + e.getMessage()); + } } } Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/AbsoluteNumValue.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/AbsoluteNumValue.java Fri Jul 1 08:06:19 2011 (r548) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/AbsoluteNumValue.java Fri Jul 1 09:05:04 2011 (r549) @@ -2,7 +2,7 @@ import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; -public class AbsoluteNumValue extends NumUnitValue { +public class AbsoluteNumValue extends NumUnitValue{ public AbsoluteNumValue() throws InvalidGdlSchemaException{ super("0px"); } Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/AutoNumUnitValue.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/AutoNumUnitValue.java Fri Jul 1 08:06:19 2011 (r548) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/AutoNumUnitValue.java Fri Jul 1 09:05:04 2011 (r549) @@ -2,7 +2,7 @@ import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; -public class AutoNumUnitValue extends NumUnitValue { +public class AutoNumUnitValue extends NumUnitValue{ public AutoNumUnitValue(){ super.unit = null; // if unit is null, the default value is auto super.value = 0f; @@ -30,11 +30,11 @@ @Override - public String getStringValue() { + public String getCssValue() { if(super.unit == null){ return "auto"; } else { - return super.getStringValue(); + return super.getCssValue(); } } Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/AutoNumValue.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/AutoNumValue.java Fri Jul 1 08:06:19 2011 (r548) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/AutoNumValue.java Fri Jul 1 09:05:04 2011 (r549) @@ -3,7 +3,7 @@ import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; -public class AutoNumValue { +public class AutoNumValue implements CssValue{ private Integer intValue = null; @@ -28,7 +28,7 @@ // return a string that contains either an integer as a string value // or the string auto - public String getStringValue(){ + public String getCssValue(){ if(intValue == null){ return "auto"; }else { Copied and modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/BorderStyleValue.java (from r543, branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/BorderStyle.java) ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/BorderStyle.java Fri Jul 1 03:10:46 2011 (r543, copy source) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/BorderStyleValue.java Fri Jul 1 09:05:04 2011 (r549) @@ -1,6 +1,6 @@ package us.isidor.gdl.anaToMia.Widgets.values; -public enum BorderStyle { +public enum BorderStyleValue implements CssValue{ NONE, HIDDEN, DOTTED, @@ -10,5 +10,9 @@ GROOVE, RIDGE, INSET, - OUTSET + OUTSET; + + public String getCssValue(){ + return this.toString().toLowerCase(); + } } Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ClearValue.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ClearValue.java Fri Jul 1 08:06:19 2011 (r548) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ClearValue.java Fri Jul 1 09:05:04 2011 (r549) @@ -1,8 +1,12 @@ package us.isidor.gdl.anaToMia.Widgets.values; -public enum ClearValue { +public enum ClearValue implements CssValue{ NONE, LEFT, RIGHT, - BOTH + BOTH; + + public String getCssValue(){ + return this.toString().toLowerCase(); + } } Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ColorValue.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ColorValue.java Fri Jul 1 08:06:19 2011 (r548) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ColorValue.java Fri Jul 1 09:05:04 2011 (r549) @@ -2,7 +2,7 @@ import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; -public class ColorValue { +public class ColorValue implements CssValue{ private String stringValue = null; @@ -88,7 +88,7 @@ // returns a string of the format #RRGGBB - public String getStringValue(){ + public String getCssValue(){ return this.stringValue; } @@ -150,7 +150,7 @@ // represents the color key words that are defined in CSS chapter 4.3.6 // (http://www.w3.org/TR/CSS21/syndata.html#value-def-color) - public enum CssColor{ + public enum CssColor implements CssValue{ MAROON, RED, ORANGE, @@ -167,6 +167,10 @@ TEAL, BLACK, SILVER, - GRAY + GRAY; + + public String getCssValue(){ + return this.toString().toLowerCase(); + } } } Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/CssValue.java ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/CssValue.java Fri Jul 1 09:05:04 2011 (r549) @@ -0,0 +1,5 @@ +package us.isidor.gdl.anaToMia.Widgets.values; + +public interface CssValue { + public String getCssValue(); +} Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/CursorValue.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/CursorValue.java Fri Jul 1 08:06:19 2011 (r548) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/CursorValue.java Fri Jul 1 09:05:04 2011 (r549) @@ -1,6 +1,6 @@ package us.isidor.gdl.anaToMia.Widgets.values; -public enum CursorValue { +public enum CursorValue implements CssValue{ AUTO, DEFAULT, CROSSHAIR, @@ -17,5 +17,10 @@ TEXT, WAIT, HELP, - PROGRESS + PROGRESS; + + + public String getCssValue(){ + return this.toString().toLowerCase(); + } } Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/NumUnitValue.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/NumUnitValue.java Fri Jul 1 08:06:19 2011 (r548) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/NumUnitValue.java Fri Jul 1 09:05:04 2011 (r549) @@ -2,7 +2,7 @@ import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; -public class NumUnitValue { +public class NumUnitValue implements CssValue{ protected CssUnit unit = CssUnit.PIXEL; protected float value = 0f; @@ -46,7 +46,7 @@ // returns the value represented by this instance as a css string - public String getStringValue(){ + public String getCssValue(){ switch(this.unit){ case PIXEL: return (int)this.value + "px"; case POINT: return (int)this.value + "pt"; @@ -68,9 +68,14 @@ // a subset of CSS units that are supported by the GDL - public enum CssUnit { + public enum CssUnit implements CssValue{ POINT, PIXEL, - PERCENTAGE + PERCENTAGE; + + + public String getCssValue(){ + return this.toString().toLowerCase(); + } } } From lgiessmann at common-lisp.net Fri Jul 1 17:15:31 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Fri, 01 Jul 2011 10:15:31 -0700 Subject: [isidorus-cvs] r550 - branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base Message-ID: Author: lgiessmann Date: Fri Jul 1 10:15:30 2011 New Revision: 550 Log: gdl-frontend: Widgets: implemented some methods that set the element's style properties Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 1 09:05:04 2011 (r549) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 1 10:15:30 2011 (r550) @@ -1177,6 +1177,257 @@ } + // sets the vertical-align style property of this element by using the GWT DOM class + public void setVerticalAlign(VerticalAlign value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "verticalAlign", value.getCssName()); + } + } + + + // sets the margin style property of this element by using the GWT DOM class + public void setMargin(NumUnitValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "margin", value.getCssValue()); + } + } + + + // sets the margin-top style property of this element by using the GWT DOM class + public void setMarginTop(NumUnitValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "marginTop", value.getCssValue()); + } + } + + + // sets the margin-right style property of this element by using the GWT DOM class + public void setMarginRight(NumUnitValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "marginRight", value.getCssValue()); + } + } + + + // sets the margin-bottom style property of this element by using the GWT DOM class + public void setMarginBottom(NumUnitValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "marginBottom", value.getCssValue()); + } + } + + + // sets the margin-left style property of this element by using the GWT DOM class + public void setMarginLeft(NumUnitValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "marginLeft", value.getCssValue()); + } + } + + + // sets the border-color style property of this element by using the GWT DOM class + public void setBorderColor(ColorValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "borderColor", value.getCssValue()); + } + } + + + // sets the border-top-color style property of this element by using the GWT DOM class + public void setBorderTopColor(ColorValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "borderTopColor", value.getCssValue()); + } + } + + + // sets the border-right-color style property of this element by using the GWT DOM class + public void setBorderRightColor(ColorValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "borderRightColor", value.getCssValue()); + } + } + + + // sets the border-bottom-color style property of this element by using the GWT DOM class + public void setBorderBottomColor(ColorValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "borderBottomColor", value.getCssValue()); + } + } + + + // sets the border-left-color style property of this element by using the GWT DOM class + public void setBorderLeftColor(ColorValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "borderLeftColor", value.getCssValue()); + } + } + + + // sets the border-style style property of this element by using the GWT DOM class + public void setBorderStyle(BorderStyleValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "borderStyle", value.getCssValue()); + } + } + + + // sets the border-top-style style property of this element by using the GWT DOM class + public void setBorderTopStyle(BorderStyleValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "borderTopStyle", value.getCssValue()); + } + } + + + // sets the border-right-style style property of this element by using the GWT DOM class + public void setBorderRightStyle(BorderStyleValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "borderRightStyle", value.getCssValue()); + } + } + + + // sets the border-bottom-style style property of this element by using the GWT DOM class + public void setBorderBottomStyle(BorderStyleValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "borderBottomStyle", value.getCssValue()); + } + } + + + // sets the border-left-style style property of this element by using the GWT DOM class + public void setBorderLeftStyle(BorderStyleValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "borderLeftStyle", value.getCssValue()); + } + } + + + // sets the border-width style property of this element by using the GWT DOM class + public void setBorderWidth(AbsoluteNumValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "borderWidth", value.getCssValue()); + } + } + + + // sets the border-width style property of this element by using the GWT DOM class + public void setBorderTopWidth(AbsoluteNumValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "borderTopWidth", value.getCssValue()); + } + } + + + // sets the border-width style property of this element by using the GWT DOM class + public void setBorderRightWidth(AbsoluteNumValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "borderRightWidth", value.getCssValue()); + } + } + + + // sets the border-width style property of this element by using the GWT DOM class + public void setBorderBottomWidth(AbsoluteNumValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "borderBottomWidth", value.getCssValue()); + } + } + + + // sets the border-width style property of this element by using the GWT DOM class + public void setBorderLeftWidth(AbsoluteNumValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "borderLeftWidth", value.getCssValue()); + } + } + + + // sets the border-radius style property of this element by using the GWT DOM class + public void setBorderRadius(NumUnitValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "borderRadius", value.getCssValue()); + } + } + + + // sets the border-top-right-radius style property of this element by using the GWT DOM class + public void setBorderTopRightRadius(NumUnitValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "borderTopRightRadius", value.getCssValue()); + } + } + + + // sets the border-bottom-right-radius style property of this element by using the GWT DOM class + public void setBorderBottomRightRadius(NumUnitValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "borderBottomRightRadius", value.getCssValue()); + } + } + + + // sets the border-bottom-left-radius style property of this element by using the GWT DOM class + public void setBorderBottomLeftRadius(NumUnitValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "borderBottomLeftRadius", value.getCssValue()); + } + } + + + // sets the border-top-left-radius style property of this element by using the GWT DOM class + public void setBorderTopLeftRadius(NumUnitValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "borderTopLeftRadius", value.getCssValue()); + } + } + + + // sets the padding style property of this element by using the GWT DOM class + public void setPadding(NumUnitValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "padding", value.getCssValue()); + } + } + + + // sets the padding-top style property of this element by using the GWT DOM class + public void setPaddingTop(NumUnitValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "paddingTop", value.getCssValue()); + } + } + + + // sets the padding-right style property of this element by using the GWT DOM class + public void setPaddingRight(NumUnitValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "paddingRight", value.getCssValue()); + } + } + + + // sets the padding-bottom style property of this element by using the GWT DOM class + public void setPaddingBottom(NumUnitValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "paddingBottom", value.getCssValue()); + } + } + + + // sets the padding-left style property of this element by using the GWT DOM class + public void setPaddingLeft(NumUnitValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "paddingLeft", value.getCssValue()); + } + } + + + // TODO: handle styleClass in the setterMethods + + public void setGdlStyle(){ // TODO: implement } Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Fri Jul 1 09:05:04 2011 (r549) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Fri Jul 1 10:15:30 2011 (r550) @@ -11,11 +11,13 @@ import com.google.gwt.dom.client.Style.Display; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.event.dom.client.MouseOutEvent; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.HorizontalPanel; import com.google.gwt.user.client.ui.RootPanel; +import com.google.gwt.user.client.ui.Widget; public class TestClass implements EntryPoint{ HorizontalPanel mainPanel = new HorizontalPanel(); @@ -59,14 +61,17 @@ Topic gdlBackgroundColor = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlBackgroundColor)); tmpRepresentative.createOccurrence(gdlBackgroundColor, "red", null); - GdlVisibleObject tmp = new GdlVisibleObject(tmpRepresentative) { - }; + GdlVisibleObject tmp = new GdlVisibleObject(tmpRepresentative){}; + + + + tmp.setPixelSize(300, 300); // TODO: remove + DOM.setStyleAttribute(tmp.getElement(), "backgroundColor", "lime"); // TODO: remove - tmp.setPixelSize(300, 300); - //DOM.setStyleAttribute(tmp.getElement(), "backgroundColor", "lime"); + + this.mainPanel.add(tmp); - Window.alert(CursorValue.CROSSHAIR.getCssValue()); }catch(Exception e){ Window.alert(">> e >> " + e.getClass() + " >> " + e.getMessage()); } From lgiessmann at common-lisp.net Fri Jul 1 20:42:50 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Fri, 01 Jul 2011 13:42:50 -0700 Subject: [isidorus-cvs] r551 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: base isidorus Message-ID: Author: lgiessmann Date: Fri Jul 1 13:42:48 2011 New Revision: 551 Log: gdl-frontend: Widgets: added the last method for setting gdl attributes on gdl:Visible-Object Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/LoadSchemaCallback.java Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 1 10:15:30 2011 (r550) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 1 13:42:48 2011 (r551) @@ -1129,14 +1129,6 @@ } - // sets the background-color style property of this element by using the GWT DOM class - public void setBackgroundColor(ColorValue value){ - if(value != null){ - DOM.setStyleAttribute(this.getElement(), "backgroundColor", value.getCssValue()); - } - } - - // sets the id property of this element by using the GWT DOM class public void setId(String id){ if(id != null){ @@ -1424,10 +1416,89 @@ } } + + // sets the width style property of this element by using the GWT DOM class + public void setWidth(AutoNumUnitValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "width", value.getCssValue()); + } + } + + + // sets the min-width style property of this element by using the GWT DOM class + public void setMinWidth(AutoNumUnitValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "minWidth", value.getCssValue()); + } + } + + + // sets the max-width style property of this element by using the GWT DOM class + public void setMaxWidth(AutoNumUnitValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "maxWidth", value.getCssValue()); + } + } + + + // sets the height style property of this element by using the GWT DOM class + public void setHeight(AutoNumUnitValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "height", value.getCssValue()); + } + } + + + // sets the min-height style property of this element by using the GWT DOM class + public void setMinHeight(AutoNumUnitValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "minHeight", value.getCssValue()); + } + } + + + // sets the max-height style property of this element by using the GWT DOM class + public void setMaxHeight(AutoNumUnitValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "maxHeight", value.getCssValue()); + } + } + + + // sets the cursor style property of this element by using the GWT DOM class + public void setCursor(CursorValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "cursor", value.getCssValue()); + } + } + + + // sets the background-color style property of this element by using the GWT DOM class + public void setBackgroundColor(ColorValue value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "backgroundColor", value.getCssValue()); + } + } + + + // sets the overflow style property of this element by using the GWT DOM class + public void setOverflow(Overflow value){ + if(value != null){ + DOM.setStyleAttribute(this.getElement(), "overlof", value.getCssName()); + } + } + + + + + // TODO: handle styleClass in the setterMethods + + + public void setGdlStyle(){ // TODO: implement } Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/LoadSchemaCallback.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/LoadSchemaCallback.java Fri Jul 1 10:15:30 2011 (r550) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/LoadSchemaCallback.java Fri Jul 1 13:42:48 2011 (r551) @@ -9,7 +9,6 @@ import com.google.gwt.http.client.RequestException; import com.google.gwt.http.client.Response; import com.google.gwt.http.client.URL; -import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Window; import us.isidor.gdl.anaToMia.Widgets.base.ButtonDialog; import us.isidor.gdl.anaToMia.Widgets.base.GdlPanel; From lgiessmann at common-lisp.net Fri Jul 1 21:03:30 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Fri, 01 Jul 2011 14:03:30 -0700 Subject: [isidorus-cvs] r552 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: base values Message-ID: Author: lgiessmann Date: Fri Jul 1 14:03:30 2011 New Revision: 552 Log: gdl-frontend: Widgets: fixed a bug in the constructor AutoNumValue(String) Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/AutoNumUnitValue.java Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 1 13:42:48 2011 (r551) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 1 14:03:30 2011 (r552) @@ -39,10 +39,12 @@ this.tmRepresentative = tmRepresentative; this.tm = this.tmRepresentative.getTopicMap(); - // TODO: apply GDL style + this.setId(this.getId()); + this.setGdlStyle(); } + // returns the topic that represents this element public Topic getTmRepresentative(){ return this.tmRepresentative; } @@ -50,7 +52,9 @@ // a helper method that returns all occurrences of the type bound to the passed PSI private JsArray getOccurrences(String occurrenceType){ - return tmRepresentative.getOccurrences(tm.getTopicBySubjectIdentifier(tm.createLocator(occurrenceType))); + Topic occType = tm.getTopicBySubjectIdentifier(tm.createLocator(occurrenceType)); + if(occType == null) return null; + else return tmRepresentative.getOccurrences(occType); } @@ -65,7 +69,7 @@ } if(unscopedOccs.size() > 1){ - throw new InvalidGdlSchemaException("The topic " + GdlPsis.getAnyIdOfTopic(this.tmRepresentative) + "must be bound to none or one unscoped occurrence of the type " + occurrenceType + "but is bound " + unscopedOccs.size() + " times to it"); + throw new InvalidGdlSchemaException("The topic " + GdlPsis.getAnyIdOfTopic(this.tmRepresentative) + " must be bound to none or one unscoped occurrence of the type " + occurrenceType + ", but is bound " + unscopedOccs.size() + " times to it"); } else if(unscopedOccs.size() == 1){ return unscopedOccs.get(0); } else { @@ -107,7 +111,7 @@ public String getId() throws InvalidGdlSchemaException { JsArray idOccs = getOccurrences(GdlPsis.OccurrenceType.gdlId); if(idOccs.length() != 1){ - throw new InvalidGdlSchemaException("The topic " + GdlPsis.getAnyIdOfTopic(this.tmRepresentative) + "must be bound to exactly one occurrence of the type " + GdlPsis.OccurrenceType.gdlId + "but is bound " + idOccs.length() + " times to it"); + throw new InvalidGdlSchemaException("The topic " + GdlPsis.getAnyIdOfTopic(this.tmRepresentative) + " must be bound to exactly one occurrence of the type " + GdlPsis.OccurrenceType.gdlId + ", but is bound " + idOccs.length() + " times to it"); } else { return idOccs.get(0).getValue(); } @@ -1499,7 +1503,11 @@ - public void setGdlStyle(){ + public void setGdlStyle() throws InvalidGdlSchemaException { // TODO: implement + + this.setWidth(this.getWidth(null)); + this.setHeight(this.getHeight(null)); + this.setBackgroundColor(this.getBackgroundColor(null)); } } Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Fri Jul 1 13:42:48 2011 (r551) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Fri Jul 1 14:03:30 2011 (r552) @@ -11,13 +11,12 @@ import com.google.gwt.dom.client.Style.Display; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.event.dom.client.MouseOutEvent; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.HorizontalPanel; import com.google.gwt.user.client.ui.RootPanel; -import com.google.gwt.user.client.ui.Widget; + public class TestClass implements EntryPoint{ HorizontalPanel mainPanel = new HorizontalPanel(); @@ -59,20 +58,26 @@ try{ Topic tmpRepresentative = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator("http://test.org/test-top")); Topic gdlBackgroundColor = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlBackgroundColor)); + Topic gdlId = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlId)); + Topic gdlWidth = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlWidth)); + Topic gdlHeight = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlHeight)); tmpRepresentative.createOccurrence(gdlBackgroundColor, "red", null); + tmpRepresentative.createOccurrence(gdlId, "ID_1", null); + tmpRepresentative.createOccurrence(gdlWidth, "300px", null); + tmpRepresentative.createOccurrence(gdlHeight, "300px", null); + GdlVisibleObject tmp = new GdlVisibleObject(tmpRepresentative){}; - tmp.setPixelSize(300, 300); // TODO: remove - DOM.setStyleAttribute(tmp.getElement(), "backgroundColor", "lime"); // TODO: remove this.mainPanel.add(tmp); }catch(Exception e){ + e.printStackTrace(); Window.alert(">> e >> " + e.getClass() + " >> " + e.getMessage()); } } Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/AutoNumUnitValue.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/AutoNumUnitValue.java Fri Jul 1 13:42:48 2011 (r551) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/AutoNumUnitValue.java Fri Jul 1 14:03:30 2011 (r552) @@ -14,14 +14,14 @@ if(upperString.equals("AUTO")){ super.unit = null; // if unit is null, the default value is auto super.value = 0f; - }else if(value.endsWith("PX")){ - this.value = makeFloat(value, 2); + }else if(upperString.endsWith("PX")){ + this.value = makeFloat(upperString, 2); this.unit = CssUnit.PIXEL; - }else if (value.endsWith("PT")){ - this.value = makeFloat(value, 2); + }else if (upperString.endsWith("PT")){ + this.value = makeFloat(upperString, 2); this.unit = CssUnit.POINT; - } else if(value.endsWith("%")){ - this.value = makeFloat(value, 1); + } else if(upperString.endsWith("%")){ + this.value = makeFloat(upperString, 1); this.unit = CssUnit.PERCENTAGE; } else { throw new InvalidGdlSchemaException("auto numeric values supported by the GDL containing a unit definition must be of the form (pt|px|%)|auto, but found: " + value); From lgiessmann at common-lisp.net Fri Jul 1 22:01:50 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Fri, 01 Jul 2011 15:01:50 -0700 Subject: [isidorus-cvs] r553 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: base values Message-ID: Author: lgiessmann Date: Fri Jul 1 15:01:50 2011 New Revision: 553 Log: gdl-frontend: Widgets: implemented the method setGdlStyle, which sets all styles defined for a gdl:Visible-Object within a topic map Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ColorValue.java Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 1 14:03:30 2011 (r552) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 1 15:01:50 2011 (r553) @@ -121,7 +121,7 @@ // returns a Display instance of a gdl:display occurrence. // If no gdl:display occurrence is set, the default value is returned public Display getDisplay() throws InvalidGdlSchemaException { - Occurrence displayOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlId); + Occurrence displayOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlDisplay); if(displayOcc != null){ String value = displayOcc.getValue().toLowerCase(); @@ -258,8 +258,7 @@ // returns a NumUnitValue instance that represents the margin-top of this element. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned - // or null. If the styleClass is null and no occurrence was found, the default value for this - // property is returned. + // or null. public NumUnitValue getMarginTop(String styleClass) throws InvalidGdlSchemaException { Occurrence marginOcc = null; if(styleClass != null){ @@ -268,10 +267,8 @@ marginOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlMarginTop); } - if(marginOcc == null && styleClass != null){ + if(marginOcc == null){ return null; - } else if(marginOcc == null) { - return new NumUnitValue(); } else { return new NumUnitValue(marginOcc.getValue()); } @@ -280,8 +277,7 @@ // returns a NumUnitValue instance that represents the margin-right of this element. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned - // or null. If the styleClass is null and no occurrence was found, the default value for this - // property is returned. + // or null. public NumUnitValue getMarginRight(String styleClass) throws InvalidGdlSchemaException { Occurrence marginOcc = null; if(styleClass != null){ @@ -290,10 +286,8 @@ marginOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlMarginRight); } - if(marginOcc == null && styleClass != null){ + if(marginOcc == null){ return null; - } else if(marginOcc == null) { - return new NumUnitValue(); } else { return new NumUnitValue(marginOcc.getValue()); } @@ -302,8 +296,7 @@ // returns a NumUnitValue instance that represents the margin-bottom of this element. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned - // or null. If the styleClass is null and no occurrence was found, the default value for this - // property is returned. + // or null. public NumUnitValue getMarginBottom(String styleClass) throws InvalidGdlSchemaException { Occurrence marginOcc = null; if(styleClass != null){ @@ -312,10 +305,8 @@ marginOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlMarginBottom); } - if(marginOcc == null && styleClass != null){ + if(marginOcc == null){ return null; - } else if(marginOcc == null) { - return new NumUnitValue(); } else { return new NumUnitValue(marginOcc.getValue()); } @@ -324,8 +315,7 @@ // returns a NumUnitValue instance that represents the margin-left of this element. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned - // or null. If the styleClass is null and no occurrence was found, the default value for this - // property is returned. + // or null. public NumUnitValue getMarginLeft(String styleClass) throws InvalidGdlSchemaException { Occurrence marginOcc = null; if(styleClass != null){ @@ -334,10 +324,8 @@ marginOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlMarginLeft); } - if(marginOcc == null && styleClass != null){ + if(marginOcc == null){ return null; - } else if(marginOcc == null) { - return new NumUnitValue(); } else { return new NumUnitValue(marginOcc.getValue()); } @@ -356,10 +344,8 @@ colorOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderColor); } - if(colorOcc == null && styleClass != null){ + if(colorOcc == null ){ return null; - } else if(colorOcc == null) { - return new ColorValue(); } else { return new ColorValue(colorOcc.getValue()); } @@ -368,8 +354,7 @@ // returns a ColorValue instance that represents the color of this element's border-top. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned - // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this - // property is returned. + // null, null otherwise. public ColorValue getBorderTopColor(String styleClass) throws InvalidGdlSchemaException { Occurrence colorOcc = null; if(styleClass != null){ @@ -378,10 +363,8 @@ colorOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderTopColor); } - if(colorOcc == null && styleClass != null){ + if(colorOcc == null ){ return null; - } else if(colorOcc == null) { - return new ColorValue(); } else { return new ColorValue(colorOcc.getValue()); } @@ -390,8 +373,7 @@ // returns a ColorValue instance that represents the color of this element's border-right. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned - // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this - // property is returned. + // null, null otherwise. public ColorValue getBorderRightColor(String styleClass) throws InvalidGdlSchemaException { Occurrence colorOcc = null; if(styleClass != null){ @@ -400,10 +382,8 @@ colorOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderRightColor); } - if(colorOcc == null && styleClass != null){ + if(colorOcc == null ){ return null; - } else if(colorOcc == null) { - return new ColorValue(); } else { return new ColorValue(colorOcc.getValue()); } @@ -412,8 +392,7 @@ // returns a ColorValue instance that represents the color of this element's border-bottom. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned - // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this - // property is returned. + // null, null otherwise. public ColorValue getBorderBottomColor(String styleClass) throws InvalidGdlSchemaException { Occurrence colorOcc = null; if(styleClass != null){ @@ -422,10 +401,8 @@ colorOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderBottomColor); } - if(colorOcc == null && styleClass != null){ + if(colorOcc == null ){ return null; - } else if(colorOcc == null) { - return new ColorValue(); } else { return new ColorValue(colorOcc.getValue()); } @@ -434,8 +411,7 @@ // returns a ColorValue instance that represents the color of this element's border-left. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned - // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this - // property is returned. + // null, null otherwise. public ColorValue getBorderLeftColor(String styleClass) throws InvalidGdlSchemaException { Occurrence colorOcc = null; if(styleClass != null){ @@ -444,10 +420,8 @@ colorOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderLeftColor); } - if(colorOcc == null && styleClass != null){ + if(colorOcc == null ){ return null; - } else if(colorOcc == null) { - return new ColorValue(); } else { return new ColorValue(colorOcc.getValue()); } @@ -472,7 +446,7 @@ return BorderStyleValue.NONE; } else { try{ - return BorderStyleValue.valueOf(styleOcc.getValue()); + return BorderStyleValue.valueOf(styleOcc.getValue().toUpperCase()); }catch(IllegalArgumentException e){ String values = "none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset"; throw new InvalidGdlSchemaException("border-style must be set to one of " + values + ", but is " + styleOcc.getValue()); @@ -483,8 +457,7 @@ // returns a ColorValue instance that represents the style of this element's border-top. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned - // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this - // property is returned. + // null, null otherwise. public BorderStyleValue getBorderTopStyle(String styleClass) throws InvalidGdlSchemaException { Occurrence styleOcc = null; if(styleClass != null){ @@ -493,13 +466,11 @@ styleOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderTopStyle); } - if(styleOcc == null && styleClass != null){ + if(styleOcc == null){ return null; - } else if(styleOcc == null) { - return BorderStyleValue.NONE; } else { try{ - return BorderStyleValue.valueOf(styleOcc.getValue()); + return BorderStyleValue.valueOf(styleOcc.getValue().toUpperCase()); }catch(IllegalArgumentException e){ String values = "none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset"; throw new InvalidGdlSchemaException("border-top-style must be set to one of " + values + ", but is " + styleOcc.getValue()); @@ -510,8 +481,7 @@ // returns a ColorValue instance that represents the style of this element's border-right. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned - // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this - // property is returned. + // null, null otherwise. public BorderStyleValue getBorderRightStyle(String styleClass) throws InvalidGdlSchemaException { Occurrence styleOcc = null; if(styleClass != null){ @@ -520,13 +490,11 @@ styleOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderRightStyle); } - if(styleOcc == null && styleClass != null){ + if(styleOcc == null){ return null; - } else if(styleOcc == null) { - return BorderStyleValue.NONE; } else { try{ - return BorderStyleValue.valueOf(styleOcc.getValue()); + return BorderStyleValue.valueOf(styleOcc.getValue().toUpperCase()); }catch(IllegalArgumentException e){ String values = "none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset"; throw new InvalidGdlSchemaException("border-right-style must be set to one of " + values + ", but is " + styleOcc.getValue()); @@ -537,8 +505,7 @@ // returns a ColorValue instance that represents the style of this element's border-bottom. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned - // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this - // property is returned. + // null, null otherwise. public BorderStyleValue getBorderBottomStyle(String styleClass) throws InvalidGdlSchemaException { Occurrence styleOcc = null; if(styleClass != null){ @@ -547,13 +514,11 @@ styleOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderBottomStyle); } - if(styleOcc == null && styleClass != null){ + if(styleOcc == null){ return null; - } else if(styleOcc == null) { - return BorderStyleValue.NONE; } else { try{ - return BorderStyleValue.valueOf(styleOcc.getValue()); + return BorderStyleValue.valueOf(styleOcc.getValue().toUpperCase()); }catch(IllegalArgumentException e){ String values = "none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset"; throw new InvalidGdlSchemaException("border-bottom-style must be set to one of " + values + ", but is " + styleOcc.getValue()); @@ -564,8 +529,7 @@ // returns a ColorValue instance that represents the style of this element's border-left. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned - // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this - // property is returned. + // null, null otherwise. public BorderStyleValue getBorderLeftStyle(String styleClass) throws InvalidGdlSchemaException { Occurrence styleOcc = null; if(styleClass != null){ @@ -574,13 +538,11 @@ styleOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderLeftStyle); } - if(styleOcc == null && styleClass != null){ + if(styleOcc == null){ return null; - } else if(styleOcc == null) { - return BorderStyleValue.NONE; } else { try{ - return BorderStyleValue.valueOf(styleOcc.getValue()); + return BorderStyleValue.valueOf(styleOcc.getValue().toUpperCase()); }catch(IllegalArgumentException e){ String values = "none, hidden, dotted, dashed, solid, double, groove, ridge, inset, outset"; throw new InvalidGdlSchemaException("border-left-style must be set to one of " + values + ", but is " + styleOcc.getValue()); @@ -613,8 +575,7 @@ // returns a ColorValue instance that represents the width of this element's border-top. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned - // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this - // property is returned. + // null, null otherwise. public AbsoluteNumValue getBorderTopWidth(String styleClass) throws InvalidGdlSchemaException { Occurrence widthOcc = null; if(styleClass != null){ @@ -623,10 +584,8 @@ widthOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderTopWidth); } - if(widthOcc == null && styleClass != null){ + if(widthOcc == null){ return null; - } else if(widthOcc == null) { - return new AbsoluteNumValue(); } else { return new AbsoluteNumValue(widthOcc.getValue()); } @@ -635,8 +594,7 @@ // returns a ColorValue instance that represents the width of this element's border-right. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned - // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this - // property is returned. + // null, null otherwise. public AbsoluteNumValue getBorderRightWidth(String styleClass) throws InvalidGdlSchemaException { Occurrence widthOcc = null; if(styleClass != null){ @@ -645,10 +603,8 @@ widthOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderRightWidth); } - if(widthOcc == null && styleClass != null){ + if(widthOcc == null){ return null; - } else if(widthOcc == null) { - return new AbsoluteNumValue(); } else { return new AbsoluteNumValue(widthOcc.getValue()); } @@ -657,8 +613,7 @@ // returns a ColorValue instance that represents the width of this element's border-bottom. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned - // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this - // property is returned. + // null, null otherwise. public AbsoluteNumValue getBorderBottomWidth(String styleClass) throws InvalidGdlSchemaException { Occurrence widthOcc = null; if(styleClass != null){ @@ -667,10 +622,8 @@ widthOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderBottomWidth); } - if(widthOcc == null && styleClass != null){ + if(widthOcc == null){ return null; - } else if(widthOcc == null) { - return new AbsoluteNumValue(); } else { return new AbsoluteNumValue(widthOcc.getValue()); } @@ -679,8 +632,7 @@ // returns a ColorValue instance that represents the width of this element's border-left. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned - // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this - // property is returned. + // null, null otherwise. public AbsoluteNumValue getBorderLeftWidth(String styleClass) throws InvalidGdlSchemaException { Occurrence widthOcc = null; if(styleClass != null){ @@ -689,10 +641,8 @@ widthOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderLeftWidth); } - if(widthOcc == null && styleClass != null){ + if(widthOcc == null){ return null; - } else if(widthOcc == null) { - return new AbsoluteNumValue(); } else { return new AbsoluteNumValue(widthOcc.getValue()); } @@ -723,8 +673,7 @@ // returns a NumUnitValue instance that represents the radius of this element's border-top-left. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned - // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this - // property is returned. + // null, null otherwise. public NumUnitValue getBorderTopLeftRadius(String styleClass) throws InvalidGdlSchemaException { Occurrence radiusOcc = null; if(styleClass != null){ @@ -733,10 +682,8 @@ radiusOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderTopLeftRadius); } - if(radiusOcc == null && styleClass != null){ + if(radiusOcc == null){ return null; - } else if(radiusOcc == null) { - return new NumUnitValue(); } else { return new NumUnitValue(radiusOcc.getValue()); } @@ -745,8 +692,7 @@ // returns a NumUnitValue instance that represents the radius of this element's border-top-right. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned - // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this - // property is returned. + // null, null otherwise. public NumUnitValue getBorderTopRightRadius(String styleClass) throws InvalidGdlSchemaException { Occurrence radiusOcc = null; if(styleClass != null){ @@ -755,10 +701,8 @@ radiusOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderTopRightRadius); } - if(radiusOcc == null && styleClass != null){ + if(radiusOcc == null){ return null; - } else if(radiusOcc == null) { - return new NumUnitValue(); } else { return new NumUnitValue(radiusOcc.getValue()); } @@ -767,8 +711,7 @@ // returns a NumUnitValue instance that represents the radius of this element's border-bottom-left. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned - // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this - // property is returned. + // null, null otherwise. public NumUnitValue getBorderBottomLeftRadius(String styleClass) throws InvalidGdlSchemaException { Occurrence radiusOcc = null; if(styleClass != null){ @@ -777,10 +720,8 @@ radiusOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderBottomLeftRadius); } - if(radiusOcc == null && styleClass != null){ + if(radiusOcc == null){ return null; - } else if(radiusOcc == null) { - return new NumUnitValue(); } else { return new NumUnitValue(radiusOcc.getValue()); } @@ -789,8 +730,7 @@ // returns a NumUnitValue instance that represents the radius of this element's border-bottom-right. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned - // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this - // property is returned. + // null, null otherwise. public NumUnitValue getBorderBottomRightRadius(String styleClass) throws InvalidGdlSchemaException { Occurrence radiusOcc = null; if(styleClass != null){ @@ -799,10 +739,8 @@ radiusOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderBottomRightRadius); } - if(radiusOcc == null && styleClass != null){ + if(radiusOcc == null){ return null; - } else if(radiusOcc == null) { - return new NumUnitValue(); } else { return new NumUnitValue(radiusOcc.getValue()); } @@ -833,8 +771,7 @@ // returns a NumUnitValue instance that represents the padding of this element's top. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned - // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this - // property is returned. + // null, null otherwise. public NumUnitValue getPaddingTop(String styleClass) throws InvalidGdlSchemaException { Occurrence paddingOcc = null; if(styleClass != null){ @@ -843,10 +780,8 @@ paddingOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlPaddingTop); } - if(paddingOcc == null && styleClass != null){ + if(paddingOcc == null){ return null; - } else if(paddingOcc == null) { - return new NumUnitValue(); } else { return new NumUnitValue(paddingOcc.getValue()); } @@ -855,8 +790,7 @@ // returns a NumUnitValue instance that represents the padding of this element's right. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned - // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this - // property is returned. + // null, null otherwise. public NumUnitValue getPaddingRight(String styleClass) throws InvalidGdlSchemaException { Occurrence paddingOcc = null; if(styleClass != null){ @@ -865,10 +799,8 @@ paddingOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlPaddingRight); } - if(paddingOcc == null && styleClass != null){ + if(paddingOcc == null){ return null; - } else if(paddingOcc == null) { - return new NumUnitValue(); } else { return new NumUnitValue(paddingOcc.getValue()); } @@ -877,8 +809,7 @@ // returns a NumUnitValue instance that represents the padding of this element's bottom. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned - // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this - // property is returned. + // null, null otherwise. public NumUnitValue getPaddingBottom(String styleClass) throws InvalidGdlSchemaException { Occurrence paddingOcc = null; if(styleClass != null){ @@ -887,10 +818,8 @@ paddingOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlPaddingBottom); } - if(paddingOcc == null && styleClass != null){ + if(paddingOcc == null){ return null; - } else if(paddingOcc == null) { - return new NumUnitValue(); } else { return new NumUnitValue(paddingOcc.getValue()); } @@ -899,8 +828,7 @@ // returns a NumUnitValue instance that represents the padding of this element's left. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned - // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this - // property is returned. + // null, null otherwise. public NumUnitValue getPaddingLeft(String styleClass) throws InvalidGdlSchemaException { Occurrence paddingOcc = null; if(styleClass != null){ @@ -909,10 +837,8 @@ paddingOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlPaddingLeft); } - if(paddingOcc == null && styleClass != null){ + if(paddingOcc == null){ return null; - } else if(paddingOcc == null) { - return new NumUnitValue(); } else { return new NumUnitValue(paddingOcc.getValue()); } @@ -1109,9 +1035,9 @@ public Overflow getOverflow(String styleClass) throws InvalidGdlSchemaException { Occurrence overflowOcc = null; if(styleClass != null){ - overflowOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlCursor, styleClass); + overflowOcc = getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlOverflow, styleClass); } else { - overflowOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlCursor); + overflowOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlOverflow); } if(overflowOcc == null && styleClass != null){ @@ -1504,10 +1430,49 @@ public void setGdlStyle() throws InvalidGdlSchemaException { - // TODO: implement - + this.setDisplay(this.getDisplay()); + this.setZindex(this.getZindex()); + this.setFloat(this.getFloat()); + this.setClear(this.getClear()); + this.setVerticalAlign(this.getVerticalAlign(null)); + this.setMargin(this.getMargin(null)); + this.setMarginTop(this.getMarginTop(null)); + this.setMarginRight(this.getMarginRight(null)); + this.setMarginBottom(this.getMarginBottom(null)); + this.setMarginLeft(this.getMarginLeft(null)); + this.setBorderColor(this.getBorderColor(null)); + this.setBorderTopColor(this.getBorderTopColor(null)); + this.setBorderRightColor(this.getBorderRightColor(null)); + this.setBorderBottomColor(this.getBorderBottomColor(null)); + this.setBorderLeftColor(this.getBorderLeftColor(null)); + this.setBorderStyle(this.getBorderStyle(null)); + this.setBorderTopStyle(this.getBorderTopStyle(null)); + this.setBorderRightStyle(this.getBorderRightStyle(null)); + this.setBorderBottomStyle(this.getBorderBottomStyle(null)); + this.setBorderLeftStyle(this.getBorderLeftStyle(null)); + this.setBorderWidth(this.getBorderWidth(null)); + this.setBorderTopWidth(this.getBorderTopWidth(null)); + this.setBorderRightWidth(this.getBorderRightWidth(null)); + this.setBorderBottomWidth(this.getBorderBottomWidth(null)); + this.setBorderLeftWidth(this.getBorderLeftWidth(null)); + this.setBorderRadius(this.getBorderRadius(null)); + this.setBorderTopRightRadius(this.getBorderTopRightRadius(null)); + this.setBorderBottomRightRadius(this.getBorderBottomRightRadius(null)); + this.setBorderBottomLeftRadius(this.getBorderBottomLeftRadius(null)); + this.setBorderTopLeftRadius(this.getBorderTopLeftRadius(null)); + this.setPadding(this.getPadding(null)); + this.setPaddingTop(this.getPaddingTop(null)); + this.setPaddingRight(this.getPaddingRight(null)); + this.setPaddingBottom(this.getPaddingBottom(null)); + this.setPaddingLeft(this.getPaddingLeft(null)); this.setWidth(this.getWidth(null)); + this.setMinWidth(this.getMinWidth(null)); + this.setMaxWidth(this.getMaxWidth(null)); this.setHeight(this.getHeight(null)); + this.setMinHeight(this.getMinHeight(null)); + this.setMaxHeight(this.getMaxHeight(null)); + this.setCursor(this.getCursor(null)); this.setBackgroundColor(this.getBackgroundColor(null)); + this.setOverflow(this.getOverflow(null)); } } Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Fri Jul 1 14:03:30 2011 (r552) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Fri Jul 1 15:01:50 2011 (r553) @@ -3,12 +3,8 @@ import us.isidor.gdl.anaToMia.TmEngine.jtmsBasedEngine.JtmsTmEngine; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic; import us.isidor.gdl.anaToMia.Widgets.isidorus.LoadSchemaCallback; -import us.isidor.gdl.anaToMia.Widgets.values.ClearValue; -import us.isidor.gdl.anaToMia.Widgets.values.ColorValue; import us.isidor.gdl.anaToMia.Widgets.values.CursorValue; - import com.google.gwt.core.client.EntryPoint; -import com.google.gwt.dom.client.Style.Display; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.user.client.DOM; @@ -61,11 +57,35 @@ Topic gdlId = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlId)); Topic gdlWidth = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlWidth)); Topic gdlHeight = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlHeight)); + Topic gdlBorderRadius = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlBorderRadius)); + Topic gdlBorderBottomRightRadius = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlBorderBottomRightRadius)); + Topic gdlPadding = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlPadding)); + Topic gdlPaddingLeft = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlPaddingLeft)); + Topic gdlCursor = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlCursor)); + Topic gdlMarginTop = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlMarginTop)); + Topic gdlBorderColor = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlBorderColor)); + Topic gdlBorderTopColor = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlBorderTopColor)); + Topic gdlBorderRightColor = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlBorderRightColor)); + Topic gdlBorderBottomColor = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlBorderBottomColor)); + Topic gdlBorderStyle = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlBorderStyle)); + Topic gdlBorderWidth = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlBorderWidth)); + tmpRepresentative.createOccurrence(gdlBackgroundColor, "red", null); tmpRepresentative.createOccurrence(gdlId, "ID_1", null); tmpRepresentative.createOccurrence(gdlWidth, "300px", null); tmpRepresentative.createOccurrence(gdlHeight, "300px", null); - + tmpRepresentative.createOccurrence(gdlBorderRadius, "30px", null); + tmpRepresentative.createOccurrence(gdlBorderBottomRightRadius, "2%", null); + tmpRepresentative.createOccurrence(gdlPadding, "5px", null); + tmpRepresentative.createOccurrence(gdlPaddingLeft, "5%", null); + tmpRepresentative.createOccurrence(gdlCursor, CursorValue.HELP.getCssValue(), null); + tmpRepresentative.createOccurrence(gdlMarginTop, "50pt", null); + tmpRepresentative.createOccurrence(gdlBorderColor, "lime", null); + tmpRepresentative.createOccurrence(gdlBorderTopColor, "#00f", null); + tmpRepresentative.createOccurrence(gdlBorderRightColor, "rgb(0, 255, 0)", null); + tmpRepresentative.createOccurrence(gdlBorderBottomColor, "rgb(100%, 100%, 0%)", null); + tmpRepresentative.createOccurrence(gdlBorderStyle, "dashed", null); + tmpRepresentative.createOccurrence(gdlBorderWidth, "5px", null); GdlVisibleObject tmp = new GdlVisibleObject(tmpRepresentative){}; Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ColorValue.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ColorValue.java Fri Jul 1 14:03:30 2011 (r552) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ColorValue.java Fri Jul 1 15:01:50 2011 (r553) @@ -21,14 +21,14 @@ this.stringValue = value; }else if(value.matches("^#[0-9A-F]{3}$")) { this.stringValue = "#" + value.charAt(1) + value.charAt(1) + value.charAt(2) + value.charAt(2) + value.charAt(3) + value.charAt(3); - }else if(value.matches("^rgb\\( *\\+?[0-9]{1,3} *, *\\+?[0-9]{1,3} *, *\\+?[0-9]{1,3} *\\)$")){ + }else if(value.matches("^RGB\\( *\\+?[0-9]{1,3} *, *\\+?[0-9]{1,3} *, *\\+?[0-9]{1,3} *\\)$")){ String[] rgb = value.substring(4, value.length() - 1).split(","); this.stringValue = "#" + decToHexIntegerString(rgb[0]) + decToHexIntegerString(rgb[1]) + decToHexIntegerString(rgb[2]); - }else if(value.matches("^rgb\\( *\\+?[0-9]{1,3}% *, *\\+?[0-9]{1,3}% *, *\\+?[0-9]{1,3}% *\\)$")){ + }else if(value.matches("^RGB\\( *\\+?[0-9]{1,3}% *, *\\+?[0-9]{1,3}% *, *\\+?[0-9]{1,3}% *\\)$")){ String[] rgb = value.substring(4, value.length() - 1).split(","); this.stringValue = "#" + percentToHexIntegerString(rgb[0]) + percentToHexIntegerString(rgb[1]) + percentToHexIntegerString(rgb[2]); }else { - throw new InvalidGdlSchemaException("a ColorValue must be a value of the format #RRGGBB, #RGB, rdg(rrr,ggg,bbb), rgb(rrr%,ggg%,bbb%) or a CssColor, but is " + color); + throw new InvalidGdlSchemaException("a color value must be a value of the format #RRGGBB, #RGB, rgb(rrr,ggg,bbb), rgb(rrr%,ggg%,bbb%) or a CssColor, but is " + color); } } @@ -47,6 +47,7 @@ private String percentToHexIntegerString(String percentageString){ String rawValue = percentageString.replaceFirst("%", "").replaceFirst("\\+", "").trim(); int percentValue = Integer.valueOf(rawValue); + percentValue = percentValue > 100 ? 100 : percentValue; String result = Integer.toHexString((int)(255 * ((float)percentValue / 100))); return result.length() == 1 ? "0" + result : result; } From lgiessmann at common-lisp.net Mon Jul 4 06:00:31 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Sun, 03 Jul 2011 23:00:31 -0700 Subject: [isidorus-cvs] r554 - branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base Message-ID: Author: lgiessmann Date: Sun Jul 3 23:00:30 2011 New Revision: 554 Log: gdl-frontend: Widgets: started to implement style setters for the GDL/CSS pseudo style classes Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 1 15:01:50 2011 (r553) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Sun Jul 3 23:00:30 2011 (r554) @@ -1100,321 +1100,481 @@ // sets the vertical-align style property of this element by using the GWT DOM class - public void setVerticalAlign(VerticalAlign value){ + public void setVerticalAlign(VerticalAlign value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "verticalAlign", value.getCssName()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "verticalAlign", value.getCssName()); + } else { + // TODO: implement + } } } // sets the margin style property of this element by using the GWT DOM class - public void setMargin(NumUnitValue value){ + public void setMargin(NumUnitValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "margin", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "margin", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the margin-top style property of this element by using the GWT DOM class - public void setMarginTop(NumUnitValue value){ + public void setMarginTop(NumUnitValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "marginTop", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "marginTop", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the margin-right style property of this element by using the GWT DOM class - public void setMarginRight(NumUnitValue value){ + public void setMarginRight(NumUnitValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "marginRight", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "marginRight", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the margin-bottom style property of this element by using the GWT DOM class - public void setMarginBottom(NumUnitValue value){ + public void setMarginBottom(NumUnitValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "marginBottom", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "marginBottom", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the margin-left style property of this element by using the GWT DOM class - public void setMarginLeft(NumUnitValue value){ + public void setMarginLeft(NumUnitValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "marginLeft", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "marginLeft", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the border-color style property of this element by using the GWT DOM class - public void setBorderColor(ColorValue value){ + public void setBorderColor(ColorValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "borderColor", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "borderColor", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the border-top-color style property of this element by using the GWT DOM class - public void setBorderTopColor(ColorValue value){ + public void setBorderTopColor(ColorValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "borderTopColor", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "borderTopColor", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the border-right-color style property of this element by using the GWT DOM class - public void setBorderRightColor(ColorValue value){ + public void setBorderRightColor(ColorValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "borderRightColor", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "borderRightColor", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the border-bottom-color style property of this element by using the GWT DOM class - public void setBorderBottomColor(ColorValue value){ + public void setBorderBottomColor(ColorValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "borderBottomColor", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "borderBottomColor", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the border-left-color style property of this element by using the GWT DOM class - public void setBorderLeftColor(ColorValue value){ + public void setBorderLeftColor(ColorValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "borderLeftColor", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "borderLeftColor", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the border-style style property of this element by using the GWT DOM class - public void setBorderStyle(BorderStyleValue value){ + public void setBorderStyle(BorderStyleValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "borderStyle", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "borderStyle", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the border-top-style style property of this element by using the GWT DOM class - public void setBorderTopStyle(BorderStyleValue value){ + public void setBorderTopStyle(BorderStyleValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "borderTopStyle", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "borderTopStyle", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the border-right-style style property of this element by using the GWT DOM class - public void setBorderRightStyle(BorderStyleValue value){ + public void setBorderRightStyle(BorderStyleValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "borderRightStyle", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "borderRightStyle", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the border-bottom-style style property of this element by using the GWT DOM class - public void setBorderBottomStyle(BorderStyleValue value){ + public void setBorderBottomStyle(BorderStyleValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "borderBottomStyle", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "borderBottomStyle", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the border-left-style style property of this element by using the GWT DOM class - public void setBorderLeftStyle(BorderStyleValue value){ + public void setBorderLeftStyle(BorderStyleValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "borderLeftStyle", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "borderLeftStyle", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the border-width style property of this element by using the GWT DOM class - public void setBorderWidth(AbsoluteNumValue value){ + public void setBorderWidth(AbsoluteNumValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "borderWidth", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "borderWidth", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the border-width style property of this element by using the GWT DOM class - public void setBorderTopWidth(AbsoluteNumValue value){ + public void setBorderTopWidth(AbsoluteNumValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "borderTopWidth", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "borderTopWidth", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the border-width style property of this element by using the GWT DOM class - public void setBorderRightWidth(AbsoluteNumValue value){ + public void setBorderRightWidth(AbsoluteNumValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "borderRightWidth", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "borderRightWidth", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the border-width style property of this element by using the GWT DOM class - public void setBorderBottomWidth(AbsoluteNumValue value){ + public void setBorderBottomWidth(AbsoluteNumValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "borderBottomWidth", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "borderBottomWidth", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the border-width style property of this element by using the GWT DOM class - public void setBorderLeftWidth(AbsoluteNumValue value){ + public void setBorderLeftWidth(AbsoluteNumValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "borderLeftWidth", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "borderLeftWidth", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the border-radius style property of this element by using the GWT DOM class - public void setBorderRadius(NumUnitValue value){ + public void setBorderRadius(NumUnitValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "borderRadius", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "borderRadius", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the border-top-right-radius style property of this element by using the GWT DOM class - public void setBorderTopRightRadius(NumUnitValue value){ + public void setBorderTopRightRadius(NumUnitValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "borderTopRightRadius", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "borderTopRightRadius", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the border-bottom-right-radius style property of this element by using the GWT DOM class - public void setBorderBottomRightRadius(NumUnitValue value){ + public void setBorderBottomRightRadius(NumUnitValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "borderBottomRightRadius", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "borderBottomRightRadius", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the border-bottom-left-radius style property of this element by using the GWT DOM class - public void setBorderBottomLeftRadius(NumUnitValue value){ + public void setBorderBottomLeftRadius(NumUnitValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "borderBottomLeftRadius", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "borderBottomLeftRadius", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the border-top-left-radius style property of this element by using the GWT DOM class - public void setBorderTopLeftRadius(NumUnitValue value){ + public void setBorderTopLeftRadius(NumUnitValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "borderTopLeftRadius", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "borderTopLeftRadius", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the padding style property of this element by using the GWT DOM class - public void setPadding(NumUnitValue value){ + public void setPadding(NumUnitValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "padding", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "padding", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the padding-top style property of this element by using the GWT DOM class - public void setPaddingTop(NumUnitValue value){ + public void setPaddingTop(NumUnitValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "paddingTop", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "paddingTop", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the padding-right style property of this element by using the GWT DOM class - public void setPaddingRight(NumUnitValue value){ + public void setPaddingRight(NumUnitValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "paddingRight", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "paddingRight", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the padding-bottom style property of this element by using the GWT DOM class - public void setPaddingBottom(NumUnitValue value){ + public void setPaddingBottom(NumUnitValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "paddingBottom", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "paddingBottom", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the padding-left style property of this element by using the GWT DOM class - public void setPaddingLeft(NumUnitValue value){ + public void setPaddingLeft(NumUnitValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "paddingLeft", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "paddingLeft", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the width style property of this element by using the GWT DOM class - public void setWidth(AutoNumUnitValue value){ + public void setWidth(AutoNumUnitValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "width", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "width", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the min-width style property of this element by using the GWT DOM class - public void setMinWidth(AutoNumUnitValue value){ + public void setMinWidth(AutoNumUnitValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "minWidth", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "minWidth", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the max-width style property of this element by using the GWT DOM class - public void setMaxWidth(AutoNumUnitValue value){ + public void setMaxWidth(AutoNumUnitValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "maxWidth", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "maxWidth", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the height style property of this element by using the GWT DOM class - public void setHeight(AutoNumUnitValue value){ + public void setHeight(AutoNumUnitValue value, String styleClass){ if(value != null){ + if(styleClass == null){ DOM.setStyleAttribute(this.getElement(), "height", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the min-height style property of this element by using the GWT DOM class - public void setMinHeight(AutoNumUnitValue value){ + public void setMinHeight(AutoNumUnitValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "minHeight", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "minHeight", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the max-height style property of this element by using the GWT DOM class - public void setMaxHeight(AutoNumUnitValue value){ + public void setMaxHeight(AutoNumUnitValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "maxHeight", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "maxHeight", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the cursor style property of this element by using the GWT DOM class - public void setCursor(CursorValue value){ + public void setCursor(CursorValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "cursor", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "cursor", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the background-color style property of this element by using the GWT DOM class - public void setBackgroundColor(ColorValue value){ + public void setBackgroundColor(ColorValue value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "backgroundColor", value.getCssValue()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "backgroundColor", value.getCssValue()); + } else { + // TODO: implement + } } } // sets the overflow style property of this element by using the GWT DOM class - public void setOverflow(Overflow value){ + public void setOverflow(Overflow value, String styleClass){ if(value != null){ - DOM.setStyleAttribute(this.getElement(), "overlof", value.getCssName()); + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), "overlof", value.getCssName()); + } else { + // TODO: implement + } } } @@ -1434,45 +1594,49 @@ this.setZindex(this.getZindex()); this.setFloat(this.getFloat()); this.setClear(this.getClear()); - this.setVerticalAlign(this.getVerticalAlign(null)); - this.setMargin(this.getMargin(null)); - this.setMarginTop(this.getMarginTop(null)); - this.setMarginRight(this.getMarginRight(null)); - this.setMarginBottom(this.getMarginBottom(null)); - this.setMarginLeft(this.getMarginLeft(null)); - this.setBorderColor(this.getBorderColor(null)); - this.setBorderTopColor(this.getBorderTopColor(null)); - this.setBorderRightColor(this.getBorderRightColor(null)); - this.setBorderBottomColor(this.getBorderBottomColor(null)); - this.setBorderLeftColor(this.getBorderLeftColor(null)); - this.setBorderStyle(this.getBorderStyle(null)); - this.setBorderTopStyle(this.getBorderTopStyle(null)); - this.setBorderRightStyle(this.getBorderRightStyle(null)); - this.setBorderBottomStyle(this.getBorderBottomStyle(null)); - this.setBorderLeftStyle(this.getBorderLeftStyle(null)); - this.setBorderWidth(this.getBorderWidth(null)); - this.setBorderTopWidth(this.getBorderTopWidth(null)); - this.setBorderRightWidth(this.getBorderRightWidth(null)); - this.setBorderBottomWidth(this.getBorderBottomWidth(null)); - this.setBorderLeftWidth(this.getBorderLeftWidth(null)); - this.setBorderRadius(this.getBorderRadius(null)); - this.setBorderTopRightRadius(this.getBorderTopRightRadius(null)); - this.setBorderBottomRightRadius(this.getBorderBottomRightRadius(null)); - this.setBorderBottomLeftRadius(this.getBorderBottomLeftRadius(null)); - this.setBorderTopLeftRadius(this.getBorderTopLeftRadius(null)); - this.setPadding(this.getPadding(null)); - this.setPaddingTop(this.getPaddingTop(null)); - this.setPaddingRight(this.getPaddingRight(null)); - this.setPaddingBottom(this.getPaddingBottom(null)); - this.setPaddingLeft(this.getPaddingLeft(null)); - this.setWidth(this.getWidth(null)); - this.setMinWidth(this.getMinWidth(null)); - this.setMaxWidth(this.getMaxWidth(null)); - this.setHeight(this.getHeight(null)); - this.setMinHeight(this.getMinHeight(null)); - this.setMaxHeight(this.getMaxHeight(null)); - this.setCursor(this.getCursor(null)); - this.setBackgroundColor(this.getBackgroundColor(null)); - this.setOverflow(this.getOverflow(null)); + + String[] styleClasses = new String[]{null, GdlPsis.Scope.gdlActive, GdlPsis.Scope.gdlFocus, GdlPsis.Scope.gdlHover}; + for (String styleClass : styleClasses) { + this.setVerticalAlign(this.getVerticalAlign(styleClass), styleClass); + this.setMargin(this.getMargin(styleClass), styleClass); + this.setMarginTop(this.getMarginTop(styleClass), styleClass); + this.setMarginRight(this.getMarginRight(styleClass), styleClass); + this.setMarginBottom(this.getMarginBottom(styleClass), styleClass); + this.setMarginLeft(this.getMarginLeft(styleClass), styleClass); + this.setBorderColor(this.getBorderColor(styleClass), styleClass); + this.setBorderTopColor(this.getBorderTopColor(styleClass), styleClass); + this.setBorderRightColor(this.getBorderRightColor(styleClass), styleClass); + this.setBorderBottomColor(this.getBorderBottomColor(styleClass), styleClass); + this.setBorderLeftColor(this.getBorderLeftColor(styleClass), styleClass); + this.setBorderStyle(this.getBorderStyle(styleClass), styleClass); + this.setBorderTopStyle(this.getBorderTopStyle(styleClass), styleClass); + this.setBorderRightStyle(this.getBorderRightStyle(styleClass), styleClass); + this.setBorderBottomStyle(this.getBorderBottomStyle(styleClass), styleClass); + this.setBorderLeftStyle(this.getBorderLeftStyle(styleClass), styleClass); + this.setBorderWidth(this.getBorderWidth(styleClass), styleClass); + this.setBorderTopWidth(this.getBorderTopWidth(styleClass), styleClass); + this.setBorderRightWidth(this.getBorderRightWidth(styleClass), styleClass); + this.setBorderBottomWidth(this.getBorderBottomWidth(styleClass), styleClass); + this.setBorderLeftWidth(this.getBorderLeftWidth(styleClass), styleClass); + this.setBorderRadius(this.getBorderRadius(styleClass), styleClass); + this.setBorderTopRightRadius(this.getBorderTopRightRadius(styleClass), styleClass); + this.setBorderBottomRightRadius(this.getBorderBottomRightRadius(styleClass), styleClass); + this.setBorderBottomLeftRadius(this.getBorderBottomLeftRadius(styleClass), styleClass); + this.setBorderTopLeftRadius(this.getBorderTopLeftRadius(styleClass), styleClass); + this.setPadding(this.getPadding(styleClass), styleClass); + this.setPaddingTop(this.getPaddingTop(styleClass), styleClass); + this.setPaddingRight(this.getPaddingRight(styleClass), styleClass); + this.setPaddingBottom(this.getPaddingBottom(styleClass), styleClass); + this.setPaddingLeft(this.getPaddingLeft(styleClass), styleClass); + this.setWidth(this.getWidth(styleClass), styleClass); + this.setMinWidth(this.getMinWidth(styleClass), styleClass); + this.setMaxWidth(this.getMaxWidth(styleClass), styleClass); + this.setHeight(this.getHeight(styleClass), styleClass); + this.setMinHeight(this.getMinHeight(styleClass), styleClass); + this.setMaxHeight(this.getMaxHeight(styleClass), styleClass); + this.setCursor(this.getCursor(styleClass), styleClass); + this.setBackgroundColor(this.getBackgroundColor(styleClass), styleClass); + this.setOverflow(this.getOverflow(styleClass), styleClass); + } } } From lgiessmann at common-lisp.net Mon Jul 4 14:26:25 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Mon, 04 Jul 2011 07:26:25 -0700 Subject: [isidorus-cvs] r555 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: base views Message-ID: Author: lgiessmann Date: Mon Jul 4 07:26:24 2011 New Revision: 555 Log: gdl-frontend: Widgets: finalised the behavior for setting all css style attributes that depend on the css pseudo classes hover, active, focus; added methods for registering the following handlers to GdlVisibleObject: ClickHandler, MouseOutHandler, MouseMoveHandler Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlAssociationView.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlCreatorAssociationView.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlDefaultCreatorTopicView.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlDefaultEditorTopicView.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlDefaultTopicView.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlEditorAssociationView.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlSpecialCreatorTopicView.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlSpecialEditorTopicView.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlSpecialTopicView.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlTopicView.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlView.java Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Sun Jul 3 23:00:30 2011 (r554) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Mon Jul 4 07:26:24 2011 (r555) @@ -4,7 +4,9 @@ import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMap; +import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException; import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; +import us.isidor.gdl.anaToMia.Widgets.environment.Pair; import us.isidor.gdl.anaToMia.Widgets.values.AutoNumUnitValue; import us.isidor.gdl.anaToMia.Widgets.values.AutoNumValue; import us.isidor.gdl.anaToMia.Widgets.values.BorderStyleValue; @@ -18,46 +20,74 @@ import com.google.gwt.dom.client.Style.Float; import com.google.gwt.dom.client.Style.Overflow; import com.google.gwt.dom.client.Style.VerticalAlign; +import com.google.gwt.event.dom.client.BlurEvent; +import com.google.gwt.event.dom.client.BlurHandler; +import com.google.gwt.event.dom.client.ClickEvent; +import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.event.dom.client.FocusEvent; +import com.google.gwt.event.dom.client.FocusHandler; +import com.google.gwt.event.dom.client.HasBlurHandlers; +import com.google.gwt.event.dom.client.HasClickHandlers; +import com.google.gwt.event.dom.client.HasFocusHandlers; +import com.google.gwt.event.dom.client.HasMouseDownHandlers; +import com.google.gwt.event.dom.client.HasMouseOutHandlers; +import com.google.gwt.event.dom.client.HasMouseOverHandlers; +import com.google.gwt.event.dom.client.HasMouseUpHandlers; +import com.google.gwt.event.dom.client.MouseDownEvent; +import com.google.gwt.event.dom.client.MouseDownHandler; +import com.google.gwt.event.dom.client.MouseOutEvent; +import com.google.gwt.event.dom.client.MouseOutHandler; +import com.google.gwt.event.dom.client.MouseOverEvent; +import com.google.gwt.event.dom.client.MouseOverHandler; +import com.google.gwt.event.dom.client.MouseUpEvent; +import com.google.gwt.event.dom.client.MouseUpHandler; +import com.google.gwt.event.shared.HandlerRegistration; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.ui.AbsolutePanel; import com.google.gwt.user.client.ui.Composite; -public abstract class GdlVisibleObject extends Composite implements GdlDescriptor { +public abstract class GdlVisibleObject extends Composite implements GdlDescriptor, HasClickHandlers, HasMouseOutHandlers, HasMouseOverHandlers, HasFocusHandlers, HasMouseDownHandlers, HasMouseUpHandlers, HasBlurHandlers{ protected AbsolutePanel mainPanel = new AbsolutePanel(); protected Topic tmRepresentative = null; protected TopicMap tm = null; - - + protected ActiveStyleHandler activeStyleHandler = new ActiveStyleHandler(); + protected FocusStyleHandler focusStyleHandler = new FocusStyleHandler(); + protected HoverStyleHandler hoverStyleHandler = new HoverStyleHandler(); + protected boolean isActive = false; + protected boolean isFocused = false; + protected boolean isHovered = false; + + private GdlVisibleObject() { initWidget(this.mainPanel); } - - - public GdlVisibleObject(Topic tmRepresentative) throws InvalidGdlSchemaException{ + + + public GdlVisibleObject(Topic tmRepresentative) throws InvalidGdlSchemaException, ExecutionException{ this(); this.tmRepresentative = tmRepresentative; this.tm = this.tmRepresentative.getTopicMap(); - + this.setId(this.getId()); this.setGdlStyle(); } - - + + // returns the topic that represents this element public Topic getTmRepresentative(){ return this.tmRepresentative; } - - + + // a helper method that returns all occurrences of the type bound to the passed PSI private JsArray getOccurrences(String occurrenceType){ Topic occType = tm.getTopicBySubjectIdentifier(tm.createLocator(occurrenceType)); if(occType == null) return null; else return tmRepresentative.getOccurrences(occType); } - - + + // a helper method that returns one occurrence of the type bound to the passed PSI. // If more than one occurrence is available an InvalidGdlSchemaException is thrown. // If nor occurrence is available the return value is null @@ -67,7 +97,7 @@ for(int i = 0; i != occs.length(); ++i){ if(occs.get(i).getScope().length() == 0) unscopedOccs.add(occs.get(i)); } - + if(unscopedOccs.size() > 1){ throw new InvalidGdlSchemaException("The topic " + GdlPsis.getAnyIdOfTopic(this.tmRepresentative) + " must be bound to none or one unscoped occurrence of the type " + occurrenceType + ", but is bound " + unscopedOccs.size() + " times to it"); } else if(unscopedOccs.size() == 1){ @@ -77,7 +107,7 @@ } } - + // a helper method that returns one occurrence of the type bound to the passed PSI and scoped // by the theme bound to the passed PSI. If no such occurrence exist, the default value is null private Occurrence getNoneOrOneScopedOccurrence(String occurrenceType, String theme) throws InvalidGdlSchemaException{ @@ -95,7 +125,7 @@ } } } - + if(matchedOccurrences.size() > 1){ throw new InvalidGdlSchemaException("The topic " + GdlPsis.getAnyIdOfTopic(this.tmRepresentative) + "must be bound to none or one occurrence of the type " + occurrenceType + " and the scope " + theme + " but is bound " + matchedOccurrences.size() + " times to it"); } else if(matchedOccurrences.size() == 1){ @@ -105,8 +135,8 @@ } } } - - + + // returns the string value of a gdl:id occurrence public String getId() throws InvalidGdlSchemaException { JsArray idOccs = getOccurrences(GdlPsis.OccurrenceType.gdlId); @@ -116,13 +146,13 @@ return idOccs.get(0).getValue(); } } - - + + // returns a Display instance of a gdl:display occurrence. // If no gdl:display occurrence is set, the default value is returned public Display getDisplay() throws InvalidGdlSchemaException { Occurrence displayOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlDisplay); - + if(displayOcc != null){ String value = displayOcc.getValue().toLowerCase(); if(value.equals("none")){ @@ -140,8 +170,8 @@ return Display.INLINE_BLOCK; } } - - + + // returns an AutoNumValue instance of a gdl:z-index occurrence. // If no gdl:z-index occurrence is set, the default value is returned public AutoNumValue getZindex() throws InvalidGdlSchemaException { @@ -153,12 +183,12 @@ } } - + // returns a Float instance of a gdl:float occurrence or the default value for // this property if no gdl:float occurrence is available public Float getFloat() throws InvalidGdlSchemaException { Occurrence floatOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlFloat); - + if(floatOcc != null){ String value = floatOcc.getValue().toLowerCase(); if(value.equals("none")){ @@ -174,13 +204,13 @@ return Float.NONE; } } - - + + // returns a ClearValue instance of a gdl:clear occurrence or the default value for // this property if no gdl:clear occurrence is available public ClearValue getClear() throws InvalidGdlSchemaException { Occurrence clearOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlFloat); - + if(clearOcc != null){ try{ return ClearValue.valueOf(clearOcc.getValue().toUpperCase()); @@ -191,8 +221,8 @@ return ClearValue.NONE; } } - - + + // returns a VerticalAlign instance of a gdl:vertical-align occurrence // or the default value for this property if no gdl:vertical-align occurrence // is available. The styleClass attribute is used as scope for expressing @@ -204,7 +234,7 @@ } else { vaOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlVerticalAlign); } - + if(vaOcc == null && styleClass != null){ return null; } else if(vaOcc == null) { @@ -233,7 +263,7 @@ } } - + // returns a NumUnitValue instance that represents the margin of this element. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // or null. If the styleClass is null and no occurrence was found, the default value for this @@ -245,7 +275,7 @@ } else { marginOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlMargin); } - + if(marginOcc == null && styleClass != null){ return null; } else if(marginOcc == null) { @@ -254,8 +284,8 @@ return new NumUnitValue(marginOcc.getValue()); } } - - + + // returns a NumUnitValue instance that represents the margin-top of this element. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // or null. @@ -266,15 +296,15 @@ } else { marginOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlMarginTop); } - + if(marginOcc == null){ return null; } else { return new NumUnitValue(marginOcc.getValue()); } } - - + + // returns a NumUnitValue instance that represents the margin-right of this element. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // or null. @@ -285,15 +315,15 @@ } else { marginOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlMarginRight); } - + if(marginOcc == null){ return null; } else { return new NumUnitValue(marginOcc.getValue()); } } - - + + // returns a NumUnitValue instance that represents the margin-bottom of this element. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // or null. @@ -304,15 +334,15 @@ } else { marginOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlMarginBottom); } - + if(marginOcc == null){ return null; } else { return new NumUnitValue(marginOcc.getValue()); } } - - + + // returns a NumUnitValue instance that represents the margin-left of this element. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // or null. @@ -323,7 +353,7 @@ } else { marginOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlMarginLeft); } - + if(marginOcc == null){ return null; } else { @@ -343,15 +373,15 @@ } else { colorOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderColor); } - + if(colorOcc == null ){ return null; } else { return new ColorValue(colorOcc.getValue()); } } - - + + // returns a ColorValue instance that represents the color of this element's border-top. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // null, null otherwise. @@ -362,15 +392,15 @@ } else { colorOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderTopColor); } - + if(colorOcc == null ){ return null; } else { return new ColorValue(colorOcc.getValue()); } } - - + + // returns a ColorValue instance that represents the color of this element's border-right. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // null, null otherwise. @@ -381,15 +411,15 @@ } else { colorOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderRightColor); } - + if(colorOcc == null ){ return null; } else { return new ColorValue(colorOcc.getValue()); } } - - + + // returns a ColorValue instance that represents the color of this element's border-bottom. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // null, null otherwise. @@ -400,15 +430,15 @@ } else { colorOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderBottomColor); } - + if(colorOcc == null ){ return null; } else { return new ColorValue(colorOcc.getValue()); } } - - + + // returns a ColorValue instance that represents the color of this element's border-left. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // null, null otherwise. @@ -419,7 +449,7 @@ } else { colorOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderLeftColor); } - + if(colorOcc == null ){ return null; } else { @@ -439,7 +469,7 @@ } else { styleOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderStyle); } - + if(styleOcc == null && styleClass != null){ return null; } else if(styleOcc == null) { @@ -453,8 +483,8 @@ } } } - - + + // returns a ColorValue instance that represents the style of this element's border-top. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // null, null otherwise. @@ -465,7 +495,7 @@ } else { styleOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderTopStyle); } - + if(styleOcc == null){ return null; } else { @@ -477,8 +507,8 @@ } } } - - + + // returns a ColorValue instance that represents the style of this element's border-right. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // null, null otherwise. @@ -489,7 +519,7 @@ } else { styleOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderRightStyle); } - + if(styleOcc == null){ return null; } else { @@ -501,8 +531,8 @@ } } } - - + + // returns a ColorValue instance that represents the style of this element's border-bottom. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // null, null otherwise. @@ -513,7 +543,7 @@ } else { styleOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderBottomStyle); } - + if(styleOcc == null){ return null; } else { @@ -525,8 +555,8 @@ } } } - - + + // returns a ColorValue instance that represents the style of this element's border-left. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // null, null otherwise. @@ -537,7 +567,7 @@ } else { styleOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderLeftStyle); } - + if(styleOcc == null){ return null; } else { @@ -549,7 +579,7 @@ } } } - + // returns a ColorValue instance that represents the width of this element's border. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned @@ -562,7 +592,7 @@ } else { widthOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderWidth); } - + if(widthOcc == null && styleClass != null){ return null; } else if(widthOcc == null) { @@ -571,8 +601,8 @@ return new AbsoluteNumValue(widthOcc.getValue()); } } - - + + // returns a ColorValue instance that represents the width of this element's border-top. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // null, null otherwise. @@ -583,15 +613,15 @@ } else { widthOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderTopWidth); } - + if(widthOcc == null){ return null; } else { return new AbsoluteNumValue(widthOcc.getValue()); } } - - + + // returns a ColorValue instance that represents the width of this element's border-right. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // null, null otherwise. @@ -602,15 +632,15 @@ } else { widthOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderRightWidth); } - + if(widthOcc == null){ return null; } else { return new AbsoluteNumValue(widthOcc.getValue()); } } - - + + // returns a ColorValue instance that represents the width of this element's border-bottom. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // null, null otherwise. @@ -621,15 +651,15 @@ } else { widthOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderBottomWidth); } - + if(widthOcc == null){ return null; } else { return new AbsoluteNumValue(widthOcc.getValue()); } } - - + + // returns a ColorValue instance that represents the width of this element's border-left. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // null, null otherwise. @@ -640,14 +670,14 @@ } else { widthOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderLeftWidth); } - + if(widthOcc == null){ return null; } else { return new AbsoluteNumValue(widthOcc.getValue()); } } - + // returns a NumUnitValue instance that represents the radius of this element's border. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned @@ -660,7 +690,7 @@ } else { radiusOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderRadius); } - + if(radiusOcc == null && styleClass != null){ return null; } else if(radiusOcc == null) { @@ -669,8 +699,8 @@ return new NumUnitValue(radiusOcc.getValue()); } } - - + + // returns a NumUnitValue instance that represents the radius of this element's border-top-left. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // null, null otherwise. @@ -681,15 +711,15 @@ } else { radiusOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderTopLeftRadius); } - + if(radiusOcc == null){ return null; } else { return new NumUnitValue(radiusOcc.getValue()); } } - - + + // returns a NumUnitValue instance that represents the radius of this element's border-top-right. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // null, null otherwise. @@ -700,15 +730,15 @@ } else { radiusOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderTopRightRadius); } - + if(radiusOcc == null){ return null; } else { return new NumUnitValue(radiusOcc.getValue()); } } - - + + // returns a NumUnitValue instance that represents the radius of this element's border-bottom-left. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // null, null otherwise. @@ -719,15 +749,15 @@ } else { radiusOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderBottomLeftRadius); } - + if(radiusOcc == null){ return null; } else { return new NumUnitValue(radiusOcc.getValue()); } } - - + + // returns a NumUnitValue instance that represents the radius of this element's border-bottom-right. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // null, null otherwise. @@ -738,7 +768,7 @@ } else { radiusOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderBottomRightRadius); } - + if(radiusOcc == null){ return null; } else { @@ -746,7 +776,7 @@ } } - + // returns a NumUnitValue instance that represents the padding of this element. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this @@ -758,7 +788,7 @@ } else { paddingOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlPadding); } - + if(paddingOcc == null && styleClass != null){ return null; } else if(paddingOcc == null) { @@ -767,8 +797,8 @@ return new NumUnitValue(paddingOcc.getValue()); } } - - + + // returns a NumUnitValue instance that represents the padding of this element's top. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // null, null otherwise. @@ -779,15 +809,15 @@ } else { paddingOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlPaddingTop); } - + if(paddingOcc == null){ return null; } else { return new NumUnitValue(paddingOcc.getValue()); } } - - + + // returns a NumUnitValue instance that represents the padding of this element's right. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // null, null otherwise. @@ -798,7 +828,7 @@ } else { paddingOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlPaddingRight); } - + if(paddingOcc == null){ return null; } else { @@ -806,7 +836,7 @@ } } - + // returns a NumUnitValue instance that represents the padding of this element's bottom. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // null, null otherwise. @@ -817,15 +847,15 @@ } else { paddingOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlPaddingBottom); } - + if(paddingOcc == null){ return null; } else { return new NumUnitValue(paddingOcc.getValue()); } } - - + + // returns a NumUnitValue instance that represents the padding of this element's left. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // null, null otherwise. @@ -836,7 +866,7 @@ } else { paddingOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlPaddingLeft); } - + if(paddingOcc == null){ return null; } else { @@ -856,7 +886,7 @@ } else { widthOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlWidth); } - + if(widthOcc == null && styleClass != null){ return null; } else if(widthOcc == null) { @@ -865,8 +895,8 @@ return new AutoNumUnitValue(widthOcc.getValue()); } } - - + + // returns an AutoNumUnitValue instance that represents the min-width of this element. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this @@ -878,7 +908,7 @@ } else { widthOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlMinWidth); } - + if(widthOcc == null && styleClass != null){ return null; } else if(widthOcc == null) { @@ -887,8 +917,8 @@ return new AutoNumUnitValue(widthOcc.getValue()); } } - - + + // returns an AutoNumUnitValue instance that represents the max-width of this element. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this @@ -900,7 +930,7 @@ } else { widthOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlMaxWidth); } - + if(widthOcc == null && styleClass != null){ return null; } else if(widthOcc == null) { @@ -909,8 +939,8 @@ return new AutoNumUnitValue(widthOcc.getValue()); } } - - + + // returns an AutoNumUnitValue instance that represents the height of this element. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this @@ -922,7 +952,7 @@ } else { heightOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlHeight); } - + if(heightOcc == null && styleClass != null){ return null; } else if(heightOcc == null) { @@ -931,8 +961,8 @@ return new AutoNumUnitValue(heightOcc.getValue()); } } - - + + // returns an AutoNumUnitValue instance that represents the min-height of this element. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this @@ -944,7 +974,7 @@ } else { heightOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlMinHeight); } - + if(heightOcc == null && styleClass != null){ return null; } else if(heightOcc == null) { @@ -953,8 +983,8 @@ return new AutoNumUnitValue(heightOcc.getValue()); } } - - + + // returns an AutoNumUnitValue instance that represents the max-height of this element. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this @@ -966,7 +996,7 @@ } else { heightOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlMaxHeight); } - + if(heightOcc == null && styleClass != null){ return null; } else if(heightOcc == null) { @@ -975,7 +1005,7 @@ return new AutoNumUnitValue(heightOcc.getValue()); } } - + // returns a CursorValue instance that represents the cursor of this element. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned @@ -988,7 +1018,7 @@ } else { cursorOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlCursor); } - + if(cursorOcc == null && styleClass != null){ return null; } else if(cursorOcc == null) { @@ -998,14 +1028,14 @@ return CursorValue.valueOf(cursorOcc.getValue().toUpperCase().replace("-", "_")); }catch(IllegalArgumentException e){ String values = "auto, default, crosshair, pointer, move, n-resize, ne-resize," + - "nw-resize, e-resize, se-resize, s-resize, sw-resize, w-resize," + - "text, wait, help, or progress"; + "nw-resize, e-resize, se-resize, s-resize, sw-resize, w-resize," + + "text, wait, help, or progress"; throw new InvalidGdlSchemaException("cursor must be set to one of " + values + ", but is " + cursorOcc.getValue()); } } } - - + + // returns a ColorValue instance that represents the background-color of this element. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // null, null otherwise. If the styleClass is null and no occurrence was found, the default value for this @@ -1017,7 +1047,7 @@ } else { colorOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBackgroundColor); } - + if(colorOcc == null && styleClass != null){ return null; } else if(colorOcc == null) { @@ -1026,7 +1056,7 @@ return new ColorValue(colorOcc.getValue()); } } - + // returns an Overflow instance that represents the overflow property of this element. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned @@ -1039,7 +1069,7 @@ } else { overflowOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlOverflow); } - + if(overflowOcc == null && styleClass != null){ return null; } else if(overflowOcc == null) { @@ -1057,544 +1087,315 @@ } } } - - + + // sets the id property of this element by using the GWT DOM class public void setId(String id){ if(id != null){ DOM.setElementProperty(this.getElement(), "id", id); } } - - + + // sets the display style property of this element by using the GWT DOM class public void setDisplay(Display display){ if(display != null){ DOM.setStyleAttribute(this.getElement(), "display", display.getCssName()); } } - - + + // sets the z-index style property of this element by using the GWT DOM class public void setZindex(AutoNumValue value){ if(value != null){ DOM.setStyleAttribute(this.getElement(), "zIndex", value.getCssValue()); } } - - + + // sets the float style property of this element by using the GWT DOM class public void setFloat(Float value){ if(value != null){ DOM.setStyleAttribute(this.getElement(), "float", value.getCssName()); } } - - + + // sets the clear style property of this element by using the GWT DOM class public void setClear(ClearValue value){ if(value != null){ DOM.setStyleAttribute(this.getElement(), "clear", value.getCssValue()); } } - - + + // sets the vertical-align style property of this element by using the GWT DOM class - public void setVerticalAlign(VerticalAlign value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "verticalAlign", value.getCssName()); - } else { - // TODO: implement - } - } + public void setVerticalAlign(VerticalAlign value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "verticalAlign", value.getCssName()); } - - + + // sets the margin style property of this element by using the GWT DOM class - public void setMargin(NumUnitValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "margin", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setMargin(NumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "margin", value.getCssValue()); } - - + + // sets the margin-top style property of this element by using the GWT DOM class - public void setMarginTop(NumUnitValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "marginTop", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setMarginTop(NumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "marginTop", value.getCssValue()); } - - + + // sets the margin-right style property of this element by using the GWT DOM class - public void setMarginRight(NumUnitValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "marginRight", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setMarginRight(NumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "marginRight", value.getCssValue()); } - - + + // sets the margin-bottom style property of this element by using the GWT DOM class - public void setMarginBottom(NumUnitValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "marginBottom", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setMarginBottom(NumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "marginBottom", value.getCssValue()); } - - + + // sets the margin-left style property of this element by using the GWT DOM class - public void setMarginLeft(NumUnitValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "marginLeft", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setMarginLeft(NumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "marginLeft", value.getCssValue()); } - - + + // sets the border-color style property of this element by using the GWT DOM class - public void setBorderColor(ColorValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "borderColor", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setBorderColor(ColorValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "borderColor", value.getCssValue()); } - + // sets the border-top-color style property of this element by using the GWT DOM class - public void setBorderTopColor(ColorValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "borderTopColor", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setBorderTopColor(ColorValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "borderTopColor", value.getCssValue()); } - - + + // sets the border-right-color style property of this element by using the GWT DOM class - public void setBorderRightColor(ColorValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "borderRightColor", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setBorderRightColor(ColorValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "borderRightColor", value.getCssValue()); } - - + + // sets the border-bottom-color style property of this element by using the GWT DOM class - public void setBorderBottomColor(ColorValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "borderBottomColor", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setBorderBottomColor(ColorValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "borderBottomColor", value.getCssValue()); } - - + + // sets the border-left-color style property of this element by using the GWT DOM class - public void setBorderLeftColor(ColorValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "borderLeftColor", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setBorderLeftColor(ColorValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "borderLeftColor", value.getCssValue()); } - - + + // sets the border-style style property of this element by using the GWT DOM class - public void setBorderStyle(BorderStyleValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "borderStyle", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setBorderStyle(BorderStyleValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "borderStyle", value.getCssValue()); } - - + + // sets the border-top-style style property of this element by using the GWT DOM class - public void setBorderTopStyle(BorderStyleValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "borderTopStyle", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setBorderTopStyle(BorderStyleValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "borderTopStyle", value.getCssValue()); } - - + + // sets the border-right-style style property of this element by using the GWT DOM class - public void setBorderRightStyle(BorderStyleValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "borderRightStyle", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setBorderRightStyle(BorderStyleValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "borderRightStyle", value.getCssValue()); } - - + + // sets the border-bottom-style style property of this element by using the GWT DOM class - public void setBorderBottomStyle(BorderStyleValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "borderBottomStyle", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setBorderBottomStyle(BorderStyleValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "borderBottomStyle", value.getCssValue()); } - - + + // sets the border-left-style style property of this element by using the GWT DOM class - public void setBorderLeftStyle(BorderStyleValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "borderLeftStyle", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setBorderLeftStyle(BorderStyleValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "borderLeftStyle", value.getCssValue()); } - + // sets the border-width style property of this element by using the GWT DOM class - public void setBorderWidth(AbsoluteNumValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "borderWidth", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setBorderWidth(AbsoluteNumValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "borderWidth", value.getCssValue()); } - - + + // sets the border-width style property of this element by using the GWT DOM class - public void setBorderTopWidth(AbsoluteNumValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "borderTopWidth", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setBorderTopWidth(AbsoluteNumValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "borderTopWidth", value.getCssValue()); } - - + + // sets the border-width style property of this element by using the GWT DOM class - public void setBorderRightWidth(AbsoluteNumValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "borderRightWidth", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setBorderRightWidth(AbsoluteNumValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "borderRightWidth", value.getCssValue()); } - - + + // sets the border-width style property of this element by using the GWT DOM class - public void setBorderBottomWidth(AbsoluteNumValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "borderBottomWidth", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setBorderBottomWidth(AbsoluteNumValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "borderBottomWidth", value.getCssValue()); } - - + + // sets the border-width style property of this element by using the GWT DOM class - public void setBorderLeftWidth(AbsoluteNumValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "borderLeftWidth", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setBorderLeftWidth(AbsoluteNumValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "borderLeftWidth", value.getCssValue()); } - - + + // sets the border-radius style property of this element by using the GWT DOM class - public void setBorderRadius(NumUnitValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "borderRadius", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setBorderRadius(NumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "borderRadius", value.getCssValue()); } - - + + // sets the border-top-right-radius style property of this element by using the GWT DOM class - public void setBorderTopRightRadius(NumUnitValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "borderTopRightRadius", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setBorderTopRightRadius(NumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "borderTopRightRadius", value.getCssValue()); } - - + + // sets the border-bottom-right-radius style property of this element by using the GWT DOM class - public void setBorderBottomRightRadius(NumUnitValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "borderBottomRightRadius", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setBorderBottomRightRadius(NumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "borderBottomRightRadius", value.getCssValue()); } - - + + // sets the border-bottom-left-radius style property of this element by using the GWT DOM class - public void setBorderBottomLeftRadius(NumUnitValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "borderBottomLeftRadius", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setBorderBottomLeftRadius(NumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "borderBottomLeftRadius", value.getCssValue()); } - - + + // sets the border-top-left-radius style property of this element by using the GWT DOM class - public void setBorderTopLeftRadius(NumUnitValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "borderTopLeftRadius", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setBorderTopLeftRadius(NumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "borderTopLeftRadius", value.getCssValue()); } - - + + // sets the padding style property of this element by using the GWT DOM class - public void setPadding(NumUnitValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "padding", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setPadding(NumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "padding", value.getCssValue()); } - - + + // sets the padding-top style property of this element by using the GWT DOM class - public void setPaddingTop(NumUnitValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "paddingTop", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setPaddingTop(NumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "paddingTop", value.getCssValue()); } - - + + // sets the padding-right style property of this element by using the GWT DOM class - public void setPaddingRight(NumUnitValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "paddingRight", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setPaddingRight(NumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "paddingRight", value.getCssValue()); } - - + + // sets the padding-bottom style property of this element by using the GWT DOM class - public void setPaddingBottom(NumUnitValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "paddingBottom", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setPaddingBottom(NumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "paddingBottom", value.getCssValue()); } - - + + // sets the padding-left style property of this element by using the GWT DOM class - public void setPaddingLeft(NumUnitValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "paddingLeft", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setPaddingLeft(NumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "paddingLeft", value.getCssValue()); } - + // sets the width style property of this element by using the GWT DOM class - public void setWidth(AutoNumUnitValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "width", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setWidth(AutoNumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "width", value.getCssValue()); } - - + + // sets the min-width style property of this element by using the GWT DOM class - public void setMinWidth(AutoNumUnitValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "minWidth", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setMinWidth(AutoNumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "minWidth", value.getCssValue()); } - - + + // sets the max-width style property of this element by using the GWT DOM class - public void setMaxWidth(AutoNumUnitValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "maxWidth", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setMaxWidth(AutoNumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "maxHeight", value.getCssValue()); } - - + + // sets the height style property of this element by using the GWT DOM class - public void setHeight(AutoNumUnitValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "height", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setHeight(AutoNumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "height", value.getCssValue()); } - - + + // sets the min-height style property of this element by using the GWT DOM class - public void setMinHeight(AutoNumUnitValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "minHeight", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setMinHeight(AutoNumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "minHeight", value.getCssValue()); } - - + + // sets the max-height style property of this element by using the GWT DOM class - public void setMaxHeight(AutoNumUnitValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "maxHeight", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setMaxHeight(AutoNumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "maxHeight", value.getCssValue()); } - - + + // sets the cursor style property of this element by using the GWT DOM class - public void setCursor(CursorValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "cursor", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setCursor(CursorValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "cursor", value.getCssValue()); } - - + + // sets the background-color style property of this element by using the GWT DOM class - public void setBackgroundColor(ColorValue value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "backgroundColor", value.getCssValue()); - } else { - // TODO: implement - } - } + public void setBackgroundColor(ColorValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "backgroundColor", value.getCssValue()); } - - + + // sets the overflow style property of this element by using the GWT DOM class - public void setOverflow(Overflow value, String styleClass){ - if(value != null){ - if(styleClass == null){ - DOM.setStyleAttribute(this.getElement(), "overlof", value.getCssName()); - } else { - // TODO: implement - } + public void setOverflow(Overflow value, String styleClass)throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) this.setCssProperty(styleClass, "overflow", value.getCssName()); + } + + + // sets the passed css style porperty to the passed css value. + // If a styleClass is given, the style is applied to either active, hover or focus + private void setCssProperty(String styleClass, String cssProperty, String cssValue)throws InvalidGdlSchemaException, ExecutionException{ + if(cssValue == null || cssProperty == null) return; + + if(styleClass == null){ + DOM.setStyleAttribute(this.getElement(), cssProperty, cssValue); + } else if(styleClass.equals(GdlPsis.Scope.gdlActive)){ + this.activeStyleHandler.addCssStyle(new Pair(cssProperty, cssValue)); + } else if(styleClass.equals(GdlPsis.Scope.gdlFocus)){ + this.focusStyleHandler.addCssStyle(new Pair(cssProperty, cssValue)); + } else if (styleClass.equals(GdlPsis.Scope.gdlHover)){ + this.hoverStyleHandler.addCssStyle(new Pair(cssProperty, cssValue)); + } else { + String values = GdlPsis.Scope.gdlActive + ", " + GdlPsis.Scope.gdlFocus + ", " + GdlPsis.Scope.gdlHover; + throw new InvalidGdlSchemaException("GDL defines only the style classes " + values + ", but found " + styleClass); } } - - - - - - - // TODO: handle styleClass in the setterMethods - - - - - - public void setGdlStyle() throws InvalidGdlSchemaException { + + + // sets all GDL styles that are defined by the topic map representative + public void setGdlStyle() throws InvalidGdlSchemaException, ExecutionException { this.setDisplay(this.getDisplay()); this.setZindex(this.getZindex()); this.setFloat(this.getFloat()); this.setClear(this.getClear()); - + String[] styleClasses = new String[]{null, GdlPsis.Scope.gdlActive, GdlPsis.Scope.gdlFocus, GdlPsis.Scope.gdlHover}; for (String styleClass : styleClasses) { this.setVerticalAlign(this.getVerticalAlign(styleClass), styleClass); @@ -1638,5 +1439,148 @@ this.setBackgroundColor(this.getBackgroundColor(styleClass), styleClass); this.setOverflow(this.getOverflow(styleClass), styleClass); } + + // registers the handlers for the CSS pseudo classes + this.addMouseDownHandler(this.activeStyleHandler); + this.addMouseUpHandler(this.activeStyleHandler); + this.addFocusHandler(this.focusStyleHandler); + this.addBlurHandler(this.focusStyleHandler); + this.addMouseOutHandler(this.hoverStyleHandler); + this.addMouseOverHandler(this.hoverStyleHandler); + } + + + // registers a click handler for this element + @Override + public HandlerRegistration addClickHandler(ClickHandler handler) { + return this.addDomHandler(handler, ClickEvent.getType()); + } + + + // registers a mouse out handler on this element + @Override + public HandlerRegistration addMouseOutHandler(MouseOutHandler handler) { + return this.addDomHandler(handler, MouseOutEvent.getType()); + } + + + // registers a mouse over handler on this element + @Override + public HandlerRegistration addMouseOverHandler(MouseOverHandler handler) { + return this.addDomHandler(handler, MouseOverEvent.getType()); + } + + + // registers a focus handler on this element + @Override + public HandlerRegistration addFocusHandler(FocusHandler handler) { + return this.addDomHandler(handler, FocusEvent.getType()); + } + + + // registers a mouse down handler on this element + @Override + public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) { + return this.addDomHandler(handler, MouseDownEvent.getType()); + } + + + // registers a mouse down handler on this element + @Override + public HandlerRegistration addMouseUpHandler(MouseUpHandler handler) { + return this.addDomHandler(handler, MouseUpEvent.getType()); + } + + + // registers a blur on this element + @Override + public HandlerRegistration addBlurHandler(BlurHandler handler) { + return this.addDomHandler(handler, BlurEvent.getType()); + } + + + // this class is used as base for all style handlers, so a style property + // can be added to a style handler by adding a Pair instance + protected class CssStyleHandler{ + private ArrayList> cssNameAndValues = new ArrayList>(); + private ArrayList> cssPreviousNameAndValues = new ArrayList>(); + + + // adds a CSS name value pair + public void addCssStyle(Pair cssNameAndValue) { + if(cssNameAndValue != null && cssNameAndValue.getFirst() != null && cssNameAndValue.getSecond() != null){ + this.cssNameAndValues.add(cssNameAndValue); + } + } + + + // sets the stored CSS name/value pairs + public void setStyles(){ + for (Pair cssNameValue : this.cssNameAndValues) { + Pair oldNameValue = null; + String oldVal = DOM.getStyleAttribute(GdlVisibleObject.this.getElement(), cssNameValue.getFirst()); + if(oldVal != null && oldVal.length() != 0){ + oldNameValue = new Pair(cssNameValue.getFirst(), oldVal); + this.cssPreviousNameAndValues.add(oldNameValue); + } + DOM.setStyleAttribute(GdlVisibleObject.this.getElement(), cssNameValue.getFirst(), cssNameValue.getSecond()); + } + } + + + // must sets the original style that is bound to the non-pseudo-class name space + public void unsetStyles(){ + for (Pair oldNameValue : this.cssPreviousNameAndValues) { + DOM.setStyleAttribute(GdlVisibleObject.this.getElement(), oldNameValue.getFirst(), oldNameValue.getSecond()); + } + } + } + + + // this class is used to set the style of focused elements + protected class FocusStyleHandler extends CssStyleHandler implements FocusHandler, BlurHandler{ + + @Override + public void onFocus(FocusEvent event) { + super.setStyles(); + } + + + @Override + public void onBlur(BlurEvent event) { + super.unsetStyles(); + } + } + + + // this class is used to set the style of hovered elements + protected class HoverStyleHandler extends CssStyleHandler implements MouseOverHandler, MouseOutHandler { + + @Override + public void onMouseOut(MouseOutEvent event) { + super.unsetStyles(); + } + + @Override + public void onMouseOver(MouseOverEvent event) { + super.setStyles(); + } + } + + + // this class is used to set the style of active elements + protected class ActiveStyleHandler extends CssStyleHandler implements MouseDownHandler, MouseUpHandler { + + + @Override + public void onMouseUp(MouseUpEvent event) { + super.unsetStyles(); + } + + @Override + public void onMouseDown(MouseDownEvent event) { + super.setStyles(); + } + } } Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Sun Jul 3 23:00:30 2011 (r554) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Mon Jul 4 07:26:24 2011 (r555) @@ -1,6 +1,7 @@ package us.isidor.gdl.anaToMia.Widgets.base; import us.isidor.gdl.anaToMia.TmEngine.jtmsBasedEngine.JtmsTmEngine; +import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic; import us.isidor.gdl.anaToMia.Widgets.isidorus.LoadSchemaCallback; import us.isidor.gdl.anaToMia.Widgets.values.CursorValue; @@ -20,38 +21,39 @@ @Override public void onModuleLoad() { - Window.alert("TEST !!!"); - RootPanel.get("GWT_Content").add(mainPanel); - mainPanel.setBorderWidth(1); - mainPanel.setPixelSize(500, 500); - - gdlPanel = new GdlPanel(""); - gdlPanel.setPixelSize(100, 100); - DOM.setStyleAttribute(gdlPanel.getElement(), "backgroundColor", "yellow"); - mainPanel.add(gdlPanel); - gdlPanel.setTmEngine(new JtmsTmEngine()); - - - Button requestButton = new Button("start request"); - requestButton.addClickHandler(new ClickHandler() { - @Override - public void onClick(ClickEvent event) { - LoadSchemaCallback callback = new LoadSchemaCallback(); - try{ - callback.loadSchema(gdlPanel, "", new String[]{}); - }catch(Exception e){ - Window.alert("cought error: " + e.getLocalizedMessage()); + try{ + Window.alert("TEST !!!"); + RootPanel.get("GWT_Content").add(mainPanel); + mainPanel.setBorderWidth(1); + mainPanel.setPixelSize(500, 500); + + gdlPanel = new GdlPanel(""); + gdlPanel.setPixelSize(100, 100); + DOM.setStyleAttribute(gdlPanel.getElement(), "backgroundColor", "yellow"); + mainPanel.add(gdlPanel); + gdlPanel.setTmEngine(new JtmsTmEngine()); + + + Button requestButton = new Button("start request"); + requestButton.addClickHandler(new ClickHandler() { + @Override + public void onClick(ClickEvent event) { + LoadSchemaCallback callback = new LoadSchemaCallback(); + try{ + callback.loadSchema(gdlPanel, "", new String[]{}); + }catch(Exception e){ + Window.alert("cought error: " + e.getLocalizedMessage()); + } } - } - }); - - mainPanel.add(requestButton); + }); + + mainPanel.add(requestButton); // only for testing - try{ + Topic tmpRepresentative = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator("http://test.org/test-top")); Topic gdlBackgroundColor = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlBackgroundColor)); Topic gdlId = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlId)); @@ -69,6 +71,10 @@ Topic gdlBorderBottomColor = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlBorderBottomColor)); Topic gdlBorderStyle = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlBorderStyle)); Topic gdlBorderWidth = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlBorderWidth)); + Topic gdlHover = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.Scope.gdlHover)); + Topic gdlActive = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.Scope.gdlActive)); + Topic gdlFocus = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.Scope.gdlFocus)); + tmpRepresentative.createOccurrence(gdlBackgroundColor, "red", null); tmpRepresentative.createOccurrence(gdlId, "ID_1", null); @@ -86,15 +92,15 @@ tmpRepresentative.createOccurrence(gdlBorderBottomColor, "rgb(100%, 100%, 0%)", null); tmpRepresentative.createOccurrence(gdlBorderStyle, "dashed", null); tmpRepresentative.createOccurrence(gdlBorderWidth, "5px", null); - - GdlVisibleObject tmp = new GdlVisibleObject(tmpRepresentative){}; - - + Occurrence bgcHover = tmpRepresentative.createOccurrence(gdlBackgroundColor, "green", null); + bgcHover.addTheme(gdlHover); + Occurrence bgcActive = tmpRepresentative.createOccurrence(gdlBackgroundColor, "purple", null); + bgcActive.addTheme(gdlActive); + Occurrence bgcFocus = tmpRepresentative.createOccurrence(gdlBackgroundColor, "silver", null); + bgcFocus.addTheme(gdlFocus); - - - + GdlVisibleObject tmp = new GdlVisibleObject(tmpRepresentative){}; this.mainPanel.add(tmp); }catch(Exception e){ e.printStackTrace(); Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlAssociationView.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlAssociationView.java Sun Jul 3 23:00:30 2011 (r554) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlAssociationView.java Mon Jul 4 07:26:24 2011 (r555) @@ -1,12 +1,13 @@ package us.isidor.gdl.anaToMia.Widgets.views; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic; +import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException; import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; public abstract class GdlAssociationView extends GdlView { - public GdlAssociationView(Topic tmRepresentative) throws InvalidGdlSchemaException { + public GdlAssociationView(Topic tmRepresentative) throws InvalidGdlSchemaException, ExecutionException { super(tmRepresentative); // TODO Auto-generated constructor stub } Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlCreatorAssociationView.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlCreatorAssociationView.java Sun Jul 3 23:00:30 2011 (r554) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlCreatorAssociationView.java Mon Jul 4 07:26:24 2011 (r555) @@ -7,12 +7,13 @@ import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMap; import us.isidor.gdl.anaToMia.Widgets.base.GdlVisibleObject; +import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException; import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; public class GdlCreatorAssociationView extends GdlAssociationView { - public GdlCreatorAssociationView(Topic tmRepresentative) throws InvalidGdlSchemaException { + public GdlCreatorAssociationView(Topic tmRepresentative) throws InvalidGdlSchemaException, ExecutionException { super(tmRepresentative); // TODO Auto-generated constructor stub } Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlDefaultCreatorTopicView.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlDefaultCreatorTopicView.java Sun Jul 3 23:00:30 2011 (r554) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlDefaultCreatorTopicView.java Mon Jul 4 07:26:24 2011 (r555) @@ -6,13 +6,14 @@ import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMap; import us.isidor.gdl.anaToMia.Widgets.base.GdlVisibleObject; +import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException; import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; public class GdlDefaultCreatorTopicView extends GdlDefaultTopicView{ // TODO: implement - public GdlDefaultCreatorTopicView(Topic tmRepresentative) throws InvalidGdlSchemaException { + public GdlDefaultCreatorTopicView(Topic tmRepresentative) throws InvalidGdlSchemaException, ExecutionException { super(tmRepresentative); // TODO Auto-generated constructor stub } Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlDefaultEditorTopicView.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlDefaultEditorTopicView.java Sun Jul 3 23:00:30 2011 (r554) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlDefaultEditorTopicView.java Mon Jul 4 07:26:24 2011 (r555) @@ -6,12 +6,13 @@ import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMap; import us.isidor.gdl.anaToMia.Widgets.base.GdlVisibleObject; +import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException; import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; public abstract class GdlDefaultEditorTopicView extends GdlDefaultTopicView { - public GdlDefaultEditorTopicView(Topic tmRepresentative) throws InvalidGdlSchemaException { + public GdlDefaultEditorTopicView(Topic tmRepresentative) throws InvalidGdlSchemaException, ExecutionException { super(tmRepresentative); // TODO Auto-generated constructor stub } Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlDefaultTopicView.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlDefaultTopicView.java Sun Jul 3 23:00:30 2011 (r554) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlDefaultTopicView.java Mon Jul 4 07:26:24 2011 (r555) @@ -1,11 +1,12 @@ package us.isidor.gdl.anaToMia.Widgets.views; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic; +import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException; import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; public abstract class GdlDefaultTopicView extends GdlTopicView { - public GdlDefaultTopicView(Topic tmRepresentative) throws InvalidGdlSchemaException { + public GdlDefaultTopicView(Topic tmRepresentative) throws InvalidGdlSchemaException, ExecutionException { super(tmRepresentative); // TODO Auto-generated constructor stub } Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlEditorAssociationView.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlEditorAssociationView.java Sun Jul 3 23:00:30 2011 (r554) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlEditorAssociationView.java Mon Jul 4 07:26:24 2011 (r555) @@ -7,12 +7,13 @@ import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMap; import us.isidor.gdl.anaToMia.Widgets.base.GdlVisibleObject; +import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException; import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; public class GdlEditorAssociationView extends GdlAssociationView { - public GdlEditorAssociationView(Topic tmRepresentative) throws InvalidGdlSchemaException { + public GdlEditorAssociationView(Topic tmRepresentative) throws InvalidGdlSchemaException, ExecutionException { super(tmRepresentative); // TODO Auto-generated constructor stub } Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlSpecialCreatorTopicView.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlSpecialCreatorTopicView.java Sun Jul 3 23:00:30 2011 (r554) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlSpecialCreatorTopicView.java Mon Jul 4 07:26:24 2011 (r555) @@ -6,12 +6,13 @@ import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMap; import us.isidor.gdl.anaToMia.Widgets.base.GdlVisibleObject; +import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException; import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; public class GdlSpecialCreatorTopicView extends GdlSpecialTopicView{ // TODO: implement - public GdlSpecialCreatorTopicView(Topic tmRepresentative) throws InvalidGdlSchemaException { + public GdlSpecialCreatorTopicView(Topic tmRepresentative) throws InvalidGdlSchemaException, ExecutionException { super(tmRepresentative); // TODO Auto-generated constructor stub } Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlSpecialEditorTopicView.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlSpecialEditorTopicView.java Sun Jul 3 23:00:30 2011 (r554) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlSpecialEditorTopicView.java Mon Jul 4 07:26:24 2011 (r555) @@ -6,6 +6,7 @@ import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMap; import us.isidor.gdl.anaToMia.Widgets.base.GdlVisibleObject; +import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException; import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; @@ -13,7 +14,7 @@ // TODO: implement - public GdlSpecialEditorTopicView(Topic tmRepresentative) throws InvalidGdlSchemaException { + public GdlSpecialEditorTopicView(Topic tmRepresentative) throws InvalidGdlSchemaException, ExecutionException { super(tmRepresentative); // TODO Auto-generated constructor stub } Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlSpecialTopicView.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlSpecialTopicView.java Sun Jul 3 23:00:30 2011 (r554) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlSpecialTopicView.java Mon Jul 4 07:26:24 2011 (r555) @@ -1,11 +1,12 @@ package us.isidor.gdl.anaToMia.Widgets.views; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic; +import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException; import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; public abstract class GdlSpecialTopicView extends GdlTopicView { - public GdlSpecialTopicView(Topic tmRepresentative) throws InvalidGdlSchemaException { + public GdlSpecialTopicView(Topic tmRepresentative) throws InvalidGdlSchemaException, ExecutionException { super(tmRepresentative); // TODO Auto-generated constructor stub } Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlTopicView.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlTopicView.java Sun Jul 3 23:00:30 2011 (r554) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlTopicView.java Mon Jul 4 07:26:24 2011 (r555) @@ -1,12 +1,13 @@ package us.isidor.gdl.anaToMia.Widgets.views; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic; +import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException; import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; public abstract class GdlTopicView extends GdlView { - public GdlTopicView(Topic tmRepresentative) throws InvalidGdlSchemaException{ + public GdlTopicView(Topic tmRepresentative) throws InvalidGdlSchemaException, ExecutionException{ super(tmRepresentative); // TODO Auto-generated constructor stub } Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlView.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlView.java Sun Jul 3 23:00:30 2011 (r554) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlView.java Mon Jul 4 07:26:24 2011 (r555) @@ -10,6 +10,7 @@ import us.isidor.gdl.anaToMia.Widgets.base.GdlPsis; import us.isidor.gdl.anaToMia.Widgets.base.GdlVisibleObject; import us.isidor.gdl.anaToMia.Widgets.base.IGdlContainer; +import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException; import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; @@ -21,7 +22,7 @@ - public GdlView(Topic tmRepresentative) throws InvalidGdlSchemaException{ + public GdlView(Topic tmRepresentative) throws InvalidGdlSchemaException, ExecutionException{ super(tmRepresentative); // TODO: implement } @@ -55,6 +56,9 @@ public abstract void deregisterButtonCallback(ClickHandler handler, String id); + // TODO: implement addXYZhandler(handler, id); + + // hierarchy // From lgiessmann at common-lisp.net Mon Jul 4 15:29:45 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Mon, 04 Jul 2011 08:29:45 -0700 Subject: [isidorus-cvs] r556 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: base values Message-ID: Author: lgiessmann Date: Mon Jul 4 08:29:44 2011 New Revision: 556 Log: gdl-frontend: Widgets: added the class GdlTextObject, derived from GdlVisibleObject Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlTextObject.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/DirectionValue.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/NormalNumUnitValue.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/TextAlignValue.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/TextDecorationValue.java Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlTextObject.java ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlTextObject.java Mon Jul 4 08:29:44 2011 (r556) @@ -0,0 +1,150 @@ +package us.isidor.gdl.anaToMia.Widgets.base; + + +import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence; +import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic; +import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException; +import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; +import us.isidor.gdl.anaToMia.Widgets.values.DirectionValue; +import us.isidor.gdl.anaToMia.Widgets.values.NormalNumUnitValue; +import us.isidor.gdl.anaToMia.Widgets.values.TextAlignValue; +import us.isidor.gdl.anaToMia.Widgets.values.TextDecorationValue; + +public abstract class GdlTextObject extends GdlVisibleObject { + + // some constructors + protected GdlTextObject(){ + super(); + } + + + public GdlTextObject(Topic tmRepresentative) throws InvalidGdlSchemaException, ExecutionException{ + super(tmRepresentative); + } + + + // returns a DirectionValue instance that represents the text direction of this element. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // or null. + public DirectionValue getDirection(String styleClass) throws InvalidGdlSchemaException { + Occurrence directionOcc = null; + if(styleClass != null){ + directionOcc = super.getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlDirection, styleClass); + } else { + directionOcc = super.getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlDirection); + } + + if(directionOcc == null && styleClass != null){ + return null; + } else if(directionOcc == null) { + return DirectionValue.LTR; + } else { + try{ + return DirectionValue.valueOf(directionOcc.getValue().toUpperCase()); + }catch(IllegalArgumentException e){ + throw new InvalidGdlSchemaException("The occurrence " + GdlPsis.OccurrenceType.gdlDirection + " must be set to one of \"ltr\" or \"rtl\", but is \"" + directionOcc.getValue() + "\""); + } + } + } + + + // returns a TextAlingvalue instance that represents the text-align of this element. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // or null. + public TextAlignValue getTextAlign(String styleClass) throws InvalidGdlSchemaException { + Occurrence textAlignOcc = null; + if(styleClass != null){ + textAlignOcc = super.getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlDirection, styleClass); + } else { + textAlignOcc = super.getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlDirection); + } + + if(textAlignOcc == null && styleClass != null){ + return null; + } else if(textAlignOcc == null) { + return TextAlignValue.LEFT; + } else { + try{ + return TextAlignValue.valueOf(textAlignOcc.getValue().toUpperCase()); + }catch(IllegalArgumentException e){ + throw new InvalidGdlSchemaException("The occurrence " + GdlPsis.OccurrenceType.gdlTextAlign + " must be set to one of \"left\", \"right\", \"center\" or \"justify\", but is \"" + textAlignOcc.getValue() + "\""); + } + } + } + + + // returns a NormalNumUnitValue instance that represents the line-height of this element. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // or null. + public NormalNumUnitValue getLineHeight(String styleClass) throws InvalidGdlSchemaException { + Occurrence lineHeightOcc = null; + if(styleClass != null){ + lineHeightOcc = super.getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlDirection, styleClass); + } else { + lineHeightOcc = super.getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlDirection); + } + + if(lineHeightOcc == null && styleClass != null){ + return null; + } else if(lineHeightOcc == null) { + return new NormalNumUnitValue(); + } else { + return new NormalNumUnitValue(lineHeightOcc.getValue()); + } + } + + + // returns a TextDecoarionValue instance that represents the text-decoration of this element. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // or null. + public TextDecorationValue getGdlTextDecoration(String styleClass) throws InvalidGdlSchemaException { + Occurrence decorationOcc = null; + if(styleClass != null){ + decorationOcc = super.getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlTextDecoration, styleClass); + } else { + decorationOcc = super.getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlTextDecoration); + } + + if(decorationOcc == null && styleClass != null){ + return null; + } else if(decorationOcc == null) { + return TextDecorationValue.NONE; + } else { + try{ + return TextDecorationValue.valueOf(decorationOcc.getValue().toUpperCase()); + }catch(IllegalArgumentException e){ + throw new InvalidGdlSchemaException("The occurrence " + GdlPsis.OccurrenceType.gdlTextDecoration + " must be set to one of \"underline\", \"overline\", \"line-through\", \"blink\" or \"none\", but is \"" + decorationOcc.getValue() + "\""); + } + } + } + + + // calls the super class's setGdlStyle and additionally calls local statements + // to fulfill the style settings + @Override + protected void setGdlStyle() throws InvalidGdlSchemaException, ExecutionException{ + super.setGdlStyle(); + + // TODO: implement + + // direction [hover | active | focus] + // text-align [hover | active | focus] + // line-height [hover | active | focus] + // text-decoration [hover | active | focus] + // color [hover | active | focus] + // font-family [hover | active | focus] + // font-style [hover | active | focus] + // font-size [hover | active | focus] + // font-weight [hover | active | focus] + // letter-spacing [hover | active | focus] + // word-spacing [hover | active | focus] + + + // TODO: implement + // css pseudo class handlers => register additional handlers for this class ??? + } + + + // shall return the objects textual value + public abstract String getText(); +} Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Mon Jul 4 07:26:24 2011 (r555) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Mon Jul 4 08:29:44 2011 (r556) @@ -33,6 +33,7 @@ import com.google.gwt.event.dom.client.HasMouseOutHandlers; import com.google.gwt.event.dom.client.HasMouseOverHandlers; import com.google.gwt.event.dom.client.HasMouseUpHandlers; +import com.google.gwt.event.dom.client.HasScrollHandlers; import com.google.gwt.event.dom.client.MouseDownEvent; import com.google.gwt.event.dom.client.MouseDownHandler; import com.google.gwt.event.dom.client.MouseOutEvent; @@ -41,13 +42,15 @@ import com.google.gwt.event.dom.client.MouseOverHandler; import com.google.gwt.event.dom.client.MouseUpEvent; import com.google.gwt.event.dom.client.MouseUpHandler; +import com.google.gwt.event.dom.client.ScrollEvent; +import com.google.gwt.event.dom.client.ScrollHandler; import com.google.gwt.event.shared.HandlerRegistration; import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.ui.AbsolutePanel; import com.google.gwt.user.client.ui.Composite; -public abstract class GdlVisibleObject extends Composite implements GdlDescriptor, HasClickHandlers, HasMouseOutHandlers, HasMouseOverHandlers, HasFocusHandlers, HasMouseDownHandlers, HasMouseUpHandlers, HasBlurHandlers{ +public abstract class GdlVisibleObject extends Composite implements GdlDescriptor, HasClickHandlers, HasMouseOutHandlers, HasMouseOverHandlers, HasFocusHandlers, HasMouseDownHandlers, HasMouseUpHandlers, HasBlurHandlers, HasScrollHandlers{ protected AbsolutePanel mainPanel = new AbsolutePanel(); protected Topic tmRepresentative = null; protected TopicMap tm = null; @@ -59,7 +62,8 @@ protected boolean isHovered = false; - private GdlVisibleObject() { + // some constructors + protected GdlVisibleObject() { initWidget(this.mainPanel); } @@ -81,7 +85,7 @@ // a helper method that returns all occurrences of the type bound to the passed PSI - private JsArray getOccurrences(String occurrenceType){ + protected JsArray getOccurrences(String occurrenceType){ Topic occType = tm.getTopicBySubjectIdentifier(tm.createLocator(occurrenceType)); if(occType == null) return null; else return tmRepresentative.getOccurrences(occType); @@ -91,7 +95,7 @@ // a helper method that returns one occurrence of the type bound to the passed PSI. // If more than one occurrence is available an InvalidGdlSchemaException is thrown. // If nor occurrence is available the return value is null - private Occurrence getNoneOrOneUnscopedOccurrence(String occurrenceType) throws InvalidGdlSchemaException{ + protected Occurrence getNoneOrOneUnscopedOccurrence(String occurrenceType) throws InvalidGdlSchemaException{ JsArray occs = getOccurrences(occurrenceType); ArrayList unscopedOccs = new ArrayList(); for(int i = 0; i != occs.length(); ++i){ @@ -110,7 +114,7 @@ // a helper method that returns one occurrence of the type bound to the passed PSI and scoped // by the theme bound to the passed PSI. If no such occurrence exist, the default value is null - private Occurrence getNoneOrOneScopedOccurrence(String occurrenceType, String theme) throws InvalidGdlSchemaException{ + protected Occurrence getNoneOrOneScopedOccurrence(String occurrenceType, String theme) throws InvalidGdlSchemaException{ Topic themeTopic = tm.getTopicBySubjectIdentifier(tm.createLocator(theme)); if(themeTopic == null){ return null; @@ -1390,7 +1394,7 @@ // sets all GDL styles that are defined by the topic map representative - public void setGdlStyle() throws InvalidGdlSchemaException, ExecutionException { + protected void setGdlStyle() throws InvalidGdlSchemaException, ExecutionException { this.setDisplay(this.getDisplay()); this.setZindex(this.getZindex()); this.setFloat(this.getFloat()); @@ -1485,6 +1489,13 @@ } + // registers a scroll handler on this element + @Override + public HandlerRegistration addScrollHandler(ScrollHandler handler) { + return this.addDomHandler(handler, ScrollEvent.getType()); + } + + // registers a mouse down handler on this element @Override public HandlerRegistration addMouseUpHandler(MouseUpHandler handler) { Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Mon Jul 4 07:26:24 2011 (r555) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Mon Jul 4 08:29:44 2011 (r556) @@ -100,7 +100,11 @@ bgcFocus.addTheme(gdlFocus); - GdlVisibleObject tmp = new GdlVisibleObject(tmpRepresentative){}; + GdlTextObject tmp = new GdlTextObject(tmpRepresentative){ + @Override + public String getText() { + return "tmp"; + }}; this.mainPanel.add(tmp); }catch(Exception e){ e.printStackTrace(); Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/DirectionValue.java ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/DirectionValue.java Mon Jul 4 08:29:44 2011 (r556) @@ -0,0 +1,11 @@ +package us.isidor.gdl.anaToMia.Widgets.values; + +public enum DirectionValue implements CssValue { + LTR, + RTL; + + + public String getCssValue(){ + return this.toString().toLowerCase(); + } +} Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/NormalNumUnitValue.java ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/NormalNumUnitValue.java Mon Jul 4 08:29:44 2011 (r556) @@ -0,0 +1,46 @@ +package us.isidor.gdl.anaToMia.Widgets.values; + +import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; + +public class NormalNumUnitValue extends NumUnitValue{ + public NormalNumUnitValue(){ + super.unit = null; // if unit is null, the default value is normal + super.value = 0f; + } + + + public NormalNumUnitValue(String value) throws InvalidGdlSchemaException{ + String upperString = value.trim().toUpperCase(); + if(upperString.equals("NORMAL")){ + super.unit = null; // if unit is null, the default value is normal + super.value = 0f; + }else if(upperString.endsWith("PX")){ + this.value = makeFloat(upperString, 2); + this.unit = CssUnit.PIXEL; + }else if (upperString.endsWith("PT")){ + this.value = makeFloat(upperString, 2); + this.unit = CssUnit.POINT; + } else if(upperString.endsWith("%")){ + this.value = makeFloat(upperString, 1); + this.unit = CssUnit.PERCENTAGE; + } else { + throw new InvalidGdlSchemaException("normal numeric values supported by the GDL containing a unit definition must be of the form (pt|px|%)|normal, but found: " + value); + } + } + + + @Override + public String getCssValue() { + if(super.unit == null){ + return "normal"; + } else { + return super.getCssValue(); + } + } + + + // this method returns true, if the value must be treated as "auto" + public boolean isNormal(){ + return super.unit == null; + } +} \ No newline at end of file Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/TextAlignValue.java ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/TextAlignValue.java Mon Jul 4 08:29:44 2011 (r556) @@ -0,0 +1,14 @@ +package us.isidor.gdl.anaToMia.Widgets.values; + +public enum TextAlignValue implements CssValue{ + LEFT, + RIGHT, + CENTER, + JUSTIFY; + + + @Override + public String getCssValue() { + return this.toString().toLowerCase(); + } +} Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/TextDecorationValue.java ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/TextDecorationValue.java Mon Jul 4 08:29:44 2011 (r556) @@ -0,0 +1,15 @@ +package us.isidor.gdl.anaToMia.Widgets.values; + +public enum TextDecorationValue implements CssValue { + UNDERLINE, + OVERLINE, + LINE_THROUGH, + BLINK, + NONE; + + + @Override + public String getCssValue() { + return this.toString().toLowerCase().replace("_", "-"); + } +} From lgiessmann at common-lisp.net Mon Jul 4 18:50:38 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Mon, 04 Jul 2011 11:50:38 -0700 Subject: [isidorus-cvs] r557 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: base values Message-ID: Author: lgiessmann Date: Mon Jul 4 11:50:37 2011 New Revision: 557 Log: gdl-frontend: Widgets: implemented the class GdlTextObject; implemented all corresponding css styles (with css pseudo-classes) supported by the GDL Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/FontWeightValue.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/PositiveNumUnitValue.java Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlTextObject.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java Mon Jul 4 08:29:44 2011 (r556) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java Mon Jul 4 11:50:37 2011 (r557) @@ -147,7 +147,7 @@ public final static String gdlColor = gdl + "color"; public final static String gdlFontfamily = gdl + "font-family"; public final static String gdlFontStyle = gdl + "font-style"; - public final static String gdlFontSize = gdl + "font-weight"; + public final static String gdlFontSize = gdl + "font-size"; public final static String gdlFontWeight = gdl + "font-weight"; public final static String gdlLetterSpacing = gdl + "letter-spacing"; public final static String gdlWordSpacing = gdl + "word-spacing"; Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlTextObject.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlTextObject.java Mon Jul 4 08:29:44 2011 (r556) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlTextObject.java Mon Jul 4 11:50:37 2011 (r557) @@ -1,12 +1,18 @@ package us.isidor.gdl.anaToMia.Widgets.base; +import com.google.gwt.dom.client.Style.FontStyle; +import com.google.gwt.user.client.DOM; + import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic; import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException; import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; +import us.isidor.gdl.anaToMia.Widgets.values.ColorValue; import us.isidor.gdl.anaToMia.Widgets.values.DirectionValue; +import us.isidor.gdl.anaToMia.Widgets.values.FontWeightValue; import us.isidor.gdl.anaToMia.Widgets.values.NormalNumUnitValue; +import us.isidor.gdl.anaToMia.Widgets.values.PositiveNumUnitValue; import us.isidor.gdl.anaToMia.Widgets.values.TextAlignValue; import us.isidor.gdl.anaToMia.Widgets.values.TextDecorationValue; @@ -97,7 +103,7 @@ // returns a TextDecoarionValue instance that represents the text-decoration of this element. // If a styleClass is set, only the corresponding value of the scoped occurrence is returned // or null. - public TextDecorationValue getGdlTextDecoration(String styleClass) throws InvalidGdlSchemaException { + public TextDecorationValue getTextDecoration(String styleClass) throws InvalidGdlSchemaException { Occurrence decorationOcc = null; if(styleClass != null){ decorationOcc = super.getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlTextDecoration, styleClass); @@ -119,29 +125,244 @@ } + // returns a ColorValue instance that represents the text color of this element. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // or null. + public ColorValue getColor(String styleClass) throws InvalidGdlSchemaException { + Occurrence colorOcc = null; + if(styleClass != null){ + colorOcc = super.getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlColor, styleClass); + } else { + colorOcc = super.getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlColor); + } + + if(colorOcc == null && styleClass != null){ + return null; + } else if(colorOcc == null) { + return new ColorValue(); + } else { + return new ColorValue(colorOcc.getValue()); + } + } + + + // returns a String instance that represents the text font-family of this element. + public String getFontFamily(String styleClass) throws InvalidGdlSchemaException { + Occurrence fontOcc = null; + if(styleClass != null){ + fontOcc = super.getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlFontfamily, styleClass); + } else { + fontOcc = super.getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlFontfamily); + } + + if(fontOcc == null){ + return null; // use the browser's default font + } else { + return fontOcc.getValue(); + } + } + + + // returns a FontStyle instance that represents the text font-style of this element. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // or null. + public FontStyle getFontStyle(String styleClass) throws InvalidGdlSchemaException { + Occurrence styleOcc = null; + if(styleClass != null){ + styleOcc = super.getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlFontStyle, styleClass); + } else { + styleOcc = super.getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlFontStyle); + } + + if(styleOcc == null && styleClass != null){ + return null; + } else if(styleOcc == null) { + return FontStyle.NORMAL; + } else { + try{ + return FontStyle.valueOf(styleOcc.getValue().toUpperCase()); + }catch(IllegalArgumentException e){ + throw new InvalidGdlSchemaException("The occurrence " + GdlPsis.OccurrenceType.gdlFontStyle + " must be set to one of \"normal\", \"italic\" or \"oblique\", but is \"" + styleOcc.getValue() + "\""); + } + } + } + + + // returns a PositiveNumUnitValue instance that represents the text font-size of this element. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // or null. + public PositiveNumUnitValue getFontSize(String styleClass) throws InvalidGdlSchemaException { + Occurrence sizeOcc = null; + if(styleClass != null){ + sizeOcc = super.getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlFontSize, styleClass); + } else { + sizeOcc = super.getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlFontSize); + } + + if(sizeOcc == null && styleClass != null){ + return null; + } else if(sizeOcc == null) { + return new PositiveNumUnitValue("12pt"); + } else { + return new PositiveNumUnitValue(sizeOcc.getValue()); + } + } + + + // returns a FontWeightValue instance that represents the text font-weight of this element. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // or null. + public FontWeightValue getFontWeight(String styleClass) throws InvalidGdlSchemaException { + Occurrence weightOcc = null; + if(styleClass != null){ + weightOcc = super.getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlFontWeight, styleClass); + } else { + weightOcc = super.getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlFontWeight); + } + + if(weightOcc == null && styleClass != null){ + return null; + } else if(weightOcc == null) { + return FontWeightValue.NORMAL; + } else { + try{ + return FontWeightValue.fromString(weightOcc.getValue()); + }catch(IllegalArgumentException e){ + String values = "normal, bold, bolder, lighter, 100, 200, 300, 400, 500, 600, 700, 800 or 900"; + throw new InvalidGdlSchemaException("The occurrence " + GdlPsis.OccurrenceType.gdlFontWeight + " must be set to one of " + values + ", but found " + weightOcc.getValue() + "\""); + } + } + } + + + // returns a NormalNumUnitValue instance that represents the text letter-spacing of this element. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // or null. + public NormalNumUnitValue getLetterSpacing(String styleClass) throws InvalidGdlSchemaException { + Occurrence spacingOcc = null; + if(styleClass != null){ + spacingOcc = super.getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlLetterSpacing, styleClass); + } else { + spacingOcc = super.getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlLetterSpacing); + } + + if(spacingOcc == null && styleClass != null){ + return null; + } else if(spacingOcc == null) { + return new NormalNumUnitValue(); + } else { + return new NormalNumUnitValue(spacingOcc.getValue()); + } + } + + + // returns a NormalNumUnitValue instance that represents the text word-spacing of this element. + // If a styleClass is set, only the corresponding value of the scoped occurrence is returned + // or null. + public NormalNumUnitValue getWordSpacing(String styleClass) throws InvalidGdlSchemaException { + Occurrence spacingOcc = null; + if(styleClass != null){ + spacingOcc = super.getNoneOrOneScopedOccurrence(GdlPsis.OccurrenceType.gdlWordSpacing, styleClass); + } else { + spacingOcc = super.getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlWordSpacing); + } + + if(spacingOcc == null && styleClass != null){ + return null; + } else if(spacingOcc == null) { + return new NormalNumUnitValue(); + } else { + return new NormalNumUnitValue(spacingOcc.getValue()); + } + } + + + // sets the direction style property of this element by using the GWT DOM class + public void setDirection(DirectionValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) super.setCssProperty(styleClass, "direction", value.getCssValue()); + } + + + // sets the text-align style property of this element by using the GWT DOM class + public void setTextAlign(TextAlignValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) super.setCssProperty(styleClass, "textAlign", value.getCssValue()); + } + + + // sets the line-height style property of this element by using the GWT DOM class + public void setLineHeight(NormalNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) super.setCssProperty(styleClass, "lineHeight", value.getCssValue()); + } + + + // sets the text-decoration style property of this element by using the GWT DOM class + public void setTextDecoration(TextDecorationValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) super.setCssProperty(styleClass, "textDecoration", value.getCssValue()); + } + + + // sets the color style property of this element by using the GWT DOM class + public void setColor(ColorValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) super.setCssProperty(styleClass, "color", value.getCssValue()); + } + + + // sets the font-family style property of this element by using the GWT DOM class + public void setFontFamily(String value, String styleClass) throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) super.setCssProperty(styleClass, "fontFamily", value); + } + + + // sets the font-style style property of this element by using the GWT DOM class + public void setFontStyle(FontStyle value, String styleClass) throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) super.setCssProperty(styleClass, "fontStyle", value.getCssName()); + } + + + // sets the font-size style property of this element by using the GWT DOM class + public void setFontSize(PositiveNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) super.setCssProperty(styleClass, "fontSize", value.getCssValue()); + } + + + // sets the font-weight style property of this element by using the GWT DOM class + public void setFontWeight(FontWeightValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) super.setCssProperty(styleClass, "fontWeight", value.getCssValue()); + } + + + // sets the letter-spacing style property of this element by using the GWT DOM class + public void setLetterSpacing(NormalNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) super.setCssProperty(styleClass, "letterSpacing", value.getCssValue()); + } + + + // sets the word-spacing style property of this element by using the GWT DOM class + public void setWordSpacing(NormalNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException{ + if(value != null) super.setCssProperty(styleClass, "wordSpacing", value.getCssValue()); + } + + // calls the super class's setGdlStyle and additionally calls local statements // to fulfill the style settings @Override protected void setGdlStyle() throws InvalidGdlSchemaException, ExecutionException{ super.setGdlStyle(); - // TODO: implement - - // direction [hover | active | focus] - // text-align [hover | active | focus] - // line-height [hover | active | focus] - // text-decoration [hover | active | focus] - // color [hover | active | focus] - // font-family [hover | active | focus] - // font-style [hover | active | focus] - // font-size [hover | active | focus] - // font-weight [hover | active | focus] - // letter-spacing [hover | active | focus] - // word-spacing [hover | active | focus] - - - // TODO: implement - // css pseudo class handlers => register additional handlers for this class ??? + String[] styleClasses = new String[]{null, GdlPsis.Scope.gdlActive, GdlPsis.Scope.gdlFocus, GdlPsis.Scope.gdlHover}; + for (String styleClass : styleClasses) { + this.setDirection(this.getDirection(styleClass), styleClass); + this.setTextAlign(this.getTextAlign(styleClass), styleClass); + this.setTextAlign(this.getTextAlign(styleClass), styleClass); + this.setTextDecoration(this.getTextDecoration(styleClass), styleClass); + this.setColor(this.getColor(styleClass), styleClass); + this.setFontFamily(this.getFontFamily(styleClass), styleClass); + this.setFontStyle(this.getFontStyle(styleClass), styleClass); + this.setFontSize(this.getFontSize(styleClass), styleClass); + this.setFontWeight(this.getFontWeight(styleClass), styleClass); + this.setLetterSpacing(this.getLetterSpacing(styleClass), styleClass); + this.setWordSpacing(this.getWordSpacing(styleClass), styleClass); + } } Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Mon Jul 4 08:29:44 2011 (r556) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Mon Jul 4 11:50:37 2011 (r557) @@ -1375,7 +1375,7 @@ // sets the passed css style porperty to the passed css value. // If a styleClass is given, the style is applied to either active, hover or focus - private void setCssProperty(String styleClass, String cssProperty, String cssValue)throws InvalidGdlSchemaException, ExecutionException{ + protected void setCssProperty(String styleClass, String cssProperty, String cssValue)throws InvalidGdlSchemaException, ExecutionException{ if(cssValue == null || cssProperty == null) return; if(styleClass == null){ Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Mon Jul 4 08:29:44 2011 (r556) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Mon Jul 4 11:50:37 2011 (r557) @@ -71,6 +71,7 @@ Topic gdlBorderBottomColor = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlBorderBottomColor)); Topic gdlBorderStyle = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlBorderStyle)); Topic gdlBorderWidth = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlBorderWidth)); + Topic gdlFontSize = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlFontSize)); Topic gdlHover = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.Scope.gdlHover)); Topic gdlActive = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.Scope.gdlActive)); Topic gdlFocus = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.Scope.gdlFocus)); @@ -98,6 +99,10 @@ bgcActive.addTheme(gdlActive); Occurrence bgcFocus = tmpRepresentative.createOccurrence(gdlBackgroundColor, "silver", null); bgcFocus.addTheme(gdlFocus); + tmpRepresentative.createOccurrence(gdlFontSize, "15pt", null); + Occurrence fsHover = tmpRepresentative.createOccurrence(gdlFontSize, "25pt", null); + fsHover.addTheme(gdlHover); + GdlTextObject tmp = new GdlTextObject(tmpRepresentative){ Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/FontWeightValue.java ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/FontWeightValue.java Mon Jul 4 11:50:37 2011 (r557) @@ -0,0 +1,45 @@ +package us.isidor.gdl.anaToMia.Widgets.values; + +public enum FontWeightValue implements CssValue { + NORMAL, + BOLD, + BOLDER, + LIGHTER, + _100, + _200, + _300, + _400, + _500, + _600, + _700, + _800, + _900; + + @Override + public String getCssValue() { + String str = this.toString(); + if(str.startsWith("_")) return str.substring(1); + else return str; + } + + + public static FontWeightValue fromString(String str) throws IllegalArgumentException{ + if(null == str) return null; + + String upperStr = str.toUpperCase(); + if(upperStr.equals("NORMAL")) return NORMAL; + else if(upperStr.equals("BOLD")) return BOLD; + else if(upperStr.equals("BOLDER")) return BOLDER; + else if(upperStr.equals("LIGHTER")) return LIGHTER; + else if(upperStr.equals("100")) return _100; + else if(upperStr.equals("200")) return _200; + else if(upperStr.equals("300")) return _300; + else if(upperStr.equals("400")) return _400; + else if(upperStr.equals("500")) return _500; + else if(upperStr.equals("600")) return _600; + else if(upperStr.equals("700")) return _700; + else if(upperStr.equals("800")) return _800; + else if(upperStr.equals("900")) return _900; + else throw new IllegalArgumentException("the value " + str + "is not a FontWeightValue value"); + } +} Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/PositiveNumUnitValue.java ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/PositiveNumUnitValue.java Mon Jul 4 11:50:37 2011 (r557) @@ -0,0 +1,17 @@ +package us.isidor.gdl.anaToMia.Widgets.values; + +import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; + +public class PositiveNumUnitValue extends NumUnitValue { + public PositiveNumUnitValue(){ + super.value = 0f; + } + + + public PositiveNumUnitValue(String value) throws InvalidGdlSchemaException{ + super(value); + if(super.value < 0){ + throw new InvalidGdlSchemaException("positive numeric values supported by the GDL containing a unit definition must be of the form (pt|px|%), but found: " + value); + } + } +} From lgiessmann at common-lisp.net Tue Jul 5 06:22:02 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Mon, 04 Jul 2011 23:22:02 -0700 Subject: [isidorus-cvs] r558 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: . base text Message-ID: Author: lgiessmann Date: Mon Jul 4 23:22:00 2011 New Revision: 558 Log: gdl-frontend: Widgets: added the package us.isidor.gdl.anaToMia.Widgets.text that contains all textable widgets; moved GdlTextObject to us.isidor.gdl.anaToMia.Widgets.text Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTextObject.java - copied, changed from r557, branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlTextObject.java Deleted: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlTextObject.java Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/GDL_Widgets.gwt.xml branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlContainer.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/GDL_Widgets.gwt.xml ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/GDL_Widgets.gwt.xml Mon Jul 4 11:50:37 2011 (r557) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/GDL_Widgets.gwt.xml Mon Jul 4 23:22:00 2011 (r558) @@ -21,6 +21,7 @@ + Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlContainer.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlContainer.java Mon Jul 4 11:50:37 2011 (r557) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlContainer.java Mon Jul 4 23:22:00 2011 (r558) @@ -3,5 +3,5 @@ import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; public interface IGdlContainer { - public void append(GdlVisibleObject ancestor, GdlVisibleObject descendant) throws InvalidGdlSchemaException; + public void append(GdlVisibleObject ancestor, GdlVisibleObject descendant/*, Position position*/) throws InvalidGdlSchemaException; } Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Mon Jul 4 11:50:37 2011 (r557) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Mon Jul 4 23:22:00 2011 (r558) @@ -4,6 +4,7 @@ import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic; import us.isidor.gdl.anaToMia.Widgets.isidorus.LoadSchemaCallback; +import us.isidor.gdl.anaToMia.Widgets.text.GdlTextObject; import us.isidor.gdl.anaToMia.Widgets.values.CursorValue; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.event.dom.client.ClickEvent; Copied and modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTextObject.java (from r557, branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlTextObject.java) ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlTextObject.java Mon Jul 4 11:50:37 2011 (r557, copy source) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTextObject.java Mon Jul 4 23:22:00 2011 (r558) @@ -1,11 +1,11 @@ -package us.isidor.gdl.anaToMia.Widgets.base; +package us.isidor.gdl.anaToMia.Widgets.text; import com.google.gwt.dom.client.Style.FontStyle; -import com.google.gwt.user.client.DOM; - import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic; +import us.isidor.gdl.anaToMia.Widgets.base.GdlPsis; +import us.isidor.gdl.anaToMia.Widgets.base.GdlVisibleObject; import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException; import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; import us.isidor.gdl.anaToMia.Widgets.values.ColorValue; @@ -16,6 +16,7 @@ import us.isidor.gdl.anaToMia.Widgets.values.TextAlignValue; import us.isidor.gdl.anaToMia.Widgets.values.TextDecorationValue; + public abstract class GdlTextObject extends GdlVisibleObject { // some constructors From lgiessmann at common-lisp.net Tue Jul 5 06:59:48 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Mon, 04 Jul 2011 23:59:48 -0700 Subject: [isidorus-cvs] r559 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: base text values Message-ID: Author: lgiessmann Date: Mon Jul 4 23:59:48 2011 New Revision: 559 Log: gdl-frontend: Widgets: added methods for reading all Topic Maps values define dby the GDL for objects of the type gdl:Text Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlHasValue.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/HtmlValue.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/TextTypeValue.java Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTextObject.java Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlHasValue.java ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlHasValue.java Mon Jul 4 23:59:48 2011 (r559) @@ -0,0 +1,11 @@ +package us.isidor.gdl.anaToMia.Widgets.base; + +import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct; +import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes; + + +public interface IGdlHasValue { + public String getStringValue(); + public Construct getTmValue(); + public TopicMapsTypes getTmType(); // null if it is a String value +} Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Mon Jul 4 23:22:00 2011 (r558) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Mon Jul 4 23:59:48 2011 (r559) @@ -106,11 +106,7 @@ - GdlTextObject tmp = new GdlTextObject(tmpRepresentative){ - @Override - public String getText() { - return "tmp"; - }}; + GdlTextObject tmp = new GdlTextObject(tmpRepresentative){}; this.mainPanel.add(tmp); }catch(Exception e){ e.printStackTrace(); Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java Mon Jul 4 23:59:48 2011 (r559) @@ -0,0 +1,160 @@ +package us.isidor.gdl.anaToMia.Widgets.text; + +import com.google.gwt.dom.client.Style.Display; + +import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct; +import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence; +import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic; +import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes; +import us.isidor.gdl.anaToMia.Widgets.base.GdlPsis; +import us.isidor.gdl.anaToMia.Widgets.base.IGdlHasValue; +import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException; +import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; +import us.isidor.gdl.anaToMia.Widgets.values.TextTypeValue; + +public class GdlText extends GdlTextObject implements IGdlHasValue{ + + + // some constructors + protected GdlText(){ + super(); + } + + + public GdlText(Topic tmRepresentative) throws InvalidGdlSchemaException, ExecutionException{ + super(tmRepresentative); + } + + + + // returns a TextType instance of a gdl:text-type occurrence. + // If no gdl:text-type occurrence is set, the default value is returned + public TextTypeValue getTextType() throws InvalidGdlSchemaException { + Occurrence typeOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlTextType); + + if(typeOcc != null){ + try{ + return TextTypeValue.valueOf(typeOcc.getValue().toUpperCase()); + }catch(IllegalArgumentException e){ + throw new InvalidGdlSchemaException("The occurrence " + GdlPsis.OccurrenceType.gdlTextType + " must be set to one of \"text\" or \"password\", but is \"" + typeOcc.getValue() + "\""); + } + } else { + return TextTypeValue.Text; + } + } + + + // returns a boolean instance of a gdl:readonly occurrence. + // If no gdl:readonly occurrence is set, the default value is returned + public boolean getReadnonly() throws InvalidGdlSchemaException { + Occurrence readOnlyOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlReadonly); + + if(readOnlyOcc != null){ + String boolStr = readOnlyOcc.getValue().toUpperCase(); + if(boolStr.equals("TRUE")){ + return true; + } else if(boolStr.equals("FALSE")) { + return false; + } else { + throw new InvalidGdlSchemaException("The occurrence " + GdlPsis.OccurrenceType.gdlReadonly + " must be set to one of \"true\" or \"false\", but is \"" + readOnlyOcc.getValue() + "\""); + } + } else { + return true; + } + } + + + + // returns a boolean instance of a gdl:rows occurrence. + // If no gdl:rows occurrence is set, the default value is returned + public int getRows() throws InvalidGdlSchemaException { + Occurrence rowsOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlRows); + + if(rowsOcc != null){ + try{ + int value = Integer.valueOf(rowsOcc.getValue()); + if(value < 0) throw new InvalidGdlSchemaException("The occurrence " + GdlPsis.OccurrenceType.gdlRows + " must be set to a positive integer, but is \"" + rowsOcc.getValue() + "\""); + else return value; + }catch(NumberFormatException e){ + throw new InvalidGdlSchemaException("The occurrence " + GdlPsis.OccurrenceType.gdlRows + " must be set to a positive integer, but is \"" + rowsOcc.getValue() + "\""); + } + } else { + return 1; + } + } + + + // returns a boolean instance of a gdl:cols occurrence. + // If no gdl:cols occurrence is set, the default value is returned + public int getCols() throws InvalidGdlSchemaException { + Occurrence colsOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlCols); + + if(colsOcc != null){ + try{ + int value = Integer.valueOf(colsOcc.getValue()); + if(value < 0) throw new InvalidGdlSchemaException("The occurrence " + GdlPsis.OccurrenceType.gdlCols + " must be set to a positive integer, but is \"" + colsOcc.getValue() + "\""); + else return value; + }catch(NumberFormatException e){ + throw new InvalidGdlSchemaException("The occurrence " + GdlPsis.OccurrenceType.gdlCols + " must be set to a positive integer, but is \"" + colsOcc.getValue() + "\""); + } + } else { + return 5; + } + } + + + // returns a boolean instance of a gdl:resize occurrence. + // If no gdl:resize occurrence is set, the default value is returned + public boolean getResize() throws InvalidGdlSchemaException { + Occurrence resizeOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlResize); + + if(resizeOcc != null){ + String boolStr = resizeOcc.getValue().toUpperCase(); + if(boolStr.equals("TRUE")){ + return true; + } else if(boolStr.equals("FALSE")) { + return false; + } else { + throw new InvalidGdlSchemaException("The occurrence " + GdlPsis.OccurrenceType.gdlResize + " must be set to one of \"true\" or \"false\", but is \"" + resizeOcc.getValue() + "\""); + } + } else { + return false; + } + } + + + // calls the super class's setGdlStyle and additionally calls local statements + // to fulfill the style settings + @Override + protected void setGdlStyle() throws InvalidGdlSchemaException, ExecutionException{ + super.setGdlStyle(); + + // TODO: implement + // text-type + // readonly + // rows + // calls + // resize + + } + + + @Override + public String getStringValue() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Construct getTmValue() { + // TODO Auto-generated method stub + return null; + } + + @Override + public TopicMapsTypes getTmType() { + // TODO Auto-generated method stub + return null; + } + +} Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTextObject.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTextObject.java Mon Jul 4 23:22:00 2011 (r558) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTextObject.java Mon Jul 4 23:59:48 2011 (r559) @@ -365,8 +365,4 @@ this.setWordSpacing(this.getWordSpacing(styleClass), styleClass); } } - - - // shall return the objects textual value - public abstract String getText(); } Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/HtmlValue.java ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/HtmlValue.java Mon Jul 4 23:59:48 2011 (r559) @@ -0,0 +1,5 @@ +package us.isidor.gdl.anaToMia.Widgets.values; + +public interface HtmlValue { + public String getHtmlValue(); +} Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/TextTypeValue.java ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/TextTypeValue.java Mon Jul 4 23:59:48 2011 (r559) @@ -0,0 +1,13 @@ +package us.isidor.gdl.anaToMia.Widgets.values; + +public enum TextTypeValue implements HtmlValue{ + Text, + Password; + + + @Override + public String getHtmlValue() { + return this.toString().toLowerCase(); + } + +} From lgiessmann at common-lisp.net Tue Jul 5 16:41:32 2011 From: lgiessmann at common-lisp.net (lgiessmann at common-lisp.net) Date: Tue, 05 Jul 2011 09:41:32 -0700 Subject: [isidorus-cvs] r560 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: base environment text values Message-ID: Author: lgiessmann Date: Tue Jul 5 09:41:31 2011 New Revision: 560 Log: gdl-frontend: Widgets: added diverse methods to GdlText Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/MultipleHandlerRegistration.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ResizeValue.java Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlHasValue.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTextObject.java Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Mon Jul 4 23:59:48 2011 (r559) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Tue Jul 5 09:41:31 2011 (r560) @@ -1087,7 +1087,7 @@ }else if(value.equals("SCROLL")){ return Overflow.SCROLL; }else { - throw new InvalidGdlSchemaException("cursor must be set to one of visible, hidden or scroll, but is " + overflowOcc.getValue()); + throw new InvalidGdlSchemaException("overflow must be set to one of visible, hidden or scroll, but is " + overflowOcc.getValue()); } } } @@ -1516,6 +1516,9 @@ private ArrayList> cssNameAndValues = new ArrayList>(); private ArrayList> cssPreviousNameAndValues = new ArrayList>(); + + public CssStyleHandler() {} + // adds a CSS name value pair public void addCssStyle(Pair cssNameAndValue) { @@ -1550,7 +1553,11 @@ // this class is used to set the style of focused elements protected class FocusStyleHandler extends CssStyleHandler implements FocusHandler, BlurHandler{ - + public FocusStyleHandler() { + super(); + } + + @Override public void onFocus(FocusEvent event) { super.setStyles(); @@ -1566,12 +1573,17 @@ // this class is used to set the style of hovered elements protected class HoverStyleHandler extends CssStyleHandler implements MouseOverHandler, MouseOutHandler { - + public HoverStyleHandler() { + super(); + } + + @Override public void onMouseOut(MouseOutEvent event) { super.unsetStyles(); } + @Override public void onMouseOver(MouseOverEvent event) { super.setStyles(); @@ -1581,6 +1593,9 @@ // this class is used to set the style of active elements protected class ActiveStyleHandler extends CssStyleHandler implements MouseDownHandler, MouseUpHandler { + public ActiveStyleHandler() { + super(); + } @Override @@ -1588,6 +1603,7 @@ super.unsetStyles(); } + @Override public void onMouseDown(MouseDownEvent event) { super.setStyles(); Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlHasValue.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlHasValue.java Mon Jul 4 23:59:48 2011 (r559) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlHasValue.java Tue Jul 5 09:41:31 2011 (r560) @@ -1,11 +1,14 @@ package us.isidor.gdl.anaToMia.Widgets.base; +import java.util.ArrayList; + import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes; +import us.isidor.gdl.anaToMia.Widgets.environment.Pair; public interface IGdlHasValue { - public String getStringValue(); - public Construct getTmValue(); - public TopicMapsTypes getTmType(); // null if it is a String value + public ArrayList getStringValue(); + public ArrayList> getTmValue(); // TopicMapsTypes is null if the acual value is a string + public boolean validate(); } Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Mon Jul 4 23:59:48 2011 (r559) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Tue Jul 5 09:41:31 2011 (r560) @@ -4,6 +4,7 @@ import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic; import us.isidor.gdl.anaToMia.Widgets.isidorus.LoadSchemaCallback; +import us.isidor.gdl.anaToMia.Widgets.text.GdlText; import us.isidor.gdl.anaToMia.Widgets.text.GdlTextObject; import us.isidor.gdl.anaToMia.Widgets.values.CursorValue; import com.google.gwt.core.client.EntryPoint; @@ -76,6 +77,9 @@ Topic gdlHover = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.Scope.gdlHover)); Topic gdlActive = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.Scope.gdlActive)); Topic gdlFocus = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.Scope.gdlFocus)); + Topic gdlReadonly = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlReadonly)); + Topic gdlResize = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlResize)); + Topic gdlOverflow = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlOverflow)); tmpRepresentative.createOccurrence(gdlBackgroundColor, "red", null); @@ -94,19 +98,22 @@ tmpRepresentative.createOccurrence(gdlBorderBottomColor, "rgb(100%, 100%, 0%)", null); tmpRepresentative.createOccurrence(gdlBorderStyle, "dashed", null); tmpRepresentative.createOccurrence(gdlBorderWidth, "5px", null); - Occurrence bgcHover = tmpRepresentative.createOccurrence(gdlBackgroundColor, "green", null); - bgcHover.addTheme(gdlHover); - Occurrence bgcActive = tmpRepresentative.createOccurrence(gdlBackgroundColor, "purple", null); - bgcActive.addTheme(gdlActive); - Occurrence bgcFocus = tmpRepresentative.createOccurrence(gdlBackgroundColor, "silver", null); - bgcFocus.addTheme(gdlFocus); + tmpRepresentative.createOccurrence(gdlReadonly, "false", null); + tmpRepresentative.createOccurrence(gdlResize, "both", null); + tmpRepresentative.createOccurrence(gdlOverflow, "hidden", null); tmpRepresentative.createOccurrence(gdlFontSize, "15pt", null); - Occurrence fsHover = tmpRepresentative.createOccurrence(gdlFontSize, "25pt", null); - fsHover.addTheme(gdlHover); + //Occurrence bgcHover = tmpRepresentative.createOccurrence(gdlBackgroundColor, "green", null); + //bgcHover.addTheme(gdlHover); + //Occurrence bgcActive = tmpRepresentative.createOccurrence(gdlBackgroundColor, "purple", null); + //bgcActive.addTheme(gdlActive); + //Occurrence bgcFocus = tmpRepresentative.createOccurrence(gdlBackgroundColor, "silver", null); + //bgcFocus.addTheme(gdlFocus); + //Occurrence fsHover = tmpRepresentative.createOccurrence(gdlFontSize, "25pt", null); + //fsHover.addTheme(gdlHover); - GdlTextObject tmp = new GdlTextObject(tmpRepresentative){}; + GdlText tmp = new GdlText(tmpRepresentative){}; this.mainPanel.add(tmp); }catch(Exception e){ e.printStackTrace(); Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/MultipleHandlerRegistration.java ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/MultipleHandlerRegistration.java Tue Jul 5 09:41:31 2011 (r560) @@ -0,0 +1,23 @@ +package us.isidor.gdl.anaToMia.Widgets.environment; + +import java.util.ArrayList; + +import com.google.gwt.event.shared.HandlerRegistration; + +public class MultipleHandlerRegistration implements HandlerRegistration { + private ArrayList registrations = new ArrayList(); + + + @Override + public void removeHandler() { + for (HandlerRegistration reg : this.registrations) { + reg.removeHandler(); + } + } + + + public void addHandlerRegistration(HandlerRegistration registration){ + this.registrations.add(registration); + } + +} Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java Mon Jul 4 23:59:48 2011 (r559) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java Tue Jul 5 09:41:31 2011 (r560) @@ -1,31 +1,118 @@ package us.isidor.gdl.anaToMia.Widgets.text; -import com.google.gwt.dom.client.Style.Display; +import java.util.ArrayList; +import com.google.gwt.dom.client.Style.FontStyle; +import com.google.gwt.event.dom.client.BlurHandler; +import com.google.gwt.event.dom.client.FocusHandler; +import com.google.gwt.event.dom.client.KeyPressEvent; +import com.google.gwt.event.dom.client.KeyPressHandler; +import com.google.gwt.event.dom.client.MouseDownHandler; +import com.google.gwt.event.dom.client.MouseOutHandler; +import com.google.gwt.event.dom.client.MouseOverHandler; +import com.google.gwt.event.dom.client.MouseUpHandler; +import com.google.gwt.event.shared.HandlerRegistration; +import com.google.gwt.user.client.DOM; +import com.google.gwt.user.client.Window; +import com.google.gwt.user.client.ui.TextArea; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes; import us.isidor.gdl.anaToMia.Widgets.base.GdlPsis; +import us.isidor.gdl.anaToMia.Widgets.base.GdlVisibleObject; import us.isidor.gdl.anaToMia.Widgets.base.IGdlHasValue; import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException; import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException; +import us.isidor.gdl.anaToMia.Widgets.environment.MultipleHandlerRegistration; +import us.isidor.gdl.anaToMia.Widgets.environment.Pair; +import us.isidor.gdl.anaToMia.Widgets.values.AbsoluteNumValue; +import us.isidor.gdl.anaToMia.Widgets.values.AutoNumUnitValue; +import us.isidor.gdl.anaToMia.Widgets.values.AutoNumValue; +import us.isidor.gdl.anaToMia.Widgets.values.BorderStyleValue; +import us.isidor.gdl.anaToMia.Widgets.values.ColorValue; +import us.isidor.gdl.anaToMia.Widgets.values.CursorValue; +import us.isidor.gdl.anaToMia.Widgets.values.DirectionValue; +import us.isidor.gdl.anaToMia.Widgets.values.FontWeightValue; +import us.isidor.gdl.anaToMia.Widgets.values.NormalNumUnitValue; +import us.isidor.gdl.anaToMia.Widgets.values.NumUnitValue; +import us.isidor.gdl.anaToMia.Widgets.values.PositiveNumUnitValue; +import us.isidor.gdl.anaToMia.Widgets.values.ResizeValue; +import us.isidor.gdl.anaToMia.Widgets.values.TextAlignValue; +import us.isidor.gdl.anaToMia.Widgets.values.TextDecorationValue; import us.isidor.gdl.anaToMia.Widgets.values.TextTypeValue; -public class GdlText extends GdlTextObject implements IGdlHasValue{ + +public class GdlText extends GdlTextObject implements IGdlHasValue{ + protected ArrayList