Author: lgiessmann Date: Fri Jul 22 04:18:21 2011 New Revision: 660
Log: gdl-frontend: Widgets: fixed a bug when applying the css property "text-decoration" on GdlUnit in Firefox
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt 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/container/GdlUnit.java branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTextObject.java
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt Fri Jul 22 02:30:54 2011 (r659) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt Fri Jul 22 04:18:21 2011 (r660) @@ -1,8 +1,8 @@ - -2. Implement GdlLineBreak => placeholder -3. Implement TopicMaps data consumption -4. Implement TopicMaps data generation -3. Implement GdlButton(s) -4. Implement GdlButton(s) positioning -6. ImplementGdlVisibleObject => (de)registerButtonCallback -7. Fix css-pseudo-class-handlers \ No newline at end of file +* fix setting the float property in firefox +* Implement GdlLineBreak => placeholder +* Implement TopicMaps data consumption +* Implement TopicMaps data generation +* Implement GdlButton(s) +* Implement GdlButton(s) positioning +* ImplementGdlVisibleObject => (de)registerButtonCallback +* Fix css-pseudo-class-handlers \ No newline at end of file
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 22 02:30:54 2011 (r659) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 22 04:18:21 2011 (r660) @@ -47,6 +47,7 @@ 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.Element; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.AbsolutePanel; import com.google.gwt.user.client.ui.Composite; @@ -1423,6 +1424,7 @@ } + // 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; @@ -1432,6 +1434,25 @@ } 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 a given css property and css value of this element's sub element + protected void setCssProperty(Element elem, String styleClass, String cssProperty, String cssValue)throws InvalidGdlSchemaException, ExecutionException{ + if(cssValue == null || cssProperty == null) return; + + if(styleClass == null){ + DOM.setStyleAttribute(elem, 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));
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlUnit.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlUnit.java Fri Jul 22 02:30:54 2011 (r659) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlUnit.java Fri Jul 22 04:18:21 2011 (r660) @@ -3,6 +3,7 @@ import java.util.ArrayList; import com.google.gwt.user.client.Element; import com.google.gwt.user.client.Window; +import com.google.gwt.dom.client.NodeList; import com.google.gwt.event.dom.client.BlurEvent; import com.google.gwt.event.dom.client.BlurHandler; import com.google.gwt.event.dom.client.FocusEvent; @@ -135,6 +136,20 @@ } } } + + + // sets the text-decoration style property of this element by using the GWT DOM class + @Override + public void setTextDecoration(Widget widget, TextDecorationValue value, String styleClass) throws InvalidGdlSchemaException, ExecutionException { + if(value != null && widget.getClass().equals(UnitWidget.class)){ + for(int i = 0; i != DOM.getChildCount(((UnitWidget)widget).basePanel.getElement()); ++i){ + if(DOM.getChild(((UnitWidget)widget).basePanel.getElement(), i).getNodeName().toLowerCase().equals("legend")){ + Element legend = DOM.getChild(((UnitWidget)widget).basePanel.getElement(), i); + this.setCssProperty(legend, styleClass, "textDecoration", value.getCssValue()); + } + } + } + }
// sets all GDL styles that are defined by the topic map representative to tha passed widget @@ -143,8 +158,8 @@ super.setGdlStyle(widget); this.setUnitName(widget, this.getUnitName()); } - + @Override @Deprecated public GdlVisibleObject append(Topic ancestor, Topic current) throws InvalidGdlSchemaException, ExecutionException { @@ -180,6 +195,7 @@ private UnitWidget(){ initWidget(this.basePanel); this.basePanel.add(this.containerPanel); + DOM.setStyleAttribute(this.basePanel.getElement(), "textDecoration", "none"); } @@ -280,5 +296,19 @@ public HandlerRegistration addFocusHandler(FocusHandler handler) { return this.addDomHandler(handler, FocusEvent.getType()); } + + + @Override + public void onAttach(){ + super.onAttach(); + try{ + String[] styleClasses = new String[]{null, GdlPsis.Scope.gdlActive, GdlPsis.Scope.gdlFocus, GdlPsis.Scope.gdlHover}; + for (String styleClass : styleClasses) { + GdlUnit.this.setTextDecoration(this, GdlUnit.this.getTextDecoration(styleClass), styleClass); + } + }catch(Exception e){ + e.printStackTrace(); + } + } } } \ No newline at end of file
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 Fri Jul 22 02:30:54 2011 (r659) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTextObject.java Fri Jul 22 04:18:21 2011 (r660) @@ -29,7 +29,6 @@ public GdlTextObject(Topic tmRepresentative) throws InvalidGdlSchemaException, ExecutionException{ super(tmRepresentative); super.setGdlStyle(); - DOM.setStyleAttribute(this.mainPanel.getElement(), "float", "left"); // TODO: remove }