Author: lgiessmann Date: Mon Jun 27 05:57:38 2011 New Revision: 513
Log: gdl-frontend: Topic Maps Model: fixed a bug in tm.js => Topic.createOccurrence(...); fixed a bug in tm.js => Name.createVariant(...); added the class DatatypeAwareStub, that holds the URIs of the xsd:string and xsd:anyUri datatype
Added: branches/gdl-frontend/src/anaToMia/GDL_TopicMaps_Model/src/us/isidor/gdl/anaToMia/TopicMaps/TopicMapsModel/DatatypeAwareStub.java Modified: branches/gdl-frontend/src/anaToMia/GDL_TopicMaps_Model/src/us/isidor/gdl/anaToMia/TopicMaps/TopicMapsModel/Name.java branches/gdl-frontend/src/anaToMia/GDL_TopicMaps_Model/src/us/isidor/gdl/anaToMia/TopicMaps/TopicMapsModel/Topic.java
Added: branches/gdl-frontend/src/anaToMia/GDL_TopicMaps_Model/src/us/isidor/gdl/anaToMia/TopicMaps/TopicMapsModel/DatatypeAwareStub.java ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ branches/gdl-frontend/src/anaToMia/GDL_TopicMaps_Model/src/us/isidor/gdl/anaToMia/TopicMaps/TopicMapsModel/DatatypeAwareStub.java Mon Jun 27 05:57:38 2011 (r513) @@ -0,0 +1,78 @@ +package us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel; +import com.google.gwt.core.client.JavaScriptObject; +import com.google.gwt.core.client.JsArray; + + + +public class DatatypeAwareStub extends JavaScriptObject implements DatatypeAware { + public final static String xsdString = "http://www.w3.org/2001/XMLSchema#string"; + public final static String xsdUri = "http://www.w3.org/2001/XMLSchema#anyUri"; + + + protected DatatypeAwareStub() {} + + + public final native void addTheme(Topic theme) /*-{ + this.addTheme(theme); + }-*/; + + + public final native void removeTheme(Topic theme) /*-{ + this.removeTheme(theme); + }-*/; + + + public final native JsArray<Topic> getScope() /*-{ + return this.getScope(); + }-*/; + + + public final native String getId() /*-{ + return this.getId() + ""; + }-*/; + + + public final native void addItemIdentifier(Locator itemIdentifier) /*-{ + this.addItemIdentifier(itemIdentifier); + }-*/; + + + public final native JsArray<Locator> getItemIdentifiers() /*-{ + return this.getItemIdentifiers(); + }-*/; + + + public final native Construct getParent() /*-{ + return this.getParent(); + }-*/; + + + public final native TopicMap getTopicMap() /*-{ + return this.getTopicMap(); + }-*/; + + + public final native void remove() /*-{ + this.remove(); + }-*/; + + + public final native void removeItemIdentifier(Locator itemIdentifier) /*-{ + this.removeItemIdentifier(itemIdentifier); + }-*/; + + + public final native Topic getReifier() /*-{ + return this.getReifier(); + }-*/; + + + public final native void setReifier(Topic reifier) /*-{ + this.setReifier(reifier); + }-*/; + + + public final TopicMapsTypes classType(){ + return TopicMapsTypes.DatatypeAware; + } +}
Modified: branches/gdl-frontend/src/anaToMia/GDL_TopicMaps_Model/src/us/isidor/gdl/anaToMia/TopicMaps/TopicMapsModel/Name.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_TopicMaps_Model/src/us/isidor/gdl/anaToMia/TopicMaps/TopicMapsModel/Name.java Mon Jun 27 05:20:08 2011 (r512) +++ branches/gdl-frontend/src/anaToMia/GDL_TopicMaps_Model/src/us/isidor/gdl/anaToMia/TopicMaps/TopicMapsModel/Name.java Mon Jun 27 05:57:38 2011 (r513) @@ -4,17 +4,22 @@ import com.google.gwt.core.client.JsArray;
public class Name extends JavaScriptObject implements Scoped, Reifiable, Typed{ + public final static String defaultNameTypePsi = "http://psi.topicmaps.org/iso13250/model/topic-name"; + + protected Name() {} - public final native Variant createVariant(Locator value, JsArray<Topic> scope) /*-{ - return this.createVariant(value, scope); - }-*/; + public final Variant createVariant(Locator value, JsArray<Topic> scope) { + TopicMap tm = getTopicMap(); + return this.createVariant(value.getReference(), tm.createLocator(DatatypeAwareStub.xsdUri), scope); + } - public final native Variant createVariant(String value, JsArray<Topic> scope) /*-{ - return this.createVariant(value, scope); - }-*/; + public final Variant createVariant(String value, JsArray<Topic> scope) { + TopicMap tm = getTopicMap(); + return this.createVariant(value, tm.createLocator(DatatypeAwareStub.xsdString), scope); + } public final native Variant createVariant(String value, Locator datatype, JsArray<Topic> scope) /*-{
Modified: branches/gdl-frontend/src/anaToMia/GDL_TopicMaps_Model/src/us/isidor/gdl/anaToMia/TopicMaps/TopicMapsModel/Topic.java ============================================================================== --- branches/gdl-frontend/src/anaToMia/GDL_TopicMaps_Model/src/us/isidor/gdl/anaToMia/TopicMaps/TopicMapsModel/Topic.java Mon Jun 27 05:20:08 2011 (r512) +++ branches/gdl-frontend/src/anaToMia/GDL_TopicMaps_Model/src/us/isidor/gdl/anaToMia/TopicMaps/TopicMapsModel/Topic.java Mon Jun 27 05:57:38 2011 (r513) @@ -5,9 +5,6 @@
public class Topic extends JavaScriptObject implements Construct{ - private static String defaultNameTypePsi = "http://psi.topicmaps.org/iso13250/model/topic-name"; - - protected Topic() {}
@@ -28,7 +25,7 @@ public final Name createName(String value, JsArray<Topic> scope){ TopicMap tm = this.getTopicMap(); - Topic defaultNameType = tm.createTopicBySubjectIdentifier(tm.createLocator(defaultNameTypePsi)); + Topic defaultNameType = tm.createTopicBySubjectIdentifier(tm.createLocator(Name.defaultNameTypePsi)); return this.createName(value, defaultNameType, scope); } @@ -38,14 +35,16 @@ }-*/; - public final native Occurrence createOccurrence(Topic type, Locator value, JsArray<Topic> scope) /*-{ - return this.createOccurrence(type, value, scope); - }-*/; + public final Occurrence createOccurrence(Topic type, Locator value, JsArray<Topic> scope) { + TopicMap tm = getTopicMap(); + return createOccurrence(type, value.getReference(), tm.createLocator(DatatypeAwareStub.xsdUri), scope); + } - public final native Occurrence createOccurrence(Topic type, String value, JsArray<Topic> scope) /*-{ - return this.createOccurrence(type, value, scope); - }-*/; + public final Occurrence createOccurrence(Topic type, String value, JsArray<Topic> scope) { + TopicMap tm = getTopicMap(); + return createOccurrence(type, value, tm.createLocator(DatatypeAwareStub.xsdString), scope); + } public final native Occurrence createOccurrence(Topic type, String value, Locator datatype, JsArray<Topic> scope) /*-{