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

lgiessmann at common-lisp.net lgiessmann at common-lisp.net
Wed Jul 13 12:38:01 UTC 2011


Author: lgiessmann
Date: Wed Jul 13 05:38:00 2011
New Revision: 608

Log:
gdl-frontend: Widgets: changed the way the GdlPanel requests topics to edit or to create

Modified:
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPanel.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/ILoadSchemaCallback.java
   branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/LoadSchemaCallback.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/GdlPanel.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPanel.java	Wed Jul 13 04:57:28 2011	(r607)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPanel.java	Wed Jul 13 05:38:00 2011	(r608)
@@ -34,12 +34,10 @@
 	// The ClickHandlers will be registered on the buttons with the corresponding id attribute.
 	private ArrayList<Pair<ClickHandler, String>> buttonCallbacks = new ArrayList<Pair<ClickHandler, String>>();
 
-	// If requestedTypes is not null or length != 0, the string values must be treated as topic
-	// identifiers of a topic type. The created GDL view must be a Default-Topic-Creator-View
-	private ArrayList<Pair<String, TopicIdentifierTypes>> requestedTypes = new ArrayList<Pair<String, TopicIdentifierTypes>>();
-	// If requestedInstance is not null or != "", the string value must be treated as a topic identifier
-	// of a particular topic instance. The created GDL view must be a Default-Topic-Editor-View
-	private Pair<String, TopicIdentifierTypes> requestedInstance = null;
+	// if any value is set in this array list, the requested view is a Default-Creator-Topic-View
+	private ArrayList<Pair<String, TopicIdentifierTypes>> requestedTopicsToCreate = new ArrayList<Pair<String,TopicIdentifierTypes>>();
+	// if any value is set in this array list, the requested view is a Default-Editor-Topic-View
+	private ArrayList<Pair<String, TopicIdentifierTypes>> requestedTopicsToEdit = new ArrayList<Pair<String,TopicIdentifierTypes>>();
 	
 	// the GWT base for this panel 
 	private AbsolutePanel mainPanel = new AbsolutePanel();
@@ -65,46 +63,28 @@
 	}
 	
 	
-	protected GdlPanel(Pair<String, TopicIdentifierTypes> instanceIdentifier){
+	protected GdlPanel(ArrayList<Pair<String, TopicIdentifierTypes>> topicsToEdit, ArrayList<Pair<String, TopicIdentifierTypes>> topicToCreate) throws ExecutionException{
 		this();
-		if(instanceIdentifier != null && instanceIdentifier.getFirst() != null && instanceIdentifier.getSecond() != null){
-			this.requestedInstance = instanceIdentifier;
-		}
-	}
+		if(topicsToEdit != null && topicsToEdit.size() != 0)this.requestedTopicsToEdit = topicsToEdit;
+		if(topicToCreate != null && topicToCreate.size() != 0)this.requestedTopicsToCreate = topicToCreate;
 		
-	
-	public GdlPanel(Pair<String, TopicIdentifierTypes> instanceIdentifier, int width, int height){
-		this(instanceIdentifier);
-		this.setPixelSize(width, height);
+		if(this.requestedTopicsToCreate.size() != 0 && this.requestedTopicsToEdit.size() != 0)
+			throw new ExecutionException("only one container can be set, i.e. either topics to create or topics to edit");
 	}
+		
 	
-	
-	public GdlPanel(Pair<String, TopicIdentifierTypes> instanceIdentifier, String width, String height){
-		this(instanceIdentifier);
-		this.setSize(width, height);
-	}
-	
-	
-	protected GdlPanel(ArrayList<Pair<String, TopicIdentifierTypes>> typeIdentifiers){
-		this();
-		if(typeIdentifiers != null){
-			requestedTypes = typeIdentifiers;
-		}
-	}
-	
-	
-	public GdlPanel(ArrayList<Pair<String, TopicIdentifierTypes>> typeIdentifiers, int width, int height){
-		this(typeIdentifiers);
+	public GdlPanel(ArrayList<Pair<String, TopicIdentifierTypes>> topicsToEdit, ArrayList<Pair<String, TopicIdentifierTypes>> topicToCreate, int width, int height) throws ExecutionException{
+		this(topicsToEdit, topicToCreate);
 		this.setPixelSize(width, height);
 	}
 	
 	
-	public GdlPanel(ArrayList<Pair<String, TopicIdentifierTypes>> typeIdentifiers, String width, String height){
-		this(typeIdentifiers);
+	public GdlPanel(ArrayList<Pair<String, TopicIdentifierTypes>> topicsToEdit, ArrayList<Pair<String, TopicIdentifierTypes>> topicToCreate, String width, String height) throws ExecutionException{
+		this(topicsToEdit, topicToCreate);
 		this.setSize(width, height);
 	}
 
-	
+
 	public void registerOnErrorHandler(String descriptorId, IOnErrorCallback handler){
 		if(!localOnErrorContainer.contains(handler)){
 			localOnErrorContainer.add(handler);
@@ -188,7 +168,7 @@
 			if(this.loadSchemaCallback == null){
 				throw new ExecutionException("No LoadSchemaCallback was set yet");
 			}
-			this.loadSchemaCallback.loadSchema(this, this.requestedInstance, this.requestedTypes);
+			this.loadSchemaCallback.loadSchema(this, this.requestedTopicsToEdit, this.requestedTopicsToCreate);
 		}catch(Exception e){
 			for (IOnErrorCallback handler : localOnErrorContainer) {
 				handler.onError(GdlErrorTypes.LoadError, e);
@@ -278,8 +258,8 @@
 	// Creates the actual view from the requested topic map
 	public void createView(){
 		try{
-			view = GdlInstantiator.instantiateDefaultEditorOrCreatorView(requestedInstance, requestedTypes, this.requestedSchemaTm);
-			Window.alert("view: " + view);
+			//view = GdlInstantiator.instantiateDefaultEditorOrCreatorView(requestedTopicsTo, requestedTopicToCreat, this.requestedSchemaTm);
+			//TODO: implement
 			mainPanel.add(view);
 			for (Pair<ClickHandler, String> item : this.buttonCallbacks) {
 				view.registerButtonCallback(item.getFirst(), item.getSecond());

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	Wed Jul 13 04:57:28 2011	(r607)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java	Wed Jul 13 05:38:00 2011	(r608)
@@ -39,7 +39,10 @@
 			mainPanel.setBorderWidth(1);
 			mainPanel.setPixelSize(500, 500);
 			
-			gdlPanel = new GdlPanel(new Pair<String, TopicIdentifierTypes>("http://mytop/psi-1", TopicIdentifierTypes.SubjectIdentifier));
+			ArrayList<Pair<String, TopicIdentifierTypes>> requestedTopicsToCreate = new ArrayList<Pair<String,TopicIdentifierTypes>>();
+			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));
+			gdlPanel = new GdlPanel(null, requestedTopicsToCreate);
 			gdlPanel.setPixelSize(100, 100);
 			DOM.setStyleAttribute(gdlPanel.getElement(), "backgroundColor", "yellow");
 			mainPanel.add(gdlPanel);

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/ILoadSchemaCallback.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/ILoadSchemaCallback.java	Wed Jul 13 04:57:28 2011	(r607)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/ILoadSchemaCallback.java	Wed Jul 13 05:38:00 2011	(r608)
@@ -6,5 +6,5 @@
 import us.isidor.gdl.anaToMia.Widgets.base.GdlPanel;
 
 public interface ILoadSchemaCallback {
-	public void loadSchema(GdlPanel panel, Pair<String, TopicIdentifierTypes> instanceIdentifier, ArrayList<Pair<String, TopicIdentifierTypes>> typeIdentifiers)throws RequestException;
+	public void loadSchema(GdlPanel panel, ArrayList<Pair<String, TopicIdentifierTypes>> requestedTopicsToEdit, ArrayList<Pair<String, TopicIdentifierTypes>> requestedTopicsToCreate)throws RequestException;
 }

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	Wed Jul 13 04:57:28 2011	(r607)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/LoadSchemaCallback.java	Wed Jul 13 05:38:00 2011	(r608)
@@ -24,8 +24,8 @@
 // addressable by the URI isidorusUrl
 public class LoadSchemaCallback implements ILoadSchemaCallback{
 	private final String isidorusUrl = URL.encode(GWT.getModuleBaseURL() + "test.gdl.jtm"); // TODO: replace with the correct URL
-	private ArrayList<Pair<String, TopicIdentifierTypes>> typeIdentifiers = new ArrayList<Pair<String,TopicIdentifierTypes>>(); 
-	private Pair<String, TopicIdentifierTypes> instanceIdentifier = null;
+	private ArrayList<Pair<String, TopicIdentifierTypes>> requestedTopicsToCreate = new ArrayList<Pair<String,TopicIdentifierTypes>>(); 
+	private ArrayList<Pair<String, TopicIdentifierTypes>> requestedTopicsToEdit = new ArrayList<Pair<String,TopicIdentifierTypes>>(); 
 	private RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, isidorusUrl);
 	
 	
@@ -34,9 +34,9 @@
 	
 	// this method is invoked as a callback method
 	@Override
-	public void loadSchema(GdlPanel panel, Pair<String, TopicIdentifierTypes> instanceIdentifier, ArrayList<Pair<String, TopicIdentifierTypes>> typeIdentifiers)throws RequestException {
-		this.typeIdentifiers = typeIdentifiers;
-		this.instanceIdentifier = instanceIdentifier;
+	public void loadSchema(GdlPanel panel, ArrayList<Pair<String, TopicIdentifierTypes>> requestedTopicsToEdit , ArrayList<Pair<String, TopicIdentifierTypes>> requestedTopicsToCreate)throws RequestException {
+		this.requestedTopicsToCreate = requestedTopicsToCreate;
+		this.requestedTopicsToEdit = requestedTopicsToEdit;
 		requestBuilder.sendRequest(null, new RequestCallbackImpl(panel));
 	}
 
@@ -75,7 +75,7 @@
 					public void onClick(ClickEvent event) {
 						dialog.hide();
 						try{
-							loadSchema(panel, instanceIdentifier, typeIdentifiers);
+							loadSchema(panel, LoadSchemaCallback.this.requestedTopicsToEdit, LoadSchemaCallback.this.requestedTopicsToCreate);
 						}catch(Exception e){
 							Window.alert("connection to : " + isidorusUrl + " failed: " + e.getMessage());
 						}
@@ -102,7 +102,7 @@
 				public void onClick(ClickEvent event) {
 					dialog.hide();
 					try{
-						loadSchema(panel, instanceIdentifier, typeIdentifiers);
+						loadSchema(panel, LoadSchemaCallback.this.requestedTopicsToEdit, LoadSchemaCallback.this.requestedTopicsToCreate);
 					}catch(Exception e){
 						Window.alert("connection to : " + isidorusUrl + " failed: " + e.getMessage());
 					}

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 13 04:57:28 2011	(r607)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm	Wed Jul 13 05:38:00 2011	(r608)
@@ -35,6 +35,7 @@
            {"subject_identifiers":["[doc:instance-value]"], "instance_of":["si:[gdl:TM-Instance-Value]"]},
            {"subject_identifiers":["[doc:multi-type-value-1]"], "instance_of":["si:[gdl:TM-Multiple-Type-Value]"]},
            {"subject_identifiers":["[doc:multi-type-value-2]"], "instance_of":["si:[gdl:TM-Multiple-Type-Value]"]},
+           {"subject_identifiers":["[doc:multi-type-value-3]"], "instance_of":["si:[gdl:TM-Multiple-Type-Value]"]},
            {"subject_identifiers":["[gdl:Topic-View]"]},
            {"subject_identifiers":["[gdl:Default-Topic-View]"]},
            {"subject_identifiers":["[gdl:Special-Topic-View]"]},
@@ -72,5 +73,8 @@
                  {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[doc:multi-type-value-2]"}, {"type":"si:[gdl:tm-construct]", "player":"si:[doc:Musician]"}]},
                  {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[doc:multi-type-value-2]"}, {"type":"si:[gdl:tm-construct]", "player":"si:[doc:Director]"}]},
                  {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[doc:multi-type-value-2]"}, {"type":"si:[gdl:tm-construct]", "player":"si:[doc:Poet]"}]},
-                 {"type":"si:[gdl:topic-view-binding]", "roles":[{"type":"si:[gdl:tm-value]", "player":"si:[doc:multi-type-value-2]"}, {"type":"si:[gdl:descriptor]", "player":"si:[doc:default-creator-topic-view-2]"}]}
+                 {"type":"si:[gdl:topic-view-binding]", "roles":[{"type":"si:[gdl:tm-value]", "player":"si:[doc:multi-type-value-2]"}, {"type":"si:[gdl:descriptor]", "player":"si:[doc:default-creator-topic-view-2]"}]},
+                 {"type":"si:[gdl:topic-view-binding]", "roles":[{"type":"si:[gdl:tm-value]", "player":"si:[doc:multi-type-value-3]"}, {"type":"si:[gdl:descriptor]", "player":"si:[doc:special-creator-topic-view]"}]},
+                 {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[doc:multi-type-value-3]"}, {"type":"si:[gdl:tm-construct]", "player":"si:[doc:Musician]"}]},
+                 {"type":"si:[gdl:tm-binding]", "roles":[{"type":"si:[gdl:descriptor]", "player":"si:[doc:multi-type-value-3]"}, {"type":"si:[gdl:tm-construct]", "player":"si:[doc:Poet]"}]}
                 ]}
\ No newline at end of file




More information about the Isidorus-cvs mailing list