Author: lgiessmann Date: Thu Jul 7 07:44:51 2011 New Revision: 576
Log: gdl-frontend: Widgets: fixed a bug in the style-handlers, which are responsible for setting width, min-width, max-width, height, min-height and max-height for resizeable textarea elements
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Thu Jul 7 06:50:26 2011 (r575) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Thu Jul 7 07:44:51 2011 (r576) @@ -26,6 +26,7 @@ import com.google.gwt.dom.client.Style.VerticalAlign; import com.google.gwt.event.dom.client.BlurEvent; import com.google.gwt.event.dom.client.BlurHandler; +import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.FocusEvent; import com.google.gwt.event.dom.client.FocusHandler; @@ -51,7 +52,6 @@ import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.HorizontalPanel; import com.google.gwt.user.client.ui.Panel; -import com.google.gwt.user.client.ui.TextArea; import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.Widget;
@@ -1194,202 +1194,199 @@ // sets the border-color style property of this element by using the GWT DOM class public void setBorderColor(Widget widget, ColorValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderColor", value.getCssValue()); + if(value != null) this.setCssProperty(widget, styleClass, "borderColor", value.getCssValue()); }
// sets the border-top-color style property of this element by using the GWT DOM class public void setBorderTopColor(Widget widget, ColorValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderTopColor", value.getCssValue()); + if(value != null) this.setCssProperty(widget, styleClass, "borderTopColor", value.getCssValue()); }
// sets the border-right-color style property of this element by using the GWT DOM class public void setBorderRightColor(Widget widget, ColorValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderRightColor", value.getCssValue()); + if(value != null) this.setCssProperty(widget, styleClass, "borderRightColor", value.getCssValue()); }
// sets the border-bottom-color style property of this element by using the GWT DOM class public void setBorderBottomColor(Widget widget, ColorValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderBottomColor", value.getCssValue()); + if(value != null) this.setCssProperty(widget, styleClass, "borderBottomColor", value.getCssValue()); }
// sets the border-left-color style property of this element by using the GWT DOM class public void setBorderLeftColor(Widget widget, ColorValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderLeftColor", value.getCssValue()); + if(value != null) this.setCssProperty(widget, styleClass, "borderLeftColor", value.getCssValue()); } // sets the border-style style property of this element by using the GWT DOM class public void setBorderStyle(Widget widget, BorderStyleValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderStyle", value.getCssValue()); + if(value != null) this.setCssProperty(widget, styleClass, "borderStyle", value.getCssValue()); }
// sets the border-top-style style property of this element by using the GWT DOM class public void setBorderTopStyle(Widget widget, BorderStyleValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderTopStyle", value.getCssValue()); + if(value != null) this.setCssProperty(widget, styleClass, "borderTopStyle", value.getCssValue()); }
// sets the border-right-style style property of this element by using the GWT DOM class public void setBorderRightStyle(Widget widget, BorderStyleValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderRightStyle", value.getCssValue()); + if(value != null) this.setCssProperty(widget, styleClass, "borderRightStyle", value.getCssValue()); }
// sets the border-bottom-style style property of this element by using the GWT DOM class public void setBorderBottomStyle(Widget widget, BorderStyleValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderBottomStyle", value.getCssValue()); + if(value != null) this.setCssProperty(widget, styleClass, "borderBottomStyle", value.getCssValue()); }
// sets the border-left-style style property of this element by using the GWT DOM class public void setBorderLeftStyle(Widget widget, BorderStyleValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderLeftStyle", value.getCssValue()); + if(value != null) this.setCssProperty(widget, styleClass, "borderLeftStyle", value.getCssValue()); }
// sets the border-width style property of this element by using the GWT DOM class public void setBorderWidth(Widget widget, AbsoluteNumValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderWidth", value.getCssValue()); + if(value != null) this.setCssProperty(widget, styleClass, "borderWidth", value.getCssValue()); }
// sets the border-width style property of this element by using the GWT DOM class public void setBorderTopWidth(Widget widget, AbsoluteNumValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderTopWidth", value.getCssValue()); + if(value != null) this.setCssProperty(widget, styleClass, "borderTopWidth", value.getCssValue()); }
// 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()); + if(value != null) this.setCssProperty(widget, styleClass, "borderRightWidth", value.getCssValue()); }
// sets the border-width style property of this element by using the GWT DOM class public void setBorderBottomWidth(Widget widget, AbsoluteNumValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderBottomWidth", value.getCssValue()); + if(value != null) this.setCssProperty(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()); + if(value != null) this.setCssProperty(widget, styleClass, "borderLeftWidth", value.getCssValue()); } // sets the border-radius style property of this element by using the GWT DOM class public void setBorderRadius(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderRadius", value.getCssValue()); + if(value != null) this.setCssProperty(widget, styleClass, "borderRadius", value.getCssValue()); }
// sets the border-top-right-radius style property of this element by using the GWT DOM class public void setBorderTopRightRadius(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderTopRightRadius", value.getCssValue()); + if(value != null) this.setCssProperty(widget, styleClass, "borderTopRightRadius", value.getCssValue()); }
// sets the border-bottom-right-radius style property of this element by using the GWT DOM class public void setBorderBottomRightRadius(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderBottomRightRadius", value.getCssValue()); + if(value != null) this.setCssProperty(widget, styleClass, "borderBottomRightRadius", value.getCssValue()); }
// sets the border-bottom-left-radius style property of this element by using the GWT DOM class public void setBorderBottomLeftRadius(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderBottomLeftRadius", value.getCssValue()); + if(value != null) this.setCssProperty(widget, styleClass, "borderBottomLeftRadius", value.getCssValue()); }
// sets the border-top-left-radius style property of this element by using the GWT DOM class public void setBorderTopLeftRadius(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "borderTopLeftRadius", value.getCssValue()); + if(value != null) this.setCssProperty(widget, styleClass, "borderTopLeftRadius", value.getCssValue()); } // sets the padding style property of this element by using the GWT DOM class public void setPadding(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "padding", value.getCssValue()); + if(value != null) this.setCssProperty(widget, styleClass, "padding", value.getCssValue()); }
// sets the padding-top style property of this element by using the GWT DOM class public void setPaddingTop(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "paddingTop", value.getCssValue()); + if(value != null) this.setCssProperty(widget, styleClass, "paddingTop", value.getCssValue()); }
// sets the padding-right style property of this element by using the GWT DOM class public void setPaddingRight(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "paddingRight", value.getCssValue()); + if(value != null) this.setCssProperty(widget, styleClass, "paddingRight", value.getCssValue()); }
// sets the padding-bottom style property of this element by using the GWT DOM class public void setPaddingBottom(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "paddingBottom", value.getCssValue()); + if(value != null) this.setCssProperty(widget, styleClass, "paddingBottom", value.getCssValue()); }
// sets the padding-left style property of this element by using the GWT DOM class public void setPaddingLeft(Widget widget, NumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "paddingLeft", value.getCssValue()); + if(value != null) this.setCssProperty(widget, styleClass, "paddingLeft", value.getCssValue()); } - - - // sets the width style property of this element by using the GWT DOM class public void setWidth(Widget widget, AutoNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "width", value.getCssValue()); + if(value != null) this.setCssProperty(widget, styleClass, "width", value.getCssValue()); }
// sets the min-width style property of this element by using the GWT DOM class public void setMinWidth(Widget widget, AutoNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "minWidth", value.getCssValue()); + if(value != null) this.setCssProperty(widget, styleClass, "minWidth", value.getCssValue()); }
// sets the max-width style property of this element by using the GWT DOM class public void setMaxWidth(Widget widget, AutoNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "maxWidth", value.getCssValue()); + if(value != null) this.setCssProperty(widget, styleClass, "maxWidth", value.getCssValue()); }
// sets the height style property of this element by using the GWT DOM class public void setHeight(Widget widget, AutoNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "height", value.getCssValue()); + if(value != null) this.setCssProperty(widget, styleClass, "height", value.getCssValue()); }
// sets the min-height style property of this element by using the GWT DOM class public void setMinHeight(Widget widget, AutoNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "minHeight", value.getCssValue()); + if(value != null) this.setCssProperty(widget, styleClass, "minHeight", value.getCssValue()); }
// sets the max-height style property of this element by using the GWT DOM class public void setMaxHeight(Widget widget, AutoNumUnitValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "maxHeight", value.getCssValue()); + if(value != null) this.setCssProperty(widget, styleClass, "maxHeight", value.getCssValue()); } // sets the cursor style property of this element by using the GWT DOM class public void setCursor(Widget widget, CursorValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "cursor", value.getCssValue()); + if(value != null) this.setCssProperty(widget, styleClass, "cursor", value.getCssValue()); }
// sets the background-color style property of this element by using the GWT DOM class public void setBackgroundColor(Widget widget, ColorValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { - if(value != null) this.setCssProperty((TextArea)widget, styleClass, "backgroundColor", value.getCssValue()); + if(value != null) this.setCssProperty(widget, styleClass, "backgroundColor", value.getCssValue()); } @@ -1499,7 +1496,7 @@ public MultipleHandlerRegistration addClickHandler(ClickHandler handler) { MultipleHandlerRegistration regs = new MultipleHandlerRegistration(); for (Widget item : this.subElements) { - regs.addHandlerRegistration(((TextArea)item).addClickHandler(handler)); + regs.addHandlerRegistration(item.addHandler(handler, ClickEvent.getType())); } return regs; } @@ -1510,7 +1507,7 @@ public MultipleHandlerRegistration addMouseOutHandler(MouseOutHandler handler){ MultipleHandlerRegistration regs = new MultipleHandlerRegistration(); for (Widget item : this.subElements) { - regs.addHandlerRegistration(((TextArea)item).addMouseOutHandler(handler)); + regs.addHandlerRegistration(item.addHandler(handler, MouseOutEvent.getType())); } return regs; } @@ -1521,7 +1518,7 @@ public MultipleHandlerRegistration addMouseOverHandler(MouseOverHandler handler){ MultipleHandlerRegistration regs = new MultipleHandlerRegistration(); for (Widget item : this.subElements) { - regs.addHandlerRegistration(((TextArea)item).addMouseOverHandler(handler)); + regs.addHandlerRegistration(item.addHandler(handler, MouseOverEvent.getType())); } return regs; } @@ -1532,7 +1529,7 @@ public MultipleHandlerRegistration addFocusHandler(FocusHandler handler){ MultipleHandlerRegistration regs = new MultipleHandlerRegistration(); for (Widget item : this.subElements) { - regs.addHandlerRegistration(((TextArea)item).addFocusHandler(handler)); + regs.addHandlerRegistration(item.addHandler(handler, FocusEvent.getType())); } return regs; } @@ -1543,7 +1540,7 @@ public MultipleHandlerRegistration addMouseDownHandler(MouseDownHandler handler){ MultipleHandlerRegistration regs = new MultipleHandlerRegistration(); for (Widget item : this.subElements) { - regs.addHandlerRegistration(((TextArea)item).addMouseDownHandler(handler)); + regs.addHandlerRegistration(item.addHandler(handler, MouseDownEvent.getType())); } return regs; } @@ -1554,7 +1551,7 @@ public MultipleHandlerRegistration addMouseUpHandler(MouseUpHandler handler){ MultipleHandlerRegistration regs = new MultipleHandlerRegistration(); for (Widget item : this.subElements) { - regs.addHandlerRegistration(((TextArea)item).addMouseUpHandler(handler)); + regs.addHandlerRegistration(item.addHandler(handler, MouseUpEvent.getType())); } return regs; } @@ -1566,14 +1563,14 @@ public MultipleHandlerRegistration addBlurHandler(BlurHandler handler){ MultipleHandlerRegistration regs = new MultipleHandlerRegistration(); for (Widget item : this.subElements) { - regs.addHandlerRegistration(((TextArea)item).addBlurHandler(handler)); + regs.addHandlerRegistration(item.addHandler(handler, BlurEvent.getType())); } return regs; } // adds the passed handler to the list eventHandlers - private void addEventHandler(Widget elem, EventHandler handler){ + protected void addEventHandler(Widget elem, EventHandler handler){ if(handler == null || elem == null) return; for (Pair<Widget, ArrayList<EventHandler>> item : this.eventHandlers) { @@ -1591,7 +1588,7 @@ // remove the passed handler of the list eventHandlers - private void removeEventHandler(Widget elem, EventHandler handler){ + protected void removeEventHandler(Widget elem, EventHandler handler){ for (Pair<Widget, ArrayList<EventHandler>> item : this.eventHandlers) { if(item.getFirst().equals(elem)){ item.getSecond().remove(handler); @@ -1601,7 +1598,7 @@ // returns the last handler bound to the passed element. - private EventHandler getLastHandler(Widget elem){ + protected EventHandler getLastHandler(Widget elem){ for (Pair<Widget, ArrayList<EventHandler>> item : this.eventHandlers) { if(item.getFirst().equals(elem)){ int idx = item.getSecond().size() - 1; @@ -1616,7 +1613,7 @@ // applies the styles bound to hover and the passed element - private void onHoverStart(Widget widget){ + protected void onHoverStart(Widget widget){ for (Pair<String, String> elem : this.hoverCssNamesAndStyles) { DOM.setStyleAttribute(widget.getElement(), elem.getFirst(), elem.getSecond()); } @@ -1624,7 +1621,7 @@ // applies the styles bound to acitve and the passed element - private void onActiveStart(Widget widget){ + protected void onActiveStart(Widget widget){ for (Pair<String, String> elem : this.activeCssNamesAndStyles) { DOM.setStyleAttribute(widget.getElement(), elem.getFirst(), elem.getSecond()); } @@ -1632,7 +1629,7 @@ // applies the styles bound to focus and the passed element - private void onFocusStart(Widget widget){ + protected void onFocusStart(Widget widget){ for (Pair<String, String> elem : this.focusCssNamesAndStyles) { DOM.setStyleAttribute(widget.getElement(), elem.getFirst(), elem.getSecond()); } @@ -1652,7 +1649,7 @@ // shall be called when the focus event was fired public void onHoverEnd(MouseOutEvent event, HoverStyleHandler handler) { try{ - TextArea source = (TextArea)event.getSource(); + Widget source = (Widget)event.getSource(); this.removeEventHandler(source, handler); EventHandler lastHandler = this.getLastHandler(source); if(lastHandler == null){ @@ -1696,7 +1693,7 @@ }
- // shall be called to apply the styles of the sctive class + // shall be called to apply the styles of the active class public void onActiveStart(MouseDownEvent event, ActiveStyleHandler handler) { Widget source = (Widget)event.getSource(); this.addEventHandler(source, handler);
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 Thu Jul 7 06:50:26 2011 (r575) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java Thu Jul 7 07:44:51 2011 (r576) @@ -1,11 +1,16 @@ package us.isidor.gdl.anaToMia.Widgets.text;
import java.util.ArrayList; + +import com.google.gwt.event.dom.client.BlurEvent; import com.google.gwt.event.dom.client.KeyPressEvent; import com.google.gwt.event.dom.client.KeyPressHandler; +import com.google.gwt.event.dom.client.MouseOutEvent; +import com.google.gwt.event.dom.client.MouseUpEvent; 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; @@ -633,5 +638,193 @@ } - // 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 + // like setGdlStyle, except the width, minwidth, maxWidth, height, minHeight and maxHeight properties + // are not set. This method should only be invoked of the onFocusEnd, onActiveEnd and onHoverEnd + // to avoid the resizing of resizeable textarea elements + private void setCleanGdlStyle(TextArea source) throws InvalidGdlSchemaException, ExecutionException{ + ResizeValue resize = this.getResize(); + + // GdlVisibleObject + this.setContentOrientation(source, this.getContentOrientation()); + + this.setVerticalAlign(source, this.getVerticalAlign(null), null); + + this.setMargin(source, this.getMargin(null), null); + this.setMarginTop(source, this.getMarginTop(null), null); + this.setMarginRight(source, this.getMarginRight(null), null); + this.setMarginBottom(source, this.getMarginBottom(null), null); + this.setMarginLeft(source, this.getMarginLeft(null), null); + + this.setBorderColor(source, this.getBorderColor(null), null); + this.setBorderTopColor(source, this.getBorderTopColor(null), null); + this.setBorderRightColor(source, this.getBorderRightColor(null), null); + this.setBorderBottomColor(source, this.getBorderBottomColor(null), null); + this.setBorderLeftColor(source, this.getBorderLeftColor(null), null); + + this.setBorderStyle(source, this.getBorderStyle(null), null); + this.setBorderTopStyle(source, this.getBorderTopStyle(null), null); + this.setBorderRightStyle(source, this.getBorderRightStyle(null), null); + this.setBorderBottomStyle(source, this.getBorderBottomStyle(null), null); + this.setBorderLeftStyle(source, this.getBorderLeftStyle(null), null); + + this.setBorderWidth(source, this.getBorderWidth(null), null); + this.setBorderTopWidth(source, this.getBorderTopWidth(null), null); + this.setBorderRightWidth(source, this.getBorderRightWidth(null), null); + this.setBorderBottomWidth(source, this.getBorderBottomWidth(null), null); + this.setBorderLeftWidth(source, this.getBorderLeftWidth(null), null); + + this.setBorderRadius(source, this.getBorderRadius(null), null); + this.setBorderTopRightRadius(source, this.getBorderTopRightRadius(null), null); + this.setBorderBottomRightRadius(source, this.getBorderBottomRightRadius(null), null); + this.setBorderBottomLeftRadius(source, this.getBorderBottomLeftRadius(null), null); + this.setBorderTopLeftRadius(source, this.getBorderTopLeftRadius(null), null); + + this.setCursor(source, this.getCursor(null), null); + + this.setBackgroundColor(source, this.getBackgroundColor(null), null); + + if(resize == ResizeValue.NONE || resize == ResizeValue.VERTICAL){ + this.setWidth(source, this.getWidth(null), null); + this.setMaxWidth(source, this.getMaxWidth(null), null); + this.setMinWidth(source, this.getMinWidth(null), null); + } + + if(resize == ResizeValue.NONE || resize == ResizeValue.HORIZONTAL){ + this.setHeight(source, this.getHeight(null), null); + this.setMaxHeight(source, this.getMaxHeight(null), null); + this.setMinHeight(source, this.getMinHeight(null), null); + } + + // GdlTextObject + this.setColor(source, this.getColor(null), null); + + this.setDirection(source, this.getDirection(null), null); + this.setTextAlign(source, this.getTextAlign(null), null); + this.setLineHeight(source, this.getLineHeight(null), null); + this.setTextDecoration(source, this.getTextDecoration(null), null); + this.setFontFamily(source, this.getFontFamily(null), null); + this.setFontStyle(source, this.getFontStyle(null), null); + this.setFontSize(source, this.getFontSize(null), null); + this.setFontWeight(source, this.getFontWeight(null), null); + this.setLetterSpacing(source, this.getLetterSpacing(null), null); + this.setWordSpacing(source, this.getWordSpacing(null), null); + } + + + // 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.setCleanGdlStyle(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()); + } + } + + + // 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.setCleanGdlStyle(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 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.setCleanGdlStyle(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()); + } + } + + + // width, minWidth, maxWidth, height, minHeight, maxHeight properties are ignore for styleClasses of resizable elements + @Override + protected void setCssProperty(Widget elem, String styleClass, String cssProperty, String cssValue)throws InvalidGdlSchemaException, ExecutionException{ + if(styleClass != null){ + ResizeValue resize = this.getResize(); + if(resize == ResizeValue.NONE){ + super.setCssProperty(elem, styleClass, cssProperty, cssValue); + }else if(resize == ResizeValue.HORIZONTAL){ + if(cssProperty.equals("width") || cssProperty.equals("minWidth") || cssProperty.equals("maxWidth")) { + // do nothing this properties are ignored for resizable textareas + } else { + super.setCssProperty(elem, styleClass, cssProperty, cssValue); + } + }else if(resize == ResizeValue.VERTICAL) { + if(cssProperty.equals("height") || cssProperty.equals("minHeight") || cssProperty.equals("maxHeight")) { + // do nothing this properties are ignored for resizable textareas + } else { + super.setCssProperty(elem, styleClass, cssProperty, cssValue); + } + }else { + if(cssProperty.equals("height") || cssProperty.equals("minHeight") || cssProperty.equals("maxHeight") || cssProperty.equals("width") || cssProperty.equals("minWidth") || cssProperty.equals("maxWidth")) { + // do nothing this properties are ignored for resizable textareas + } else { + super.setCssProperty(elem, styleClass, cssProperty, cssValue); + } + } + }else { + super.setCssProperty(elem, styleClass, cssProperty, cssValue); + } + } + + + // width, minWidth, maxWidth, height, minHeight, maxHeight properties are ignore for styleClasses of resizable elements + protected void setCssProperty(String styleClass, String cssProperty, String cssValue)throws InvalidGdlSchemaException, ExecutionException{ + if(styleClass != null){ + ResizeValue resize = this.getResize(); + if(resize == ResizeValue.NONE){ + super.setCssProperty(styleClass, cssProperty, cssValue); + }else if(resize == ResizeValue.HORIZONTAL){ + if(cssProperty.equals("width") || cssProperty.equals("minWidth") || cssProperty.equals("maxWidth")) { + // do nothing this properties are ignored for resizable textareas + } else { + super.setCssProperty(styleClass, cssProperty, cssValue); + } + }else if(resize == ResizeValue.VERTICAL) { + if(cssProperty.equals("height") || cssProperty.equals("minHeight") || cssProperty.equals("maxHeight")) { + // do nothing this properties are ignored for resizable textareas + } else { + super.setCssProperty(styleClass, cssProperty, cssValue); + } + }else { + if(cssProperty.equals("height") || cssProperty.equals("minHeight") || cssProperty.equals("maxHeight") || cssProperty.equals("width") || cssProperty.equals("minWidth") || cssProperty.equals("maxWidth")) { + // do nothing this properties are ignored for resizable textareas + } else { + super.setCssProperty(styleClass, cssProperty, cssValue); + } + } + }else { + super.setCssProperty(styleClass, cssProperty, cssValue); + } + } }