Author: lgiessmann Date: Wed Jul 6 07:41:45 2011 New Revision: 568
Log: gdl-frontend: Widgets: changed the behavior of setting default style properties of GdlText
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/text/GdlText.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 Wed Jul 6 07:19:57 2011 (r567) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Wed Jul 6 07:41:45 2011 (r568) @@ -35,7 +35,6 @@ 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.ui.AbsolutePanel; import com.google.gwt.user.client.ui.Composite; @@ -721,7 +720,9 @@ radiusOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderTopLeftRadius); }
- if(radiusOcc == null){ + if(radiusOcc == null && styleClass != null){ + return null; + } else if(radiusOcc == null){ return null; } else { return new NumUnitValue(radiusOcc.getValue()); @@ -740,7 +741,9 @@ radiusOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderTopRightRadius); }
- if(radiusOcc == null){ + if(radiusOcc == null && styleClass != null){ + return null; + } else if(radiusOcc == null){ return null; } else { return new NumUnitValue(radiusOcc.getValue()); @@ -759,7 +762,9 @@ radiusOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderBottomLeftRadius); }
- if(radiusOcc == null){ + if(radiusOcc == null && styleClass != null){ + return null; + } else if(radiusOcc == null){ return null; } else { return new NumUnitValue(radiusOcc.getValue()); @@ -778,7 +783,9 @@ radiusOcc = getNoneOrOneUnscopedOccurrence(GdlPsis.OccurrenceType.gdlBorderBottomRightRadius); }
- if(radiusOcc == null){ + if(radiusOcc == null && styleClass != null){ + return null; + } else if(radiusOcc == null){ return null; } else { return new NumUnitValue(radiusOcc.getValue());
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 Wed Jul 6 07:19:57 2011 (r567) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java Wed Jul 6 07:41:45 2011 (r568) @@ -108,6 +108,331 @@ } + // returns only a value if it was set, so the browsers default value is set + @Override + 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) return null; + else return new AbsoluteNumValue(widthOcc.getValue()); + } + + + // returns only a value if it was set, so the browsers default value is set + @Override + 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) return null; + else return new AbsoluteNumValue(widthOcc.getValue()); + } + + + // returns only a value if it was set, so the browsers default value is set + @Override + 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) return null; + else return new AbsoluteNumValue(widthOcc.getValue()); + } + + + // returns only a value if it was set, so the browsers default value is set + @Override + 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) return null; + else return new AbsoluteNumValue(widthOcc.getValue()); + } + + + // returns only a value if it was set, so the browsers default value is set + @Override + 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) return null; + else return new AbsoluteNumValue(widthOcc.getValue()); + } + + + // returns only a value if it was set, so the browsers default value is set + 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) return null; + else return new NumUnitValue(radiusOcc.getValue()); + } + + + // returns only a value if it was set, so the browsers default value is set + 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) return null; + else return new NumUnitValue(radiusOcc.getValue()); + } + + + // returns only a value if it was set, so the browsers default value is set + 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) return null; + else return new NumUnitValue(radiusOcc.getValue()); + } + + + // returns only a value if it was set, so the browsers default value is set + 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) return null; + else return new NumUnitValue(radiusOcc.getValue()); + } + + + // returns only a value if it was set, so the browsers default value is set + 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) return null; + else return new NumUnitValue(radiusOcc.getValue()); + } + + + // returns only a value if it was set, so the browsers default value is set + 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 ) return null; + else return new ColorValue(colorOcc.getValue()); + } + + + // returns only a value if it was set, so the browsers default value is set + 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 ) return null; + else return new ColorValue(colorOcc.getValue()); + } + + + // returns only a value if it was set, so the browsers default value is set + 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 ) return null; + else return new ColorValue(colorOcc.getValue()); + } + + + // returns only a value if it was set, so the browsers default value is set + 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 ) return null; + else return new ColorValue(colorOcc.getValue()); + } + + + // returns only a value if it was set, so the browsers default value is set + 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 ) return null; + else return new ColorValue(colorOcc.getValue()); + } + + + // returns only a value if it was set, so the browsers default value is set + public BorderStyleValue 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) { + return null; + } else { + try{ + 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()); + } + } + } + + + // returns only a value if it was set, so the browsers default value is set + public BorderStyleValue 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) { + return null; + } else { + try{ + 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()); + } + } + } + + + // returns only a value if it was set, so the browsers default value is set + public BorderStyleValue 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) { + return null; + } else { + try{ + 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()); + } + } + } + + + // returns only a value if it was set, so the browsers default value is set + public BorderStyleValue 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) { + return null; + } else { + try{ + 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()); + } + } + } + + + // returns only a value if it was set, so the browsers default value is set + public BorderStyleValue 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) { + return null; + } else { + try{ + 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()); + } + } + } + + // 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 { @@ -709,6 +1034,7 @@ } + // resets the size of this element depending on the amount of inner sub-elements @Override protected void adjustSize(){ // TODO: implement => width, height, overflow of the mainpanel