[isidorus-cvs] r936 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: base button isidorus

lgiessmann at common-lisp.net lgiessmann at common-lisp.net
Tue Sep 20 10:29:49 UTC 2011


Author: lgiessmann
Date: Tue Sep 20 03:29:48 2011
New Revision: 936

Log:
gdl-frontend: Widgets: changed the static method for registering button-click-handlers on the GdlPanel to a non-static method

Modified:
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPanel.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/button/GdlActionButton.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/GdlWebPage.java

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPanel.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPanel.java	Tue Sep 20 03:19:01 2011	(r935)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPanel.java	Tue Sep 20 03:29:48 2011	(r936)
@@ -55,7 +55,7 @@
 	
 	// contains all callbacks that are used as click handlers and the corresponding
 	// html element id of the button element
-	private static ArrayList<Pair<String, ArrayList<ClickHandler>>> buttonCallbacks = new ArrayList<Pair<String,ArrayList<ClickHandler>>>();
+	private ArrayList<Pair<String, ArrayList<ClickHandler>>> buttonCallbacks = new ArrayList<Pair<String,ArrayList<ClickHandler>>>();
 
 	
 	// some constructors
@@ -86,23 +86,23 @@
 	}
 
 	
-	public static ArrayList<ClickHandler> getClickHandlers(String id){
-		for (Pair<String, ArrayList<ClickHandler>> item : GdlPanel.buttonCallbacks)
+	public ArrayList<ClickHandler> getClickHandlers(String id){
+		for (Pair<String, ArrayList<ClickHandler>> item : this.buttonCallbacks)
 			if(item.getFirst().equals(id)) return item.getSecond();
 			
 		return new ArrayList<ClickHandler>();
 	}
 	
 	
-	public static void addClickHandler(String id, ClickHandler handler) throws ExecutionException {
+	public void addClickHandler(String id, ClickHandler handler) throws ExecutionException {
 		if(id == null && handler == null) return;
 		if(id == null || handler == null) throw new ExecutionException("id and handler must be set, but are: " + id + ", " + handler);
 		
-		ArrayList<ClickHandler> item = GdlPanel.getClickHandlers(id);
+		ArrayList<ClickHandler> item = this.getClickHandlers(id);
 		if(item.size() == 0){
 			ArrayList<ClickHandler> handlers = new ArrayList<ClickHandler>();
 			handlers.add(handler);
-			GdlPanel.buttonCallbacks.add(new Pair<String, ArrayList<ClickHandler>>(id, handlers));
+			this.buttonCallbacks.add(new Pair<String, ArrayList<ClickHandler>>(id, handlers));
 		} else{
 			item.add(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	Tue Sep 20 03:19:01 2011	(r935)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java	Tue Sep 20 03:29:48 2011	(r936)
@@ -42,7 +42,9 @@
 			//Pair<String, TopicIdentifierTypes> requestedTopicToEdit = new Pair<String, TopicIdentifierTypes>("http://textgrid.org/serviceregistry/test-env-1", TopicIdentifierTypes.SubjectIdentifier);
 			//Pair<String, TopicIdentifierTypes> requestedTopicToEdit = new Pair<String, TopicIdentifierTypes>("http://textgrid.org/serviceregistry/test-hash-2", TopicIdentifierTypes.SubjectIdentifier);
 			//Pair<String, TopicIdentifierTypes> requestedTopicToEdit = new Pair<String, TopicIdentifierTypes>("http://textgrid.org/serviceregistry/hash-object/Test Environment 1/test1", TopicIdentifierTypes.SubjectIdentifier);
-			GdlPanel.addClickHandler("hash_object_reset_button_id", new ClickHandler() {
+			gdlPanel = new GdlPanel(null, requestedTopicsToCreate);
+			 
+			gdlPanel.addClickHandler("hash_object_reset_button_id", new ClickHandler() {
 				@Override
 				public void onClick(ClickEvent event) {
 					Element elem = DOM.getElementById("hash_object_text_key_id__GDL_0");
@@ -52,7 +54,6 @@
 				}
 			});
 			
-			gdlPanel = new GdlPanel(null, requestedTopicsToCreate);
 			mainPanel.add(gdlPanel);
 			gdlPanel.setTmEngine(new JtmsTmEngine());
 			gdlPanel.setLoadSchemaCallback(new LoadSchemaCallback());

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlActionButton.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlActionButton.java	Tue Sep 20 03:19:01 2011	(r935)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlActionButton.java	Tue Sep 20 03:29:48 2011	(r936)
@@ -7,7 +7,6 @@
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
-import us.isidor.gdl.anaToMia.Widgets.base.GdlPanel;
 import us.isidor.gdl.anaToMia.Widgets.base.GdlVisibleObject;
 import us.isidor.gdl.anaToMia.Widgets.base.PSIs;
 import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException;
@@ -53,7 +52,7 @@
 	
 	
 	protected void setClickHandlers() throws InvalidGdlSchemaException{
-		ArrayList<ClickHandler> handlers = GdlPanel.getClickHandlers(this.getId());		
+		ArrayList<ClickHandler> handlers = this.getRoot().getClickHandlers(this.getId());		
 		if(handlers == null || this.subElements.size() == 0) return;
 		
 		for (ClickHandler handler : handlers)

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/GdlWebPage.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/GdlWebPage.java	Tue Sep 20 03:19:01 2011	(r935)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/GdlWebPage.java	Tue Sep 20 03:29:48 2011	(r936)
@@ -52,7 +52,6 @@
 		this.createNewButton.addStyleName(this.CREATE_NEW_BUTTON_STYLE_NAME);
 		DOM.setStyleAttribute(this.createNewButton.getElement(), "marginBottom", "1em");
 		try{
-			GdlPanel.addClickHandler("hash_object_reset_button_id", new ResetClickHandler());
 			this.psiContainer = new PsiContainer(new PsiClickHandler());
 			this.createNewButton.addClickHandler(new CreateNewClickHandler());
 		}catch(Exception e){
@@ -142,6 +141,7 @@
 				ArrayList<Pair<String, TopicIdentifierTypes>> topicsToCreate = new ArrayList<Pair<String, TopicIdentifierTypes>>();
 				topicsToCreate.add(new Pair<String, TopicIdentifierTypes>(GdlWebPage.this.topicTypePsi, TopicIdentifierTypes.SubjectIdentifier));
 				GdlWebPage.this.gdlPanel = new GdlPanel(null, topicsToCreate, 362, 160);
+				GdlWebPage.this.gdlPanel.addClickHandler("hash_object_reset_button_id", new ResetClickHandler());
 				GdlWebPage.this.mainPanel.add(gdlPanel);
 				gdlPanel.setTmEngine(new JtmsTmEngine());
 				gdlPanel.setLoadSchemaCallback(new LoadSchemaCallback(GdlWebPage.this));
@@ -167,6 +167,7 @@
 				try{
 					if(GdlWebPage.this.gdlPanel != null) GdlWebPage.this.gdlPanel.removeFromParent();
 					GdlWebPage.this.gdlPanel = new GdlPanel(new Pair<String, TopicIdentifierTypes>(source.getText(), TopicIdentifierTypes.SubjectIdentifier), null, 362, 160);
+					GdlWebPage.this.gdlPanel.addClickHandler("hash_object_reset_button_id", new ResetClickHandler());
 					GdlWebPage.this.mainPanel.add(gdlPanel);
 					gdlPanel.setTmEngine(new JtmsTmEngine());
 					gdlPanel.setLoadSchemaCallback(new LoadSchemaCallback(GdlWebPage.this));




More information about the Isidorus-cvs mailing list