Author: lgiessmann Date: Wed Aug 17 04:27:45 2011 New Revision: 746
Log: gdl-frontend: Widgets: fixed some bugs when consuming Topic Maps data
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/TmHelper.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/view/GdlView.java
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 Aug 17 03:19:14 2011 (r745) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TestClass.java Wed Aug 17 04:27:45 2011 (r746) @@ -27,18 +27,19 @@ 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/Hash-Object", TopicIdentifierTypes.SubjectIdentifier)); //requestedTopicsToCreate.add(new Pair<String, TopicIdentifierTypes>("http://textgrid.org/serviceregistry/model/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/test-environment", TopicIdentifierTypes.SubjectIdentifier); + //Pair<String, TopicIdentifierTypes> requestedTopicToEdit = new Pair<String, TopicIdentifierTypes>("http://textgrid.org/serviceregistry/model/test-environment", 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, requestedTopicsToCreate); + 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/base/TmHelper.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java Wed Aug 17 03:19:14 2011 (r745) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java Wed Aug 17 04:27:45 2011 (r746) @@ -110,7 +110,7 @@ // returns true if the topic instance if an instance of the topic type public static boolean isInstanceOf(Topic instance, Topic type){ if(instance == null || (instance.getTypes().length() != 0 && type == null)) return false; - if(instance.getTypes().length() == 0 && type == null) return true; + if(instance.getTypes().length() == 0 && type == null) return false; // type must be always set!
JsArray<Topic> types = instance.getTypes(); for(int i = 0; i != types.length(); ++i){ @@ -317,7 +317,7 @@ Topic containerRoleType = getTopicByPsi(PSIs.RoleType.gdlContainer, tm); Topic visibleObject = getTopicByPsi(PSIs.TopicType.gdlVisibleObject, tm); Topic containeeRoleType = getTopicByPsi(PSIs.RoleType.gdlContainee, tm); - + return getOtherPlayerOfBinaryAssociation(container, containerRoleType, containsAssocType, null, visibleObject, containeeRoleType); }
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 Wed Aug 17 03:19:14 2011 (r745) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/environment/GdlInstantiator.java Wed Aug 17 04:27:45 2011 (r746) @@ -94,18 +94,18 @@ }else if(TmHelper.isInstanceOf(tmRepresentative, PSIs.TopicType.gdlDefaultCreatorTopicView)){ return new GdlDefaultCreatorTopicView(tmRepresentative); }else if(TmHelper.isInstanceOf(tmRepresentative, PSIs.TopicType.gdlDefaultEditorTopicView)){ - if(!(receivedData instanceof Topic)) throw new ExecutionException("receivedData must be of type Topic when used with " + PSIs.TopicType.gdlDefaultEditorTopicView); + 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)){ return new GdlSpecialCreatorTopicView(tmRepresentative); }else if(TmHelper.isInstanceOf(tmRepresentative, PSIs.TopicType.gdlSpecialEditorTopicView)){ - if(!(receivedData instanceof Topic)) throw new ExecutionException("receivedData must be of type Topic when used with " + 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)) throw new ExecutionException("receivedData must be of type Association when used with " + 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); }else if(TmHelper.isInstanceOf(tmRepresentative, PSIs.TopicType.gdlEditorAssociationView)){ - if(!(receivedData instanceof Topic)) throw new ExecutionException("receivedData must be of type Associaiton when used with " + 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); }else{ String values = "";
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 Aug 17 03:19:14 2011 (r745) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/isidorus/LoadSchemaCallback.java Wed Aug 17 04:27:45 2011 (r746) @@ -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_GDL_Edit_Environment.jtm"); //"test.gdl.jtm"); // TODO: replace with the correct URL + private final String isidorusUrl = URL.encode(GWT.getModuleBaseURL() + "TextGrid_GDL_Create_HashObject.jtm"); //"test.gdl.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/view/GdlView.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlView.java Wed Aug 17 03:19:14 2011 (r745) +++ branches/gdl-frontend/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/view/GdlView.java Wed Aug 17 04:27:45 2011 (r746) @@ -3,7 +3,6 @@ import java.util.ArrayList; import com.google.gwt.core.client.JsArray; import com.google.gwt.user.client.ui.Widget; - import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Name; import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;