Author: lgiessmann Date: Fri Jul 8 09:27:41 2011 New Revision: 587
Log: gdl-frontend: Widgets: implemented the style-handlers of GdlTitle
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/GdlTitle.java
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 8 09:14:13 2011 (r586) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Fri Jul 8 09:27:41 2011 (r587) @@ -113,7 +113,6 @@ } -
// a helper method that returns all occurrences of the type bound to the passed PSI protected JsArray<Occurrence> getOccurrences(String occurrenceType){
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTitle.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTitle.java Fri Jul 8 09:14:13 2011 (r586) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTitle.java Fri Jul 8 09:27:41 2011 (r587) @@ -40,7 +40,6 @@ import com.google.gwt.event.dom.client.MouseUpHandler; import com.google.gwt.event.shared.HandlerRegistration; import com.google.gwt.user.client.DOM; -import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.AbsolutePanel; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.Widget; @@ -60,6 +59,7 @@ super(tmRepresentative); // TODO: create a Title element for each TM-elem this.createTitle(); + this.createTitle(); } @@ -67,7 +67,6 @@ public void createTitle() throws InvalidGdlSchemaException, ExecutionException { // this object is able to own only one sub-element TitleWidget title = new TitleWidget(this.getTitleOrder()); - title.setText("TITLE!!!"); ActiveStyleHandler asHandler = new ActiveStyleHandler(this); FocusStyleHandler fsHandler = new FocusStyleHandler(this); HoverStyleHandler hsHandler = new HoverStyleHandler(this); @@ -347,33 +346,15 @@ } - - - - - - - // TODO: override 2x onActiveStart => handle style classes - - // TODO: override 2x onHoverStart => handle style classes - - // TODO: override 2x onFocusStart => handle style classes - - - - - - - - // some handler for applying the css style bound to the pseudo classes hover, active and focus @Override public void onHoverStart(MouseOverEvent event, HoverStyleHandler handler) { Widget source = (Widget)event.getSource(); - super.onHoverStart(event, handler); - Window.alert("TEST 1 >> " + source.getClass()); + GdlTitle.super.onHoverStart(event, handler); if(source.getClass().equals(TitleWidget.class)){ - // TODO: implement + for (Pair<String, String> pair : this.titleHoverCssNamesAndStyles) { + GdlTitle.super.replaceStyleProperty(((TitleWidget)source).titleElement, pair.getFirst(), pair.getSecond()); + } } } @@ -381,26 +362,61 @@ // applies the styles bound to hover and the passed element @Override protected void onHoverStart(Widget widget){ - Window.alert("TEST 1.1 >> " + widget.getClass()); + GdlTitle.super.onHoverStart(widget); if(widget.getClass().equals(TitleWidget.class)){ - // TODO: implement - } - for (Pair<String, String> elem : this.hoverCssNamesAndStyles) { - DOM.setStyleAttribute(widget.getElement(), elem.getFirst(), elem.getSecond()); + for (Pair<String, String> pair : this.titleHoverCssNamesAndStyles) { + GdlTitle.super.replaceStyleProperty(((TitleWidget)widget).titleElement, pair.getFirst(), pair.getSecond()); + } } }
- + // applies the styles bound to focus and the passed element + protected void onFocusStart(Widget widget){ + GdlTitle.super.onFocusStart(widget); + if(widget.getClass().equals(TitleWidget.class)){ + for (Pair<String, String> pair : this.titleFocusCssNamesAndStyles) { + GdlTitle.super.replaceStyleProperty(((TitleWidget)widget).titleElement, pair.getFirst(), pair.getSecond()); + } + } + } + // shall be called to apply the styles of the focus class + public void onFocusStart(FocusEvent event, FocusStyleHandler handler) { + Widget source = (Widget)event.getSource(); + GdlTitle.super.onFocusStart(event, handler); + if(source.getClass().equals(TitleWidget.class)){ + for (Pair<String, String> pair : this.titleFocusCssNamesAndStyles) { + GdlTitle.super.replaceStyleProperty(((TitleWidget)source).titleElement, pair.getFirst(), pair.getSecond()); + } + } + } + // applies the styles bound to acitve and the passed element + protected void onActiveStart(Widget widget){ + GdlTitle.super.onActiveStart(widget); + if(widget.getClass().equals(TitleWidget.class)){ + for (Pair<String, String> pair : this.titleActiveCssNamesAndStyles) { + GdlTitle.super.replaceStyleProperty(((TitleWidget)widget).titleElement, pair.getFirst(), pair.getSecond()); + } + } + } + // shall be called to apply the styles of the active class + public void onActiveStart(MouseDownEvent event, ActiveStyleHandler handler) { + Widget source = (Widget)event.getSource(); + GdlTitle.super.onActiveStart(event, handler); + if(source.getClass().equals(TitleWidget.class)){ + for (Pair<String, String> pair : this.titleActiveCssNamesAndStyles) { + GdlTitle.super.replaceStyleProperty(((TitleWidget)source).titleElement, pair.getFirst(), pair.getSecond()); + } + } + }
- // this class represents the acutal content of this widget, i.e. // it wraps a h1, h2, h3 or h4 element protected class TitleWidget extends Composite implements HasMouseDownHandlers, HasMouseUpHandlers, HasMouseOverHandlers, HasMouseOutHandlers, HasBlurHandlers, HasFocusHandlers{