[isidorus-cvs] r787 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: base environment isidorus
lgiessmann at common-lisp.net
lgiessmann at common-lisp.net
Thu Aug 25 14:41:30 UTC 2011
Author: lgiessmann
Date: Thu Aug 25 07:41:29 2011
New Revision: 787
Log:
gdl-frontend: Widgets: implemented a sample CommitCallback
Added:
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/CommitCallback.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/TestClass.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/ICommitCallback.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 Thu Aug 25 06:56:56 2011 (r786)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPanel.java Thu Aug 25 07:41:29 2011 (r787)
@@ -137,24 +137,21 @@
// some setters for callback instances
- public void setLoadSchemaCallback(ILoadSchemaCallback callback){
- if(callback != null){
- this.loadSchemaCallback = callback;
- }
+ public void setLoadSchemaCallback(ILoadSchemaCallback callback) throws ExecutionException{
+ if(callback == null) throw new ExecutionException("callback must not be null");
+ this.loadSchemaCallback = callback;
}
- public void setCommitCallback(ICommitCallback callback){
- if(callback != null){
- this.commitCallback = callback;
- }
+ public void setCommitCallback(ICommitCallback callback) throws ExecutionException{
+ if(callback == null) throw new ExecutionException("callback must not be null");
+ this.commitCallback = callback;
}
- public void setDeleteCallback(IDeleteCallback callback){
- if(callback != null){
- this.deleteCallback = callback;
- }
+ public void setDeleteCallback(IDeleteCallback callback) throws ExecutionException{
+ if(callback == null) throw new ExecutionException("callback must not be null");
+ this.deleteCallback = callback;
}
@@ -173,6 +170,7 @@
return this.deleteCallback;
}
+
// a getter for the internal topic map
public TopicMap getSchemaTm(){
return this.requestedSchemaTm;
@@ -210,7 +208,7 @@
if(this.commitCallback == null){
throw new ExecutionException("No CommitCallback was set yet");
}
- this.commitCallback.commitTmConstruct(requestedSchemaTm, TopicMapsTypes.TopicMap);
+ this.commitCallback.commitTmConstruct(this.requestedSchemaTm, TopicMapsTypes.TopicMap, this.tmEngine);
}catch(Exception e){
for (IOnErrorCallback handler : localOnErrorContainer) {
handler.onError(GdlErrorTypes.CommitError, 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 Thu Aug 25 06:56:56 2011 (r786)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Thu Aug 25 07:41:29 2011 (r787)
@@ -5,6 +5,7 @@
import us.isidor.gdl.anaToMia.TmEngine.jtmsBasedEngine.JtmsTmEngine;
import us.isidor.gdl.anaToMia.Widgets.environment.Pair;
import us.isidor.gdl.anaToMia.Widgets.environment.TopicIdentifierTypes;
+import us.isidor.gdl.anaToMia.Widgets.isidorus.CommitCallback;
import us.isidor.gdl.anaToMia.Widgets.isidorus.LoadSchemaCallback;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.event.dom.client.ClickEvent;
@@ -45,7 +46,7 @@
mainPanel.add(gdlPanel);
gdlPanel.setTmEngine(new JtmsTmEngine());
gdlPanel.setLoadSchemaCallback(new LoadSchemaCallback());
-
+ gdlPanel.setCommitCallback(new CommitCallback());
Button requestButton = new Button("load schema");
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/ICommitCallback.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/ICommitCallback.java Thu Aug 25 06:56:56 2011 (r786)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/ICommitCallback.java Thu Aug 25 07:41:29 2011 (r787)
@@ -1,9 +1,10 @@
package us.isidor.gdl.anaToMia.Widgets.environment;
+import us.isidor.gdl.anaToMia.TopicMaps.TmEngineModel.TmEngine;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes;
public interface ICommitCallback {
- public void commitTmConstruct(Construct construct, TopicMapsTypes constructType);
+ public void commitTmConstruct(Construct construct, TopicMapsTypes constructType, TmEngine tmengine);
}
Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/CommitCallback.java
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/CommitCallback.java Thu Aug 25 07:41:29 2011 (r787)
@@ -0,0 +1,45 @@
+package us.isidor.gdl.anaToMia.Widgets.isidorus;
+
+import com.google.gwt.user.client.Window;
+
+import us.isidor.gdl.anaToMia.TopicMaps.TmEngineModel.ExporterException;
+import us.isidor.gdl.anaToMia.TopicMaps.TmEngineModel.TmEngine;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Association;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Name;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Variant;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Role;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Occurrence;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMapsTypes;
+import us.isidor.gdl.anaToMia.Widgets.environment.ICommitCallback;
+
+public class CommitCallback implements ICommitCallback{
+
+ @Override
+ public void commitTmConstruct(Construct construct, TopicMapsTypes constructType, TmEngine tmEngine) {
+ try{
+ String jtm = null;
+
+ switch(constructType){
+ case Association: jtm = tmEngine.exportTm((Association)construct);
+ break;
+ case Role: jtm = tmEngine.exportTm((Role)construct);
+ break;
+ case Topic: jtm = tmEngine.exportTm((Topic)construct);
+ break;
+ case Name: jtm = tmEngine.exportTm((Name)construct);
+ break;
+ case Variant: jtm = tmEngine.exportTm((Variant)construct);
+ break;
+ case Occurrence: jtm = tmEngine.exportTm((Occurrence)construct);
+ break;
+ }
+
+ Window.alert(jtm);
+ // TODO: implement
+ }catch(ExporterException ee){
+ Window.alert("faild to commit the Topic Maps data, because: " + ee.getMessage());
+ }
+ }
+}
More information about the Isidorus-cvs
mailing list