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

lgiessmann at common-lisp.net lgiessmann at common-lisp.net
Thu Jul 28 09:10:25 UTC 2011


Author: lgiessmann
Date: Thu Jul 28 02:10:24 2011
New Revision: 685

Log:
gdl-frontend: Widgets: implemented the static method TmHelper.getValueGroupOf(Topic visibleElement) that can be used by all visible elements to retrieve the bound gdl:Value-Group instance.

Modified:
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.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/GdlText.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/GdlPsis.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java	Wed Jul 27 23:55:37 2011	(r684)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.java	Thu Jul 28 02:10:24 2011	(r685)
@@ -186,6 +186,7 @@
 		public final static String gdlNthPosition = gdl + "nth-position";
 		public final static String gdlButtonPosition = gdl + "button-position";
 		public final static String gdlTmBinding = gdl + "tm-binding";
+		public final static String gdlViewBinding = gdl + "view-binding";
 		public final static String gdlTopicViewBinding = gdl + "topic-view-binding";
 	}
 	

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 Jul 27 23:55:37 2011	(r684)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java	Thu Jul 28 02:10:24 2011	(r685)
@@ -584,4 +584,30 @@
 			}
 		}
 	}
+
+	
+	// returns binary associations that corresponds to the given parameters
+	public static ArrayList<Association> getBinaryAssociations(Topic topic, Topic roleType, Topic assocType, ArrayList<Topic> scope, Topic otherPlayerType, Topic otherRoleType){
+		ArrayList<Pair<Topic, Topic>> rolePlayertypesAndTypes = new ArrayList<Pair<Topic,Topic>>();
+		rolePlayertypesAndTypes.add(new Pair<Topic, Topic>(otherPlayerType, otherRoleType));
+		return getAssociationsOfTopic(topic, roleType, assocType, scope, rolePlayertypesAndTypes);	
+	}
+
+	
+	// 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{
+		if(visibleElement == null) throw null;
+		
+		TopicMap tm = visibleElement.getTopicMap();
+		Topic descriptorRoleType = getTopicByPsi(GdlPsis.RoleType.gdlDescriptor, tm);
+		Topic viewBindingAssocType = getTopicByPsi(GdlPsis.AssociationType.gdlViewBinding, tm);
+		Topic valueGroupType = getTopicByPsi(GdlPsis.TopicType.gdlValueGroup, tm);
+		Topic valueGroupRoleType = getTopicByPsi(GdlPsis.RoleType.gdlValueGroup, tm);
+		ArrayList<Topic> valueGroups = getOtherPlayerOfBinaryAssociation(visibleElement, descriptorRoleType, viewBindingAssocType, null, valueGroupType, valueGroupRoleType);
+		
+		if(valueGroups.size() == 1) return valueGroups.get(0);
+		else if(valueGroups.size() == 0) return null;
+		else throw new InvalidGdlSchemaException("the topic " + getAnyIdOfTopic(visibleElement) + " must be bound none or once to a value group, but is: " + valueGroups.size());
+	}
 }

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java	Wed Jul 27 23:55:37 2011	(r684)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java	Thu Jul 28 02:10:24 2011	(r685)
@@ -12,12 +12,16 @@
 import com.google.gwt.user.client.Window;
 import com.google.gwt.user.client.ui.TextArea;
 import com.google.gwt.user.client.ui.Widget;
+
+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.TopicMapsTypes;
 import us.isidor.gdl.anaToMia.Widgets.base.ButtonableObject;
 import us.isidor.gdl.anaToMia.Widgets.base.GdlPsis;
 import us.isidor.gdl.anaToMia.Widgets.base.IGdlHasValue;
+import us.isidor.gdl.anaToMia.Widgets.base.IGdlHasValueGroup;
+import us.isidor.gdl.anaToMia.Widgets.base.TmHelper;
 import us.isidor.gdl.anaToMia.Widgets.environment.ActiveStyleHandler;
 import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException;
 import us.isidor.gdl.anaToMia.Widgets.environment.FocusStyleHandler;
@@ -33,10 +37,11 @@
 
 
 
-public class GdlText extends GdlTextObject implements IGdlHasValue{
+public class GdlText extends GdlTextObject implements IGdlHasValue, IGdlHasValueGroup {
 	protected ArrayList<PasswordKeyPressHandler> passwordKeyPressHandler = null;
 	protected ArrayList<HandlerRegistration> passwordKeyPressRegistrations = null;
-	
+	protected Topic valueGroupTopic = null;
+	protected boolean valueGroupTopicSet = false;
 	
 	// some constructors
 	protected GdlText() throws InvalidGdlSchemaException, ExecutionException {
@@ -831,4 +836,62 @@
 			super.setCssProperty(styleClass, cssProperty, cssValue);
 		}
 	}
+
+
+	@Override
+	public Topic getValueGroup() throws InvalidGdlSchemaException {
+		if(!this.valueGroupTopicSet) this.valueGroupTopic = TmHelper.getValueGroupOf(this.tmRepresentative);
+		return this.valueGroupTopic;
+	}
+
+
+	@Override
+	public Topic getConstraint() throws InvalidGdlSchemaException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+
+	@Override
+	public ArrayList<Topic> getDefaultTmValues()
+			throws InvalidGdlSchemaException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+
+	@Override
+	public String getDefaultLiteralValue() throws InvalidGdlSchemaException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+
+	@Override
+	public ArrayList<Topic> getTmValues() throws InvalidGdlSchemaException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+
+	@Override
+	public ArrayList<String> getLiteralValues()
+			throws InvalidGdlSchemaException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+
+	@Override
+	public String getSetLiteralValue() throws InvalidGdlSchemaException {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+
+	@Override
+	public Construct getSetTmValue() throws InvalidGdlSchemaException {
+		// TODO Auto-generated method stub
+		return null;
+	}
 }

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	Wed Jul 27 23:55:37 2011	(r684)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm	Thu Jul 28 02:10:24 2011	(r685)
@@ -19,6 +19,8 @@
            {"subject_identifiers":["[gdl:containee]"], "instance_of":["si:[tmcl:role-type]"]},
            {"subject_identifiers":["[gdl:ancestor]"], "instance_of":["si:[tmcl:role-type]"]},
            {"subject_identifiers":["[gdl:descendant]"], "instance_of":["si:[tmcl:role-type]"]},
+           {"subject_identifiers":["[gdl:view-binding]"], "instance_of":["si:[tmcl:role-type]"]},
+           {"subject_identifiers":["[gdl:value-group]"], "instance_of":["si:[tmcl:role-type]"]},
            {"subject_identifiers":["[gdl:Schema]"], "instance_of":["si:[tmcl:topic-type]"]},
            {"subject_identifiers":["[gdl:schema-name]"], "instance_of":["si:[tmcl:name-type]"]},
            {"subject_identifiers":["[gdl:view-name]"], "instance_of":["si:[tmcl:name-type]"]},
@@ -26,9 +28,11 @@
            {"subject_identifiers":["[gdl:border-width]"], "instance_of":["si:[tmcl:occurrence-type]"]},
            {"subject_identifiers":["[doc:test-schema]"], "instance_of":["si:[gdl:Schema]"], "names":[{"value": "Test GDL Schema", "type":"si:[gdl:schema-name]"}]},
            {"subject_identifiers":["[gdl:Visible-Object]"]},
+           {"subject_identifiers":["[gdl:Value-Group]"]},
            {"subject_identifiers":["[gdl:Text-Object]"]},
            {"subject_identifiers":["[gdl:Position]"]},
            {"subject_identifiers":["[gdl:position]"], "instance_of":["si:[tmcl:association-type]"]},
+           {"subject_identifiers":["[doc:value-group-person-name]"], "instance_of":["si:[gdl:Value-Group]"]},
            {"subject_identifiers":["[gdl:margin-left]"], "instance_of":["si:[tmcl:occurrence-type]"]},
            {"subject_identifiers":["[gdl:border-style]"], "instance_of":["si:[tmcl:occurrence-type]"]},
            {"subject_identifiers":["[gdl:margin-top]"], "instance_of":["si:[tmcl:occurrence-type]"]},
@@ -165,6 +169,7 @@
                  {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Button]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:Action-Button]"}]},
                  {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Action-Button]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:Delete-Button]"}]},
                  {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Action-Button]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:Create-Button]"}]},
+                 {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdl:Descriptor]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdl:Value-Group]"}]},
                  {"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[doc:test-schema]"},{"type":"si:[gdl:containee]", "player":"si:[doc:default-creator-topic-view-1]"}]},
                  {"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[doc:test-schema]"},{"type":"si:[gdl:containee]", "player":"si:[doc:default-creator-topic-view-2]"}]},
                  {"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[doc:test-schema]"},{"type":"si:[gdl:containee]", "player":"si:[doc:default-editor-topic-view]"}]},
@@ -213,5 +218,6 @@
                  {"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[doc:unit-1-text]"},{"type":"si:[gdl:containee]", "player":"si:[doc:unit-1-text-delete-button]"}]},
                  {"type":"si:[gdl:button-position]", "roles":[{"type":"si:[gdl:nth-element]", "player":"si:[doc:nth-elem-crt-btn]"},{"type":"si:[gdl:action-button]", "player":"si:[doc:unit-1-text-create-button]"}]},
                  {"type":"si:[gdl:button-position]", "roles":[{"type":"si:[gdl:nth-element]", "player":"si:[doc:nth-elem-del-btn]"},{"type":"si:[gdl:action-button]", "player":"si:[doc:unit-1-text-delete-button]"}]},
-                 {"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[doc:unit-1-reference]"},{"type":"si:[gdl:containee]", "player":"si:[doc:info-1]"}]}
+                 {"type":"si:[gdl:contains]", "roles":[{"type":"si:[gdl:container]", "player":"si:[doc:unit-1-reference]"},{"type":"si:[gdl:containee]", "player":"si:[doc:info-1]"}]},
+                 {"type":"si:[gdl:view-binding]", "roles":[{"type":"si:[gdl:value-group]", "player":"si:[doc:value-group-person-name]"},{"type":"si:[gdl:descriptor]", "player":"si:[doc:text-1]"}]}
                 ]}
\ No newline at end of file




More information about the Isidorus-cvs mailing list