[isidorus-cvs] r527 - in branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets: base environment views
lgiessmann at common-lisp.net
lgiessmann at common-lisp.net
Wed Jun 29 09:20:20 UTC 2011
Author: lgiessmann
Date: Wed Jun 29 02:20:20 2011
New Revision: 527
Log:
gdl-frontend: Widgets: implemented a skeleton for the GDL entry point
Added:
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/GdlPsis.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlContainer.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/GdlError.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/IGdlErrorHandler.java
- copied, changed from r526, branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/IWidgetClickHandler.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/IGdlEventHandler.java
- copied, changed from r526, branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/IWidgetEventHandler.java
Deleted:
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/IWidgetClickHandler.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/IWidgetEventHandler.java
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/TestClass.java
branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlView.java
Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPanel.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/base/GdlPanel.java Wed Jun 29 02:20:20 2011 (r527)
@@ -0,0 +1,219 @@
+package us.isidor.gdl.anaToMia.Widgets.base;
+
+import java.util.ArrayList;
+import us.isidor.gdl.anaToMia.TopicMaps.TmEngineModel.TmEngine;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMap;
+import us.isidor.gdl.anaToMia.Widgets.environment.IGdlErrorHandler;
+import us.isidor.gdl.anaToMia.Widgets.environment.IGdlEventHandler;
+import us.isidor.gdl.anaToMia.Widgets.views.GdlDefaultTopicView;
+
+import com.google.gwt.user.client.ui.AbsolutePanel;
+import com.google.gwt.user.client.ui.Composite;
+
+
+public class GdlPanel extends Composite{
+ // tmEngine is used as Topic Maps engine for this GdlPanel instance
+ private TmEngine tmEngine = null;
+ // onLoadContainer references handlers that are executed when the GDL schema was successfully loaded from the server
+ private ArrayList<IGdlEventHandler> onLoadContainer = new ArrayList<IGdlEventHandler>();
+ // onCommitContainer references handlers that are executed when the GDL content was successfully committed
+ private ArrayList<IGdlEventHandler> onCommitContainer = new ArrayList<IGdlEventHandler>();
+ // onValidateContainer references handlers that are executed when the GDL content was successfully validated
+ private ArrayList<IGdlEventHandler> onValidateContainer = new ArrayList<IGdlEventHandler>();
+ // onDeleteContainer references handlers that are executed when the GDL content was successfully deleted
+ private ArrayList<IGdlEventHandler> onDeleteContainer = new ArrayList<IGdlEventHandler>();
+ // onErrorContainer references handlers that are executed if an error occurred, i.e. if one of the processes
+ // GDL loading, GDL commit, GDL validate, GDL delete failed, but any other execution error also executes an
+ // error handler
+ private ArrayList<IGdlErrorHandler> onErrorContainer = new ArrayList<IGdlErrorHandler>();
+
+ // 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 String[] requestedTypes = new String[]{};
+ // 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 String requestedInstance = "";
+
+ // the GWT base for this panel
+ private AbsolutePanel mainPanel = new AbsolutePanel();
+
+ // the actual view with the corresponding content
+ GdlDefaultTopicView view = null;
+
+
+ private GdlPanel() {
+ initWidget(mainPanel);
+ }
+
+
+ protected GdlPanel(String instanceIdentifier){
+ this();
+ if(instanceIdentifier != null){
+ this.requestedInstance = instanceIdentifier;
+ }
+
+ createView();
+ }
+
+
+ public GdlPanel(String instanceIdentifier, int width, int height){
+ this(instanceIdentifier);
+ this.setPixelSize(width, height);
+ }
+
+
+ public GdlPanel(String instanceIdentifier, String width, String height){
+ this(instanceIdentifier);
+ this.setSize(width, height);
+ }
+
+
+ protected GdlPanel(String[] typeIdentifiers){
+ this();
+ if(typeIdentifiers != null){
+ requestedTypes = typeIdentifiers;
+ }
+
+ createView();
+ }
+
+
+ public GdlPanel(String[] typeIdentifiers, int width, int height){
+ this(typeIdentifiers);
+ this.setPixelSize(width, height);
+ }
+
+
+ public GdlPanel(String[] typeIdentifiers, String width, String height){
+ this(typeIdentifiers);
+ this.setSize(width, height);
+ }
+
+
+ public void addOnLoadHandler(IGdlEventHandler handler){
+ if(!onLoadContainer.contains(handler)){
+ onLoadContainer.add(handler);
+ }
+ }
+
+
+ public void removeOnLoadHandler(IGdlEventHandler handler){
+ onLoadContainer.remove(handler);
+ }
+
+
+ public void addOnCommitHandler(IGdlEventHandler handler){
+ if(!onCommitContainer.contains(handler)){
+ onCommitContainer.add(handler);
+ }
+ }
+
+
+ public void removeOnCommitHandler(IGdlEventHandler handler){
+ onCommitContainer.remove(handler);
+ }
+
+
+ public void addOnValidateHandler(IGdlEventHandler handler){
+ if(!onValidateContainer.contains(handler)){
+ onValidateContainer.add(handler);
+ }
+ }
+
+
+ public void removeOnValidateHandler(IGdlEventHandler handler){
+ onValidateContainer.remove(handler);
+ }
+
+
+ public void addOnDeleteHandler(IGdlEventHandler handler){
+ if(!onDeleteContainer.contains(handler)){
+ onDeleteContainer.add(handler);
+ }
+ }
+
+
+ public void removeOnDeleteHandler(IGdlEventHandler handler){
+ onDeleteContainer.remove(handler);
+ }
+
+
+ public void addOnErrorHandler(IGdlErrorHandler handler){
+ if(!onErrorContainer.contains(handler)){
+ onErrorContainer.add(handler);
+ }
+ }
+
+
+ public void removeOnErrorHandler(IGdlErrorHandler handler){
+ onErrorContainer.remove(handler);
+ }
+
+
+ public TmEngine getTmengine(){
+ return this.tmEngine;
+ }
+
+
+ public void setTmEngine(TmEngine tmEngine) {
+ if(tmEngine != null){
+ this.tmEngine = tmEngine;
+ }
+ }
+
+
+ public void doLoad(){
+ try{
+ // TODO: Implement
+ }catch(Exception e){
+ // TODO: executes all onError handlers
+ }
+ }
+
+
+ public void doCommit(){
+ try{
+ // TODO: Implement
+ }catch(Exception e){
+ // TODO: executes all onError handlers
+ }
+ }
+
+
+ public void doValidate() {
+ try{
+ // TODO: Implement
+ }catch(Exception e){
+ // TODO: executes all onError handlers
+ }
+ }
+
+
+ public void doDelete() {
+ try{
+ // TODO: Implement
+ }catch(Exception e){
+ // TODO: executes all onError handlers
+ }
+ }
+
+
+ public TopicMap generateTopicMap() {
+ try{
+ // TODO: Implement
+ return null;
+ }catch(Exception e){
+ // TODO: executes all onError handlers
+ return null;
+ }
+ }
+
+
+ public void createView(){
+ try{
+ // TODO: Implement
+ }catch(Exception e){
+ // TODO: executes all onError handlers
+ }
+ }
+}
Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPsis.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/base/GdlPsis.java Wed Jun 29 02:20:20 2011 (r527)
@@ -0,0 +1,7 @@
+package us.isidor.gdl.anaToMia.Widgets.base;
+
+public class GdlPsis {
+ public final static String gdl = "http://psi.isidor.us/gdl/";
+ public final static String gdlViewName = gdl + "view-name";
+
+}
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 Tue Jun 28 09:18:45 2011 (r526)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Wed Jun 29 02:20:20 2011 (r527)
@@ -2,6 +2,4 @@
public abstract class GdlVisibleObject extends GdlDescriptor{
// TODO: implement
-
- public abstract String getViewName();
}
Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/IGdlContainer.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/base/IGdlContainer.java Wed Jun 29 02:20:20 2011 (r527)
@@ -0,0 +1,7 @@
+package us.isidor.gdl.anaToMia.Widgets.base;
+
+import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException;
+
+public interface IGdlContainer {
+ public void append(GdlVisibleObject ancestor, GdlVisibleObject descendant) throws InvalidGdlSchemaException;
+}
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 Jun 28 09:18:45 2011 (r526)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Wed Jun 29 02:20:20 2011 (r527)
@@ -1,13 +1,27 @@
package us.isidor.gdl.anaToMia.Widgets.base;
import com.google.gwt.core.client.EntryPoint;
+import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.RootPanel;
-public class TestClass implements EntryPoint{
+public class TestClass implements EntryPoint{
+ HorizontalPanel mainPanel = new HorizontalPanel();
+ GdlPanel gdlPanel = null;
+
@Override
public void onModuleLoad() {
- Window.alert("TEST !!!");
+ Window.alert("TEST !!!");
+ RootPanel.get("GWT_Content").add(mainPanel);
+ mainPanel.setBorderWidth(1);
+ mainPanel.setPixelSize(500, 500);
+
+ gdlPanel = new GdlPanel("");
+ gdlPanel.setPixelSize(100, 100);
+ DOM.setStyleAttribute(gdlPanel.getElement(), "backgroundColor", "yellow");
+ mainPanel.add(gdlPanel);
}
}
Added: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/GdlError.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/environment/GdlError.java Wed Jun 29 02:20:20 2011 (r527)
@@ -0,0 +1,5 @@
+package us.isidor.gdl.anaToMia.Widgets.environment;
+
+public enum GdlError {
+
+}
Copied and modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/IGdlErrorHandler.java (from r526, branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/IWidgetClickHandler.java)
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/IWidgetClickHandler.java Tue Jun 28 09:18:45 2011 (r526, copy source)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/IGdlErrorHandler.java Wed Jun 29 02:20:20 2011 (r527)
@@ -1,7 +1,6 @@
package us.isidor.gdl.anaToMia.Widgets.environment;
-import com.google.gwt.event.dom.client.ClickEvent;
-public interface IWidgetClickHandler {
- public void onEvent(ClickEvent event, boolean success);
+public interface IGdlErrorHandler {
+ public void onError(GdlError errorType, Object errorInformation);
}
Copied and modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/IGdlEventHandler.java (from r526, branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/IWidgetEventHandler.java)
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/IWidgetEventHandler.java Tue Jun 28 09:18:45 2011 (r526, copy source)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/IGdlEventHandler.java Wed Jun 29 02:20:20 2011 (r527)
@@ -1,6 +1,6 @@
package us.isidor.gdl.anaToMia.Widgets.environment;
-public interface IWidgetEventHandler {
- public void onEvent(String message);
+public interface IGdlEventHandler {
+ public void onEvent(Object eventInformation);
}
Modified: branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlView.java
==============================================================================
--- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlView.java Tue Jun 28 09:18:45 2011 (r526)
+++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/views/GdlView.java Wed Jun 29 02:20:20 2011 (r527)
@@ -1,33 +1,39 @@
package us.isidor.gdl.anaToMia.Widgets.views;
+import com.google.gwt.core.client.JsArray;
+
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Name;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
+import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.TopicMap;
+import us.isidor.gdl.anaToMia.Widgets.base.GdlPsis;
import us.isidor.gdl.anaToMia.Widgets.base.GdlVisibleObject;
+import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException;
public abstract class GdlView extends GdlVisibleObject{
- // TODO: Implement => Default-Topic-View
+ private String viewName = "";
+ private TopicMap tm = null;
+ private Topic representative = null;
+ // TODO: implement
+
+
+ protected void init(TopicMap tm, Topic representative) throws InvalidGdlSchemaException {
+ this.tm = tm;
+ this.representative = representative;
+ JsArray<Name> viewNames = representative.getNames(tm.getTopicBySubjectIdentifier(tm.createLocator(GdlPsis.gdlViewName)));
+ if(viewNames.length() != 1){
+ throw new InvalidGdlSchemaException("A view must be bound to a gdl:view-name instance");
+ }
+
+ this.viewName = viewNames.get(0).getValue();
+ }
+
+
+ public String getViewName(){
+ return this.viewName;
+ }
- // on load (IWidgetEventHandler)
- // on commit (IWidgetClickHandler)
- // on validate (IWidgetClickHandler)
- // on delete (IWidgetClickHandler)
- // on error (IWidgetEventHandler)
-
- // set tm engine
- // on request
- // do request
- // do commit
- // do validate
- // do load
- // do delete
- // (partial) load GDL handler
- // (partial) commit GDL handler
- // (partial) delete GDL handler
-
- // request instance
- // request types
- // generate tmData
-
// hierarchy
More information about the Isidorus-cvs
mailing list