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

lgiessmann at common-lisp.net lgiessmann at common-lisp.net
Wed Aug 17 16:16:43 UTC 2011


Author: lgiessmann
Date: Wed Aug 17 09:16:43 2011
New Revision: 752

Log:
gdl-frontend: Widgets: fixed some bugs when a a visible-object follows after a container-element in the GUI

Modified:
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java

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	Wed Aug 17 08:30:29 2011	(r751)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java	Wed Aug 17 09:16:43 2011	(r752)
@@ -473,7 +473,7 @@
 			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(isInstanceOf(player, visibleObject) && !validDescendants.contains(player) && containees.contains(player)) validDescendants.add(player);
 			}
 		}
 		
@@ -483,7 +483,7 @@
 			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 descendant element, but found " + bindings);
+			throw new InvalidGdlSchemaException("the topic " + top + " must be bound to exactly one descendant element, but found " + bindings);
 		}else {
 			return validDescendants.get(0);
 		}
@@ -542,7 +542,12 @@
 		Topic position = getTopicByPsi(PSIs.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, positionAssocType, null, rolePlayertypesAndTypes);
+		ArrayList<Association> possiblePosAssocs = getAssociationsOfTopic(ancestor, ancestorRoleType, positionAssocType, null, rolePlayertypesAndTypes);
+		ArrayList<Association> posAssocs = new ArrayList<Association>();
+		for (Association candidate : possiblePosAssocs) {
+			JsArray<Role> descendantRole = candidate.getRoles(descendantRoleType);
+			if(descendantRole.length() == 1 && descendantRole.get(0).getPlayer().equals(descendant)) posAssocs.add(candidate);
+		}
 		
 		if(posAssocs.size() != 1){
 			String top1 = getAnyIdOfTopic(ancestor);
@@ -554,7 +559,7 @@
 						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);
+			throw new InvalidGdlSchemaException("the topics " + top1 + " and " + top2 + " must be bound to exactly one position topic, but is bound to " + bindings);
 		}else {
 			ArrayList<Topic> positions = new ArrayList<Topic>();
 			for (Association assoc : posAssocs) {




More information about the Isidorus-cvs mailing list