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

lgiessmann at common-lisp.net lgiessmann at common-lisp.net
Tue Aug 30 13:17:29 UTC 2011


Author: lgiessmann
Date: Tue Aug 30 06:17:28 2011
New Revision: 813

Log:
gdl-frontend: Widgets: fixed a bug in GdlVisibleObject.getContent()

Modified:
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlCommitButton.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlAssociationView.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlTopicView.java

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlCommitButton.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlCommitButton.java	Tue Aug 30 05:45:13 2011	(r812)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlCommitButton.java	Tue Aug 30 06:17:28 2011	(r813)
@@ -1,14 +1,18 @@
 package us.isidor.gdl.anaToMia.Widgets.button;
 
+import us.isidor.gdl.anaToMia.TopicMaps.TmEngineModel.TmEngine;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Association;
 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;
+import us.isidor.gdl.anaToMia.Widgets.environment.Pair;
 import com.google.gwt.event.dom.client.ClickEvent;
 import com.google.gwt.event.dom.client.ClickHandler;
 import com.google.gwt.user.client.Window;
 import com.google.gwt.user.client.ui.Button;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes;
 
 
 public class GdlCommitButton extends GdlActionButton {
@@ -37,7 +41,17 @@
 		@Override
 		public void onClick(ClickEvent event) {
 			try{
-				Window.alert(" >> " + this.owner.getGdlParent().getContent(null).size());
+				TmEngine tmEngine = this.owner.getRoot().getTmEngine();
+				for (Pair<Construct, TopicMapsTypes> pair : this.owner.getGdlParent().getContent(null)) {
+					String str = "";
+					if(pair.getSecond().equals(TopicMapsTypes.Topic)){
+						str = tmEngine.exportTm((Topic)pair.getFirst());
+					} else if(pair.getSecond().equals(TopicMapsTypes.Association)){
+						str = tmEngine.exportTm((Association)pair.getFirst());
+					}
+				
+					Window.alert(str);
+				}
 				
 				// TODO: implement
 			}catch(Exception e){

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlAssociationView.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlAssociationView.java	Tue Aug 30 05:45:13 2011	(r812)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlAssociationView.java	Tue Aug 30 06:17:28 2011	(r813)
@@ -2,7 +2,6 @@
 
 import java.util.ArrayList;
 import com.google.gwt.core.client.JsArray;
-import com.google.gwt.user.client.Window;
 import com.google.gwt.user.client.ui.HorizontalPanel;
 import com.google.gwt.user.client.ui.VerticalPanel;
 import com.google.gwt.user.client.ui.Widget;

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlTopicView.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlTopicView.java	Tue Aug 30 05:45:13 2011	(r812)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlTopicView.java	Tue Aug 30 06:17:28 2011	(r813)
@@ -83,10 +83,11 @@
 		if(localCarrier == null) localCarrier = this.getRepresentedTopic();
 				
 		for (Widget ctrl : this.subElements) {
-			if(this.receivedData == null) result.add(new Pair<Construct, TopicMapsTypes>(localCarrier, TopicMapsTypes.Topic));
+			Pair<Construct, TopicMapsTypes> topicPair = new Pair<Construct, TopicMapsTypes>(localCarrier, TopicMapsTypes.Topic);
+			if(this.receivedData == null && !result.contains(topicPair)) result.add(topicPair);
 			if(ctrl instanceof GdlVisibleObject){
 				for (Pair<Construct, TopicMapsTypes> pair : ((GdlVisibleObject)ctrl).getContent(localCarrier)) {
-					if(this.receivedData != null)result.add(pair);
+					if(this.receivedData != null || (ctrl instanceof GdlView))result.add(pair);
 				}
 			}
 		}
@@ -110,6 +111,7 @@
 	}
 	
 	
+	// returns the recieved topic or creates a topic stub
 	public Topic getRepresentedTopic(){
 		if(this.receivedData ==null){
 			if(this.representedTopic == null){




More information about the Isidorus-cvs mailing list