[isidorus-cvs] r728 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets: lib src/us/isidor/gdl/anaToMia/Widgets/base src/us/isidor/gdl/anaToMia/Widgets/container src/us/isidor/gdl/anaToMia/Widgets/environment src/us/isidor/gdl/anaToMia/Widgets/text

lgiessmann at common-lisp.net lgiessmann at common-lisp.net
Mon Aug 15 12:40:22 UTC 2011


Author: lgiessmann
Date: Mon Aug 15 05:40:19 2011
New Revision: 728

Log:
gdl-frontend: Widgets: implemented the consumption of SubjectIdentifiers, SubjectLocators, ItemIdentifiers, TopicNames and TopicOccurrences in GdlText

Modified:
   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/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/container/GdlUnit.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/GdlInstantiator.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java

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/base/GdlVisibleObject.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java	Mon Aug 15 04:11:51 2011	(r727)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java	Mon Aug 15 05:40:19 2011	(r728)
@@ -4,9 +4,12 @@
 
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Association;
 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.Role;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMap;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Variant;
 import us.isidor.gdl.anaToMia.Widgets.button.GdlActionButton;
 import us.isidor.gdl.anaToMia.Widgets.environment.ActiveStyleHandler;
 import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException;
@@ -90,7 +93,7 @@
 		this.tmRepresentative = tmRepresentative;
 		this.tm = this.tmRepresentative.getTopicMap();
 		
-		if(!(receivedData instanceof Topic) && !(receivedData instanceof Association) && receivedData != null) throw new ExecutionException("receivedData must be either a Topic or an Association, but is: " + receivedData.getClass());
+		if(!(receivedData instanceof Topic) && !(receivedData instanceof Association) && !(receivedData instanceof Name) && !(receivedData instanceof Variant) && !(receivedData instanceof Occurrence) && !(receivedData instanceof Role) && receivedData != null) throw new ExecutionException("receivedData must be either a Topic, Association, Topic-Name, Name-Variant, Topic-Occurrence or Association-Role, but is: " + receivedData.getClass());
 		this.receivedData = receivedData;
 
 		this.setId(this.getId());

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	Mon Aug 15 04:11:51 2011	(r727)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/PSIs.java	Mon Aug 15 05:40:19 2011	(r728)
@@ -20,6 +20,7 @@
 		public final static String tmclTopictype = tmcl + "topic-type";
 		public final static String tmclNameType = tmcl + "name-type";
 		public final static String tmclOccurrenceType = tmcl + "occurrence-type";
+		public final static String tmclAssociationType = "tmcl" + "association-type";
 		public final static String tmclConstraint = tmcl + "constraint";
 		public final static String tmclConstrained = tmcl + "constrained";
 		public final static String tmclConstrainedStatement = tmcl + "constrained-statement";
@@ -30,6 +31,7 @@
 		public final static String tmclReifierConstraint = tmcl + "reifier-constraint";
 		public final static String tmclScopeConstraint = tmcl + "scope-constraint";
 		public final static String tmclTopicNameConstraint = tmcl + "topic-name-constraint";
+		public final static String tmclVariantNameConstraint = tmcl + "variant-name-constraint";
 		public final static String tmclTopicOccurrenceConstraint = tmcl + "topic-occurrence-constraint";
 		public final static String tmclTopicRoleConstraint = tmcl + "topic-role-constraint";
 		public final static String tmclAssociationRoleConstraint = tmcl + "association-role-constraint";
@@ -37,6 +39,9 @@
 		public final static String tmclAllowed = tmcl + "allowed";
 		public final static String tmclAllowedReifier = tmcl + "allowed-reifier";
 		public final static String tmclConstrainedScope = tmcl + "constrained-scope";
+		public final static String tmclSubjectIdentifierConstraint = tmcl + "subject-identifier-constraint";
+		public final static String tmclSubjectLocatorConstraint = tmcl + "subject-locator-constraint";
+		public final static String tmclItemIdentifierConstraint = tmcl + "item-identifier-constraint";
 	}
 	
 	

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	Mon Aug 15 04:11:51 2011	(r727)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java	Mon Aug 15 05:40:19 2011	(r728)
@@ -21,7 +21,7 @@
 	
 	@Override
 	public void onModuleLoad() {
-		try{
+		try{			
 			RootPanel.get("GWT_Content").add(mainPanel);
 			mainPanel.setBorderWidth(1);
 			mainPanel.setPixelSize(1000, 600);

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	Mon Aug 15 04:11:51 2011	(r727)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java	Mon Aug 15 05:40:19 2011	(r728)
@@ -626,6 +626,30 @@
 		else return null;
 	}
 
+	
+	// returns the topic that plays the role of tmcl:constrained in an association
+	// of the type tmcl:constrained-statement that is bound to the passed topic
+	// constrinatTopic that plays the role of tmcl:constraint
+	public static Topic getConstrainedStatement(Topic constraintTopic) throws InvalidGdlSchemaException{
+		if(constraintTopic == null) return null;
+
+		TopicMap tm = constraintTopic.getTopicMap();
+		Topic constraintRoleType = getTopicByPsi(PSIs.TMCL.tmclConstraint, tm);
+		Topic constraintStatementAssocType = getTopicByPsi(PSIs.TMCL.tmclConstrainedStatement, tm);
+		Topic constrainedRoleType = getTopicByPsi(PSIs.TMCL.tmclConstrained, tm);
+		Topic nameType = getTopicByPsi(PSIs.TMCL.tmclNameType, tm);
+		Topic occurrenceType = getTopicByPsi(PSIs.TMCL.tmclOccurrenceType, tm);
+		Topic associationType = getTopicByPsi(PSIs.TMCL.tmclAssociationType, tm);
+		ArrayList<Topic> constrainedNameTypes = getOtherPlayerOfBinaryAssociation(constraintTopic, constraintRoleType, constraintStatementAssocType, null, nameType, constrainedRoleType);
+		ArrayList<Topic> constrainedOccurrenceTypes = getOtherPlayerOfBinaryAssociation(constraintTopic, constraintRoleType, constraintStatementAssocType, null, occurrenceType, constrainedRoleType);
+		ArrayList<Topic> constrainedAssociationTypes = getOtherPlayerOfBinaryAssociation(constraintTopic, constraintRoleType, constraintStatementAssocType, null, associationType, constrainedRoleType);
+		
+		ArrayList<Topic> constrainedStatements = Utils.union(Utils.union(constrainedNameTypes, constrainedOccurrenceTypes), constrainedAssociationTypes);
+		
+		if(constrainedStatements.size() != 1) throw new InvalidGdlSchemaException("the topic " + getAnyIdOfTopic(constraintTopic) + "must be bound exactly once to a statement topic via a " + PSIs.TMCL.tmclConstrainedStatement + " association, but is: " + constrainedStatements.size());
+		else return constrainedStatements.get(0);
+	}
+	
 
 	// returns the root constraint of a gdl:Value-Group instance, i.e. a tmcl constraint.
 	// E.g. a value group may be bound to a gdl:Type constraint and this constraint may be bound

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlUnit.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlUnit.java	Mon Aug 15 04:11:51 2011	(r727)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/container/GdlUnit.java	Mon Aug 15 05:40:19 2011	(r728)
@@ -30,12 +30,14 @@
 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.Widgets.base.ButtonableObject;
 import us.isidor.gdl.anaToMia.Widgets.base.GdlPosition;
 import us.isidor.gdl.anaToMia.Widgets.base.PSIs;
 import us.isidor.gdl.anaToMia.Widgets.base.GdlVisibleObject;
 import us.isidor.gdl.anaToMia.Widgets.base.IGdlContainer;
 import us.isidor.gdl.anaToMia.Widgets.base.TmHelper;
+import us.isidor.gdl.anaToMia.Widgets.base.Utils;
 import us.isidor.gdl.anaToMia.Widgets.environment.ActiveStyleHandler;
 import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException;
 import us.isidor.gdl.anaToMia.Widgets.environment.FocusStyleHandler;
@@ -47,26 +49,28 @@
 import us.isidor.gdl.anaToMia.Widgets.value.TextDecorationValue;
 
 
-public class GdlUnit extends GdlTextObject implements IGdlContainer {	
+public class GdlUnit extends GdlTextObject implements IGdlContainer {
+	private Topic constraintTopic = null;
+	private boolean constraintTopicSet = false;
+	
+	
 	// some constructors
 	protected GdlUnit() throws InvalidGdlSchemaException, ExecutionException {
 		super();
-		this.createUnit();
 	}
 	
 	
 	public GdlUnit(Topic tmRepresentative, Construct receivedData) throws InvalidGdlSchemaException, ExecutionException{
 		super(tmRepresentative, receivedData);
-		// create a unit for each tm-element
-		this.createUnit();
+		// create a unit for each tm-element and set the current element, e.g. current topic, occurrence, name, ...
+		this.createUnit(null);
 		this.setNthButtons();
 	}
 	
 	
-	// creates a unit element or returns the one, if there is a unit element
-	// in the subElements array
-	private void createUnit() throws InvalidGdlSchemaException, ExecutionException{
-		UnitWidget unit = new UnitWidget(this.getTmRepresentative());
+	// creates a unit element => UnitWidget
+	private UnitWidget createUnit(Construct currentElement) throws InvalidGdlSchemaException, ExecutionException{
+		UnitWidget unit = new UnitWidget(this.getTmRepresentative(), currentElement);
 		ActiveStyleHandler asHandler = new ActiveStyleHandler(this);
 		FocusStyleHandler fsHandler = new FocusStyleHandler(this);
 		HoverStyleHandler hsHandler = new HoverStyleHandler(this);
@@ -91,6 +95,8 @@
 			lastTopic = currentTopic;
 			currentTopic = TmHelper.getNextContainee(currentTopic, objectsContained);
 		}
+		
+		return unit;
 	}
 	
 	
@@ -191,13 +197,40 @@
 	}
 	
 	
+	// returns the constraint that the GdlUnit instance is bound to or null
+	// if it is not bound to a constraint topic
+	public Topic getConstraint() throws InvalidGdlSchemaException {
+		if(this.constraintTopicSet){
+			return this.constraintTopic;
+		} else {
+			this.constraintTopicSet = true;
+			TopicMap tm = this.tmRepresentative.getTopicMap();
+			Topic descriptorRoleType = TmHelper.getTopicByPsi(PSIs.RoleType.gdlDescriptor, tm);
+			Topic tmBindingAssocType = TmHelper.getTopicByPsi(PSIs.AssociationType.gdlTmBinding, tm);
+			Topic tmConstructRoleType = TmHelper.getTopicByPsi(PSIs.RoleType.gdlTmConstruct, tm);
+			Topic tmclTopicNameConstraintType = TmHelper.getTopicByPsi(PSIs.TMCL.tmclTopicNameConstraint, tm);
+			Topic tmclVariantNameConstraintType = TmHelper.getTopicByPsi(PSIs.TMCL.tmclVariantNameConstraint, tm);
+			Topic tmclTopicOccurrenceConstraintType = TmHelper.getTopicByPsi(PSIs.TMCL.tmclTopicOccurrenceConstraint, tm);
+			
+			ArrayList<Topic> nameConstraints = TmHelper.getOtherPlayerOfBinaryAssociation(this.tmRepresentative, descriptorRoleType, tmBindingAssocType, null, tmclTopicNameConstraintType, tmConstructRoleType);
+			ArrayList<Topic> variantConstraints = TmHelper.getOtherPlayerOfBinaryAssociation(this.tmRepresentative, descriptorRoleType, tmBindingAssocType, null, tmclVariantNameConstraintType, tmConstructRoleType);
+			ArrayList<Topic> occurrenceConstraints = TmHelper.getOtherPlayerOfBinaryAssociation(this.tmRepresentative, descriptorRoleType, tmBindingAssocType, null, tmclTopicOccurrenceConstraintType, tmConstructRoleType);
+			ArrayList<Topic> allConstraints = Utils.union(Utils.union(nameConstraints, variantConstraints), occurrenceConstraints);
+			if(allConstraints.size() > 1)
+				throw new InvalidGdlSchemaException("the topic " + TmHelper.getAnyIdOfTopic(this.tmRepresentative) + " can be bound only to one constraint, but is " + allConstraints.size());
+		
+			if(allConstraints.size() == 0) return null;
+			else return allConstraints.get(0);
+		}
+	}
+	
 	
 	protected class UnitWidget extends Composite implements HasFocusHandlers, HasBlurHandlers, HasMouseOutHandlers, HasMouseOverHandlers, HasMouseDownHandlers, HasMouseUpHandlers{
 		private CaptionPanel basePanel = new CaptionPanel();
 		private AbsolutePanel containerPanel = new AbsolutePanel();
 		private Topic tmRepresentative = null;
 		private ArrayList<Widget> subElements = new ArrayList<Widget>();
-		
+		private Construct currentElement = null; 
 		
 		private UnitWidget(){
 			initWidget(this.basePanel);
@@ -206,24 +239,24 @@
 		}
 		
 		
-		public UnitWidget(Topic tmRepresentative){
+		public UnitWidget(Topic tmRepresentative, Construct currentElement){
 			this();
 			this.tmRepresentative = tmRepresentative;
+			this.currentElement = currentElement;
 		}
 		
 		
 		public Topic getTmRepresentative(){
 			return this.tmRepresentative;
 		}
-		
-		
+				
 		
 		// appends a new element in form of a topic to this unit-widget
 		public GdlVisibleObject append(Topic ancestor, Topic current) throws ExecutionException, InvalidGdlSchemaException {
 			if(ancestor == null || current == null) throw new ExecutionException("to append \"" + TmHelper.getAnyIdOfTopic(current) + "\" on \"" + TmHelper.getAnyIdOfTopic(ancestor) + "\" both topics must be present");
 			GdlPosition position = new GdlPosition(TmHelper.getPositionOf(ancestor, current));
 			
-			GdlVisibleObject newObj = GdlInstantiator.instantiate(current, GdlUnit.this.receivedData);
+			GdlVisibleObject newObj = GdlInstantiator.instantiate(current, this.currentElement);
 			GdlVisibleObject oldObj = null;
 			for (Widget widget : this.subElements){
 				if(((GdlVisibleObject)widget).getTmRepresentative().equals(ancestor)){
@@ -253,6 +286,7 @@
 			DOM.setElementAttribute(this.basePanel.getElement(), "id", id);
 		}
 		
+		
 		public String getCaption() {
 			return this.basePanel.getCaptionText();
 		}

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/GdlInstantiator.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/GdlInstantiator.java	Mon Aug 15 04:11:51 2011	(r727)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/GdlInstantiator.java	Mon Aug 15 05:40:19 2011	(r728)
@@ -5,8 +5,12 @@
 
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Association;
 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.Role;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMap;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Variant;
 import us.isidor.gdl.anaToMia.Widgets.base.GdlSpace;
 import us.isidor.gdl.anaToMia.Widgets.base.PSIs;
 import us.isidor.gdl.anaToMia.Widgets.base.GdlVisibleObject;
@@ -44,7 +48,7 @@
 	// returns a java instance of a GdlVisibleObject that corresponds to the
 	// set topic type of the passed topic instance
 	public static GdlVisibleObject instantiate(Topic tmRepresentative, Construct receivedData) throws InvalidGdlSchemaException, ExecutionException{
-		if(!(receivedData instanceof Topic) && !(receivedData instanceof Association) && receivedData != null) throw new ExecutionException("receivedData must be either a Topic or an Association, but is: " + receivedData.getClass());
+		if(!(receivedData instanceof Topic) && !(receivedData instanceof Association) && !(receivedData instanceof Name) && !(receivedData instanceof Variant) && !(receivedData instanceof Occurrence) && !(receivedData instanceof Role) && receivedData != null) throw new ExecutionException("receivedData must be either a Topic, Association, Topic-Name, Name-Variant, Topic-Occurrence or Association-Role, but is: " + receivedData.getClass());
 		
 		if(TmHelper.isInstanceOf(tmRepresentative, PSIs.TopicType.gdlSpace)){
 			return new GdlSpace(tmRepresentative, receivedData);

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	Mon Aug 15 04:11:51 2011	(r727)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java	Mon Aug 15 05:40:19 2011	(r728)
@@ -14,6 +14,8 @@
 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.Reifiable;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.ReifiableStub;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
 import us.isidor.gdl.anaToMia.Widgets.base.ButtonableObject;
 import us.isidor.gdl.anaToMia.Widgets.base.PSIs;
@@ -25,6 +27,7 @@
 import us.isidor.gdl.anaToMia.Widgets.environment.HoverStyleHandler;
 import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException;
 import us.isidor.gdl.anaToMia.Widgets.environment.Pair;
+import us.isidor.gdl.anaToMia.Widgets.environment.Pattern;
 import us.isidor.gdl.anaToMia.Widgets.value.AbsoluteNumValue;
 import us.isidor.gdl.anaToMia.Widgets.value.BorderStyleValue;
 import us.isidor.gdl.anaToMia.Widgets.value.ColorValue;
@@ -60,8 +63,59 @@
 	
 	public GdlText(Topic tmRepresentative, Construct receivedData) throws InvalidGdlSchemaException, ExecutionException{
 		super(tmRepresentative, receivedData);
-		// TODO: create a text element for each TM-elem
+		// TODO: create a text element for each TM-elem, at least one empty elem
 		this.createNewTextArea().setText("Text"); // TODO: remove only for debugging
+		
+		
+		// TODO: move to GdlVisibleObject
+		if(receivedData != null){
+			if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclSubjectIdentifierConstraint)){
+				if(!(receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
+				
+				Pattern rex = new Pattern(this.getLiteralValueForConstraint());
+				for(int i = 0; i != ((Topic)receivedData).getSubjectIdentifiers().length(); ++i){
+					String psi = ((Topic)receivedData).getSubjectIdentifiers().get(i).getReference();
+					if(rex.matches(psi)){
+						this.createNewTextArea().setText(psi);
+					}
+				}
+			} else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclSubjectLocatorConstraint)){
+				if(!(receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
+				
+				Pattern rex = new Pattern(this.getLiteralValueForConstraint());
+				for(int i = 0; i != ((Topic)receivedData).getSubjectLocators().length(); ++i){
+					String sl = ((Topic)receivedData).getSubjectLocators().get(i).getReference();
+					if(rex.matches(sl)){
+						this.createNewTextArea().setText(sl);
+					}
+				}
+			} else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclItemIdentifierConstraint)){
+				if(!(this.receivedData instanceof Reifiable)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Reifiable, but is: " + receivedData.getClass());
+				
+				Pattern rex = new Pattern(this.getLiteralValueForConstraint());
+				for(int i = 0; i != ((ReifiableStub)receivedData).getItemIdentifiers().length(); ++i){
+					String ii = ((Topic)receivedData).getItemIdentifiers().get(i).getReference();
+					if(rex.matches(ii)){
+						this.createNewTextArea().setText(ii);
+					}
+				}
+			} else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclTopicNameConstraint)){
+				if(!(receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
+				
+				Topic nameType = TmHelper.getConstrainedStatement(this.getConstraint());
+				for(int i = 0; i != ((Topic)this.receivedData).getNames(nameType).length(); ++i)
+					this.createNewTextArea().setText(((Topic)this.receivedData).getNames(nameType).get(i).getValue());
+			} else if(TmHelper.isInstanceOf(this.getConstraint(), PSIs.TMCL.tmclTopicOccurrenceConstraint)){
+				if(!(receivedData instanceof Topic)) throw new ExecutionException("the constraint " + TmHelper.getAnyIdOfTopic(this.getConstraint()) + " must be bound to a Topic, but is: " + receivedData.getClass());
+				
+				Topic occurrenceType = TmHelper.getConstrainedStatement(this.getConstraint());
+				for(int i = 0; i != ((Topic)this.receivedData).getOccurrences(occurrenceType).length(); ++i)
+					this.createNewTextArea().setText(((Topic)this.receivedData).getNames(occurrenceType).get(i).getValue());
+			}
+			// TODO: implement type, variant, datatype, ... constraints
+		} else {
+			// TODO: implement: set default values or generate at least one field
+		}
 		this.setNthButtons();
 	}
 	




More information about the Isidorus-cvs mailing list