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

lgiessmann at common-lisp.net lgiessmann at common-lisp.net
Wed Sep 21 11:20:43 UTC 2011


Author: lgiessmann
Date: Wed Sep 21 04:20:42 2011
New Revision: 954

Log:
gdl-frontend: Widgets: if the user clicked the delete button of an environment topic, this button is disabled, so the user is only able to click the delete button of the generated HashObjectPsiContainer panel

Modified:
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/DeleteCallback.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/HashObjectPsiContainer.java

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/DeleteCallback.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/DeleteCallback.java	Wed Sep 21 04:06:00 2011	(r953)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/DeleteCallback.java	Wed Sep 21 04:20:42 2011	(r954)
@@ -1,6 +1,8 @@
 package us.isidor.gdl.anaToMia.Widgets.isidorus;
 
 import java.util.ArrayList;
+import com.google.gwt.dom.client.ButtonElement;
+import com.google.gwt.dom.client.Element;
 import com.google.gwt.http.client.Request;
 import com.google.gwt.http.client.RequestBuilder;
 import com.google.gwt.http.client.RequestCallback;
@@ -12,6 +14,7 @@
 import com.google.gwt.json.client.JSONParser;
 import com.google.gwt.json.client.JSONString;
 import com.google.gwt.json.client.JSONValue;
+import com.google.gwt.user.client.DOM;
 import com.google.gwt.user.client.Window;
 import us.isidor.gdl.anaToMia.TopicMaps.TmEngineModel.ExporterException;
 import us.isidor.gdl.anaToMia.TopicMaps.TmEngineModel.TmEngine;
@@ -49,6 +52,11 @@
 
 	@Override
 	public void deleteTmConstruct(ArrayList<Pair<Construct, TopicMapsTypes>> constructs, TmEngine tmEngine, String buttonId) {
+		if(buttonId != null){
+			Element elem = DOM.getElementById(buttonId);
+			ButtonElement btnElem = (ButtonElement)elem;
+			btnElem.setDisabled(true);
+		}
 		this.deleteTopic(constructs, tmEngine);
 	}
 
@@ -59,13 +67,12 @@
 				Topic top = (Topic)pair.getFirst();
 				
 				if(TmHelper.isInstanceOf(top, IsidorusConstants.ENVIRONMENT_PSI)) this.deleteEnvironmentTopic(top);
-				else this.deleteNonEnvironment(top, tmEngine);
+				else this.deleteNonEnvironmentTopic(top, tmEngine);
 			}
 		}		
 	}
 	
 	
-	
 	private String createTmSparqlQuery(Topic environment){
 		String psi = environment.getSubjectIdentifiers().get(0).getReference();
 		String psiSuffix = Utils.splitUriByLastFragment(psi)[1];
@@ -140,7 +147,7 @@
 	}
 	
 	
-	private void deleteNonEnvironment(Topic top, TmEngine tmEngine){
+	private void deleteNonEnvironmentTopic(Topic top, TmEngine tmEngine){
 		if(top.getSubjectIdentifiers().length() != 0){
 			String psi = top.getSubjectIdentifiers().get(0).getReference();
 			

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/HashObjectPsiContainer.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/HashObjectPsiContainer.java	Wed Sep 21 04:06:00 2011	(r953)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/HashObjectPsiContainer.java	Wed Sep 21 04:20:42 2011	(r954)
@@ -21,6 +21,7 @@
 	private VerticalPanel containerPanel = new VerticalPanel();
 	private Button commitButton = new Button("delete the Environment topic and all its Hash-Object topics");
 	private final String ERROR_STYLE_CLASS = "bad_input";
+	private CheckBoxClickHandler cbxClickHandler = new CheckBoxClickHandler();
 	
 	
 	public HashObjectPsiContainer(){
@@ -48,11 +49,25 @@
 			}
 		}
 		
+		cbx.addClickHandler(this.cbxClickHandler);
+		
 		if(widgetIdx == this.containerPanel.getWidgetCount()) this.containerPanel.add(cbx);
 		this.containerPanel.insert(this.commitButton, this.containerPanel.getWidgetCount());
 	}
 	
 	
+	private class CheckBoxClickHandler implements ClickHandler{
+		@Override
+		public void onClick(ClickEvent event) {
+			Object obj = event.getSource();
+			if(obj instanceof CheckBox){
+				CheckBox source = (CheckBox) obj;
+				if(source.getValue()) source.removeStyleName(HashObjectPsiContainer.this.ERROR_STYLE_CLASS);
+			}
+		}
+	}
+	
+	
 	private class HashObjectPsiContainerClickHandler implements ClickHandler {
 		public HashObjectPsiContainerClickHandler(){}
 		




More information about the Isidorus-cvs mailing list