Author: lgiessmann Date: Thu Jul 7 00:58:04 2011 New Revision: 573
Log: gdl-frontend: Widgets: simplified te behavior of the superclass GdlVisibleObject
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/text/GdlText.java 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/values/ContentOrientationValue.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/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/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 Wed Jul 6 13:36:01 2011 (r572) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Thu Jul 7 00:58:04 2011 (r573) @@ -23,12 +23,10 @@ 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.event.dom.client.BlurEvent; import com.google.gwt.event.dom.client.BlurHandler; import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.event.dom.client.DomEvent; import com.google.gwt.event.dom.client.FocusEvent; import com.google.gwt.event.dom.client.FocusHandler; import com.google.gwt.event.dom.client.HasBlurHandlers; @@ -46,9 +44,12 @@ 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.EventHandler; import com.google.gwt.user.client.DOM; +import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.AbsolutePanel; import com.google.gwt.user.client.ui.Composite; +import com.google.gwt.user.client.ui.TextArea; import com.google.gwt.user.client.ui.Widget;
@@ -59,6 +60,8 @@ protected ArrayList<Pair<String, String>> activeCssNamesAndStyles = new ArrayList<Pair<String,String>>(); protected ArrayList<Pair<String, String>> focusCssNamesAndStyles = new ArrayList<Pair<String,String>>(); protected ArrayList<Pair<String, String>> hoverCssNamesAndStyles = new ArrayList<Pair<String,String>>(); + protected ArrayList<Widget> subElements = new ArrayList<Widget>(); + protected ArrayList<Pair<TextArea, ArrayList<EventHandler>>> eventHandlers = new ArrayList<Pair<TextArea, ArrayList<EventHandler>>>();
// some constructors @@ -155,7 +158,7 @@ // 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")){ @@ -238,7 +241,7 @@ throw new InvalidGdlSchemaException("The occurrence " + GdlPsis.OccurrenceType.gdlContentOrientation + " must be set to one of "horizontal" or "vertical", but is "" + orientationOcc.getValue() + """); } } else { - return ContentOrientationValue.Vertical; + return ContentOrientationValue.VERTICAL; } } @@ -1119,8 +1122,13 @@ // sets the float style property of all sub elements by using the GWT DOM class - public abstract void setContentOrientation(Widget widget, ContentOrientationValue value) throws InvalidGdlSchemaException, ExecutionException; - + public void setContentOrientation(Widget widget, ContentOrientationValue value) throws InvalidGdlSchemaException, ExecutionException { + // TODO: use a VerticalPanel or HorizontalPanel instead of setting the display property + String valueStr = "inline"; + if(value != null && value == ContentOrientationValue.VERTICAL) valueStr = "block"; + this.setCssProperty(widget, null, "display", valueStr); + } +
// sets the clear style property of this element by using the GWT DOM class public void setClear(ClearValue value){ @@ -1131,160 +1139,244 @@
// sets the vertical-align style property of this element and all it's sub-elements by using the GWT DOM class - public abstract void setVerticalAlign(Widget widget, VerticalAlign value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; - + public void setVerticalAlign(Widget widget, VerticalAlign value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null){ + this.setCssProperty( widget, styleClass, "verticalAlign", value.getCssName()); + this.setCssProperty(styleClass, "verticalAlign", value.getCssName()); + } + }
+ // sets the margin style property of this element by using the GWT DOM class - public abstract void setMargin(Widget widget, NumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; + public void setMargin(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty(widget, styleClass, "margin", value.getCssValue()); + }
// sets the margin-top style property of this element by using the GWT DOM class - public abstract void setMarginTop(Widget widget, NumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; + public void setMarginTop(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty(widget, styleClass, "marginTop", value.getCssValue()); + }
// sets the margin-right style property of this element by using the GWT DOM class - public abstract void setMarginRight(Widget widget, NumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; + public void setMarginRight(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty(widget, styleClass, "marginRight", value.getCssValue()); + }
// sets the margin-bottom style property of this element by using the GWT DOM class - public abstract void setMarginBottom(Widget widget, NumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; + public void setMarginBottom(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty(widget, styleClass, "marginBottom", value.getCssValue()); + }
// sets the margin-left style property of this element by using the GWT DOM class - public abstract void setMarginLeft(Widget widget, NumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; - - + public void setMarginLeft(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty(widget, styleClass, "marginLeft", value.getCssValue()); + } + + // sets the border-color style property of this element by using the GWT DOM class - public abstract void setBorderColor(Widget widget, ColorValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; + public void setBorderColor(Widget widget, ColorValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderColor", value.getCssValue()); + }
// sets the border-top-color style property of this element by using the GWT DOM class - public abstract void setBorderTopColor(Widget widget, ColorValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; + public void setBorderTopColor(Widget widget, ColorValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderTopColor", value.getCssValue()); + }
// sets the border-right-color style property of this element by using the GWT DOM class - public abstract void setBorderRightColor(Widget widget, ColorValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; + public void setBorderRightColor(Widget widget, ColorValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderRightColor", value.getCssValue()); + }
// sets the border-bottom-color style property of this element by using the GWT DOM class - public abstract void setBorderBottomColor(Widget widget, ColorValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; + public void setBorderBottomColor(Widget widget, ColorValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderBottomColor", value.getCssValue()); + }
// sets the border-left-color style property of this element by using the GWT DOM class - public abstract void setBorderLeftColor(Widget widget, ColorValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; - - + public void setBorderLeftColor(Widget widget, ColorValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderLeftColor", value.getCssValue()); + } + + // sets the border-style style property of this element by using the GWT DOM class - public abstract void setBorderStyle(Widget widget, BorderStyleValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; + public void setBorderStyle(Widget widget, BorderStyleValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderStyle", value.getCssValue()); + }
// sets the border-top-style style property of this element by using the GWT DOM class - public abstract void setBorderTopStyle(Widget widget, BorderStyleValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; + public void setBorderTopStyle(Widget widget, BorderStyleValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderTopStyle", value.getCssValue()); + }
// sets the border-right-style style property of this element by using the GWT DOM class - public abstract void setBorderRightStyle(Widget widget, BorderStyleValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; + public void setBorderRightStyle(Widget widget, BorderStyleValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderRightStyle", value.getCssValue()); + }
// sets the border-bottom-style style property of this element by using the GWT DOM class - public abstract void setBorderBottomStyle(Widget widget, BorderStyleValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; + public void setBorderBottomStyle(Widget widget, BorderStyleValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderBottomStyle", value.getCssValue()); + }
// sets the border-left-style style property of this element by using the GWT DOM class - public abstract void setBorderLeftStyle(Widget widget, BorderStyleValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; - + public void setBorderLeftStyle(Widget widget, BorderStyleValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderLeftStyle", value.getCssValue()); + }
+ // sets the border-width style property of this element by using the GWT DOM class - public abstract void setBorderWidth(Widget widget, AbsoluteNumValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; - + public void setBorderWidth(Widget widget, AbsoluteNumValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderWidth", value.getCssValue()); + }
- // sets the border-width style property of this element by using the GWT DOM class - public abstract void setBorderTopWidth(Widget widget, AbsoluteNumValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; -
// sets the border-width style property of this element by using the GWT DOM class - public abstract void setBorderRightWidth(Widget widget, AbsoluteNumValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; - + public void setBorderTopWidth(Widget widget, AbsoluteNumValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderTopWidth", value.getCssValue()); + }
- // sets the border-width style property of this element by using the GWT DOM class - public abstract void setBorderBottomWidth(Widget widget, AbsoluteNumValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; + // sets the border-width style property of this element by using the GWT DOM class@Override + public void setBorderRightWidth(Widget widget, AbsoluteNumValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderRightWidth", value.getCssValue()); + }
// sets the border-width style property of this element by using the GWT DOM class - public abstract void setBorderLeftWidth(Widget widget, AbsoluteNumValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; + public void setBorderBottomWidth(Widget widget, AbsoluteNumValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderBottomWidth", value.getCssValue()); + }
+ // sets the border-width style property of this element by using the GWT DOM class + public void setBorderLeftWidth(Widget widget, AbsoluteNumValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderLeftWidth", value.getCssValue()); + } + + // sets the border-radius style property of this element by using the GWT DOM class - public abstract void setBorderRadius(Widget widget, NumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; + public void setBorderRadius(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderRadius", value.getCssValue()); + }
// sets the border-top-right-radius style property of this element by using the GWT DOM class - public abstract void setBorderTopRightRadius(Widget widget, NumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; + public void setBorderTopRightRadius(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderTopRightRadius", value.getCssValue()); + }
// sets the border-bottom-right-radius style property of this element by using the GWT DOM class - public abstract void setBorderBottomRightRadius(Widget widget, NumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; + public void setBorderBottomRightRadius(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderBottomRightRadius", value.getCssValue()); + }
// sets the border-bottom-left-radius style property of this element by using the GWT DOM class - public abstract void setBorderBottomLeftRadius(Widget widget, NumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; + public void setBorderBottomLeftRadius(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderBottomLeftRadius", value.getCssValue()); + }
// sets the border-top-left-radius style property of this element by using the GWT DOM class - public abstract void setBorderTopLeftRadius(Widget widget, NumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; - - + public void setBorderTopLeftRadius(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderTopLeftRadius", value.getCssValue()); + } + + + // sets the padding style property of this element by using the GWT DOM class - public abstract void setPadding(Widget widget, NumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; + public void setPadding(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "padding", value.getCssValue()); + }
// sets the padding-top style property of this element by using the GWT DOM class - public abstract void setPaddingTop(Widget widget, NumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; + public void setPaddingTop(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "paddingTop", value.getCssValue()); + }
// sets the padding-right style property of this element by using the GWT DOM class - public abstract void setPaddingRight(Widget widget, NumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; + public void setPaddingRight(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "paddingRight", value.getCssValue()); + }
// sets the padding-bottom style property of this element by using the GWT DOM class - public abstract void setPaddingBottom(Widget widget, NumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; + public void setPaddingBottom(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "paddingBottom", value.getCssValue()); + }
// sets the padding-left style property of this element by using the GWT DOM class - public abstract void setPaddingLeft(Widget widget, NumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; - + public void setPaddingLeft(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "paddingLeft", value.getCssValue()); + } + +
+ + // sets the width style property of this element by using the GWT DOM class - public abstract void setWidth(Widget widget, AutoNumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; + public void setWidth(Widget widget, AutoNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "width", value.getCssValue()); + }
// sets the min-width style property of this element by using the GWT DOM class - public abstract void setMinWidth(Widget widget, AutoNumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; + public void setMinWidth(Widget widget, AutoNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "minWidth", value.getCssValue()); + }
// sets the max-width style property of this element by using the GWT DOM class - public abstract void setMaxWidth(Widget widget, AutoNumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; + public void setMaxWidth(Widget widget, AutoNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "maxWidth", value.getCssValue()); + }
// sets the height style property of this element by using the GWT DOM class - public abstract void setHeight(Widget widget, AutoNumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; + public void setHeight(Widget widget, AutoNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "height", value.getCssValue()); + }
// sets the min-height style property of this element by using the GWT DOM class - public abstract void setMinHeight(Widget widget, AutoNumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; + public void setMinHeight(Widget widget, AutoNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "minHeight", value.getCssValue()); + }
// sets the max-height style property of this element by using the GWT DOM class - public abstract void setMaxHeight(Widget widget, AutoNumUnitValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; - - + public void setMaxHeight(Widget widget, AutoNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "maxHeight", value.getCssValue()); + } + + // sets the cursor style property of this element by using the GWT DOM class - public abstract void setCursor(Widget widget, CursorValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; + public void setCursor(Widget widget, CursorValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "cursor", value.getCssValue()); + }
// sets the background-color style property of this element by using the GWT DOM class - public abstract void setBackgroundColor(Widget widget, ColorValue value, String styleClass)throws InvalidGdlSchemaException, ExecutionException; - + public void setBackgroundColor(Widget widget, ColorValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "backgroundColor", value.getCssValue()); + } + // 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 @@ -1304,7 +1396,79 @@ throw new InvalidGdlSchemaException("GDL defines only the style classes " + values + ", but found " + styleClass); } } + + + // sets a given css property and css value of this element's sub element + protected void setCssProperty(Widget elem, String styleClass, String cssProperty, String cssValue)throws InvalidGdlSchemaException, ExecutionException{ + if(cssValue == null || cssProperty == null) return;
+ if(styleClass == null){ + DOM.setStyleAttribute(elem.getElement(), cssProperty, cssValue); + } else if(styleClass.equals(GdlPsis.Scope.gdlActive)){ + this.activeCssNamesAndStyles.add(new Pair<String, String>(cssProperty, cssValue)); + } else if(styleClass.equals(GdlPsis.Scope.gdlFocus)){ + this.focusCssNamesAndStyles.add(new Pair<String, String>(cssProperty, cssValue)); + } else if (styleClass.equals(GdlPsis.Scope.gdlHover)){ + this.hoverCssNamesAndStyles.add(new Pair<String, String>(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); + } + } + + + // sets all GDL styles that are defined by the topic map representative to tha passed widget + public void setGdlStyle(Widget widget) throws InvalidGdlSchemaException, ExecutionException { + this.setContentOrientation(widget, this.getContentOrientation()); + + String[] styleClasses = new String[]{null, GdlPsis.Scope.gdlActive, GdlPsis.Scope.gdlFocus, GdlPsis.Scope.gdlHover}; + for (String styleClass : styleClasses) { + this.setVerticalAlign(widget, this.getVerticalAlign(styleClass), styleClass); + + this.setMargin(widget, this.getMargin(styleClass), styleClass); + this.setMarginTop(widget, this.getMarginTop(styleClass), styleClass); + this.setMarginRight(widget, this.getMarginRight(styleClass), styleClass); + this.setMarginBottom(widget, this.getMarginBottom(styleClass), styleClass); + this.setMarginLeft(widget, this.getMarginLeft(styleClass), styleClass); + + this.setBorderColor(widget, this.getBorderColor(styleClass), styleClass); + this.setBorderTopColor(widget, this.getBorderTopColor(styleClass), styleClass); + this.setBorderRightColor(widget, this.getBorderRightColor(styleClass), styleClass); + this.setBorderBottomColor(widget, this.getBorderBottomColor(styleClass), styleClass); + this.setBorderLeftColor(widget, this.getBorderLeftColor(styleClass), styleClass); + + this.setBorderStyle(widget, this.getBorderStyle(styleClass), styleClass); + this.setBorderTopStyle(widget, this.getBorderTopStyle(styleClass), styleClass); + this.setBorderRightStyle(widget, this.getBorderRightStyle(styleClass), styleClass); + this.setBorderBottomStyle(widget, this.getBorderBottomStyle(styleClass), styleClass); + this.setBorderLeftStyle(widget, this.getBorderLeftStyle(styleClass), styleClass); + + this.setBorderWidth(widget, this.getBorderWidth(styleClass), styleClass); + this.setBorderTopWidth(widget, this.getBorderTopWidth(styleClass), styleClass); + this.setBorderRightWidth(widget, this.getBorderRightWidth(styleClass), styleClass); + this.setBorderBottomWidth(widget, this.getBorderBottomWidth(styleClass), styleClass); + this.setBorderLeftWidth(widget, this.getBorderLeftWidth(styleClass), styleClass); + + this.setBorderRadius(widget, this.getBorderRadius(styleClass), styleClass); + this.setBorderTopRightRadius(widget, this.getBorderTopRightRadius(styleClass), styleClass); + this.setBorderBottomRightRadius(widget, this.getBorderBottomRightRadius(styleClass), styleClass); + this.setBorderBottomLeftRadius(widget, this.getBorderBottomLeftRadius(styleClass), styleClass); + this.setBorderTopLeftRadius(widget, this.getBorderTopLeftRadius(styleClass), styleClass); + + this.setCursor(widget, this.getCursor(styleClass), styleClass); + + this.setWidth(widget, this.getWidth(styleClass), styleClass); + this.setMaxWidth(widget, this.getMaxWidth(styleClass), styleClass); + this.setMinWidth(widget, this.getMinWidth(styleClass), styleClass); + + this.setHeight(widget, this.getHeight(styleClass), styleClass); + this.setMaxHeight(widget, this.getMaxHeight(styleClass), styleClass); + this.setMinHeight(widget, this.getMinHeight(styleClass), styleClass); + + this.setBackgroundColor(widget, this.getBackgroundColor(styleClass), styleClass); + } + } +
// sets all GDL styles that are defined by the topic map representative protected void setGdlStyle() throws InvalidGdlSchemaException, ExecutionException { @@ -1317,59 +1481,232 @@
// registers a click handler to all sub-elements of this element @Override - public abstract MultipleHandlerRegistration addClickHandler(ClickHandler handler); + public MultipleHandlerRegistration addClickHandler(ClickHandler handler) { + MultipleHandlerRegistration regs = new MultipleHandlerRegistration(); + for (Widget item : this.subElements) { + regs.addHandlerRegistration(((TextArea)item).addClickHandler(handler)); + } + return regs; + }
// registers a mouse-out handler to all sub-elements of this element @Override - public abstract MultipleHandlerRegistration addMouseOutHandler(MouseOutHandler handler); + public MultipleHandlerRegistration addMouseOutHandler(MouseOutHandler handler){ + MultipleHandlerRegistration regs = new MultipleHandlerRegistration(); + for (Widget item : this.subElements) { + regs.addHandlerRegistration(((TextArea)item).addMouseOutHandler(handler)); + } + return regs; + }
// registers a mouse-over handler to all sub-elements of this element @Override - public abstract MultipleHandlerRegistration addMouseOverHandler(MouseOverHandler handler); + public MultipleHandlerRegistration addMouseOverHandler(MouseOverHandler handler){ + MultipleHandlerRegistration regs = new MultipleHandlerRegistration(); + for (Widget item : this.subElements) { + regs.addHandlerRegistration(((TextArea)item).addMouseOverHandler(handler)); + } + return regs; + }
// registers a focus handler to all sub-elements of this element @Override - public abstract MultipleHandlerRegistration addFocusHandler(FocusHandler handler); + public MultipleHandlerRegistration addFocusHandler(FocusHandler handler){ + MultipleHandlerRegistration regs = new MultipleHandlerRegistration(); + for (Widget item : this.subElements) { + regs.addHandlerRegistration(((TextArea)item).addFocusHandler(handler)); + } + return regs; + } // registers a mouse-down handler to all sub-elements of this element @Override - public abstract MultipleHandlerRegistration addMouseDownHandler(MouseDownHandler handler); + public MultipleHandlerRegistration addMouseDownHandler(MouseDownHandler handler){ + MultipleHandlerRegistration regs = new MultipleHandlerRegistration(); + for (Widget item : this.subElements) { + regs.addHandlerRegistration(((TextArea)item).addMouseDownHandler(handler)); + } + return regs; + } // registers a mouse-up handler to all sub-elements of this element @Override - public abstract MultipleHandlerRegistration addMouseUpHandler(MouseUpHandler handler); + public MultipleHandlerRegistration addMouseUpHandler(MouseUpHandler handler){ + MultipleHandlerRegistration regs = new MultipleHandlerRegistration(); + for (Widget item : this.subElements) { + regs.addHandlerRegistration(((TextArea)item).addMouseUpHandler(handler)); + } + return regs; + } + // registers a blur handler to all sub-elements of this element @Override - public abstract MultipleHandlerRegistration addBlurHandler(BlurHandler handler); + public MultipleHandlerRegistration addBlurHandler(BlurHandler handler){ + MultipleHandlerRegistration regs = new MultipleHandlerRegistration(); + for (Widget item : this.subElements) { + regs.addHandlerRegistration(((TextArea)item).addBlurHandler(handler)); + } + return regs; + } - // shall be called, if a sub-element of this element is hovered - public abstract void onHoverStart(@SuppressWarnings("rawtypes") DomEvent event, HoverStyleHandler handler); + // adds the passed handler to the list eventHandlers + private void addEventHandler(TextArea elem, EventHandler handler){ + if(handler == null || elem == null) return; + + for (Pair<TextArea, ArrayList<EventHandler>> item : this.eventHandlers) { + if(item.getFirst().equals(elem)){ + item.getSecond().add(handler); + return; + } + } + ArrayList<EventHandler> newHandlerList = new ArrayList<EventHandler>(); + newHandlerList.add(handler); + this.eventHandlers.add(new Pair<TextArea, ArrayList<EventHandler>>(elem, newHandlerList)); + } - // shall be called, if a sub-element of this element is hovered - public abstract void onHoverEnd(@SuppressWarnings("rawtypes") DomEvent event, HoverStyleHandler handler); + // remove the passed handler of the list eventHandlers + private void removeEventHandler(TextArea elem, EventHandler handler){ + for (Pair<TextArea, ArrayList<EventHandler>> item : this.eventHandlers) { + if(item.getFirst().equals(elem)){ + for (EventHandler handlerItem : item.getSecond()) { + if(handlerItem.equals(handler)){ + item.getSecond().remove(handlerItem); + return; + } + } + } + } + } + + + // returns the last handler bound to the passed element. + private EventHandler getLastHandler(TextArea elem){ + for (Pair<TextArea, ArrayList<EventHandler>> item : this.eventHandlers) { + if(item.getFirst().equals(elem)){ + int idx = item.getSecond().size() - 1; + if(idx >= 0){ + return item.getSecond().get(idx); + } + } + } + + return null; + } + // applies the styles bound to hover and the passed element + private void onHoverStart(Widget widget){ + for (Pair<String, String> elem : this.hoverCssNamesAndStyles) { + DOM.setStyleAttribute(widget.getElement(), elem.getFirst(), elem.getSecond()); + } + } - // shall be called, if a sub-element of this element is focused - public abstract void onFocusStart(@SuppressWarnings("rawtypes") DomEvent event, FocusStyleHandler handler); + // applies the styles bound to acitve and the passed element + private void onActiveStart(Widget widget){ + for (Pair<String, String> elem : this.activeCssNamesAndStyles) { + DOM.setStyleAttribute(widget.getElement(), elem.getFirst(), elem.getSecond()); + } + } - // shall be called, if a sub-element of this element is focused - public abstract void onFocusEnd(@SuppressWarnings("rawtypes") DomEvent event, FocusStyleHandler handler); + // applies the styles bound to focus and the passed element + private void onFocusStart(Widget widget){ + for (Pair<String, String> elem : this.focusCssNamesAndStyles) { + DOM.setStyleAttribute(widget.getElement(), elem.getFirst(), elem.getSecond()); + } + } - // shall be called, if a sub-element of this element is focused - public abstract void onActiveStart(@SuppressWarnings("rawtypes") DomEvent event, ActiveStyleHandler handler); + // some handler for applying the css style bound to the pseudo classes hover, active and focus + public void onHoverStart(MouseOverEvent event, HoverStyleHandler handler) { + TextArea source = (TextArea)event.getSource(); + this.addEventHandler(source, handler); + for (Pair<String, String> elem : this.hoverCssNamesAndStyles) { + DOM.setStyleAttribute(source.getElement(), elem.getFirst(), elem.getSecond()); + } + } + - // shall be called, if a sub-element of this element is focused - public abstract void onActiveEnd(@SuppressWarnings("rawtypes") DomEvent event, ActiveStyleHandler handler); + // shall be called when the focus event was fired + public void onHoverEnd(MouseOutEvent event, HoverStyleHandler handler) { + try{ + TextArea source = (TextArea)event.getSource(); + this.removeEventHandler(source, handler); + EventHandler lastHandler = this.getLastHandler(source); + if(lastHandler == null){ + this.setGdlStyle(source); + }else { + if(lastHandler.getClass().equals(ActiveStyleHandler.class)) this.onActiveStart(source); + else this.onFocusStart(source); + } + }catch(Exception e){ + Window.alert("could not apply the default CSS style >> " + e.getClass() + " >> " + e.getMessage()); + e.printStackTrace(); + } + } + + + // shall be called to apply the styles of the focus class + public void onFocusStart(FocusEvent event, FocusStyleHandler handler) { + TextArea source = (TextArea)event.getSource(); + this.addEventHandler(source, handler); + for (Pair<String, String> elem : this.focusCssNamesAndStyles) { + DOM.setStyleAttribute(source.getElement(), elem.getFirst(), elem.getSecond()); + } + } + + + // shall be called when the blur event was fired + public void onFocusEnd(BlurEvent event, FocusStyleHandler handler) { + try{ + TextArea source = (TextArea)event.getSource(); + this.removeEventHandler(source, handler); + EventHandler lastHandler = this.getLastHandler(source); + if(lastHandler == null){ + this.setGdlStyle(source); + }else { + if(lastHandler.getClass().equals(ActiveStyleHandler.class)) this.onActiveStart(source); + else this.onHoverStart(source); + } + }catch(Exception e){ + Window.alert("could not apply the default CSS style >> " + e.getClass() + " >> " + e.getMessage()); + } + } + + + // shall be called to apply the styles of the sctive class + public void onActiveStart(MouseDownEvent event, ActiveStyleHandler handler) { + TextArea source = (TextArea)event.getSource(); + this.addEventHandler(source, handler); + for (Pair<String, String> elem : this.activeCssNamesAndStyles) { + DOM.setStyleAttribute(source.getElement(), elem.getFirst(), elem.getSecond()); + } + } + + + // shall be called to apply the styles of the focus class + public void onActiveEnd(MouseUpEvent event, ActiveStyleHandler handler) { + try{ + TextArea source = (TextArea)event.getSource(); + this.removeEventHandler(source, handler); + EventHandler lastHandler = this.getLastHandler(source); + if(lastHandler == null){ + this.setGdlStyle(source); + }else { + if(lastHandler.getClass().equals(HoverStyleHandler.class)) this.onHoverStart(source); + else this.onFocusStart(source); + } + }catch(Exception e){ + Window.alert("could not apply the default CSS style >> " + e.getClass() + " >> " + e.getMessage()); + } + } }
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 Wed Jul 6 13:36:01 2011 (r572) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Thu Jul 7 00:58:04 2011 (r573) @@ -80,6 +80,8 @@ Topic gdlReadonly = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlReadonly)); Topic gdlResize = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlResize)); Topic gdlTextDecoration = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlTextDecoration)); + Topic gdlDisplay = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlDisplay)); + Topic gdlContentOrientation = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator(GdlPsis.OccurrenceType.gdlContentOrientation)); tmpRepresentative.createOccurrence(gdlId, "ID_1", null); tmpRepresentative.createOccurrence(gdlBackgroundColor, "red", null); @@ -101,6 +103,8 @@ tmpRepresentative.createOccurrence(gdlResize, "both", null); tmpRepresentative.createOccurrence(gdlFontSize, "15pt", null); tmpRepresentative.createOccurrence(gdlTextDecoration, "underline", null); + tmpRepresentative.createOccurrence(gdlDisplay, "inline", null); + tmpRepresentative.createOccurrence(gdlContentOrientation, "horizontal", null); Occurrence bgcHover = tmpRepresentative.createOccurrence(gdlBackgroundColor, "green", null); bgcHover.addTheme(gdlHover); Occurrence bgcActive = tmpRepresentative.createOccurrence(gdlBackgroundColor, "purple", null);
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 13:36:01 2011 (r572) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java Thu Jul 7 00:58:04 2011 (r573) @@ -1,22 +1,11 @@ package us.isidor.gdl.anaToMia.Widgets.text;
import java.util.ArrayList; -import com.google.gwt.dom.client.Style.FontStyle; -import com.google.gwt.dom.client.Style.VerticalAlign; -import com.google.gwt.event.dom.client.BlurHandler; -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.event.dom.client.DomEvent; -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.EventHandler; 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 com.google.gwt.user.client.ui.Widget; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence; @@ -29,31 +18,19 @@ import us.isidor.gdl.anaToMia.Widgets.environment.FocusStyleHandler; import us.isidor.gdl.anaToMia.Widgets.environment.HoverStyleHandler; 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.BorderStyleValue; import us.isidor.gdl.anaToMia.Widgets.values.ColorValue; -import us.isidor.gdl.anaToMia.Widgets.values.ContentOrientationValue; -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{ - protected ArrayList<TextArea> textElements = new ArrayList<TextArea>(); protected ArrayList<PasswordKeyPressHandler> passwordKeyPressHandler = null; protected ArrayList<HandlerRegistration> passwordKeyPressRegistrations = null; - protected ArrayList<Pair<TextArea, ArrayList<EventHandler>>> eventHandlers = new ArrayList<Pair<TextArea, ArrayList<EventHandler>>>(); // some constructors @@ -66,6 +43,7 @@ super(tmRepresentative); // TODO: create a text element for each TM-elem this.createNewTextArea(); // TODO: remove only for debugging + this.createNewTextArea(); // TODO: remove only for debugging } @@ -73,7 +51,7 @@ // and applies the styles on it protected TextArea createNewTextArea() throws InvalidGdlSchemaException, ExecutionException { TextArea elem = new TextArea(); - DOM.setElementAttribute(elem.getElement(), "id", this.getId() + "__GDL_" + this.textElements.size()); + DOM.setElementAttribute(elem.getElement(), "id", this.getId() + "__GDL_" + this.subElements.size()); this.setGdlStyle((Widget)elem); ActiveStyleHandler asHandler = new ActiveStyleHandler(this); FocusStyleHandler fsHandler = new FocusStyleHandler(this); @@ -84,7 +62,7 @@ elem.addMouseOutHandler(hsHandler); elem.addFocusHandler(fsHandler); elem.addBlurHandler(fsHandler); - this.textElements.add(elem); + this.subElements.add(elem); super.mainPanel.add(elem); return elem; } @@ -98,7 +76,7 @@ break; } } - this.textElements.remove(elem); + this.subElements.remove(elem); elem.removeFromParent(); } @@ -520,25 +498,6 @@ } - // sets a given css property and css value of this element's text area element - private void setCssProperty(TextArea elem, String styleClass, String cssProperty, String cssValue)throws InvalidGdlSchemaException, ExecutionException{ - if(cssValue == null || cssProperty == null) return; - - if(styleClass == null){ - DOM.setStyleAttribute(elem.getElement(), cssProperty, cssValue); - } else if(styleClass.equals(GdlPsis.Scope.gdlActive)){ - super.activeCssNamesAndStyles.add(new Pair<String, String>(cssProperty, cssValue)); - } else if(styleClass.equals(GdlPsis.Scope.gdlFocus)){ - super.focusCssNamesAndStyles.add(new Pair<String, String>(cssProperty, cssValue)); - } else if (styleClass.equals(GdlPsis.Scope.gdlHover)){ - super.hoverCssNamesAndStyles.add(new Pair<String, String>(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); - } - } - - // sets the resize style property. // If gdl:readonly is set to true, this property is set to none, i.e. the passed value is ignored. // IF gdl:readonly is set to false, this property is set to the passed argument. @@ -565,9 +524,9 @@ this.passwordKeyPressHandler = new ArrayList<PasswordKeyPressHandler>(); this.passwordKeyPressRegistrations = new ArrayList<HandlerRegistration>(); - for (TextArea item : this.textElements) { + for (Widget item : this.subElements) { PasswordKeyPressHandler handler = new PasswordKeyPressHandler(); - this.passwordKeyPressRegistrations.add(item.addKeyPressHandler(handler)); + this.passwordKeyPressRegistrations.add(((TextArea)item).addKeyPressHandler(handler)); } } }else { @@ -600,481 +559,25 @@ // cols is only treated if width is not set if(widthOcc == null) DOM.setElementAttribute(widget.getElement(), "cols", String.valueOf(value)); } - - - @Override - public void setDirection(Widget widget, DirectionValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "direction", value.getCssValue()); - } - - - @Override - public void setTextAlign(Widget widget, TextAlignValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "textAlign", value.getCssValue()); - } - - - @Override - public void setLineHeight(Widget widget, NormalNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "lineHeight", value.getCssValue()); - } - - - @Override - public void setTextDecoration(Widget widget, TextDecorationValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "textDecoration", value.getCssValue()); - } - - - @Override - public void setColor(Widget widget, ColorValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "color", value.getCssValue()); - } - - - @Override - public void setFontFamily(Widget widget, String value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "fontFamily", value); - } - - - @Override - public void setFontStyle(Widget widget, FontStyle value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "fontStyle", value.getCssName()); - } - - - @Override - public void setFontSize(Widget widget, PositiveNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "fontSize", value.getCssValue()); - } - - - @Override - public void setFontWeight(Widget widget, FontWeightValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "fontWeight", value.getCssValue()); - } - - - @Override - public void setLetterSpacing(Widget widget, NormalNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "letterSpacing", value.getCssValue()); - } - - - @Override - public void setWordSpacing(Widget widget, NormalNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "wordSpacing", value.getCssValue()); - } - - - @Override - public void setContentOrientation(Widget widget, ContentOrientationValue value) throws InvalidGdlSchemaException, ExecutionException { - String valueStr = "inline"; - if(value != null && value == ContentOrientationValue.Vertical) valueStr = "block"; - this.setCssProperty((TextArea)widget, null, "display", valueStr); - } - - - @Override - public void setMargin(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "margin", value.getCssValue()); - } - - - @Override - public void setMarginTop(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "marginTop", value.getCssValue()); - } - - - @Override - public void setMarginRight(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "marginRight", value.getCssValue()); - } - - - @Override - public void setMarginBottom(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "marginBottom", value.getCssValue()); - } - - - @Override - public void setMarginLeft(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "marginLeft", value.getCssValue()); - } - - - @Override - public void setBorderColor(Widget widget, ColorValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderColor", value.getCssValue()); - } - - - @Override - public void setBorderTopColor(Widget widget, ColorValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderTopColor", value.getCssValue()); - } - - - @Override - public void setBorderRightColor(Widget widget, ColorValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderRightColor", value.getCssValue()); - } - - - @Override - public void setBorderBottomColor(Widget widget, ColorValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderBottomColor", value.getCssValue()); - } - - - @Override - public void setBorderLeftColor(Widget widget, ColorValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderLeftColor", value.getCssValue()); - } - - - @Override - public void setBorderStyle(Widget widget, BorderStyleValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderStyle", value.getCssValue()); - } - - - @Override - public void setBorderTopStyle(Widget widget, BorderStyleValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderTopStyle", value.getCssValue()); - } - - - @Override - public void setBorderRightStyle(Widget widget, BorderStyleValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderRightStyle", value.getCssValue()); - } - - - @Override - public void setBorderBottomStyle(Widget widget, BorderStyleValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderBottomStyle", value.getCssValue()); - } - - - @Override - public void setBorderLeftStyle(Widget widget, BorderStyleValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderLeftStyle", value.getCssValue()); - } - - - @Override - public void setBorderWidth(Widget widget, AbsoluteNumValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderWidth", value.getCssValue()); - } - - - @Override - public void setBorderTopWidth(Widget widget, AbsoluteNumValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderTopWidth", value.getCssValue()); - } - - - @Override - public void setBorderRightWidth(Widget widget, AbsoluteNumValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderRightWidth", value.getCssValue()); - } - - - @Override - public void setBorderBottomWidth(Widget widget, AbsoluteNumValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderBottomWidth", value.getCssValue()); - } - - - @Override - public void setBorderLeftWidth(Widget widget, AbsoluteNumValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderLeftWidth", value.getCssValue()); - } - - - @Override - public void setBorderRadius(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderRadius", value.getCssValue()); - } - - - @Override - public void setBorderTopRightRadius(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderTopRightRadius", value.getCssValue()); - } - - - @Override - public void setBorderBottomRightRadius(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderBottomRightRadius", value.getCssValue()); - } - - - @Override - public void setBorderBottomLeftRadius(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderBottomLeftRadius", value.getCssValue()); - } - - - @Override - public void setBorderTopLeftRadius(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderTopLeftRadius", value.getCssValue()); - } - - - @Override - public void setPadding(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "padding", value.getCssValue()); - } - - - @Override - public void setPaddingTop(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "paddingTop", value.getCssValue()); - } - - - @Override - public void setPaddingRight(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "paddingRight", value.getCssValue()); - } - - - @Override - public void setPaddingBottom(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "paddingBottom", value.getCssValue()); - } - - - @Override - public void setPaddingLeft(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "paddingLeft", value.getCssValue()); - } - - - @Override - public void setWidth(Widget widget, AutoNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "width", value.getCssValue()); - } - - - @Override - public void setMinWidth(Widget widget, AutoNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "minWidth", value.getCssValue()); - } - - - @Override - public void setMaxWidth(Widget widget, AutoNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "maxWidth", value.getCssValue()); - } - - - @Override - public void setHeight(Widget widget, AutoNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "height", value.getCssValue()); - } - - - @Override - public void setMinHeight(Widget widget, AutoNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "minHeight", value.getCssValue()); - } - - - @Override - public void setMaxHeight(Widget widget, AutoNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "maxHeight", value.getCssValue()); - } - - - @Override - public void setCursor(Widget widget, CursorValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "cursor", value.getCssValue()); - } - - - @Override - public void setBackgroundColor(Widget widget, ColorValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "backgroundColor", value.getCssValue()); - }
- public void setVerticalAlign(Widget widget, VerticalAlign value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null){ - this.setCssProperty((TextArea) widget, styleClass, "verticalAlign", value.getCssName()); - super.setCssProperty(styleClass, "verticalAlign", value.getCssName()); - } - } - - - public void setGdlStyle(Widget widget) throws InvalidGdlSchemaException, ExecutionException { - this.setContentOrientation(widget, this.getContentOrientation()); - - String[] styleClasses = new String[]{null, GdlPsis.Scope.gdlActive, GdlPsis.Scope.gdlFocus, GdlPsis.Scope.gdlHover}; - for (String styleClass : styleClasses) { - this.setReadonly(widget, this.getReadonly()); - this.setResize(widget, this.getResize()); - this.setTextType(this.getTextType()); - this.setRows(widget, this.getRows()); - this.setCols(widget, this.getCols()); - - this.setVerticalAlign(widget, this.getVerticalAlign(styleClass), styleClass); - - this.setMargin(widget, this.getMargin(styleClass), styleClass); - this.setMarginTop(widget, this.getMarginTop(styleClass), styleClass); - this.setMarginRight(widget, this.getMarginRight(styleClass), styleClass); - this.setMarginBottom(widget, this.getMarginBottom(styleClass), styleClass); - this.setMarginLeft(widget, this.getMarginLeft(styleClass), styleClass); - - this.setBorderColor(widget, this.getBorderColor(styleClass), styleClass); - this.setBorderTopColor(widget, this.getBorderTopColor(styleClass), styleClass); - this.setBorderRightColor(widget, this.getBorderRightColor(styleClass), styleClass); - this.setBorderBottomColor(widget, this.getBorderBottomColor(styleClass), styleClass); - this.setBorderLeftColor(widget, this.getBorderLeftColor(styleClass), styleClass); - - this.setBorderStyle(widget, this.getBorderStyle(styleClass), styleClass); - this.setBorderTopStyle(widget, this.getBorderTopStyle(styleClass), styleClass); - this.setBorderRightStyle(widget, this.getBorderRightStyle(styleClass), styleClass); - this.setBorderBottomStyle(widget, this.getBorderBottomStyle(styleClass), styleClass); - this.setBorderLeftStyle(widget, this.getBorderLeftStyle(styleClass), styleClass); - - this.setBorderWidth(widget, this.getBorderWidth(styleClass), styleClass); - this.setBorderTopWidth(widget, this.getBorderTopWidth(styleClass), styleClass); - this.setBorderRightWidth(widget, this.getBorderRightWidth(styleClass), styleClass); - this.setBorderBottomWidth(widget, this.getBorderBottomWidth(styleClass), styleClass); - this.setBorderLeftWidth(widget, this.getBorderLeftWidth(styleClass), styleClass); - - this.setBorderRadius(widget, this.getBorderRadius(styleClass), styleClass); - this.setBorderTopRightRadius(widget, this.getBorderTopRightRadius(styleClass), styleClass); - this.setBorderBottomRightRadius(widget, this.getBorderBottomRightRadius(styleClass), styleClass); - this.setBorderBottomLeftRadius(widget, this.getBorderBottomLeftRadius(styleClass), styleClass); - this.setBorderTopLeftRadius(widget, this.getBorderTopLeftRadius(styleClass), styleClass); - - this.setCursor(widget, this.getCursor(styleClass), styleClass); - - this.setWidth(widget, this.getWidth(styleClass), styleClass); - this.setMaxWidth(widget, this.getMaxWidth(styleClass), styleClass); - this.setMinWidth(widget, this.getMinWidth(styleClass), styleClass); - - this.setHeight(widget, this.getHeight(styleClass), styleClass); - this.setMaxHeight(widget, this.getMaxHeight(styleClass), styleClass); - this.setMinHeight(widget, this.getMinHeight(styleClass), styleClass); - - this.setBackgroundColor(widget, this.getBackgroundColor(styleClass), styleClass); - this.setColor(widget, this.getColor(styleClass), styleClass); - - this.setDirection(widget, this.getDirection(styleClass), styleClass); - this.setTextAlign(widget, this.getTextAlign(styleClass), styleClass); - this.setLineHeight(widget, this.getLineHeight(styleClass), styleClass); - this.setTextDecoration(widget, this.getTextDecoration(styleClass), styleClass); - this.setFontFamily(widget, this.getFontFamily(styleClass), styleClass); - this.setFontStyle(widget, this.getFontStyle(styleClass), styleClass); - this.setFontSize(widget, this.getFontSize(styleClass), styleClass); - this.setFontWeight(widget, this.getFontWeight(styleClass), styleClass); - this.setLetterSpacing(widget, this.getLetterSpacing(styleClass), styleClass); - this.setWordSpacing(widget, this.getWordSpacing(styleClass), styleClass); - } - } - - // calls the super applies the GdlStyle for eaver TextAre item of this instance + // calls the super applies the GdlStyle for every TextArea item of this instance @Override protected void setGdlStyle() throws InvalidGdlSchemaException, ExecutionException{ - if(this.textElements != null){ - for (TextArea item : this.textElements) { - this.setGdlStyle((Widget)item); + if(this.subElements != null){ + for (Widget item : this.subElements) { + this.setGdlStyle(item); } } } - // registers a passed mouse down handler to each text element of this item - @Override - public MultipleHandlerRegistration addMouseDownHandler(MouseDownHandler handler){ - MultipleHandlerRegistration regs = new MultipleHandlerRegistration(); - for (TextArea item : this.textElements) { - regs.addHandlerRegistration(item.addMouseDownHandler(handler)); - } - return regs; - } - - - // registers a passed mouse up handler to each text element of this item - @Override - public MultipleHandlerRegistration addMouseUpHandler(MouseUpHandler handler){ - MultipleHandlerRegistration regs = new MultipleHandlerRegistration(); - for (TextArea item : this.textElements) { - regs.addHandlerRegistration(item.addMouseUpHandler(handler)); - } - return regs; - } - - - // registers a passed focus handler to each text element of this item - @Override - public MultipleHandlerRegistration addFocusHandler(FocusHandler handler){ - MultipleHandlerRegistration regs = new MultipleHandlerRegistration(); - for (TextArea item : this.textElements) { - regs.addHandlerRegistration(item.addFocusHandler(handler)); - } - return regs; - } - - - // registers a passed blur handler to each text element of this item - @Override - public MultipleHandlerRegistration addBlurHandler(BlurHandler handler){ - MultipleHandlerRegistration regs = new MultipleHandlerRegistration(); - for (TextArea item : this.textElements) { - regs.addHandlerRegistration(item.addBlurHandler(handler)); - } - return regs; - } - - - // registers a passed mouse out handler to each text element of this item - @Override - public MultipleHandlerRegistration addMouseOutHandler(MouseOutHandler handler){ - MultipleHandlerRegistration regs = new MultipleHandlerRegistration(); - for (TextArea item : this.textElements) { - regs.addHandlerRegistration(item.addMouseOutHandler(handler)); - } - return regs; - } - - - // registers a passed mouse over handler to each text element of this item - @Override - public MultipleHandlerRegistration addMouseOverHandler(MouseOverHandler handler){ - MultipleHandlerRegistration regs = new MultipleHandlerRegistration(); - for (TextArea item : this.textElements) { - regs.addHandlerRegistration(item.addMouseOverHandler(handler)); - } - return regs; - } - - - // registers a passed click handler to each text element of this item - @Override - public MultipleHandlerRegistration addClickHandler(ClickHandler handler) { - MultipleHandlerRegistration regs = new MultipleHandlerRegistration(); - for (TextArea item : this.textElements) { - regs.addHandlerRegistration(item.addClickHandler(handler)); - } - return regs; - } - - // returns the results of all text area elements @Override public ArrayList<String> getStringValue() { ArrayList<String> results = new ArrayList<String>(); - for (TextArea item : this.textElements) { - results.add(item.getValue()); + for (Widget item : this.subElements) { + results.add(((TextArea)item).getValue()); } return results; } @@ -1092,162 +595,21 @@ // TODO: implement return false; } - - - // adds the passed handler to the list eventHandlers - private void addEventHandler(TextArea elem, EventHandler handler){ - if(handler == null || elem == null) return; - - for (Pair<TextArea, ArrayList<EventHandler>> item : this.eventHandlers) { - if(item.getFirst().equals(elem)){ - item.getSecond().add(handler); - return; - } - } - ArrayList<EventHandler> newHandlerList = new ArrayList<EventHandler>(); - newHandlerList.add(handler); - this.eventHandlers.add(new Pair<TextArea, ArrayList<EventHandler>>(elem, newHandlerList)); - } - - - // remove the passed handler of the list eventHandlers - private void removeEventHandler(TextArea elem, EventHandler handler){ - for (Pair<TextArea, ArrayList<EventHandler>> item : this.eventHandlers) { - if(item.getFirst().equals(elem)){ - for (EventHandler handlerItem : item.getSecond()) { - if(handlerItem.equals(handler)){ - item.getSecond().remove(handlerItem); - return; - } - } - } - } - } - - - // returns the last handler bound to the passed element. - private EventHandler getLastHandler(TextArea elem){ - for (Pair<TextArea, ArrayList<EventHandler>> item : this.eventHandlers) { - if(item.getFirst().equals(elem)){ - int idx = item.getSecond().size() - 1; - if(idx >= 0){ - return item.getSecond().get(idx); - } - } - } - - return null; - } - - - // applies the styles bound to hover and the passed element - private void onHoverStart(Widget widget){ - for (Pair<String, String> elem : this.hoverCssNamesAndStyles) { - DOM.setStyleAttribute(widget.getElement(), elem.getFirst(), elem.getSecond()); - } - } - // applies the styles bound to acitve and the passed element - private void onActiveStart(Widget widget){ - for (Pair<String, String> elem : this.activeCssNamesAndStyles) { - DOM.setStyleAttribute(widget.getElement(), elem.getFirst(), elem.getSecond()); - } - } - - - // applies the styles bound to focus and the passed element - private void onFocusStart(Widget widget){ - for (Pair<String, String> elem : this.focusCssNamesAndStyles) { - DOM.setStyleAttribute(widget.getElement(), elem.getFirst(), elem.getSecond()); - } - } - - - // some handler for applying the css style bound to the pseudo classes hover, active and focus - @Override - public void onHoverStart(@SuppressWarnings("rawtypes") DomEvent event, HoverStyleHandler handler) { - TextArea source = (TextArea)event.getSource(); - this.addEventHandler(source, handler); - for (Pair<String, String> elem : this.hoverCssNamesAndStyles) { - DOM.setStyleAttribute(source.getElement(), elem.getFirst(), elem.getSecond()); - } - } - - - @Override - public void onHoverEnd(@SuppressWarnings("rawtypes") DomEvent event, HoverStyleHandler handler) { - try{ - TextArea source = (TextArea)event.getSource(); - this.removeEventHandler(source, handler); - EventHandler lastHandler = this.getLastHandler(source); - if(lastHandler == null){ - this.setGdlStyle(source); - }else { - if(lastHandler.getClass().equals(ActiveStyleHandler.class)) this.onActiveStart(source); - else this.onFocusStart(source); - } - }catch(Exception e){ - Window.alert("could not apply the default CSS style >> " + e.getClass() + " >> " + e.getMessage()); - e.printStackTrace(); - } - } - - - @Override - public void onFocusStart(@SuppressWarnings("rawtypes") DomEvent event, FocusStyleHandler handler) { - TextArea source = (TextArea)event.getSource(); - this.addEventHandler(source, handler); - for (Pair<String, String> elem : this.focusCssNamesAndStyles) { - DOM.setStyleAttribute(source.getElement(), elem.getFirst(), elem.getSecond()); - } - } - - + // sets the css properties, by calling the super class's method and the local + // method, which sets some specific properties for the GdlText instance @Override - public void onFocusEnd(@SuppressWarnings("rawtypes") DomEvent event, FocusStyleHandler handler) { - try{ - TextArea source = (TextArea)event.getSource(); - this.removeEventHandler(source, handler); - EventHandler lastHandler = this.getLastHandler(source); - if(lastHandler == null){ - this.setGdlStyle(source); - }else { - if(lastHandler.getClass().equals(ActiveStyleHandler.class)) this.onActiveStart(source); - else this.onHoverStart(source); - } - }catch(Exception e){ - Window.alert("could not apply the default CSS style >> " + e.getClass() + " >> " + e.getMessage()); - } - } - + public void setGdlStyle(Widget widget) throws InvalidGdlSchemaException, ExecutionException { + super.setGdlStyle(widget);
- @Override - public void onActiveStart(@SuppressWarnings("rawtypes") DomEvent event, ActiveStyleHandler handler) { - TextArea source = (TextArea)event.getSource(); - this.addEventHandler(source, handler); - for (Pair<String, String> elem : this.activeCssNamesAndStyles) { - DOM.setStyleAttribute(source.getElement(), elem.getFirst(), elem.getSecond()); - } + this.setReadonly(widget, this.getReadonly()); + this.setResize(widget, this.getResize()); + this.setTextType(this.getTextType()); + this.setRows(widget, this.getRows()); + this.setCols(widget, this.getCols()); }
- - @Override - public void onActiveEnd(@SuppressWarnings("rawtypes") DomEvent event, ActiveStyleHandler handler) { - try{ - TextArea source = (TextArea)event.getSource(); - this.removeEventHandler(source, handler); - EventHandler lastHandler = this.getLastHandler(source); - if(lastHandler == null){ - this.setGdlStyle(source); - }else { - if(lastHandler.getClass().equals(HoverStyleHandler.class)) this.onHoverStart(source); - else this.onFocusStart(source); - } - }catch(Exception e){ - Window.alert("could not apply the default CSS style >> " + e.getClass() + " >> " + e.getMessage()); - } - } // this class catches all keypress events and transforms the visible @@ -1264,9 +626,12 @@ realValue += (char)event.getCharCode() + ""; } - + public String getValue(){ return this.realValue; } } + + + // TODO: override setWidth when invoking by any StyleHandler => if resize is true => don't set the size to its origin, but to its last value }
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 Wed Jul 6 13:36:01 2011 (r572) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTextObject.java Thu Jul 7 00:58:04 2011 (r573) @@ -2,6 +2,7 @@
import com.google.gwt.dom.client.Style.FontStyle; +import com.google.gwt.user.client.ui.TextArea; import com.google.gwt.user.client.ui.Widget;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence; @@ -281,45 +282,86 @@
// sets the direction style property of this element by using the GWT DOM class - public abstract void setDirection(Widget widget, DirectionValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException; + public void setDirection(Widget widget, DirectionValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "direction", value.getCssValue()); + } // sets the text-align style property of this element by using the GWT DOM class - public abstract void setTextAlign(Widget widget, TextAlignValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException; + public void setTextAlign(Widget widget, TextAlignValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "textAlign", value.getCssValue()); + } // sets the line-height style property of this element by using the GWT DOM class - public abstract void setLineHeight(Widget widget, NormalNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException; + public void setLineHeight(Widget widget, NormalNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "lineHeight", value.getCssValue()); + } // sets the text-decoration style property of this element by using the GWT DOM class - public abstract void setTextDecoration(Widget widget, TextDecorationValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException; + public void setTextDecoration(Widget widget, TextDecorationValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "textDecoration", value.getCssValue()); + } // sets the color style property of this element by using the GWT DOM class - public abstract void setColor(Widget widget, ColorValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException; + public void setColor(Widget widget, ColorValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "color", value.getCssValue()); + } // sets the font-family style property of this element by using the GWT DOM class - public abstract void setFontFamily(Widget widget, String value, String styleClass) throws InvalidGdlSchemaException, ExecutionException; + public void setFontFamily(Widget widget, String value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "fontFamily", value); + } // sets the font-style style property of this element by using the GWT DOM class - public abstract void setFontStyle(Widget widget, FontStyle value, String styleClass) throws InvalidGdlSchemaException, ExecutionException; + public void setFontStyle(Widget widget, FontStyle value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "fontStyle", value.getCssName()); + } // sets the font-size style property of this element by using the GWT DOM class - public abstract void setFontSize(Widget widget, PositiveNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException; + public void setFontSize(Widget widget, PositiveNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "fontSize", value.getCssValue()); + } // sets the font-weight style property of this element by using the GWT DOM class - public abstract void setFontWeight(Widget widget, FontWeightValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException; + public void setFontWeight(Widget widget, FontWeightValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "fontWeight", value.getCssValue()); + } // sets the letter-spacing style property of this element by using the GWT DOM class - public abstract void setLetterSpacing(Widget widget, NormalNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException; - + public void setLetterSpacing(Widget widget, NormalNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "letterSpacing", value.getCssValue()); + } // sets the word-spacing style property of this element by using the GWT DOM class - public abstract void setWordSpacing(Widget widget, NormalNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException; + public void setWordSpacing(Widget widget, NormalNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null) this.setCssProperty((TextArea)widget, styleClass, "wordSpacing", value.getCssValue()); + } + + + public void setGdlStyle(Widget widget) throws InvalidGdlSchemaException, ExecutionException { + super.setGdlStyle(widget); + String[] styleClasses = new String[]{null, GdlPsis.Scope.gdlActive, GdlPsis.Scope.gdlFocus, GdlPsis.Scope.gdlHover}; + for (String styleClass : styleClasses) { + this.setColor(widget, this.getColor(styleClass), styleClass); + + this.setDirection(widget, this.getDirection(styleClass), styleClass); + this.setTextAlign(widget, this.getTextAlign(styleClass), styleClass); + this.setLineHeight(widget, this.getLineHeight(styleClass), styleClass); + this.setTextDecoration(widget, this.getTextDecoration(styleClass), styleClass); + this.setFontFamily(widget, this.getFontFamily(styleClass), styleClass); + this.setFontStyle(widget, this.getFontStyle(styleClass), styleClass); + this.setFontSize(widget, this.getFontSize(styleClass), styleClass); + this.setFontWeight(widget, this.getFontWeight(styleClass), styleClass); + this.setLetterSpacing(widget, this.getLetterSpacing(styleClass), styleClass); + this.setWordSpacing(widget, this.getWordSpacing(styleClass), styleClass); + } + } }
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ContentOrientationValue.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ContentOrientationValue.java Wed Jul 6 13:36:01 2011 (r572) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/values/ContentOrientationValue.java Thu Jul 7 00:58:04 2011 (r573) @@ -1,8 +1,8 @@ package us.isidor.gdl.anaToMia.Widgets.values;
public enum ContentOrientationValue implements CssValue{ - Horizontal, - Vertical; + HORIZONTAL, + VERTICAL;
@Override public String getCssValue() {
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 Wed Jul 6 13:36:01 2011 (r572) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlCreatorAssociationView.java Thu Jul 7 00:58:04 2011 (r573) @@ -384,40 +384,38 @@ }
- - @Override - public void onHoverStart(DomEvent event, HoverStyleHandler handler) { + public void onHoverStart(MouseOverEvent event, HoverStyleHandler handler) { // TODO Auto-generated method stub }
@Override - public void onHoverEnd(DomEvent event, HoverStyleHandler handler) { + public void onHoverEnd(MouseOutEvent event, HoverStyleHandler handler) { // TODO Auto-generated method stub }
@Override - public void onFocusStart(DomEvent event, FocusStyleHandler handler) { + public void onFocusStart(FocusEvent event, FocusStyleHandler handler) { // TODO Auto-generated method stub }
@Override - public void onFocusEnd(DomEvent event, FocusStyleHandler handler) { + public void onFocusEnd(BlurEvent event, FocusStyleHandler handler) { // TODO Auto-generated method stub }
@Override - public void onActiveStart(DomEvent event, ActiveStyleHandler handler) { + public void onActiveStart(MouseDownEvent event, ActiveStyleHandler handler) { // TODO Auto-generated method stub }
@Override - public void onActiveEnd(DomEvent event, ActiveStyleHandler handler) { + public void onActiveEnd(MouseUpEvent event, ActiveStyleHandler handler) { // TODO Auto-generated method 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 Wed Jul 6 13:36:01 2011 (r572) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlDefaultCreatorTopicView.java Thu Jul 7 00:58:04 2011 (r573) @@ -419,49 +419,46 @@ // TODO Auto-generated method stub } - - +
@Override - public void onHoverStart(DomEvent event, HoverStyleHandler handler) { + public void onHoverStart(MouseOverEvent event, HoverStyleHandler handler) { // TODO Auto-generated method stub }
@Override - public void onHoverEnd(DomEvent event, HoverStyleHandler handler) { + public void onHoverEnd(MouseOutEvent event, HoverStyleHandler handler) { // TODO Auto-generated method stub }
@Override - public void onFocusStart(DomEvent event, FocusStyleHandler handler) { + public void onFocusStart(FocusEvent event, FocusStyleHandler handler) { // TODO Auto-generated method stub }
@Override - public void onFocusEnd(DomEvent event, FocusStyleHandler handler) { + public void onFocusEnd(BlurEvent event, FocusStyleHandler handler) { // TODO Auto-generated method stub }
@Override - public void onActiveStart(DomEvent event, ActiveStyleHandler handler) { + public void onActiveStart(MouseDownEvent event, ActiveStyleHandler handler) { // TODO Auto-generated method stub }
@Override - public void onActiveEnd(DomEvent event, ActiveStyleHandler handler) { + public void onActiveEnd(MouseUpEvent event, ActiveStyleHandler handler) { // TODO Auto-generated method 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 Wed Jul 6 13:36:01 2011 (r572) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlEditorAssociationView.java Thu Jul 7 00:58:04 2011 (r573) @@ -421,48 +421,49 @@ // TODO Auto-generated method stub } - - +
@Override - public void onHoverStart(DomEvent event, HoverStyleHandler handler) { + public void onHoverStart(MouseOverEvent event, HoverStyleHandler handler) { // TODO Auto-generated method stub }
@Override - public void onHoverEnd(DomEvent event, HoverStyleHandler handler) { + public void onHoverEnd(MouseOutEvent event, HoverStyleHandler handler) { // TODO Auto-generated method stub }
@Override - public void onFocusStart(DomEvent event, FocusStyleHandler handler) { + public void onFocusStart(FocusEvent event, FocusStyleHandler handler) { // TODO Auto-generated method stub }
@Override - public void onFocusEnd(DomEvent event, FocusStyleHandler handler) { + public void onFocusEnd(BlurEvent event, FocusStyleHandler handler) { // TODO Auto-generated method stub }
@Override - public void onActiveStart(DomEvent event, ActiveStyleHandler handler) { + public void onActiveStart(MouseDownEvent event, ActiveStyleHandler handler) { // TODO Auto-generated method stub }
@Override - public void onActiveEnd(DomEvent event, ActiveStyleHandler handler) { + public void onActiveEnd(MouseUpEvent event, ActiveStyleHandler handler) { // TODO Auto-generated method 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 Wed Jul 6 13:36:01 2011 (r572) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlSpecialCreatorTopicView.java Thu Jul 7 00:58:04 2011 (r573) @@ -422,47 +422,47 @@ // TODO Auto-generated method stub } - - + + @Override - public void onHoverStart(DomEvent event, HoverStyleHandler handler) { + public void onHoverStart(MouseOverEvent event, HoverStyleHandler handler) { // TODO Auto-generated method stub }
@Override - public void onHoverEnd(DomEvent event, HoverStyleHandler handler) { + public void onHoverEnd(MouseOutEvent event, HoverStyleHandler handler) { // TODO Auto-generated method stub }
@Override - public void onFocusStart(DomEvent event, FocusStyleHandler handler) { + public void onFocusStart(FocusEvent event, FocusStyleHandler handler) { // TODO Auto-generated method stub }
@Override - public void onFocusEnd(DomEvent event, FocusStyleHandler handler) { + public void onFocusEnd(BlurEvent event, FocusStyleHandler handler) { // TODO Auto-generated method stub }
@Override - public void onActiveStart(DomEvent event, ActiveStyleHandler handler) { + public void onActiveStart(MouseDownEvent event, ActiveStyleHandler handler) { // TODO Auto-generated method stub }
@Override - public void onActiveEnd(DomEvent event, ActiveStyleHandler handler) { + public void onActiveEnd(MouseUpEvent event, ActiveStyleHandler handler) { // TODO Auto-generated method 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 Wed Jul 6 13:36:01 2011 (r572) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlSpecialEditorTopicView.java Thu Jul 7 00:58:04 2011 (r573) @@ -424,49 +424,47 @@ // TODO Auto-generated method stub } -
@Override - public void onHoverStart(DomEvent event, HoverStyleHandler handler) { + public void onHoverStart(MouseOverEvent event, HoverStyleHandler handler) { // TODO Auto-generated method stub }
@Override - public void onHoverEnd(DomEvent event, HoverStyleHandler handler) { + public void onHoverEnd(MouseOutEvent event, HoverStyleHandler handler) { // TODO Auto-generated method stub }
@Override - public void onFocusStart(DomEvent event, FocusStyleHandler handler) { + public void onFocusStart(FocusEvent event, FocusStyleHandler handler) { // TODO Auto-generated method stub }
@Override - public void onFocusEnd(DomEvent event, FocusStyleHandler handler) { + public void onFocusEnd(BlurEvent event, FocusStyleHandler handler) { // TODO Auto-generated method stub }
@Override - public void onActiveStart(DomEvent event, ActiveStyleHandler handler) { + public void onActiveStart(MouseDownEvent event, ActiveStyleHandler handler) { // TODO Auto-generated method stub }
@Override - public void onActiveEnd(DomEvent event, ActiveStyleHandler handler) { + public void onActiveEnd(MouseUpEvent event, ActiveStyleHandler handler) { // TODO Auto-generated method 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 Wed Jul 6 13:36:01 2011 (r572) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlView.java Thu Jul 7 00:58:04 2011 (r573) @@ -80,60 +80,6 @@ } - // registers a click handler to all sub-elements of this element - @Override - public MultipleHandlerRegistration addClickHandler(ClickHandler handler){ - // TODO: implement - return null; - } - - - // registers a mouse-out handler to all sub-elements of this element - @Override - public MultipleHandlerRegistration addMouseOutHandler(MouseOutHandler handler){ - // TODO: implement - return null; - } - - - // registers a mouse-over handler to all sub-elements of this element - @Override - public MultipleHandlerRegistration addMouseOverHandler(MouseOverHandler handler){ - // TODO: implement - return null; - } - - - // registers a focus handler to all sub-elements of this element - @Override - public MultipleHandlerRegistration addFocusHandler(FocusHandler handler){ - // TODO: implement - return null; - } - - - // registers a mouse-down handler to all sub-elements of this element - @Override - public MultipleHandlerRegistration addMouseDownHandler(MouseDownHandler handler){ - // TODO: implement - return null; - } - - - // registers a mouse-up handler to all sub-elements of this element - @Override - public MultipleHandlerRegistration addMouseUpHandler(MouseUpHandler handler){ - // TODO: implement - return null; - } - - - // registers a blur handler to all sub-elements of this element - @Override - public MultipleHandlerRegistration addBlurHandler(BlurHandler handler){ - // TODO: implement - return null; - }