[isidorus-cvs] r590 - branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text

lgiessmann at common-lisp.net lgiessmann at common-lisp.net
Fri Jul 8 20:38:06 UTC 2011


Author: lgiessmann
Date: Fri Jul  8 13:38:06 2011
New Revision: 590

Log:
gdl-frontend: Widgets: started to implement the GdlReference class

Added:
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlReference.java
Modified:
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTitle.java

Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlReference.java
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlReference.java	Fri Jul  8 13:38:06 2011	(r590)
@@ -0,0 +1,104 @@
+package us.isidor.gdl.anaToMia.Widgets.text;
+
+import java.util.ArrayList;
+
+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.event.dom.client.HasBlurHandlers;
+import com.google.gwt.event.dom.client.HasFocusHandlers;
+import com.google.gwt.event.shared.HandlerRegistration;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.ui.Label;
+
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes;
+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.Pair;
+
+public class GdlReference extends GdlTextObject implements IGdlHasValue{
+	// some constructors
+	protected GdlReference() throws InvalidGdlSchemaException, ExecutionException {
+		super();
+	}
+	
+	public GdlReference(Topic tmRepresentative) throws InvalidGdlSchemaException, ExecutionException{
+		super(tmRepresentative);
+		// TODO: create a ListBox element for each TM-elem
+		this.createReference();
+	}
+	
+	
+	private Reference createReference() throws InvalidGdlSchemaException {
+		Reference reference = new Reference();
+		DOM.setElementAttribute(reference.getElement(), "id", this.getId() + "__GDL_" + this.subElements.size());
+		super.addToContainerPanel(reference);
+		ActiveStyleHandler asHandler = new ActiveStyleHandler(this);
+		FocusStyleHandler fsHandler = new FocusStyleHandler(this);
+		HoverStyleHandler hsHandler = new HoverStyleHandler(this);
+		reference.addMouseDownHandler(asHandler);
+		reference.addMouseUpHandler(asHandler);
+		reference.addMouseOverHandler(hsHandler);
+		reference.addMouseOutHandler(hsHandler);
+		reference.addFocusHandler(fsHandler);
+		reference.addBlurHandler(fsHandler);
+		// TODO: register a click handler that handles the reference behavior
+		return reference;
+	}
+	
+	
+	
+	
+	
+	
+	
+	@Override
+	public ArrayList<String> getStringValue() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public ArrayList<Pair<TopicMapsTypes, Object>> getTmValue() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public boolean validate() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+	
+	
+	
+	
+	
+	
+	// this class wraps a Label that is used as 
+	protected class Reference extends Label implements HasFocusHandlers, HasBlurHandlers {
+		public Reference(){
+			super();
+		}
+		
+		public Reference(String text){
+			super(text);
+		}
+
+		@Override
+		public HandlerRegistration addBlurHandler(BlurHandler handler) {
+			return this.addDomHandler(handler, BlurEvent.getType());
+		}
+
+		@Override
+		public HandlerRegistration addFocusHandler(FocusHandler handler) {
+			return this.addDomHandler(handler, FocusEvent.getType());
+		}
+	}
+}

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 13:00:49 2011	(r589)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTitle.java	Fri Jul  8 13:38:06 2011	(r590)
@@ -3,7 +3,9 @@
 import java.util.ArrayList;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
+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;
@@ -45,7 +47,7 @@
 import com.google.gwt.user.client.ui.Widget;
 
 
-public class GdlTitle extends GdlTextObject {
+public class GdlTitle extends GdlTextObject implements IGdlHasValue{
 	protected ArrayList<Pair<String, String>> titleActiveCssNamesAndStyles = new ArrayList<Pair<String,String>>();
 	protected ArrayList<Pair<String, String>> titleFocusCssNamesAndStyles = new ArrayList<Pair<String,String>>();
 	protected ArrayList<Pair<String, String>> titleHoverCssNamesAndStyles = new ArrayList<Pair<String,String>>();
@@ -417,6 +419,30 @@
 	}
 
 	
+	@Override
+	public ArrayList<String> getStringValue() {
+		ArrayList<String> result = new ArrayList<String>();
+		for (Widget title : this.subElements) {
+			result.add(((TitleWidget)title).titleElement.getInnerText());
+		}
+		return result;
+	}
+
+
+	@Override
+	public ArrayList<Pair<TopicMapsTypes, Object>> getTmValue() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+
+	@Override
+	public boolean validate() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+	
+	
 	// 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{




More information about the Isidorus-cvs mailing list