[isidorus-cvs] r569 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: base environment text views
lgiessmann at common-lisp.net
lgiessmann at common-lisp.net
Wed Jul 6 18:09:05 UTC 2011
Author: lgiessmann
Date: Wed Jul 6 11:09:04 2011
New Revision: 569
Log:
gdl-frontend: Widgets: changed the behavior of registering the event handlers for the realisation of the css pseudo classes active, hover and focus
Deleted:
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/CssStyleHandler.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/TestClass.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/ActiveStyleHandler.java
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/HoverStyleHandler.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/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
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 07:41:45 2011 (r568)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Wed Jul 6 11:09:04 2011 (r569)
@@ -4,9 +4,13 @@
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMap;
+import us.isidor.gdl.anaToMia.Widgets.environment.ActiveStyleHandler;
import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException;
+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.AutoNumUnitValue;
import us.isidor.gdl.anaToMia.Widgets.values.AutoNumValue;
import us.isidor.gdl.anaToMia.Widgets.values.BorderStyleValue;
@@ -21,8 +25,11 @@
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;
import com.google.gwt.event.dom.client.HasClickHandlers;
@@ -31,9 +38,13 @@
import com.google.gwt.event.dom.client.HasMouseOutHandlers;
import com.google.gwt.event.dom.client.HasMouseOverHandlers;
import com.google.gwt.event.dom.client.HasMouseUpHandlers;
+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.user.client.DOM;
import com.google.gwt.user.client.ui.AbsolutePanel;
@@ -45,7 +56,10 @@
protected AbsolutePanel mainPanel = new AbsolutePanel();
protected Topic tmRepresentative = null;
protected TopicMap tm = null;
-
+ 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>>();
+
// some constructors
protected GdlVisibleObject() {
@@ -229,8 +243,6 @@
}
-
-
// returns a VerticalAlign instance of a gdl:vertical-align occurrence
// or the default value for this property if no gdl:vertical-align occurrence
// is available. The styleClass attribute is used as scope for expressing
@@ -1322,14 +1334,11 @@
if(styleClass == null){
DOM.setStyleAttribute(this.getElement(), cssProperty, cssValue);
} else if(styleClass.equals(GdlPsis.Scope.gdlActive)){
- //this.activeStyleHandler.addCssStyle(new Pair<String, String>(cssProperty, cssValue));
- // Ignore is only set in the inheriting classes
+ this.activeCssNamesAndStyles.add(new Pair<String, String>(cssProperty, cssValue));
} else if(styleClass.equals(GdlPsis.Scope.gdlFocus)){
- //this.focusStyleHandler.addCssStyle(new Pair<String, String>(cssProperty, cssValue));
- // Ignore is only set in the inheriting classes
+ this.focusCssNamesAndStyles.add(new Pair<String, String>(cssProperty, cssValue));
} else if (styleClass.equals(GdlPsis.Scope.gdlHover)){
- //this.hoverStyleHandler.addCssStyle(new Pair<String, String>(cssProperty, cssValue));
- // Ignore is only set in the inheriting classes
+ 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);
@@ -1378,5 +1387,29 @@
// registers a blur handler to all sub-elements of this element
@Override
- public abstract MultipleHandlerRegistration addBlurHandler(BlurHandler handler);
+ public abstract MultipleHandlerRegistration addBlurHandler(BlurHandler handler);
+
+
+ // shall be called, if a sub-element of this element is hovered
+ public abstract void onHoverStart(@SuppressWarnings("rawtypes") DomEvent event, HoverStyleHandler handler);
+
+
+ // shall be called, if a sub-element of this element is hovered
+ public abstract void onHoverEnd(@SuppressWarnings("rawtypes") DomEvent event, HoverStyleHandler handler);
+
+
+ // shall be called, if a sub-element of this element is focused
+ public abstract void onFocusStart(@SuppressWarnings("rawtypes") DomEvent event, FocusStyleHandler handler);
+
+
+ // shall be called, if a sub-element of this element is focused
+ public abstract void onFocusEnd(@SuppressWarnings("rawtypes") DomEvent event, FocusStyleHandler handler);
+
+
+ // shall be called, if a sub-element of this element is focused
+ public abstract void onActiveStart(@SuppressWarnings("rawtypes") DomEvent event, ActiveStyleHandler handler);
+
+
+ // shall be called, if a sub-element of this element is focused
+ public abstract void onActiveEnd(@SuppressWarnings("rawtypes") DomEvent event, ActiveStyleHandler handler);
}
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 07:41:45 2011 (r568)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Wed Jul 6 11:09:04 2011 (r569)
@@ -104,14 +104,14 @@
tmpRepresentative.createOccurrence(gdlOverflow, "hidden", null);
tmpRepresentative.createOccurrence(gdlFontSize, "15pt", null);
tmpRepresentative.createOccurrence(gdlTextDecoration, "underline", null);
- //Occurrence bgcHover = tmpRepresentative.createOccurrence(gdlBackgroundColor, "green", null);
- //bgcHover.addTheme(gdlHover);
- //Occurrence bgcActive = tmpRepresentative.createOccurrence(gdlBackgroundColor, "purple", null);
- //bgcActive.addTheme(gdlActive);
- //Occurrence bgcFocus = tmpRepresentative.createOccurrence(gdlBackgroundColor, "silver", null);
- //bgcFocus.addTheme(gdlFocus);
- //Occurrence fsHover = tmpRepresentative.createOccurrence(gdlFontSize, "25pt", null);
- //fsHover.addTheme(gdlHover);
+ Occurrence bgcHover = tmpRepresentative.createOccurrence(gdlBackgroundColor, "green", null);
+ bgcHover.addTheme(gdlHover);
+ Occurrence bgcActive = tmpRepresentative.createOccurrence(gdlBackgroundColor, "purple", null);
+ bgcActive.addTheme(gdlActive);
+ Occurrence bgcFocus = tmpRepresentative.createOccurrence(gdlBackgroundColor, "silver", null);
+ bgcFocus.addTheme(gdlFocus);
+ Occurrence fsHover = tmpRepresentative.createOccurrence(gdlFontSize, "25pt", null);
+ fsHover.addTheme(gdlHover);
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/ActiveStyleHandler.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/ActiveStyleHandler.java Wed Jul 6 07:41:45 2011 (r568)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/ActiveStyleHandler.java Wed Jul 6 11:09:04 2011 (r569)
@@ -1,28 +1,30 @@
package us.isidor.gdl.anaToMia.Widgets.environment;
import us.isidor.gdl.anaToMia.Widgets.base.GdlVisibleObject;
-
import com.google.gwt.event.dom.client.MouseDownEvent;
import com.google.gwt.event.dom.client.MouseDownHandler;
import com.google.gwt.event.dom.client.MouseUpEvent;
import com.google.gwt.event.dom.client.MouseUpHandler;
+import com.google.gwt.user.client.ui.Widget;
-public class ActiveStyleHandler extends CssStyleHandler implements MouseDownHandler, MouseUpHandler{
- public ActiveStyleHandler() {
- super();
- }
+
+
+public class ActiveStyleHandler implements MouseDownHandler, MouseUpHandler{
+ GdlVisibleObject widget = null;
+ public ActiveStyleHandler(GdlVisibleObject widget) {
+ this.widget = widget;
+ }
+
@Override
public void onMouseUp(MouseUpEvent event) {
- GdlVisibleObject widget = (GdlVisibleObject)event.getSource();
- super.unsetStyles(widget);
+ widget.onActiveEnd(event, this);
}
@Override
public void onMouseDown(MouseDownEvent event) {
- GdlVisibleObject widget = (GdlVisibleObject)event.getSource();
- super.setStyles(widget);
+ widget.onActiveStart(event, this);
}
}
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 07:41:45 2011 (r568)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/FocusStyleHandler.java Wed Jul 6 11:09:04 2011 (r569)
@@ -1,29 +1,29 @@
package us.isidor.gdl.anaToMia.Widgets.environment;
import us.isidor.gdl.anaToMia.Widgets.base.GdlVisibleObject;
-import us.isidor.gdl.anaToMia.Widgets.environment.CssStyleHandler;
import com.google.gwt.event.dom.client.BlurEvent;
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 extends CssStyleHandler implements FocusHandler, BlurHandler{
+public class FocusStyleHandler implements FocusHandler, BlurHandler{
+ GdlVisibleObject widget = null;
+
// this class is used to set the style of focused elements
- public FocusStyleHandler() {
- super();
+ public FocusStyleHandler(GdlVisibleObject widget) {
+ this.widget = widget;
}
-
+
@Override
public void onFocus(FocusEvent event) {
- GdlVisibleObject widget = (GdlVisibleObject)event.getSource();
- super.setStyles(widget);;
+ widget.onFocusStart(event, this);
}
@Override
public void onBlur(BlurEvent event) {
- GdlVisibleObject widget = (GdlVisibleObject)event.getSource();
- super.unsetStyles(widget);
+ widget.onFocusEnd(event, this);
}
}
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/HoverStyleHandler.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/HoverStyleHandler.java Wed Jul 6 07:41:45 2011 (r568)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/HoverStyleHandler.java Wed Jul 6 11:09:04 2011 (r569)
@@ -1,28 +1,30 @@
package us.isidor.gdl.anaToMia.Widgets.environment;
-import us.isidor.gdl.anaToMia.Widgets.base.GdlVisibleObject;
+import us.isidor.gdl.anaToMia.Widgets.base.GdlVisibleObject;
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;
-public class HoverStyleHandler extends CssStyleHandler implements MouseOverHandler, MouseOutHandler{
- public HoverStyleHandler() {
- super();
- }
+
+public class HoverStyleHandler implements MouseOverHandler, MouseOutHandler{
+ GdlVisibleObject widget = null;
+ public HoverStyleHandler(GdlVisibleObject widget){
+ this.widget = widget;
+ }
+
+
@Override
public void onMouseOut(MouseOutEvent event) {
- GdlVisibleObject widget = (GdlVisibleObject)event.getSource();
- super.unsetStyles(widget);
+ widget.onHoverEnd(event, this);
}
@Override
public void onMouseOver(MouseOverEvent event) {
- GdlVisibleObject widget = (GdlVisibleObject)event.getSource();
- super.setStyles(widget);
+ widget.onHoverStart(event, this);
}
}
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 07:41:45 2011 (r568)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java Wed Jul 6 11:09:04 2011 (r569)
@@ -4,17 +4,26 @@
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;
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;
@@ -22,7 +31,10 @@
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes;
import us.isidor.gdl.anaToMia.Widgets.base.GdlPsis;
import us.isidor.gdl.anaToMia.Widgets.base.IGdlHasValue;
+import us.isidor.gdl.anaToMia.Widgets.environment.ActiveStyleHandler;
import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException;
+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;
@@ -48,9 +60,7 @@
protected ArrayList<TextArea> textElements = new ArrayList<TextArea>();
protected ArrayList<PasswordKeyPressHandler> passwordKeyPressHandler = null;
protected ArrayList<HandlerRegistration> passwordKeyPressRegistrations = null;
- // TODO: protected ArrayList<Pair<TextArea, ActiveStyleHandler>> activeStyleHandler = new ArrayList<Pair<TextArea,ActiveStyleHandler>>();
- // TODO: protected ArrayList<Pair<TextArea, FocusStyleHandler>> focusStyleHandler = new ArrayList<Pair<TextArea,FocusStyleHandler>>();
- // TODO: protected ArrayList<Pair<TextArea, HoverStyleHandler>> hoverStyleHandler = new ArrayList<Pair<TextArea,HoverStyleHandler>>();
+ protected ArrayList<Pair<TextArea, ArrayList<EventHandler>>> eventHandlers = new ArrayList<Pair<TextArea, ArrayList<EventHandler>>>();
// some constructors
@@ -71,9 +81,18 @@
protected TextArea createNewTextArea() throws InvalidGdlSchemaException, ExecutionException {
TextArea elem = new TextArea();
DOM.setElementAttribute(elem.getElement(), "id", this.getId() + "__GDL_" + this.textElements.size());
+ this.setGdlStyle((Widget)elem);
+ ActiveStyleHandler asHandler = new ActiveStyleHandler(this);
+ FocusStyleHandler fsHandler = new FocusStyleHandler(this);
+ HoverStyleHandler hsHandler = new HoverStyleHandler(this);
+ elem.addMouseDownHandler(asHandler);
+ elem.addMouseUpHandler(asHandler);
+ elem.addMouseOverHandler(hsHandler);
+ elem.addMouseOutHandler(hsHandler);
+ elem.addFocusHandler(fsHandler);
+ elem.addBlurHandler(fsHandler);
this.textElements.add(elem);
super.mainPanel.add(elem);
- this.setGdlStyle((Widget)elem);
this.adjustSize();
return elem;
}
@@ -81,27 +100,12 @@
// removes the passed element and all its handlers from the outer element
protected void removeTextArea(TextArea elem){
- // TODO: implement
- /*for (Pair<TextArea, ActiveStyleHandler> item : this.activeStyleHandler) {
- if(item.getFirst().equals(elem)){
- this.activeStyleHandler.remove(item);
- break;
- }
- }
- for (Pair<TextArea, FocusStyleHandler> item : this.focusStyleHandler) {
+ for (Pair<TextArea, ArrayList<EventHandler>> item : this.eventHandlers) {
if(item.getFirst().equals(elem)){
- this.focusStyleHandler.remove(item);
+ this.eventHandlers.remove(item);
break;
}
}
- for (Pair<TextArea, HoverStyleHandler> item : this.hoverStyleHandler) {
- if(item.getFirst().equals(elem)){
- this.hoverStyleHandler.remove(item);
- break;
- }
- }
- */
-
this.textElements.remove(elem);
elem.removeFromParent();
this.adjustSize();
@@ -532,31 +536,11 @@
if(styleClass == null){
DOM.setStyleAttribute(elem.getElement(), cssProperty, cssValue);
} else if(styleClass.equals(GdlPsis.Scope.gdlActive)){
- /* TODO: implement
- if(item.getFirst().equals(elem)){
- item.getSecond().addCssStyle(new Pair<String, String>(cssProperty, cssValue));
- break;
- }
- }
- */
+ super.activeCssNamesAndStyles.add(new Pair<String, String>(cssProperty, cssValue));
} else if(styleClass.equals(GdlPsis.Scope.gdlFocus)){
- /* TODO: implement
- for (Pair<TextArea, FocusStyleHandler> item : this.focusStyleHandler) {
- if(item.getFirst().equals(elem)){
- item.getSecond().addCssStyle(new Pair<String, String>(cssProperty, cssValue));
- break;
- }
- }
- */
+ super.focusCssNamesAndStyles.add(new Pair<String, String>(cssProperty, cssValue));
} else if (styleClass.equals(GdlPsis.Scope.gdlHover)){
- /* TODO: implement
- for (Pair<TextArea, HoverStyleHandler> item : this.hoverStyleHandler) {
- if(item.getFirst().equals(elem)){
- item.getSecond().addCssStyle(new Pair<String, String>(cssProperty, cssValue));
- break;
- }
- }
- */
+ 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);
@@ -1142,6 +1126,138 @@
// 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;
+ }
+
+
+ // 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(event, null);
+ else this.onFocusStart(null, null);
+ }
+ }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());
+ }
+ }
+
+
+ @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(event, null);
+ else this.onHoverStart(null, null);
+ }
+ }catch(Exception e){
+ Window.alert("could not apply the default CSS style >> " + e.getClass() + " >> " + e.getMessage());
+ }
+ }
+
+
+ @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());
+ }
+ }
+
+
+ @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(event, null);
+ else this.onFocusStart(null, null);
+ }
+ }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
@@ -1163,5 +1279,4 @@
return this.realValue;
}
}
-
}
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 07:41:45 2011 (r568)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlCreatorAssociationView.java Wed Jul 6 11:09:04 2011 (r569)
@@ -2,7 +2,14 @@
import com.google.gwt.dom.client.Style.Float;
import com.google.gwt.dom.client.Style.Overflow;
+import com.google.gwt.event.dom.client.BlurEvent;
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.MouseDownEvent;
+import com.google.gwt.event.dom.client.MouseOutEvent;
+import com.google.gwt.event.dom.client.MouseOverEvent;
+import com.google.gwt.event.dom.client.MouseUpEvent;
import com.google.gwt.user.client.ui.Widget;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Association;
@@ -10,7 +17,10 @@
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMap;
import us.isidor.gdl.anaToMia.Widgets.base.GdlVisibleObject;
+import us.isidor.gdl.anaToMia.Widgets.environment.ActiveStyleHandler;
import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException;
+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.values.AbsoluteNumValue;
import us.isidor.gdl.anaToMia.Widgets.values.AutoNumUnitValue;
@@ -379,4 +389,41 @@
protected void adjustSize() {
// ignore this method, since all instances of gdl:View have a static size
}
+
+ @Override
+ public void onHoverStart(DomEvent event, HoverStyleHandler handler) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void onHoverEnd(DomEvent event, HoverStyleHandler handler) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void onFocusStart(DomEvent event, FocusStyleHandler handler) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void onFocusEnd(DomEvent event, FocusStyleHandler handler) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void onActiveStart(DomEvent event, ActiveStyleHandler handler) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void onActiveEnd(DomEvent 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 07:41:45 2011 (r568)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlDefaultCreatorTopicView.java Wed Jul 6 11:09:04 2011 (r569)
@@ -1,11 +1,21 @@
package us.isidor.gdl.anaToMia.Widgets.views;
+import com.google.gwt.event.dom.client.BlurEvent;
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.MouseDownEvent;
+import com.google.gwt.event.dom.client.MouseOutEvent;
+import com.google.gwt.event.dom.client.MouseOverEvent;
+import com.google.gwt.event.dom.client.MouseUpEvent;
import com.google.gwt.user.client.ui.Widget;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMap;
import us.isidor.gdl.anaToMia.Widgets.base.GdlVisibleObject;
+import us.isidor.gdl.anaToMia.Widgets.environment.ActiveStyleHandler;
import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException;
+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.values.AbsoluteNumValue;
import us.isidor.gdl.anaToMia.Widgets.values.AutoNumUnitValue;
@@ -415,4 +425,48 @@
protected void adjustSize() {
// ignore this method, since all instances of gdl:View have a static size
}
+
+
+ @Override
+ public void onHoverStart(DomEvent event, HoverStyleHandler handler) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ @Override
+ public void onHoverEnd(DomEvent event, HoverStyleHandler handler) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ @Override
+ public void onFocusStart(DomEvent event, FocusStyleHandler handler) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ @Override
+ public void onFocusEnd(DomEvent event, FocusStyleHandler handler) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ @Override
+ public void onActiveStart(DomEvent event, ActiveStyleHandler handler) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ @Override
+ public void onActiveEnd(DomEvent 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 07:41:45 2011 (r568)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlEditorAssociationView.java Wed Jul 6 11:09:04 2011 (r569)
@@ -2,7 +2,14 @@
import com.google.gwt.dom.client.Style.Float;
import com.google.gwt.dom.client.Style.Overflow;
+import com.google.gwt.event.dom.client.BlurEvent;
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.MouseDownEvent;
+import com.google.gwt.event.dom.client.MouseOutEvent;
+import com.google.gwt.event.dom.client.MouseOverEvent;
+import com.google.gwt.event.dom.client.MouseUpEvent;
import com.google.gwt.user.client.ui.Widget;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Association;
@@ -10,7 +17,10 @@
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMap;
import us.isidor.gdl.anaToMia.Widgets.base.GdlVisibleObject;
+import us.isidor.gdl.anaToMia.Widgets.environment.ActiveStyleHandler;
import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException;
+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.values.AbsoluteNumValue;
import us.isidor.gdl.anaToMia.Widgets.values.AutoNumUnitValue;
@@ -417,4 +427,47 @@
protected void adjustSize() {
// ignore this method, since all instances of gdl:View have a static size
}
+
+
+ @Override
+ public void onHoverStart(DomEvent event, HoverStyleHandler handler) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ @Override
+ public void onHoverEnd(DomEvent event, HoverStyleHandler handler) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ @Override
+ public void onFocusStart(DomEvent event, FocusStyleHandler handler) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ @Override
+ public void onFocusEnd(DomEvent event, FocusStyleHandler handler) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ @Override
+ public void onActiveStart(DomEvent event, ActiveStyleHandler handler) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ @Override
+ public void onActiveEnd(DomEvent 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 07:41:45 2011 (r568)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlSpecialCreatorTopicView.java Wed Jul 6 11:09:04 2011 (r569)
@@ -2,14 +2,24 @@
import com.google.gwt.dom.client.Style.Float;
import com.google.gwt.dom.client.Style.Overflow;
+import com.google.gwt.event.dom.client.BlurEvent;
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.MouseDownEvent;
+import com.google.gwt.event.dom.client.MouseOutEvent;
+import com.google.gwt.event.dom.client.MouseOverEvent;
+import com.google.gwt.event.dom.client.MouseUpEvent;
import com.google.gwt.user.client.ui.Widget;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMap;
import us.isidor.gdl.anaToMia.Widgets.base.GdlVisibleObject;
+import us.isidor.gdl.anaToMia.Widgets.environment.ActiveStyleHandler;
import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException;
+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.values.AbsoluteNumValue;
import us.isidor.gdl.anaToMia.Widgets.values.AutoNumUnitValue;
@@ -418,4 +428,47 @@
protected void adjustSize() {
// ignore this method, since all instances of gdl:View have a static size
}
+
+
+ @Override
+ public void onHoverStart(DomEvent event, HoverStyleHandler handler) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ @Override
+ public void onHoverEnd(DomEvent event, HoverStyleHandler handler) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ @Override
+ public void onFocusStart(DomEvent event, FocusStyleHandler handler) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ @Override
+ public void onFocusEnd(DomEvent event, FocusStyleHandler handler) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ @Override
+ public void onActiveStart(DomEvent event, ActiveStyleHandler handler) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ @Override
+ public void onActiveEnd(DomEvent 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 07:41:45 2011 (r568)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlSpecialEditorTopicView.java Wed Jul 6 11:09:04 2011 (r569)
@@ -2,14 +2,24 @@
import com.google.gwt.dom.client.Style.Float;
import com.google.gwt.dom.client.Style.Overflow;
+import com.google.gwt.event.dom.client.BlurEvent;
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.MouseDownEvent;
+import com.google.gwt.event.dom.client.MouseOutEvent;
+import com.google.gwt.event.dom.client.MouseOverEvent;
+import com.google.gwt.event.dom.client.MouseUpEvent;
import com.google.gwt.user.client.ui.Widget;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMap;
import us.isidor.gdl.anaToMia.Widgets.base.GdlVisibleObject;
+import us.isidor.gdl.anaToMia.Widgets.environment.ActiveStyleHandler;
import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException;
+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.values.AbsoluteNumValue;
import us.isidor.gdl.anaToMia.Widgets.values.AutoNumUnitValue;
@@ -420,4 +430,48 @@
protected void adjustSize() {
// ignore this method, since all instances of gdl:View have a static size
}
+
+
+ @Override
+ public void onHoverStart(DomEvent event, HoverStyleHandler handler) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ @Override
+ public void onHoverEnd(DomEvent event, HoverStyleHandler handler) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ @Override
+ public void onFocusStart(DomEvent event, FocusStyleHandler handler) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ @Override
+ public void onFocusEnd(DomEvent event, FocusStyleHandler handler) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ @Override
+ public void onActiveStart(DomEvent event, ActiveStyleHandler handler) {
+ // TODO Auto-generated method stub
+
+ }
+
+
+ @Override
+ public void onActiveEnd(DomEvent event, ActiveStyleHandler handler) {
+ // TODO Auto-generated method stub
+
+ }
+
+
}
More information about the Isidorus-cvs
mailing list