[isidorus-cvs] r681 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: . base text

lgiessmann at common-lisp.net lgiessmann at common-lisp.net
Wed Jul 27 18:26:25 UTC 2011


Author: lgiessmann
Date: Wed Jul 27 11:26:24 2011
New Revision: 681

Log:
gdl-frontend: Widgets: implementd the setting metods for parent's of GdlInfo, i.e. an info element is hown if the mouse is hovered over the parent - if the mouse leaves the parent's area, the GdlInfo element will be hidden

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/text/GdlInfo.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	Wed Jul 27 11:11:28 2011	(r680)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt	Wed Jul 27 11:26:24 2011	(r681)
@@ -1,4 +1,3 @@
-* Implement GdlInfo
 * Implement TopicMaps data consumption
 * Implement TopicMaps data generation
 * Fix css-pseudo-class-handlers (=> Buttons)
\ 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	Wed Jul 27 11:11:28 2011	(r680)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java	Wed Jul 27 11:26:24 2011	(r681)
@@ -104,7 +104,7 @@
 		for (Topic info : infos){
 			GdlInfo elem = (GdlInfo)GdlInstantiator.instantiate(info);
 			this.infoElements.add(elem);
-			elem.setPosition(this.mainPanel);			
+			elem.setPosition(this);			
 		}
 	}
 	

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlInfo.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlInfo.java	Wed Jul 27 11:11:28 2011	(r680)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlInfo.java	Wed Jul 27 11:26:24 2011	(r681)
@@ -1,15 +1,24 @@
 package us.isidor.gdl.anaToMia.Widgets.text;
 
+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.user.client.DOM;
+import com.google.gwt.user.client.Window;
 import com.google.gwt.user.client.ui.Label;
 import com.google.gwt.user.client.ui.RootPanel;
 import com.google.gwt.user.client.ui.Widget;
-
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
+import us.isidor.gdl.anaToMia.Widgets.base.GdlVisibleObject;
 import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException;
 import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException;
 
+
 public class GdlInfo extends GdlTextObject {
+	GdlVisibleObject parent = null;
+	boolean parentListenerSet = false;
+	
 	// some constructors
 	protected GdlInfo(){
 		super();
@@ -36,16 +45,36 @@
 	
 	
 	private void setParentListener(){
-		// TODO: implement
+		if(this.parent != null && !this.parentListenerSet){
+			parent.addMouseOverHandler(new MouseOverHandler() {
+				@Override
+				public void onMouseOver(MouseOverEvent event) {
+					try {
+						GdlInfo.this.show();
+					} catch (InvalidGdlSchemaException e) {
+						e.printStackTrace();
+					}
+				}
+			});
+			parent.addMouseOutHandler(new MouseOutHandler() {				
+				@Override
+				public void onMouseOut(MouseOutEvent event) {
+					GdlInfo.this.hide();
+				}
+			});			
+			this.parentListenerSet = true;
+		}
 	}
 	
 	
-	public void setPosition(Widget parent) throws InvalidGdlSchemaException{
-		int left = parent.getAbsoluteLeft();
-		int top = parent.getAbsoluteTop() + parent.getOffsetHeight();
+	public void setPosition(GdlVisibleObject parent) throws InvalidGdlSchemaException{
+		this.parent = parent;
+		int left = parent.getAbsoluteLeft() + 5;
+		int top = parent.getAbsoluteTop() + parent.getOffsetHeight() + 1;
 		DOM.setStyleAttribute(this.mainPanel.getElement(), "position", "absolute");
 		DOM.setStyleAttribute(this.mainPanel.getElement(), "top", top + "px");
 		DOM.setStyleAttribute(this.mainPanel.getElement(), "left", left + "px");
+		this.setParentListener();
 		this.hide();
 	}
 	




More information about the Isidorus-cvs mailing list