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

lgiessmann at common-lisp.net lgiessmann at common-lisp.net
Fri Aug 19 18:17:37 UTC 2011


Author: lgiessmann
Date: Fri Aug 19 11:17:36 2011
New Revision: 765

Log:
gdl-frontend: Widgets: changed some methods to be able to instantiate GdlAssociationView instances

Modified:
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlHasValueGroup.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/environment/GdlInstantiator.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/LoadSchemaCallback.java
   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/view/GdlAssociationView.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlCreatorAssociationView.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlEditorAssociationView.java

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlHasValueGroup.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlHasValueGroup.java	Fri Aug 19 11:16:49 2011	(r764)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlHasValueGroup.java	Fri Aug 19 11:17:36 2011	(r765)
@@ -32,6 +32,12 @@
 	// i.e. is is one value of getDefaultTmValue(), getDefaultLiteralValue() 
 	public Topic getDefaultValue() throws InvalidGdlSchemaException;
 	
+	
+	// returns true if the default value of the element's value-group is
+	// fixed and cannot be changed by the user
+	public boolean fixedDefaultValue() throws InvalidGdlSchemaException;
+	
+	
 	// returns all possible topics that can be used as values for this value group.
 	// Note, since gdl:Default-TM-Value is treated as a usual value,
 	// default vaues are also returned by this function

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	Fri Aug 19 11:16:49 2011	(r764)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/PSIs.java	Fri Aug 19 11:17:36 2011	(r765)
@@ -214,6 +214,7 @@
 		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";
+		public final static String gdlAssociationViewBinding = gdl + "association-view-binding";
 		public final static String gdlValueBinding = gdl + "value-binding";
 	}
 	

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	Fri Aug 19 11:16:49 2011	(r764)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java	Fri Aug 19 11:17:36 2011	(r765)
@@ -1,6 +1,8 @@
 package us.isidor.gdl.anaToMia.Widgets.base;
 
 
+import java.util.ArrayList;
+
 import us.isidor.gdl.anaToMia.TmEngine.jtmsBasedEngine.JtmsTmEngine;
 import us.isidor.gdl.anaToMia.Widgets.environment.Pair;
 import us.isidor.gdl.anaToMia.Widgets.environment.TopicIdentifierTypes;
@@ -25,22 +27,22 @@
 			mainPanel.setBorderWidth(1);
 			mainPanel.setPixelSize(1000, 600);
 			
-			//ArrayList<Pair<String, TopicIdentifierTypes>> requestedTopicsToCreate = new ArrayList<Pair<String,TopicIdentifierTypes>>();
-			//requestedTopicsToCreate.add(new Pair<String, TopicIdentifierTypes>("http://textgrid.org/serviceregistry/model/types/Hash-Object", TopicIdentifierTypes.SubjectIdentifier));
+			ArrayList<Pair<String, TopicIdentifierTypes>> requestedTopicsToCreate = new ArrayList<Pair<String,TopicIdentifierTypes>>();
+			requestedTopicsToCreate.add(new Pair<String, TopicIdentifierTypes>("http://textgrid.org/serviceregistry/model/types/Hash-Object", TopicIdentifierTypes.SubjectIdentifier));
 			//requestedTopicsToCreate.add(new Pair<String, TopicIdentifierTypes>("http://textgrid.org/serviceregistry/model/types/Environment", TopicIdentifierTypes.SubjectIdentifier));
 			//requestedTopicsToCreate.add(new Pair<String, TopicIdentifierTypes>("http://psi.test.org/gdl-test/Poet", TopicIdentifierTypes.SubjectIdentifier));
 			//requestedTopicsToCreate.add(new Pair<String, TopicIdentifierTypes>("http://psi.test.org/gdl-test/Musician", TopicIdentifierTypes.SubjectIdentifier));
 			
 			//Pair<String, TopicIdentifierTypes> requestedTopicToEdit = new Pair<String, TopicIdentifierTypes>("http://textgrid.org/serviceregistry/model/types/test-env", TopicIdentifierTypes.SubjectIdentifier);
 			//Pair<String, TopicIdentifierTypes> requestedTopicToEdit = new Pair<String, TopicIdentifierTypes>("http://textgrid.org/serviceregistry/model/types/test-hash", TopicIdentifierTypes.SubjectIdentifier);
-			Pair<String, TopicIdentifierTypes> requestedTopicToEdit = new Pair<String, TopicIdentifierTypes>("http://textgrid.org/serviceregistry/test-hash-2", TopicIdentifierTypes.SubjectIdentifier);
+			//Pair<String, TopicIdentifierTypes> requestedTopicToEdit = new Pair<String, TopicIdentifierTypes>("http://textgrid.org/serviceregistry/test-hash-2", TopicIdentifierTypes.SubjectIdentifier);
 			GdlPanel.addClickHandler("unit_1_text_create_button_id", new ClickHandler() {
 				@Override
 				public void onClick(ClickEvent event) {
 					Window.alert("you clicked " + ((Button)event.getSource()).getText());
 				}
 			});
-			gdlPanel = new GdlPanel(requestedTopicToEdit, null);
+			gdlPanel = new GdlPanel(null, requestedTopicsToCreate);
 			mainPanel.add(gdlPanel);
 			gdlPanel.setTmEngine(new JtmsTmEngine());
 			gdlPanel.setLoadSchemaCallback(new LoadSchemaCallback());

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	Fri Aug 19 11:16:49 2011	(r764)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/GdlInstantiator.java	Fri Aug 19 11:17:36 2011	(r765)
@@ -97,16 +97,17 @@
 			if(!(receivedData instanceof Topic) && receivedData != null) throw new ExecutionException("receivedData must be of type Topic when used with " + PSIs.TopicType.gdlDefaultEditorTopicView);
 			return new GdlDefaultEditorTopicView(tmRepresentative, (Topic)receivedData);
 		}else if(TmHelper.isInstanceOf(tmRepresentative, PSIs.TopicType.gdlSpecialCreatorTopicView)){
+			if(!(receivedData instanceof Topic) && receivedData != null) throw new ExecutionException("receivedData must be of type Topic when used with " + PSIs.TopicType.gdlSpecialCreatorTopicView);
 			return new GdlSpecialCreatorTopicView(tmRepresentative);
 		}else if(TmHelper.isInstanceOf(tmRepresentative, PSIs.TopicType.gdlSpecialEditorTopicView)){
 			if(!(receivedData instanceof Topic) && receivedData != null) throw new ExecutionException("receivedData must be of type Topic when used with " + PSIs.TopicType.gdlSpecialEditorTopicView);
 			return new GdlSpecialEditorTopicView(tmRepresentative, (Topic)receivedData);
 		}else if(TmHelper.isInstanceOf(tmRepresentative, PSIs.TopicType.gdlCreatorAssociationview)){
 			if(!(receivedData instanceof Topic) && receivedData != null) throw new ExecutionException("receivedData must be of type Association when used with " + PSIs.TopicType.gdlCreatorAssociationview);
-			return new GdlCreatorAssociationView(tmRepresentative, (Association)receivedData);
+			return new GdlCreatorAssociationView(tmRepresentative, (Topic)receivedData);
 		}else if(TmHelper.isInstanceOf(tmRepresentative, PSIs.TopicType.gdlEditorAssociationView)){
 			if(!(receivedData instanceof Topic) && receivedData != null) throw new ExecutionException("receivedData must be of type Associaiton when used with " + PSIs.TopicType.gdlEditorAssociationView);
-			return new GdlEditorAssociationView(tmRepresentative, (Association)receivedData);
+			return new GdlEditorAssociationView(tmRepresentative, (Topic)receivedData);
 		}else{
 			String values = "";
 			for(int i = 0; i != tmRepresentative.getTypes().length(); ++i){

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/LoadSchemaCallback.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/LoadSchemaCallback.java	Fri Aug 19 11:16:49 2011	(r764)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/LoadSchemaCallback.java	Fri Aug 19 11:17:36 2011	(r765)
@@ -23,7 +23,7 @@
 // this class can be used as a callback that requests the Topic Map data
 // addressable by the URI isidorusUrl
 public class LoadSchemaCallback implements ILoadSchemaCallback{
-	private final String isidorusUrl = URL.encode(GWT.getModuleBaseURL() + "TextGrid_ServiceRegistry_required_TMCL_and_GDL_Schema_with_test_data.jtm"); // TODO: replace with the correct URL
+	private final String isidorusUrl = URL.encode(GWT.getModuleBaseURL() + "TextGrid_GDL_Create_HashObject.jtm");//"TextGrid_ServiceRegistry_required_TMCL_and_GDL_Schema_with_test_data.jtm"); // TODO: replace with the correct URL
 	private ArrayList<Pair<String, TopicIdentifierTypes>> requestedTopicsToCreate = new ArrayList<Pair<String,TopicIdentifierTypes>>(); 
 	private Pair<String, TopicIdentifierTypes> requestedTopicToEdit = null;
 	private RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, isidorusUrl);

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	Fri Aug 19 11:16:49 2011	(r764)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/text/GdlText.java	Fri Aug 19 11:17:36 2011	(r765)
@@ -530,7 +530,7 @@
 
 		if(readOnlyOcc != null){
 			String boolStr = readOnlyOcc.getValue().toUpperCase();
-			if(boolStr.equals("TRUE")){
+			if(boolStr.equals("TRUE") || this.fixedDefaultValue()){
 				return true;
 			} else if(boolStr.equals("FALSE")) {
 				return false;
@@ -971,6 +971,26 @@
 		else return this.getDefaultTmValue();
 	}
 
+	
+	public boolean fixedDefaultValue() throws InvalidGdlSchemaException{
+		Topic defVal = this.getDefaultValue();
+		
+		if(defVal == null) return false;
+		
+		TopicMap tm = defVal.getTopicMap();
+		Occurrence fixedOcc = TmHelper.getSingleOccurrence(defVal, TmHelper.getTopicByPsi(PSIs.OccurrenceType.gdlFixed, tm));
+		
+		if(fixedOcc != null){
+			try{
+				return Boolean.valueOf(fixedOcc.getValue().toLowerCase());
+			}catch(Exception e){
+				throw new InvalidGdlSchemaException("the occurrence of type " + PSIs.OccurrenceType.gdlFixed + " bound to the topic " + TmHelper.getAnyIdOfTopic(defVal) + " must be set to either true or false, but is: " + fixedOcc.getValue());
+			}
+		} else {
+			return false;
+		}
+	}
+	
 
 	@Override
 	public ArrayList<Topic> getTmValues() throws InvalidGdlSchemaException {

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	Fri Aug 19 11:16:49 2011	(r764)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlAssociationView.java	Fri Aug 19 11:17:36 2011	(r765)
@@ -1,5 +1,7 @@
 package us.isidor.gdl.anaToMia.Widgets.view;
 
+import java.util.ArrayList;
+
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Association;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
 import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException;
@@ -7,10 +9,31 @@
 
 
 public abstract class GdlAssociationView extends GdlView {
+	protected ArrayList<Association> associationsToRepresent = null;
 
-	public GdlAssociationView(Topic tmRepresentative, Association receivedData) throws InvalidGdlSchemaException, ExecutionException {
-		super(tmRepresentative, receivedData);
+	public GdlAssociationView(Topic tmRepresentative, Topic receivedData) throws InvalidGdlSchemaException, ExecutionException {
+		super(tmRepresentative, null);
 		// TODO Auto-generated constructor stub
 	}
 	// TODO: implement
+	
+	
+	// return the association-type that this element is bound to through the
+	// set association-role- and topic-role- constraints
+	public Topic getAssociationType() throws InvalidGdlSchemaException {
+		// TODO: implement
+		return null;
+	}
+	
+	
+	public ArrayList<Topic> getAssociationRoleConstraints(){
+		// TODO: implement
+		return null;
+	}
+	
+	
+	public ArrayList<Topic> getTopicRoleConstraints(){
+		// TODO: implement
+		return null;
+	}
 }

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlCreatorAssociationView.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlCreatorAssociationView.java	Fri Aug 19 11:16:49 2011	(r764)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlCreatorAssociationView.java	Fri Aug 19 11:17:36 2011	(r765)
@@ -1,6 +1,5 @@
 package us.isidor.gdl.anaToMia.Widgets.view;
 
-import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Association;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMap;
 import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException;
@@ -9,7 +8,7 @@
 
 public class GdlCreatorAssociationView extends GdlAssociationView {
 
-	public GdlCreatorAssociationView(Topic tmRepresentative, Association receivedData) throws InvalidGdlSchemaException, ExecutionException {
+	public GdlCreatorAssociationView(Topic tmRepresentative, Topic receivedData) throws InvalidGdlSchemaException, ExecutionException {
 		super(tmRepresentative, receivedData);
 		// TODO Auto-generated constructor stub
 	}

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlEditorAssociationView.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlEditorAssociationView.java	Fri Aug 19 11:16:49 2011	(r764)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlEditorAssociationView.java	Fri Aug 19 11:17:36 2011	(r765)
@@ -1,7 +1,6 @@
 package us.isidor.gdl.anaToMia.Widgets.view;
 
 
-import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Association;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
 import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMap;
 import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException;
@@ -10,7 +9,7 @@
 
 public class GdlEditorAssociationView extends GdlAssociationView {
 
-	public GdlEditorAssociationView(Topic tmRepresentative, Association receivedData) throws InvalidGdlSchemaException, ExecutionException {
+	public GdlEditorAssociationView(Topic tmRepresentative, Topic receivedData) throws InvalidGdlSchemaException, ExecutionException {
 		super(tmRepresentative, receivedData);
 		// TODO Auto-generated constructor stub
 	}




More information about the Isidorus-cvs mailing list