[isidorus-cvs] r816 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets: lib src/us/isidor/gdl/anaToMia/Widgets src/us/isidor/gdl/anaToMia/Widgets/base src/us/isidor/gdl/anaToMia/Widgets/button src/us/isidor/gdl/anaToMia/Widgets/environment src/us/isidor/gdl/anaToMia/Widgets/isidorus src/us/isidor/gdl/anaToMia/Widgets/view

lgiessmann at common-lisp.net lgiessmann at common-lisp.net
Thu Sep 1 16:18:21 UTC 2011


Author: lgiessmann
Date: Thu Sep  1 09:18:20 2011
New Revision: 816

Log:
gdl-frontend: Widgets: implemented a DeleteCallback, a CommitCallback and fixed some bugs

Added:
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/DeleteCallback.java
Modified:
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/lib/GDL_TmEngine.jar
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/lib/GDL_TopicMaps_Model.jar
   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/GdlPanel.java
   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/PSIs.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/base/TmHelper.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/Utils.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/button/GdlCommitButton.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlDeleteButton.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/ICommitCallback.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/IDeleteCallback.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/CommitCallback.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/lib/GDL_TmEngine.jar
==============================================================================
Binary file (source and/or target). No diff available.

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/lib/GDL_TopicMaps_Model.jar
==============================================================================
Binary file (source and/or target). No diff available.

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	Thu Sep  1 09:15:03 2011	(r815)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt	Thu Sep  1 09:18:20 2011	(r816)
@@ -1,4 +1,4 @@
-* finalise the GDL-Schema for creating and editing instances of tgm:Hash-Object => Hidden-Value (type-occurrence) + otherrole
+* implement validation
 * implement the handling of default-values
 * Implement TopicMaps data consumption
 * Implement TopicMaps data generation

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	Thu Sep  1 09:15:03 2011	(r815)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPanel.java	Thu Sep  1 09:18:20 2011	(r816)
@@ -209,7 +209,9 @@
 			if(this.commitCallback == null){
 				throw new ExecutionException("No CommitCallback was set yet");
 			}
-			this.commitCallback.commitTmConstruct(this.requestedSchemaTm, TopicMapsTypes.TopicMap, this.tmEngine);
+			ArrayList<Pair<Construct, TopicMapsTypes>> data = new ArrayList<Pair<Construct,TopicMapsTypes>>();
+			data.add(new Pair<Construct, TopicMapsTypes>(this.requestedSchemaTm, TopicMapsTypes.TopicMap));
+			this.commitCallback.commitTmConstruct(data, this.tmEngine, null);
 		}catch(Exception e){
 			for (IOnErrorCallback handler : localOnErrorContainer) {
 				handler.onError(GdlErrorTypes.CommitError, e);
@@ -250,7 +252,9 @@
 			if(this.deleteCallback == null)
 				throw new ExecutionException("No DeleteCallback was set yet");
 	
-			this.deleteCallback.deleteTmConstruct(requestedSchemaTm, TopicMapsTypes.TopicMap);
+			ArrayList<Pair<Construct, TopicMapsTypes>> data = new ArrayList<Pair<Construct,TopicMapsTypes>>();
+			data.add(new Pair<Construct, TopicMapsTypes>(this.requestedSchemaTm, TopicMapsTypes.TopicMap));
+			this.deleteCallback.deleteTmConstruct(data, null);
 		}catch(Exception e){
 			for (IOnErrorCallback handler : localOnErrorContainer)
 				handler.onError(GdlErrorTypes.DeleteError, e);

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	Thu Sep  1 09:15:03 2011	(r815)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java	Thu Sep  1 09:18:20 2011	(r816)
@@ -2215,7 +2215,9 @@
 	// returns the actual data that is hold by this instance
 	public ArrayList<Pair<Construct, TopicMapsTypes>> getContent(Construct carrier) throws InvalidGdlSchemaException, ExecutionException {
 		ArrayList<Pair<Construct, TopicMapsTypes>> result = new ArrayList<Pair<Construct,TopicMapsTypes>>();
-		if(carrier == null || this.getRootConstraint() == null) return result;
+		if(this.getRootConstraint() == null) return result;
+		Construct localCarrier = carrier;
+		if(carrier == null) localCarrier = TmHelper.getNearestTopicOrAssociation(this);
 		
 		//TODO: finalise
 		for (int idx = 0; idx != this.getSelectedValues().size(); ++idx){
@@ -2226,13 +2228,27 @@
 			} else if (TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclSubjectLocatorConstraint)){
 				
 			} else if (TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicNameConstraint)){
+				if(!(localCarrier instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()) + " must be bound to a Topic, but is: " + localCarrier.getClass());
+				Topic nameType = TmHelper.getConstrainedStatement(this.getConstraint());
+				JsArray<Name> names = ((Topic)localCarrier).getNames(nameType);				
 				
+				Name changedName = null;
+				if(this.getRootConstraint().equals(this.getConstraint())){
+					if(names.length() > idx){
+						changedName = names.get(idx);
+						changedName.setValue(this.getSelectedValues().get(idx));
+					}else {
+						changedName = ((Topic)localCarrier).createName(this.getSelectedValues().get(idx), nameType, null);
+					}
+				} // TODO: item-identifier, reifier, variant, ...
+				
+				result.add(new Pair<Construct, TopicMapsTypes>(changedName, TopicMapsTypes.Name));
 			} else if (TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclVariantNameConstraint)){
 				
 			} else if (TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicOccurrenceConstraint)){
-				if(!(carrier instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()) + " must be bound to a Topic, but is: " + carrier.getClass());
+				if(!(localCarrier instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()) + " must be bound to a Topic, but is: " + localCarrier.getClass());
 				Topic occurrenceType = TmHelper.getConstrainedStatement(this.getConstraint());
-				JsArray<Occurrence> occurrences = ((Topic)carrier).getOccurrences(occurrenceType);
+				JsArray<Occurrence> occurrences = ((Topic)localCarrier).getOccurrences(occurrenceType);
 
 				Occurrence changedOccurrence = null;
 				if(this.getRootConstraint().equals(this.getConstraint())){
@@ -2240,18 +2256,18 @@
 						changedOccurrence = occurrences.get(idx);
 						changedOccurrence.setValue(this.getSelectedValues().get(idx));
 					}else {
-						changedOccurrence = ((Topic)carrier).createOccurrence(occurrenceType, this.getSelectedValues().get(idx), null, null);
+						changedOccurrence = ((Topic)localCarrier).createOccurrence(occurrenceType, this.getSelectedValues().get(idx), null, null);
 					}
-				} // TODO: Type, Role-Player, ...
+				} // TODO: item-identifier, reifier, ...
 				
 				result.add(new Pair<Construct, TopicMapsTypes>(changedOccurrence, TopicMapsTypes.Occurrence));
 			} else if (TmHelper.isInstanceOf(this.getRootConstraint(), PSIs.TMCL.tmclTopicRoleConstraint)){
-				if(!(carrier instanceof Association)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()) + " must be bound to an Association, but is: " + carrier.getClass());
+				if(!(localCarrier instanceof Association)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getRootConstraint()) + " must be bound to an Association, but is: " + localCarrier.getClass());
 				Pair<Topic, Topic> roleAndPlayerType = TmHelper.getConstrainedRoleAndPlayerTypeOfConstraint(this.getRootConstraint());
 				Topic roleType = roleAndPlayerType.getFirst();
 				Topic playerType = roleAndPlayerType.getSecond();
 				
-				JsArray<Role> typedRoles = ((Association)carrier).getRoles(roleType);
+				JsArray<Role> typedRoles = ((Association)localCarrier).getRoles(roleType);
 				ArrayList<Role> roles = new ArrayList<Role>();
 				for(int i = 0; i != typedRoles.length(); ++i)
 					if(TmHelper.isInstanceOf(typedRoles.get(i).getPlayer(), playerType)) roles.add(typedRoles.get(i));
@@ -2266,7 +2282,7 @@
 						changedRole = roles.get(idx);
 						changedRole.setPlayer(TmHelper.getTopicFromStringRepresentation(this.getSelectedValues().get(idx), this.getValueGroup()));
 					} else {
-						changedRole = ((Association)carrier).createRole(roleType, TmHelper.getTopicFromStringRepresentation(this.getSelectedValues().get(idx), this.getValueGroup()));
+						changedRole = ((Association)localCarrier).createRole(roleType, TmHelper.getTopicFromStringRepresentation(this.getSelectedValues().get(idx), this.getValueGroup()));
 					}
 				} else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.GDL.TopicType.gdlType)){
 					// TODO: implement

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/PSIs.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/PSIs.java	Thu Sep  1 09:15:03 2011	(r815)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/PSIs.java	Thu Sep  1 09:18:20 2011	(r816)
@@ -2,7 +2,7 @@
 
 
 
-public class PSIs {
+public class PSIs {	
 	// some psis of the TMDM
 	public class TMDM{
 		public final static String tmdm = "http://psi.topicmaps.org/iso13250/model/";

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	Thu Sep  1 09:15:03 2011	(r815)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java	Thu Sep  1 09:18:20 2011	(r816)
@@ -7,6 +7,7 @@
 import us.isidor.gdl.anaToMia.Widgets.environment.Pair;
 import us.isidor.gdl.anaToMia.Widgets.environment.TopicIdentifierTypes;
 import us.isidor.gdl.anaToMia.Widgets.isidorus.CommitCallback;
+import us.isidor.gdl.anaToMia.Widgets.isidorus.DeleteCallback;
 import us.isidor.gdl.anaToMia.Widgets.isidorus.LoadSchemaCallback;
 import com.google.gwt.core.client.EntryPoint;
 import com.google.gwt.event.dom.client.ClickEvent;
@@ -30,12 +31,12 @@
 			mainPanel.setPixelSize(1000, 600);
 			
 			ArrayList<Pair<String, TopicIdentifierTypes>> requestedTopicsToCreate = new ArrayList<Pair<String,TopicIdentifierTypes>>();
-			requestedTopicsToCreate.add(new Pair<String, TopicIdentifierTypes>("http://textgrid.org/serviceregistry/model/types/Hash-Object", TopicIdentifierTypes.SubjectIdentifier));
-			//requestedTopicsToCreate.add(new Pair<String, TopicIdentifierTypes>("http://textgrid.org/serviceregistry/model/types/Environment", TopicIdentifierTypes.SubjectIdentifier));
+			//requestedTopicsToCreate.add(new Pair<String, TopicIdentifierTypes>("http://textgrid.org/serviceregistry/model/types/Hash-Object", TopicIdentifierTypes.SubjectIdentifier));
+			requestedTopicsToCreate.add(new Pair<String, TopicIdentifierTypes>("http://textgrid.org/serviceregistry/model/types/Environment", TopicIdentifierTypes.SubjectIdentifier));
 			//requestedTopicsToCreate.add(new Pair<String, TopicIdentifierTypes>("http://psi.test.org/gdl-test/Poet", TopicIdentifierTypes.SubjectIdentifier));
 			//requestedTopicsToCreate.add(new Pair<String, TopicIdentifierTypes>("http://psi.test.org/gdl-test/Musician", TopicIdentifierTypes.SubjectIdentifier));
 			
-			//Pair<String, TopicIdentifierTypes> requestedTopicToEdit = new Pair<String, TopicIdentifierTypes>("http://textgrid.org/serviceregistry/model/types/test-env", TopicIdentifierTypes.SubjectIdentifier);
+			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);
 			GdlPanel.addClickHandler("hash_object_reset_button_id", new ClickHandler() {
 				@Override
@@ -45,11 +46,12 @@
 				}
 			});
 			
-			gdlPanel = new GdlPanel(null, requestedTopicsToCreate);
+			gdlPanel = new GdlPanel(requestedTopicToEdit, null);
 			mainPanel.add(gdlPanel);
 			gdlPanel.setTmEngine(new JtmsTmEngine());
 			gdlPanel.setLoadSchemaCallback(new LoadSchemaCallback());
 			gdlPanel.setCommitCallback(new CommitCallback());
+			gdlPanel.setDeleteCallback(new DeleteCallback());
 			
 			
 			Button requestButton = new Button("load schema");

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java	Thu Sep  1 09:15:03 2011	(r815)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java	Thu Sep  1 09:18:20 2011	(r816)
@@ -17,12 +17,13 @@
 import us.isidor.gdl.anaToMia.Widgets.environment.Pattern;
 import us.isidor.gdl.anaToMia.Widgets.environment.TopicIdentifierTypes;
 import us.isidor.gdl.anaToMia.Widgets.view.GdlTopicView;
+import us.isidor.gdl.anaToMia.Widgets.view.GdlAssociationView.AssociationItem;
+import us.isidor.gdl.anaToMia.Widgets.view.GdlView;
+
 import com.google.gwt.core.client.JsArray;
 
 
-public class TmHelper {
-	
-	
+public class TmHelper {	
 	// a helper that returns the topic bound to the identifier via a subject identifier
 	public static Topic getTopicByPsi(String subjectIdentifier, TopicMap tm){
 		if(subjectIdentifier == null || tm == null) return null;
@@ -698,7 +699,7 @@
 
 	
 	// returns a topic that is represented by the nearest instance of GdlTopicView
-	public static Topic getNearestTopic(GdlVisibleObject elem){
+	public static Topic getNearestTopic(GdlVisibleObject elem) throws InvalidGdlSchemaException{
 		if(elem == null) return null;
 		
 		GdlTopicView view = null;
@@ -714,6 +715,25 @@
 	}
 	
 	
+	// returns a topic or associaitons that is represented by the nearest instance of GdlView
+	public static Construct getNearestTopicOrAssociation(GdlVisibleObject elem) throws InvalidGdlSchemaException{
+		if(elem == null) return null;
+		
+		GdlView view = null;
+		GdlVisibleObject parent = elem;
+		
+		do{
+			if(parent instanceof GdlView) view = (GdlView)parent;
+			else parent = parent.getGdlParent();
+		}while(view == null && parent != null);
+		
+		if(view == null) return null;
+		else if(view instanceof GdlTopicView) return ((GdlTopicView)view).getRepresentedTopic();
+		else if(view instanceof AssociationItem) return ((AssociationItem)view).getRepresentedAssociation();
+		else return null;
+	}
+	
+	
 	// returns the topic that represents the value group that is bound to the passed
 	// topic via a gdl:view-binding association
 	public static Topic getValueGroupOf(Topic visibleElement) throws InvalidGdlSchemaException{

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/Utils.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/Utils.java	Thu Sep  1 09:15:03 2011	(r815)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/Utils.java	Thu Sep  1 09:18:20 2011	(r816)
@@ -1,9 +1,9 @@
 package us.isidor.gdl.anaToMia.Widgets.base;
 
 import java.util.ArrayList;
-
+import com.google.gwt.core.client.JavaScriptObject;
 import us.isidor.gdl.anaToMia.Widgets.environment.Pattern;
-
+import com.google.gwt.core.client.JsArray;
 import com.google.gwt.dom.client.Element;
 
 public class Utils {
@@ -22,6 +22,16 @@
 	}
 	
 	
+	public static <T extends JavaScriptObject> boolean contains (JsArray<T> container, T item){
+		if(container == null || item == null) return false;
+		
+		for(int i = 0; i != container.length(); ++i)
+			if(container.get(i).equals(item)) return true;
+		
+		return false;
+	}
+	
+	
 	// returns a list that contains a union of both lists
 	public static <T> ArrayList<T> intersection(ArrayList<T> fst, ArrayList<T> snd){
 		ArrayList<T> result = new ArrayList<T>();

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	Thu Sep  1 09:15:03 2011	(r815)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlActionButton.java	Thu Sep  1 09:18:20 2011	(r816)
@@ -60,6 +60,7 @@
 			((Button)this.subElements.get(0)).addClickHandler(handler);
 	}
 	
+	
 	// sets the id property of this element by using the GWT DOM class
 	@Override
 	public void setId(String id){

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	Thu Sep  1 09:15:03 2011	(r815)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlCommitButton.java	Thu Sep  1 09:18:20 2011	(r816)
@@ -2,17 +2,15 @@
 
 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.ICommitCallback;
 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 {
@@ -42,18 +40,9 @@
 		public void onClick(ClickEvent event) {
 			try{
 				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());
-					}
+				ICommitCallback callback = this.owner.getRoot().getCommitCallback();
 				
-					Window.alert(str);
-				}
-				
-				// TODO: implement
+				callback.commitTmConstruct(this.owner.getGdlParent().getContent(null), tmEngine, this.owner.getId());
 			}catch(Exception e){
 				e.printStackTrace();
 				Window.alert("caught: " + e.getMessage());

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlDeleteButton.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlDeleteButton.java	Thu Sep  1 09:15:03 2011	(r815)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlDeleteButton.java	Thu Sep  1 09:18:20 2011	(r816)
@@ -8,6 +8,7 @@
 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.IDeleteCallback;
 import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException;
 
 public class GdlDeleteButton extends GdlActionButton {
@@ -36,9 +37,10 @@
 		@Override
 		public void onClick(ClickEvent event) {
 			try{
-				Window.alert("content: " + this.owner.getGdlParent().getContent(null));
-				// TODO: implement
+				IDeleteCallback callback = this.owner.getRoot().getDeleteCallback();
+				callback.deleteTmConstruct(this.owner.getGdlParent().getContent(null), this.owner.getId());
 			}catch(Exception e){
+				e.printStackTrace();
 				Window.alert("caught: " + e.getMessage());
 			}
 		}		

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/ICommitCallback.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/ICommitCallback.java	Thu Sep  1 09:15:03 2011	(r815)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/ICommitCallback.java	Thu Sep  1 09:18:20 2011	(r816)
@@ -1,10 +1,11 @@
 package us.isidor.gdl.anaToMia.Widgets.environment;
 
+import java.util.ArrayList;
 import us.isidor.gdl.anaToMia.TopicMaps.TmEngineModel.TmEngine;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes;
 
 
 public interface ICommitCallback {
-	public void commitTmConstruct(Construct construct, TopicMapsTypes constructType, TmEngine tmengine);
+	public void commitTmConstruct(ArrayList<Pair<Construct, TopicMapsTypes>> constructs, TmEngine tmengine, String buttonId);
 }

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/IDeleteCallback.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/IDeleteCallback.java	Thu Sep  1 09:15:03 2011	(r815)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/IDeleteCallback.java	Thu Sep  1 09:18:20 2011	(r816)
@@ -1,9 +1,11 @@
 package us.isidor.gdl.anaToMia.Widgets.environment;
 
+import java.util.ArrayList;
+
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes;
 
 
 public interface IDeleteCallback {
-	public void deleteTmConstruct(Construct construct, TopicMapsTypes constructType);
+	public void deleteTmConstruct(ArrayList<Pair<Construct, TopicMapsTypes>> constructs, String buttonId);
 }

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/CommitCallback.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/CommitCallback.java	Thu Sep  1 09:15:03 2011	(r815)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/CommitCallback.java	Thu Sep  1 09:18:20 2011	(r816)
@@ -1,45 +1,143 @@
 package us.isidor.gdl.anaToMia.Widgets.isidorus;
 
-import com.google.gwt.user.client.Window;
+import java.util.ArrayList;
+
+
+import us.isidor.gdl.anaToMia.Widgets.base.PSIs;
+import us.isidor.gdl.anaToMia.Widgets.base.TmHelper;
+import us.isidor.gdl.anaToMia.Widgets.environment.Pair;
 
+import com.google.gwt.core.client.JsArray;
+import com.google.gwt.user.client.Window;
 import us.isidor.gdl.anaToMia.TopicMaps.TmEngineModel.ExporterException;
 import us.isidor.gdl.anaToMia.TopicMaps.TmEngineModel.TmEngine;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Association;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct;
-import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Locator;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Name;
-import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Variant;
-import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Role;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMap;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes;
 import us.isidor.gdl.anaToMia.Widgets.environment.ICommitCallback;
 
 public class CommitCallback implements ICommitCallback{
 
 	@Override
-	public void commitTmConstruct(Construct construct, TopicMapsTypes constructType, TmEngine tmEngine) {
+	public void commitTmConstruct(ArrayList<Pair<Construct, TopicMapsTypes>> constructs, TmEngine tmEngine, String buttonId) {
 		try{
-			String jtm = null;
-
-			switch(constructType){
-			case Association: jtm = tmEngine.exportTm((Association)construct);
-			break;
-			case Role: jtm = tmEngine.exportTm((Role)construct);
-			break;
-			case Topic: jtm = tmEngine.exportTm((Topic)construct);
-			break;
-			case Name: jtm = tmEngine.exportTm((Name)construct);
-			break;
-			case Variant: jtm = tmEngine.exportTm((Variant)construct);
-			break;
-			case Occurrence: jtm = tmEngine.exportTm((Occurrence)construct);
-			break;
+			if("hash_object_commit_button_id".equals(buttonId)){
+				this.commitCreatedHashObject(constructs, tmEngine);
+			} else if("environment_commit_button_id".equals(buttonId)){
+				this.commitCreatedEnvironment(constructs, tmEngine);
 			}
-
-			Window.alert(jtm);
-		// TODO: implement
 		}catch(ExporterException ee){
 			Window.alert("faild to commit the Topic Maps data, because: " + ee.getMessage());
 		}
 	}
+	
+	
+	private void commitCreatedEnvironment(ArrayList<Pair<Construct, TopicMapsTypes>> constructs, TmEngine tmEngine) throws ExporterException {
+		final String carrierPsi = PSIs.GDL.gdl + "environment_default_creator_topic_view_id";
+		ArrayList<Topic> topics = new ArrayList<Topic>();
+		ArrayList<TopicMap> topicMaps = new ArrayList<TopicMap>();
+		
+		for (Pair<Construct, TopicMapsTypes> construct : constructs) {
+			if(construct.getSecond().equals(TopicMapsTypes.Topic)) topics.add((Topic)construct.getFirst());
+			else if(construct.getSecond().equals(TopicMapsTypes.TopicMap)) topicMaps.add((TopicMap)construct.getFirst());
+			else throw new ExporterException("unexpected construct types: " + construct.getSecond()+ ", only Topic and Association are allowed");
+		}
+		
+		Topic top = null;
+		Locator carrierLocator = null;
+		TopicMap tm = null;
+		if(topicMaps.size() != 0){
+			tm = topicMaps.get(0);
+			carrierLocator = tm.createLocator(carrierPsi);
+			top = (Topic)tm.getConstructByItemIdentifier(carrierLocator);
+		}
+		else if(topics.size() != 0){
+			tm = topics.get(0).getTopicMap();
+			top = topics.get(0);
+			carrierLocator = tm.createLocator(carrierPsi);
+		}
+		
+		if(top != null){
+			Name envName = top.getNames().get(0);
+			Locator psi = tm.createLocator("http://textgrid.org/serviceregistry/environment/" + envName.getValue());
+			top.removeSubjectIdentifier(carrierLocator);
+			top.addSubjectIdentifier(psi);
+		}
+		
+		String jtm = null;
+		if(topicMaps.size() != 0){
+			jtm = tmEngine.exportTm(topicMaps.get(0));
+		} else if(topics.size() != 0){
+			jtm = tmEngine.exportTm(topics, new ArrayList<Association>());
+		}
+		
+		Window.alert(jtm);
+		// TODO: implement actual commit and check if the topic already exists
+	}
+	
+	
+	private void commitCreatedHashObject(ArrayList<Pair<Construct, TopicMapsTypes>> constructs, TmEngine tmEngine) throws ExporterException{
+		final String carrierPsi = PSIs.GDL.gdl + "hash_object_default_creator_topic_view_id";
+		ArrayList<Topic> topics = new ArrayList<Topic>();
+		ArrayList<Association> associations = new ArrayList<Association>();
+		ArrayList<TopicMap> topicMaps = new ArrayList<TopicMap>();
+		
+		for (Pair<Construct, TopicMapsTypes> construct : constructs) {
+			if(construct.getSecond().equals(TopicMapsTypes.Association)) associations.add((Association)construct.getFirst());
+			else if(construct.getSecond().equals(TopicMapsTypes.Topic)) topics.add((Topic)construct.getFirst());
+			else if(construct.getSecond().equals(TopicMapsTypes.TopicMap)) topicMaps.add((TopicMap)construct.getFirst());
+			else throw new ExporterException("unexpected construct types: " + construct.getSecond()+ ", only Topic and Association are allowed");
+		}
+		
+		Topic top = null;
+		Locator carrierLocator = null;
+		TopicMap tm = null;
+		if(topicMaps.size() != 0){
+			tm = topicMaps.get(0);
+			carrierLocator = tm.createLocator(carrierPsi);
+			top = (Topic)tm.getConstructByItemIdentifier(carrierLocator);
+		}
+		else if(topics.size() != 0){
+			tm = topics.get(0).getTopicMap();
+			top = topics.get(0);
+			carrierLocator = tm.createLocator(carrierPsi);
+		}
+		
+		if(top != null){
+			Association assoc = null;
+			if(associations.size() != 0){
+				assoc = associations.get(0);
+			} else {
+				JsArray<Association> assocs = top.getTopicMap().getAssociations();
+				Topic assocType = TmHelper.getTopicByPsi("http://textgrid.org/serviceregistry/model/has-environment", tm);
+				for(int i = 0; i != assocs.length(); ++i){
+					if(assocs.get(i).getType().equals(assocType)){
+						assoc = assocs.get(i);
+						break;
+					}
+				}
+			}
+			
+			Name env = assoc.getRoles(TmHelper.getTopicByPsi("http://textgrid.org/serviceregistry/model/environment", tm)).get(0).getPlayer().getNames().get(0);
+			Occurrence key = top.getOccurrences(TmHelper.getTopicByPsi("http://textgrid.org/serviceregistry/model/key", tm)).get(0);
+			Locator psi = tm.createLocator("http://textgrid.org/serviceregistry/hash-object/" + env.getValue() + "/" + key.getValue());
+			top.removeSubjectIdentifier(carrierLocator);
+			top.addSubjectIdentifier(psi);
+		}
+		
+		String jtm = null;
+		if(topicMaps.size() != 0){
+			jtm = tmEngine.exportTm(topicMaps.get(0));
+		} else if(associations.size() != 0 || topics.size() != 0){
+			jtm = tmEngine.exportTm(topics, associations);
+		}
+		
+		Window.alert(jtm);
+		// TODO: implement actual commit and check if the topic already exists
+	}
 }

Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/DeleteCallback.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/isidorus/DeleteCallback.java	Thu Sep  1 09:18:20 2011	(r816)
@@ -0,0 +1,32 @@
+package us.isidor.gdl.anaToMia.Widgets.isidorus;
+
+import java.util.ArrayList;
+import com.google.gwt.user.client.Window;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes;
+import us.isidor.gdl.anaToMia.Widgets.environment.IDeleteCallback;
+import us.isidor.gdl.anaToMia.Widgets.environment.Pair;
+
+public class DeleteCallback implements IDeleteCallback {
+
+	@Override
+	public void deleteTmConstruct(ArrayList<Pair<Construct, TopicMapsTypes>> constructs, String buttonId) {
+		this.deleteTopic(constructs);
+	}
+
+	
+	private void deleteTopic(ArrayList<Pair<Construct, TopicMapsTypes>> constructs){
+		for (Pair<Construct, TopicMapsTypes> pair : constructs) {
+			if(pair.getSecond().equals(TopicMapsTypes.Topic)){
+				Topic env = (Topic)pair.getFirst();
+				if(env.getSubjectIdentifiers().length() != 0){
+					String psi = env.getSubjectIdentifiers().get(0).getReference();
+					
+					Window.alert("psi of the topic to be deleted: " + psi);
+					// TODO: send actual delete request
+				}
+			}
+		}		
+	}
+}

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	Thu Sep  1 09:15:03 2011	(r815)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlAssociationView.java	Thu Sep  1 09:18:20 2011	(r816)
@@ -9,7 +9,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.TopicMaps.TopicMapsModel.TopicMap;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes;
 import us.isidor.gdl.anaToMia.Widgets.base.ButtonableObject;
 import us.isidor.gdl.anaToMia.Widgets.base.GdlHiddenValue;
@@ -230,10 +229,17 @@
 	// Further elements are created by caling the GdlInstantiator.instantiate
 	// method, the passed received argument is set ot the association that is
 	// represented by this class
-	protected class AssociationItem extends GdlView {
+	public class AssociationItem extends GdlView {
 		private int indexInParent = -1;
 		
 		
+		@SuppressWarnings("unchecked")
+		public Association getRepresentedAssociation() throws InvalidGdlSchemaException{
+			if(this.receivedData != null) return (Association)this.receivedData;
+			else return this.tmRepresentative.getTopicMap().createAssociation(((GdlAssociationView)this.getGdlParent()).getAssociationType(), (JsArray<Topic>)JsArray.createArray());
+		}
+		
+		
 		@SuppressWarnings("unused")
 		private AssociationItem(){
 			super();
@@ -256,16 +262,11 @@
 		}
 		
 		
-		@SuppressWarnings("unchecked")
 		@Override
 		public ArrayList<Pair<Construct, TopicMapsTypes>> getContent(Construct carrier) throws InvalidGdlSchemaException, ExecutionException {
 			ArrayList<Pair<Construct, TopicMapsTypes>> result = new ArrayList<Pair<Construct,TopicMapsTypes>>();
 			
-			Association localCarrier = (Association)this.receivedData;
-			if(localCarrier == null){
-				TopicMap tm = this.tmRepresentative.getTopicMap();
-				localCarrier = tm.createAssociation(((GdlAssociationView)this.getGdlParent()).getAssociationType(), (JsArray<Topic>)JsArray.createArray());
-			}
+			Association localCarrier = this.getRepresentedAssociation();
 			
 			for (Widget ctrl : this.subElements) {
 				if(ctrl instanceof GdlVisibleObject){

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	Thu Sep  1 09:15:03 2011	(r815)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlTopicView.java	Thu Sep  1 09:18:20 2011	(r816)
@@ -2,13 +2,21 @@
 
 
 import java.util.ArrayList;
+import com.google.gwt.core.client.JsArray;
 import com.google.gwt.user.client.ui.Widget;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Name;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Association;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Role;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Variant;
 import us.isidor.gdl.anaToMia.Widgets.base.ButtonableObject;
 import us.isidor.gdl.anaToMia.Widgets.base.GdlVisibleObject;
+import us.isidor.gdl.anaToMia.Widgets.base.PSIs;
 import us.isidor.gdl.anaToMia.Widgets.base.TmHelper;
+import us.isidor.gdl.anaToMia.Widgets.base.Utils;
 import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException;
 import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException;
 import us.isidor.gdl.anaToMia.Widgets.environment.Pair;
@@ -75,6 +83,61 @@
 	}
 	
 	
+	// returns true if the construct that is contained in the first member of pair
+	// is also indirectly contained in the container
+	private boolean indirectlyContained(Pair<Construct, TopicMapsTypes> pair, ArrayList<Pair<Construct, TopicMapsTypes>> container){
+		if(pair == null) return true;
+		if(container == null) return false;
+		
+		TopicMapsTypes newType = pair.getSecond();
+		if(newType.equals(TopicMapsTypes.Name)){
+			Name name = (Name)pair.getFirst();
+			for (Pair<Construct, TopicMapsTypes> item : container) {
+				if(item.getSecond().equals(TopicMapsTypes.Topic)){
+					JsArray<Name> names = ((Topic)item.getFirst()).getNames();
+					if(Utils.contains(names, name)) return true;
+				}
+			}
+		} else if (newType.equals(TopicMapsTypes.Variant)){
+			Variant variant = (Variant)pair.getFirst();
+			for (Pair<Construct, TopicMapsTypes> item : container) {
+				if(item.getSecond().equals(TopicMapsTypes.Name)){
+					JsArray<Variant> variants = ((Name)item.getFirst()).getVariants();
+					if(Utils.contains(variants, variant)) return true;
+				}
+			}
+			
+			for (Pair<Construct, TopicMapsTypes> item : container) {
+				if(item.getSecond().equals(TopicMapsTypes.Topic)){
+					JsArray<Name> names = ((Topic)item.getFirst()).getNames();
+					for(int i = 0; i != names.length(); ++i){
+						JsArray<Variant> variants = names.get(i).getVariants();
+						if(Utils.contains(variants, variant)) return true;
+					}
+				}
+			}
+		} else if (newType.equals(TopicMapsTypes.Occurrence)){
+			Occurrence occurrence = (Occurrence)pair.getFirst();
+			for (Pair<Construct, TopicMapsTypes> item : container) {
+				if(item.getSecond().equals(TopicMapsTypes.Topic)){
+					JsArray<Occurrence> occurrences = ((Topic)item.getFirst()).getOccurrences();
+					if(Utils.contains(occurrences, occurrence)) return true;
+				}
+			}
+		} else if (newType.equals(TopicMapsTypes.Role)){
+			Role role = (Role)pair.getFirst();
+			for (Pair<Construct, TopicMapsTypes> item : container) {
+				if(item.getSecond().equals(TopicMapsTypes.Association)){
+					JsArray<Role> roles = ((Association)item.getFirst()).getRoles();
+					if(Utils.contains(roles, role)) return true;
+				}
+			}
+		}
+
+		return false;
+	}
+	
+	
 	@Override
 	public ArrayList<Pair<Construct, TopicMapsTypes>> getContent(Construct carrier) throws InvalidGdlSchemaException, ExecutionException {
 		ArrayList<Pair<Construct, TopicMapsTypes>> result = new ArrayList<Pair<Construct,TopicMapsTypes>>();
@@ -83,11 +146,13 @@
 		if(localCarrier == null) localCarrier = this.getRepresentedTopic();
 				
 		for (Widget ctrl : this.subElements) {
-			Pair<Construct, TopicMapsTypes> topicPair = new Pair<Construct, TopicMapsTypes>(localCarrier, TopicMapsTypes.Topic);
-			if(this.receivedData == null && !result.contains(topicPair)) result.add(topicPair);
+			int i = 0;
+			for( ; i != result.size(); ++i) if(result.get(i).getFirst().equals(localCarrier)) break;
+			if(i == result.size()) result.add(new Pair<Construct, TopicMapsTypes>(localCarrier, TopicMapsTypes.Topic));
+			
 			if(ctrl instanceof GdlVisibleObject){
 				for (Pair<Construct, TopicMapsTypes> pair : ((GdlVisibleObject)ctrl).getContent(localCarrier)) {
-					if(this.receivedData != null || (ctrl instanceof GdlView))result.add(pair);
+					if((this.receivedData != null || (ctrl instanceof GdlView)) && !this.indirectlyContained(pair, result))result.add(pair);
 				}
 			}
 		}
@@ -112,10 +177,10 @@
 	
 	
 	// returns the recieved topic or creates a topic stub
-	public Topic getRepresentedTopic(){
+	public Topic getRepresentedTopic() throws InvalidGdlSchemaException {
 		if(this.receivedData ==null){
 			if(this.representedTopic == null){
-				this.representedTopic = this.tmRepresentative.getTopicMap().createTopic();
+				this.representedTopic = this.tmRepresentative.getTopicMap().createTopicBySubjectIdentifier(this.tm.createLocator(PSIs.GDL.gdl + this.getId()));
 				return this.representedTopic;
 			} else {
 				return this.representedTopic;




More information about the Isidorus-cvs mailing list