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

lgiessmann at common-lisp.net lgiessmann at common-lisp.net
Thu Sep 8 14:54:01 UTC 2011


Author: lgiessmann
Date: Thu Sep  8 07:54:00 2011
New Revision: 858

Log:
gdl-frontend: Widgets: fixed a bug in the hanlding of GdlHiddenValue in GdlAssociationView instances

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

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  8 07:47:55 2011	(r857)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlAssociationView.java	Thu Sep  8 07:54:00 2011	(r858)
@@ -8,6 +8,7 @@
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Association;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence;
+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.Widgets.base.ButtonableObject;
@@ -201,14 +202,19 @@
 		// process hidden values
 		for (Topic hd : this.getHiddenValues()) {
 			GdlHiddenValue hdv = new GdlHiddenValue(hd, this);
+			Topic player = hdv.getRawTmValue();
+			if(player == null) throw new InvalidGdlSchemaException("the hidden value " + TmHelper.getAnyIdOfTopic(hd) + " must be bound to exactly one topic, but is unbound");
+			Topic roleType = TmHelper.getConstrainedRoleAndPlayerTypeOfConstraint(hdv.getRootConstraint()).getFirst();
+			
 			if(TmHelper.isInstanceOf(hdv.getConstraint(), PSIs.GDL.TopicType.gdlRolePlayer)){
 				if(!TmHelper.isInstanceOf(hdv.getRootConstraint(), PSIs.TMCL.tmclTopicRoleConstraint)) throw new InvalidGdlSchemaException("the constraint " + TmHelper.getAnyIdOfTopic(hdv.getConstraint()) + " must be bound to an instance of " + PSIs.TMCL.tmclTopicRoleConstraint + ", but is: " + TmHelper.getAnyIdOfTopic(hdv.getRootConstraint()));
 				for (Pair<Construct, TopicMapsTypes> pair : result) {
 					if(pair.getSecond().equals(TopicMapsTypes.Association)){
 						Association assoc = (Association)pair.getFirst();
-						Topic player = hdv.getRawTmValue();
-						if(player == null) throw new InvalidGdlSchemaException("the hidden value " + TmHelper.getAnyIdOfTopic(hd) + " must be bound to exactly one topic, but is unbound");
-						assoc.createRole(TmHelper.getConstrainedRoleAndPlayerTypeOfConstraint(hdv.getRootConstraint()).getFirst(), player);
+						JsArray<Role> roles = assoc.getRoles(roleType);
+						int i = 0;
+						for( ; i != roles.length(); ++i) if(roles.get(i).getPlayer().equals(player)) break;
+						if(i == roles.length()) assoc.createRole(roleType, player);
 					}
 				}
 			}




More information about the Isidorus-cvs mailing list