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

lgiessmann at common-lisp.net lgiessmann at common-lisp.net
Wed Jul 13 09:27:44 UTC 2011


Author: lgiessmann
Date: Wed Jul 13 02:27:44 2011
New Revision: 606

Log:
gdl-frontend: Widgets: changed the test class for launching a test and importing a test gdl schema

Added:
   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/TestClass.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/view/GdlView.java

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	Tue Jul 12 13:26:22 2011	(r605)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPanel.java	Wed Jul 13 02:27:44 2011	(r606)
@@ -17,6 +17,7 @@
 import us.isidor.gdl.anaToMia.Widgets.view.GdlDefaultTopicView;
 
 import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.user.client.Window;
 import com.google.gwt.user.client.ui.AbsolutePanel;
 import com.google.gwt.user.client.ui.Composite;
 
@@ -69,8 +70,6 @@
 		if(instanceIdentifier != null && instanceIdentifier.getFirst() != null && instanceIdentifier.getSecond() != null){
 			this.requestedInstance = instanceIdentifier;
 		}
-		
-		createView();
 	}
 		
 	
@@ -91,8 +90,6 @@
 		if(typeIdentifiers != null){
 			requestedTypes = typeIdentifiers;
 		}
-		
-		createView();
 	}
 	
 	
@@ -138,7 +135,7 @@
 	
 	
 	// some setters for callback instances
-	public void setLoadCallback(ILoadSchemaCallback callback){
+	public void setLoadSchemaCallback(ILoadSchemaCallback callback){
 		if(callback != null){
 			this.loadSchemaCallback = callback;
 		}
@@ -160,7 +157,7 @@
 
 	
 	// some getters for callback instances
-	public ILoadSchemaCallback getLoadCallback(){
+	public ILoadSchemaCallback getLoadSchemaCallback(){
 		return this.loadSchemaCallback;
 	}
 	
@@ -183,16 +180,15 @@
 	// this method is responsible for loading the Topic Map by using the
 	// loadCallback. After a successfully load operation the
 	// onLoadHandlers are executed
-	public void doLoad(){
+	public void loadSchema(){
 		try{
 			if(tmEngine == null || requestedSchemaTm == null){
 				throw new ExecutionException("No Topic Maps engine was set yet");
 			}
 			if(this.loadSchemaCallback == null){
-				throw new ExecutionException("No LoadCallback was set yet");
+				throw new ExecutionException("No LoadSchemaCallback was set yet");
 			}
 			this.loadSchemaCallback.loadSchema(this, this.requestedInstance, this.requestedTypes);
-			
 		}catch(Exception e){
 			for (IOnErrorCallback handler : localOnErrorContainer) {
 				handler.onError(GdlErrorTypes.LoadError, e);
@@ -283,11 +279,14 @@
 	public void createView(){
 		try{
 			view = GdlInstantiator.instantiateDefaultEditorOrCreatorView(requestedInstance, requestedTypes, this.requestedSchemaTm);
+			Window.alert("view: " + view);
 			mainPanel.add(view);
 			for (Pair<ClickHandler, String> item : this.buttonCallbacks) {
 				view.registerButtonCallback(item.getFirst(), item.getSecond());
 			}
 		}catch(Exception e){
+			Window.alert("could not create a view (" + e.getClass() + "): " + e.getMessage());
+			e.printStackTrace();
 			for (IOnErrorCallback handler : localOnErrorContainer) {
 				handler.onError(GdlErrorTypes.ViewCreationError, e);
 			}

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	Tue Jul 12 13:26:22 2011	(r605)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java	Wed Jul 13 02:27:44 2011	(r606)
@@ -44,26 +44,23 @@
 			DOM.setStyleAttribute(gdlPanel.getElement(), "backgroundColor", "yellow");
 			mainPanel.add(gdlPanel);
 			gdlPanel.setTmEngine(new JtmsTmEngine());
+			gdlPanel.setLoadSchemaCallback(new LoadSchemaCallback());
 			
 	
-			Button requestButton = new Button("start request");
+			
+			Button requestButton = new Button("load schema");
 			requestButton.addClickHandler(new ClickHandler() {
 				@Override
 				public void onClick(ClickEvent event) {
-					LoadSchemaCallback callback = new LoadSchemaCallback();
-					try{
-						callback.loadSchema(gdlPanel, null, new ArrayList<Pair<String,TopicIdentifierTypes>>());
-					}catch(Exception e){
-						Window.alert("cought error: " + e.getLocalizedMessage());
-					}
+					gdlPanel.loadSchema();
 				}
 			});
 			
 			mainPanel.add(requestButton);
+			
 		
 		
-		
-		
+		/*
 		// only for testing
 	
 			Topic tmpRepresentative = gdlPanel.getSchemaTm().createTopicBySubjectIdentifier(gdlPanel.getSchemaTm().createLocator("http://test.org/test-top"));
@@ -179,6 +176,7 @@
 				}
 			};
 			this.mainPanel.add(tmp);
+			*/
 		}catch(Exception e){
 			e.printStackTrace();
 			Window.alert(">> e >> " + e.getClass() + " >> " + e.getMessage());

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	Tue Jul 12 13:26:22 2011	(r605)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/LoadSchemaCallback.java	Wed Jul 13 02:27:44 2011	(r606)
@@ -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() + "test.jtm"); // TODO: replace with the correct URL
+	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 RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.GET, isidorusUrl);
@@ -61,13 +61,13 @@
 				try{
 					if(panel.getTmEngine() == null || panel.getSchemaTm() == null) throw new ExecutionException("no Topic Maps engine was set yet");
 					panel.getTmEngine().importTopicMap(response.getText(), panel.getSchemaTm());
+					panel.createView();
 				}catch(ExecutionException e){
 					Window.alert("Execution Error: " + e.getMessage());
 				}catch(Exception e){
 					Window.alert("panel: " + panel + ", tm: " + panel.getSchemaTm() + "\ncought error: " + e.getLocalizedMessage()); // TODO: implement smarter error handling
 					e.printStackTrace();
 				}
-				panel.createView();
 			} else {
 				final ButtonDialog dialog = new ButtonDialog("Connection Error", "The request to " + isidorusUrl + " failed\n" + response.getStatusCode() + ": " + response.getStatusText(), "retry", "cancel", null, null);
 				dialog.setLeftButtonClickHandler(new ClickHandler() {	

Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlView.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlView.java	Tue Jul 12 13:26:22 2011	(r605)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlView.java	Wed Jul 13 02:27:44 2011	(r606)
@@ -48,7 +48,7 @@
 	}
 	
 	
-	// Searches the topic that represents the first item that is playced within this view instance
+	// Searches the topic that represents the first item that is placed within this view instance
 	// i.e. such an item must not have an association that is bound to it via a role of the type
 	// gdl:ancestor.
 	protected Topic getStartElement() throws InvalidGdlSchemaException {

Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/war/gdl_widgets/test.gdl.jtm
==============================================================================




More information about the Isidorus-cvs mailing list