Author: lgiessmann Date: Wed Jul 6 11:55:37 2011 New Revision: 570
Log: gdl-frontend: Widgets: fixed a bug when applying the styles for CSS active, hover and focus
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/FocusStyleHandler.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/environment/FocusStyleHandler.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/FocusStyleHandler.java Wed Jul 6 11:09:04 2011 (r569) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/FocusStyleHandler.java Wed Jul 6 11:55:37 2011 (r570) @@ -5,7 +5,7 @@ import com.google.gwt.event.dom.client.BlurHandler; import com.google.gwt.event.dom.client.FocusEvent; import com.google.gwt.event.dom.client.FocusHandler; -import com.google.gwt.user.client.ui.Widget; +
public class FocusStyleHandler implements FocusHandler, BlurHandler{ GdlVisibleObject widget = 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 11:09:04 2011 (r569) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java Wed Jul 6 11:55:37 2011 (r570) @@ -4,21 +4,15 @@ import com.google.gwt.dom.client.Style.FontStyle; 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.KeyPressEvent; import com.google.gwt.event.dom.client.KeyPressHandler; -import com.google.gwt.event.dom.client.MouseDownEvent; import com.google.gwt.event.dom.client.MouseDownHandler; -import com.google.gwt.event.dom.client.MouseOutEvent; import com.google.gwt.event.dom.client.MouseOutHandler; -import com.google.gwt.event.dom.client.MouseOverEvent; 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.event.shared.HandlerRegistration; @@ -72,7 +66,7 @@ public GdlText(Topic tmRepresentative) throws InvalidGdlSchemaException, ExecutionException{ super(tmRepresentative); // TODO: create a text element for each TM-elem - this.createNewTextArea(); + this.createNewTextArea(); // TODO: remove only for debugging } @@ -1109,7 +1103,6 @@ for (TextArea item : this.textElements) { results.add(item.getValue()); } - return results; }
@@ -1174,6 +1167,30 @@ } + // 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) { @@ -1194,8 +1211,8 @@ if(lastHandler == null){ this.setGdlStyle(source); }else { - if(lastHandler.getClass().equals(ActiveStyleHandler.class)) this.onActiveStart(event, null); - else this.onFocusStart(null, null); + 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()); @@ -1223,8 +1240,8 @@ if(lastHandler == null){ this.setGdlStyle(source); }else { - if(lastHandler.getClass().equals(ActiveStyleHandler.class)) this.onActiveStart(event, null); - else this.onHoverStart(null, null); + 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()); @@ -1251,8 +1268,8 @@ if(lastHandler == null){ this.setGdlStyle(source); }else { - if(lastHandler.getClass().equals(HoverStyleHandler.class)) this.onHoverStart(event, null); - else this.onFocusStart(null, null); + 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());