[isidorus-cvs] r621 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets: src/us/isidor/gdl/anaToMia/Widgets/base src/us/isidor/gdl/anaToMia/Widgets/text src/us/isidor/gdl/anaToMia/Widgets/view war/gdl_widgets

lgiessmann at common-lisp.net lgiessmann at common-lisp.net
Thu Jul 14 21:01:08 UTC 2011


Author: lgiessmann
Date: Thu Jul 14 14:01:08 2011
New Revision: 621

Log:
gdl-frontend: Widgets: implemented positioning in GdlView instances

Modified:
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPosition.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/text/GdlTitle.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlView.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPosition.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPosition.java	Thu Jul 14 09:46:35 2011	(r620)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPosition.java	Thu Jul 14 14:01:08 2011	(r621)
@@ -114,10 +114,10 @@
 	public void setAttributes(Widget widget) throws InvalidGdlSchemaException{
 		if(widget == null) return;
 		
-		DOM.setStyleAttribute(widget.getElement(), "position", this.getPositionStyle().getCssValue());
+		if(this.getPositionStyle() != null) DOM.setStyleAttribute(widget.getElement(), "position", this.getPositionStyle().getCssValue());
 		if(this.getTop() != null) DOM.setStyleAttribute(widget.getElement(), "top", this.getTop().getCssValue());
-		if(this.getRight() != null) DOM.setStyleAttribute(widget.getElement(), "right", this.getTop().getCssValue());
-		if(this.getBottom() != null) DOM.setStyleAttribute(widget.getElement(), "bottom", this.getTop().getCssValue());
-		if(this.getLeft() != null) DOM.setStyleAttribute(widget.getElement(), "left", this.getTop().getCssValue());
+		if(this.getRight() != null) DOM.setStyleAttribute(widget.getElement(), "right", this.getRight().getCssValue());
+		if(this.getBottom() != null) DOM.setStyleAttribute(widget.getElement(), "bottom", this.getBottom().getCssValue());
+		if(this.getLeft() != null) DOM.setStyleAttribute(widget.getElement(), "left", this.getLeft().getCssValue());
 	}
 }

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 Jul 14 09:46:35 2011	(r620)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java	Thu Jul 14 14:01:08 2011	(r621)
@@ -63,6 +63,7 @@
 	
 	// a helper method to return any identifier string of the topic
 	public static String getAnyIdOfTopic(Topic topic){
+		if(topic == null) return "";
 		if(topic.getSubjectIdentifiers().length() != 0){
 			return topic.getSubjectIdentifiers().get(0).getReference();
 		}else if(topic.getSubjectLocators().length() != 0) {
@@ -109,15 +110,15 @@
 	
 	// returns true if the topic instance if an instance of the topic type
 	public static boolean isInstanceOf(Topic instance, Topic type){
-		if(instance == null || type == null) return false;
+		if(instance == null || (instance.getTypes().length() != 0 && type == null)) return false;
+		if(instance.getTypes().length() == 0 && type == null) return true;
 
 		JsArray<Topic> types = instance.getTypes();
 		for(int i = 0; i != types.length(); ++i){
 			ArrayList<Topic> superTypes = getAllSuperTypes(types.get(i), null);
-			superTypes.add(types.get(i));
+			superTypes.add(types.get(i));	
 			if(superTypes.contains(type)) return true;
-		}
-
+		}		
 		return false;
 	}
 	
@@ -128,7 +129,7 @@
 		
 		ArrayList<Topic> localCollectedSuperTypes = new ArrayList<Topic>();
 		if(collectedSupertypes != null) localCollectedSuperTypes = collectedSupertypes;
-		
+			
 		ArrayList<Topic> direcSupertypes = getDirectSuperTypes(top);
 		for (Topic topic : localCollectedSuperTypes) direcSupertypes.remove(topic); //avoid duplicates
 		for (Topic topic : direcSupertypes)localCollectedSuperTypes.add(topic);
@@ -142,8 +143,7 @@
 		
 		for (Topic collectedIndirectSupertype : collectedIndirectSupertypes)
 			if(!localCollectedSuperTypes.contains(collectedIndirectSupertype)) localCollectedSuperTypes.add(collectedIndirectSupertype);
-		
-		
+				
 		return localCollectedSuperTypes;
 	}
 	
@@ -169,7 +169,7 @@
 	
 	
 	// returns true if a corresponding association exists
-	public static boolean hasAssociation(Topic thisTopic, Topic thisRoleType, Topic assocType, Topic otherPlayer, Topic otherRoleType){
+	public static boolean hasBinaryAssociation(Topic thisTopic, Topic thisRoleType, Topic assocType, Topic otherPlayer, Topic otherRoleType){
 		if(thisTopic == null || thisRoleType == null || assocType == null || otherPlayer == null || otherRoleType == null) return false;
 		
 		JsArray<Role> roles = thisTopic.getRolesPlayed(thisRoleType, assocType);
@@ -234,13 +234,23 @@
 		for (Pair<Topic, Topic> pair : rolePlayertypesAndTypes) {
 			JsArray<Role> selection = assoc.getRoles(pair.getSecond());
 			int i = 0;
-			for(; i != selection.length(); ++i){
+			for(; i != selection.length(); ++i)
 				if(isInstanceOf(selection.get(i).getPlayer(), pair.getFirst())) break;
-			}
 			
 			if(i == selection.length()) return false;
 		}
 		
+		// check the reverse way => duplicates
+		JsArray<Role> roles = assoc.getRoles();
+		for(int i = 0; i != roles.length(); ++i){
+			Role currentRole = roles.get(i);
+			int j = 0;
+			for(; j != rolePlayertypesAndTypes.size(); ++j)
+				if(currentRole.getType().equals(rolePlayertypesAndTypes.get(j).getSecond()) && isInstanceOf(currentRole.getPlayer(), rolePlayertypesAndTypes.get(j).getFirst())) break;
+			
+			if(j == rolePlayertypesAndTypes.size()) return false;
+		}
+		
 		return true;
 	}
 	
@@ -251,7 +261,7 @@
 		
 		ScopedStub scoped = (ScopedStub)construct;
 		if(scoped.getScope().length() != 0 && (themes == null || themes.size() == 0)) return false;
-		if(scoped.getScope().length() != themes.size()) return false;
+		if(themes != null && scoped.getScope().length() != themes.size()) return false;
 		
 		for(int i = 0; i != scoped.getScope().length(); ++i){
 			if(!themes.contains(scoped.getScope().get(i))) return false;
@@ -285,21 +295,25 @@
 	// returns the associations that are bound to the topic "topic" and have the passed scope and roles
 	public static ArrayList<Association> getAssociationsOfTopic(Topic topic, Topic roleType, Topic assocType, ArrayList<Topic> scope, ArrayList<Pair<Topic, Topic>> rolePlayertypesAndTypes){
 		ArrayList<Association> result = new ArrayList<Association>();
-		if(topic == null || assocType == null || rolePlayertypesAndTypes == null || rolePlayertypesAndTypes.size() == 0) return result;
+		if(topic == null || assocType == null || rolePlayertypesAndTypes == null) return result;
 		
 		ArrayList<Association> allPotentialAssocs = new ArrayList<Association>();
 		for(int i = 0; i != topic.getRolesPlayed(roleType, assocType).length(); ++i) allPotentialAssocs.add(topic.getRolesPlayed(roleType, assocType).get(i).getParent());
 		
 		ArrayList<Association> assocsWoScope = new ArrayList<Association>();
-		for (Association assoc : allPotentialAssocs) if(hasRoles(assoc, rolePlayertypesAndTypes)) assocsWoScope.add(assoc);
-		
+		ArrayList<Pair<Topic, Topic>> localRolePlayertypesAndTypes = rolePlayertypesAndTypes;
+		Topic typeOfTopic = topic.getTypes().length() != 0 ? topic.getTypes().get(0) : null;
+		localRolePlayertypesAndTypes.add(new Pair<Topic, Topic>(typeOfTopic, roleType));
+			
+		for (Association assoc : allPotentialAssocs) if(hasRoles(assoc, localRolePlayertypesAndTypes)) assocsWoScope.add(assoc);
+			
 		for (Association assoc : assocsWoScope) if(hasThemes(assoc, scope)) result.add(assoc);
 		
 		return result;
 	}
 
 
-	// returns all topics that are related to the passed topic via a contains assciation
+	// returns all topics that are related to the passed topic via a contains association
 	public static ArrayList<Topic> topicContains(Topic container) {
 		if(container == null) return new ArrayList<Topic>();
 		
@@ -312,60 +326,69 @@
 	}
 
 
-	// returns the topic that represetns the first item of a container, that means this item is
-	// not bound to an association o fthe type position in a role of the type descendant
+	// returns the topic that represents the first item of a container, that means this item is
+	// bound to the container via a position association and plays the role descendant, whereas
+	// the container plays the role ancestor
 	public static Topic getFirstContainee(Topic container, ArrayList<Topic> containees) throws InvalidGdlSchemaException {
 		if(containees == null || containees.size() == 0 || container == null) return null;
 		
-		ArrayList<Topic> topicsWithoutAncestor = new ArrayList<Topic>();
 		TopicMap tm = containees.get(0).getTopicMap();
 		Topic descendantRoleType = getTopicByPsi(GdlPsis.RoleType.gdlDescendant, tm);
-		Topic position = getTopicByPsi(GdlPsis.AssociationType.gdlPosition, tm);
+		Topic positionAssocType = getTopicByPsi(GdlPsis.AssociationType.gdlPosition, tm);
+		Topic position = getTopicByPsi(GdlPsis.TopicType.gdlPosition, tm);
 		Topic visibleObject = getTopicByPsi(GdlPsis.TopicType.gdlVisibleObject, tm);
 		Topic ancestorRoleType = getTopicByPsi(GdlPsis.RoleType.gdlAncestor, tm);
-		for (Topic containee : containees){
-			ArrayList<Topic> ancestors = getOtherPlayerOfBinaryAssociation(containee, descendantRoleType, position, null, visibleObject, ancestorRoleType);
-			if(ancestors.size() != 1){
-				String top = getAnyIdOfTopic(container);
-				String bindings = "";
-				for (Topic topic : ancestors) bindings += ", " + getAnyIdOfTopic(topic);
-				if(bindings.length() == 0) bindings = "[]";
-				else bindings = bindings.substring(2);
-				throw new InvalidGdlSchemaException("the topic " + top + " must be boundto exaclty one ancestor element, but found " + bindings);
-			} else {
-				if(ancestors.get(0).equals(container))topicsWithoutAncestor.add(containee);
+		Topic descriptorRoleType = getTopicByPsi(GdlPsis.RoleType.gdlDescriptor, tm);
+		
+		ArrayList<Pair<Topic, Topic>> rolePlayertypesAndTypes = new ArrayList<Pair<Topic,Topic>>();
+		rolePlayertypesAndTypes.add(new Pair<Topic, Topic>(visibleObject, descendantRoleType));
+		rolePlayertypesAndTypes.add(new Pair<Topic, Topic>(position, descriptorRoleType));
+		ArrayList<Association> descendantAssocsOfContainer = TmHelper.getAssociationsOfTopic(container, ancestorRoleType, positionAssocType, null, rolePlayertypesAndTypes);
+		
+		ArrayList<Topic> validDescendants = new ArrayList<Topic>();
+		for (Association descendantAssociation : descendantAssocsOfContainer) {
+			JsArray<Role> descendantRoles = descendantAssociation.getRoles(descendantRoleType);
+			for(int i = 0; i != descendantRoles.length(); ++i){
+				Topic player =  descendantRoles.get(i).getPlayer();
+				if(isInstanceOf(player, visibleObject) && !validDescendants.contains(player)) validDescendants.add(player);
 			}
 		}
-				
-		if(topicsWithoutAncestor.size() > 1){
-			String values = "";
-			for (Topic topic : topicsWithoutAncestor) values += ", " + getAnyIdOfTopic(topic);
-			if(values.length() >= 2) values = values.substring(2);
-			throw new InvalidGdlSchemaException("only one topic can be set as the start element of a container, but found: " + values);	
-		} else if(topicsWithoutAncestor.size() == 1){
-			return topicsWithoutAncestor.get(0);
-		} else {
-			return null;
+		
+		if(validDescendants.size() != 1){
+			String top = getAnyIdOfTopic(container);
+			String bindings = "";
+			for (Topic topic : validDescendants) bindings += ", " + getAnyIdOfTopic(topic);
+			if(bindings.length() == 0) bindings = "[]";
+			else bindings = bindings.substring(2);
+			throw new InvalidGdlSchemaException("the topic " + top + " must be bound to exaclty one ancestor element, but found " + bindings);
+		}else {
+			return validDescendants.get(0);
 		}
 	}
 	
 	
 	// returns the descendant of the current topic related via an contains association
-	public static Topic getNextContainer(Topic current, ArrayList<Topic> containees) throws InvalidGdlSchemaException{
+	public static Topic getNextContainee(Topic current, ArrayList<Topic> containees) throws InvalidGdlSchemaException{
 		if (current == null || containees == null || containees.size() == 0) return null;
 		
 		TopicMap tm = current.getTopicMap();
-		Topic descendant = getTopicByPsi(GdlPsis.RoleType.gdlDescendant, tm);
-		Topic position = getTopicByPsi(GdlPsis.AssociationType.gdlPosition, tm);
+		Topic descendantRoleType = getTopicByPsi(GdlPsis.RoleType.gdlDescendant, tm);
+		Topic positionAssocType = getTopicByPsi(GdlPsis.AssociationType.gdlPosition, tm);
 		Topic visibleObject = getTopicByPsi(GdlPsis.TopicType.gdlVisibleObject, tm);
-		Topic ancestor = getTopicByPsi(GdlPsis.RoleType.gdlAncestor, tm);
-		ArrayList<Topic> descendants = getOtherPlayerOfBinaryAssociation(current, ancestor, position, null, visibleObject, descendant);
+		Topic ancestorRoleType = getTopicByPsi(GdlPsis.RoleType.gdlAncestor, tm);
+		Topic position = getTopicByPsi(GdlPsis.TopicType.gdlPosition, tm);
+		Topic descriptorRoleType = getTopicByPsi(GdlPsis.RoleType.gdlDescriptor, tm);
+		ArrayList<Pair<Topic, Topic>> rolePlayertypesAndTypes = new ArrayList<Pair<Topic,Topic>>();
+		rolePlayertypesAndTypes.add(new Pair<Topic, Topic>(visibleObject, descendantRoleType));
+		rolePlayertypesAndTypes.add(new Pair<Topic, Topic>(position, descriptorRoleType));
+		ArrayList<Association> positionAssocs = getAssociationsOfTopic(current, ancestorRoleType, positionAssocType, null, rolePlayertypesAndTypes);
 		
 		ArrayList<Topic> descendantsContainedInContainees = new ArrayList<Topic>();
-		for (Topic topic : descendants)
-			if(containees.contains(topic) && !descendantsContainedInContainees.contains(topic)) descendantsContainedInContainees.add(topic);
-		
-		
+		for (Association assoc : positionAssocs) {
+			Role role = assoc.getRoles(descendantRoleType).get(0); // it is ensured that exaclty one role is existent, due to getAssociationsOfTopic
+			if(containees.contains(role.getPlayer()) && !descendantsContainedInContainees.contains(role.getPlayer())) descendantsContainedInContainees.add(role.getPlayer());
+		}
+				
 		if(descendantsContainedInContainees.size() > 1){
 			String top = getAnyIdOfTopic(current);
 			String bindings = "";
@@ -388,30 +411,31 @@
 		// get all potential valid associations that models a position association
 		TopicMap tm = ancestor.getTopicMap();
 		Topic ancestorRoleType = getTopicByPsi(GdlPsis.RoleType.gdlAncestor, tm);
-		Topic position = getTopicByPsi(GdlPsis.AssociationType.gdlPosition, tm);
+		Topic positionAssocType = getTopicByPsi(GdlPsis.AssociationType.gdlPosition, tm);
 		ArrayList<Pair<Topic, Topic>> rolePlayertypesAndTypes = new ArrayList<Pair<Topic,Topic>>();
-		Topic descriptor = getTopicByPsi(GdlPsis.RoleType.gdlDescendant, tm);
+		Topic descriptor = getTopicByPsi(GdlPsis.RoleType.gdlDescriptor, tm);
 		Topic descendantRoleType = getTopicByPsi(GdlPsis.RoleType.gdlDescendant, tm);
 		Topic visibleObject = getTopicByPsi(GdlPsis.TopicType.gdlVisibleObject, tm);
+		Topic position = getTopicByPsi(GdlPsis.TopicType.gdlPosition, tm);
 		rolePlayertypesAndTypes.add(new Pair<Topic, Topic>(position, descriptor));
 		rolePlayertypesAndTypes.add(new Pair<Topic, Topic>(visibleObject, descendantRoleType));
-		ArrayList<Association> posAssocs = getAssociationsOfTopic(ancestor, ancestorRoleType, position, null, rolePlayertypesAndTypes);
+		ArrayList<Association> posAssocs = getAssociationsOfTopic(ancestor, ancestorRoleType, positionAssocType, null, rolePlayertypesAndTypes);
 		
 		if(posAssocs.size() != 1){
 			String top1 = getAnyIdOfTopic(ancestor);
 			String top2 = getAnyIdOfTopic(descendant);
 			String bindings = "";
 			for (Association assoc : posAssocs)
-				if(assoc.getRoles(position).length() != 0)
-					for(int i = 0; i != assoc.getRoles(position).length(); ++i)
-						bindings += ", " + getAnyIdOfTopic(assoc.getRoles(position).get(i).getPlayer());
+				if(assoc.getRoles(descriptor).length() != 0)
+					for(int i = 0; i != assoc.getRoles(descriptor).length(); ++i)
+						bindings += ", " + getAnyIdOfTopic(assoc.getRoles(descriptor).get(i).getPlayer());
 			if(bindings.length() == 0) bindings = "[]";
 			else bindings = bindings.substring(2);
 			throw new InvalidGdlSchemaException("the topics " + top1 + " and " + top2 + " must be bound to exaclty one position topic, but is bound to " + bindings);
 		}else {
 			ArrayList<Topic> positions = new ArrayList<Topic>();
 			for (Association assoc : posAssocs) {
-				JsArray<Role> validRoles = assoc.getRoles(position);
+				JsArray<Role> validRoles = assoc.getRoles(descriptor);
 				for(int i = 0; i != validRoles.length(); ++i)
 					if(isInstanceOf(validRoles.get(i).getPlayer(), position) &&	!positions.contains(validRoles.get(i).getPlayer())) positions.add(validRoles.get(i).getPlayer());
 				

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	Thu Jul 14 09:46:35 2011	(r620)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlTitle.java	Thu Jul 14 14:01:08 2011	(r621)
@@ -62,7 +62,6 @@
 		super(tmRepresentative);
 		// TODO: create a Title element for each TM-elem
 		this.createTitle();
-		this.createTitle();
 	}
 	
 	

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlView.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlView.java	Thu Jul 14 09:46:35 2011	(r620)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlView.java	Thu Jul 14 14:01:08 2011	(r621)
@@ -6,10 +6,7 @@
 import com.google.gwt.event.dom.client.ClickHandler;
 import com.google.gwt.user.client.DOM;
 import com.google.gwt.user.client.ui.Widget;
-
-import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Association;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Name;
-import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Role;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMap;
 import us.isidor.gdl.anaToMia.Widgets.base.GdlPosition;
@@ -33,6 +30,15 @@
 	
 	public GdlView(Topic tmRepresentative) throws InvalidGdlSchemaException, ExecutionException{
 		super(tmRepresentative);
+		ArrayList<Topic> objectsContained = this.contains();
+		
+		Topic currentTopic = this.getStartElement(objectsContained);
+		Topic lastTopic = super.getTmRepresentative();
+		while(currentTopic != null){
+			this.append(lastTopic, currentTopic);
+			lastTopic = currentTopic;
+			currentTopic = TmHelper.getNextContainee(currentTopic, objectsContained);
+		}
 	}
 	
 	
@@ -58,30 +64,8 @@
 	// Searches the topic that represents the first item that is placed within this view instance
 	// i.e. such an item must not have an association that is bound to it via a role of the type
 	// gdl:ancestor.
-	protected Topic getStartElement() throws InvalidGdlSchemaException {
-		JsArray<Role> roles = this.tmRepresentative.getRolesPlayed(this.tm.getTopicBySubjectIdentifier(tm.createLocator(GdlPsis.RoleType.gdlContainer)), this.tm.getTopicBySubjectIdentifier(tm.createLocator(GdlPsis.AssociationType.gdlContains)));
-		for(int i = 0; i != roles.length(); ++i){
-			Association assoc = roles.get(i).getParent();
-			JsArray<Role> assocRoles = assoc.getRoles(this.tm.getTopicBySubjectIdentifier(this.tm.createLocator(GdlPsis.RoleType.gdlContainee)));
-			ArrayList<Topic> topsWithoutAncestorPosAssoc = new ArrayList<Topic>();
-			for(int j = 0; j != assocRoles.length(); ++j){
-				Topic player = assocRoles.get(j).getPlayer();
-				if(player.getRolesPlayed(this.tm.getTopicBySubjectIdentifier(this.tm.createLocator(GdlPsis.RoleType.gdlAncestor)), this.tm.getTopicBySubjectIdentifier(this.tm.createLocator(GdlPsis.AssociationType.gdlPosition))).length() == 0){
-					topsWithoutAncestorPosAssoc.add(player);
-				}
-			}
-			if(topsWithoutAncestorPosAssoc.size() > 1){
-				String foundTops = "";
-				for (Topic topic : topsWithoutAncestorPosAssoc) {
-					foundTops += TmHelper.getAnyIdOfTopic(topic) + ", ";
-				}
-				if(foundTops.length() >= 2)foundTops = foundTops.substring(0, foundTops.length() - 2);
-				throw new InvalidGdlSchemaException("A " + GdlPsis.TopicType.gdlView + " must have maximal one item that is desiganted to tbe the first item in this view, i.e. there must be zero or one items without being bound to a " + GdlPsis.RoleType.gdlAncestor + " but found: " + foundTops);
-			} else if(topsWithoutAncestorPosAssoc.size() == 1){
-				return topsWithoutAncestorPosAssoc.get(0);
-			}
-		}
-		return null;
+	protected Topic getStartElement(ArrayList<Topic> containees) throws InvalidGdlSchemaException {
+		return TmHelper.getFirstContainee(super.getTmRepresentative(), containees);
 	}
 	
 	
@@ -102,9 +86,10 @@
 			}
 		}
 		
-		if(this.getTmRepresentative().equals(ancestor))this.mainPanel.add(newObj);
+		this.subElements.add(newObj);
+		if(super.getTmRepresentative().equals(ancestor))this.mainPanel.add(newObj);
 		else DOM.insertBefore(this.mainPanel.getElement(), newObj.getElement(), oldObj.getElement());
-		position.setAttributes(newObj);	
+		position.setAttributes(newObj);
 		return newObj;
 	}
 	

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm	Thu Jul 14 09:46:35 2011	(r620)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm	Thu Jul 14 14:01:08 2011	(r621)
@@ -32,10 +32,10 @@
            {"subject_identifiers":["[gdl:Title]"]},
            {"subject_identifiers":["[gdl:Reference]"]},
            {"subject_identifiers":["[gdl:List-Box]"]},
-           {"subject_identifiers":["[doc:text-1]"], "instance_of":["si:[gdl:Text]"]},
-           {"subject_identifiers":["[doc:title-1]"], "instance_of":["si:[gdl:Title]"]},
-           {"subject_identifiers":["[doc:reference-1]"], "instance_of":["si:[gdl:Reference]"]},
-           {"subject_identifiers":["[doc:list-box-1]"], "instance_of":["si:[gdl:List-Box]"]},
+           {"subject_identifiers":["[doc:text-1]"], "instance_of":["si:[gdl:Text]"], "occurrences":[{"type":"si:[gdl:id]", "value":"text_1_id", "datatype":"[xsd:ID]"}]},
+           {"subject_identifiers":["[doc:title-1]"], "instance_of":["si:[gdl:Title]"], "occurrences":[{"type":"si:[gdl:id]", "value":"title_1_id", "datatype":"[xsd:ID]"}]},
+           {"subject_identifiers":["[doc:reference-1]"], "instance_of":["si:[gdl:Reference]"], "occurrences":[{"type":"si:[gdl:id]", "value":"reference_1_id", "datatype":"[xsd:ID]"}]},
+           {"subject_identifiers":["[doc:list-box-1]"], "instance_of":["si:[gdl:List-Box]"], "occurrences":[{"type":"si:[gdl:id]", "value":"list_box_1_id", "datatype":"[xsd:ID]"}]},
            {"subject_identifiers":["[gdl:Value]"], "instance_of":["si:[tmcl:topic-type]"]},
            {"subject_identifiers":["[doc:pos-of-title-1]"], "instance_of":["si:[gdl:Position]"]},
            {"subject_identifiers":["[doc:pos-of-text-1]"], "instance_of":["si:[gdl:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"relative"}, {"type":"si:[gdl:top]", "value":"40px"}, {"type":"si:[gdl:left]", "value": "5%"}]},




More information about the Isidorus-cvs mailing list