[isidorus-cvs] r1037 - in trunk/src/anaToMia/GDL_Widgets: src/us/isidor/gdl/anaToMia/Widgets src/us/isidor/gdl/anaToMia/Widgets/base src/us/isidor/gdl/anaToMia/Widgets/button war/gdl_widgets
lgiessmann at common-lisp.net
lgiessmann at common-lisp.net
Mon Nov 28 15:02:51 UTC 2011
Author: lgiessmann
Date: Mon Nov 28 07:02:47 2011
New Revision: 1037
Log:
gdl-frontend: Widgets: fixed a bug when collecting all topic instances of a particular type of a TM; implemented GdlRadioButton; added a test for GdlRadioButton
Modified:
trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt
trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPanel.java
trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java
trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObjectTmService.java
trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java
trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlCheckBox.java
trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlRadioButton.java
trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm
Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt
==============================================================================
--- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt Wed Nov 23 01:03:19 2011 (r1036)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/TODO.txt Mon Nov 28 07:02:47 2011 (r1037)
@@ -1,7 +1,7 @@
* test GdlCechkBox
* test GdlRadioButton
-* implement export of Fragments, e.g. exportJTM11Fragment(ArrayList<Topic> topics, ArrayList<Association> associaitions),
+* implement export of Fragments, e.g. exportJTM11Fragment(ArrayList<Topic> topics, ArrayList<Association> associations),
e.i. the passed topics and associations must be exported with all characteristics and associations,
and all referenced topics must be exported as stubs
* finalise GdlTopicView.getContent()
@@ -26,5 +26,4 @@
* finalise GdlDefaultCreatorTopicView
* finalise GdlDefaultEditorTopicView
* finalise GdlAssociationView.getContent()
-* inmplement GdlPanel.OnErrorHandler
-* Fix css-pseudo-class-handlers
\ No newline at end of file
+* finalise css-pseudo-class-handlers
\ No newline at end of file
Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPanel.java
==============================================================================
--- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPanel.java Wed Nov 23 01:03:19 2011 (r1036)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlPanel.java Mon Nov 28 07:02:47 2011 (r1037)
@@ -217,8 +217,7 @@
// view's validate method. After a successfully validate operation the
// onValidateHandlers are executed
public void doValidate() throws ExecutionException {
- if(tmEngine == null || requestedSchemaTm == null)
- throw new ExecutionException("No Topic Maps engine was set yet");
+ if(tmEngine == null || requestedSchemaTm == null) throw new ExecutionException("No Topic Maps engine was set yet");
// TODO: validate
// throw new InvalidContentException("The topic map content is not valid:\n" + tmEngine.exportTm(view.getContent()));
Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java
==============================================================================
--- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Wed Nov 23 01:03:19 2011 (r1036)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObject.java Mon Nov 28 07:02:47 2011 (r1037)
@@ -75,8 +75,8 @@
public abstract class GdlVisibleObject extends Composite implements GdlDescriptor, HasClickHandlers, HasMouseOutHandlers, HasMouseOverHandlers, HasFocusHandlers, HasMouseDownHandlers, HasMouseUpHandlers, HasBlurHandlers{
private GdlVisibleObject gdlParent = null;
- private GdlVisibleObjectCssService cssService = null;
- private GdlVisibleObjectTmService tmService = null;
+ protected GdlVisibleObjectCssService cssService = null;
+ protected GdlVisibleObjectTmService tmService = null;
protected AbsolutePanel mainPanel = new AbsolutePanel();
protected Panel containerPanel = null;
protected Topic tmRepresentative = null;
Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObjectTmService.java
==============================================================================
--- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObjectTmService.java Wed Nov 23 01:03:19 2011 (r1036)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/GdlVisibleObjectTmService.java Mon Nov 28 07:02:47 2011 (r1037)
@@ -690,4 +690,23 @@
}
contents.add(new Pair<Object, TopicMapsTypes>(owner, ownerType));
}
+
+
+ // returns an array list of strings that contains all possible values
+ public ArrayList<String> getAllPossibleValues() throws InvalidGdlSchemaException, ExecutionException {
+ ArrayList<String> result = new ArrayList<String>();
+ ArrayList<Topic> tmValues = this.getRawTmValues();
+ ArrayList<String> literalValues = this.getLiterals();
+
+
+ if(tmValues.size() != 0 || literalValues.size() != 0){
+ for (String literal : literalValues) result.add(literal);
+ for (Topic tmValue : tmValues) result.add(TmHelper.getTopicRepresentation(tmValue, this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup()));
+ } else {
+ ArrayList<Topic> tops = TmHelper.getTmValuesForConstraint(this.getConstraint(), this.getValueGroup());
+ for (Topic top : tops) result.add(TmHelper.getTopicRepresentation(top, this.getDisplayByOfValueGroup(), this.getPreferredScopeOfValueGroup()));
+ }
+
+ return result;
+ }
}
Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java
==============================================================================
--- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java Wed Nov 23 01:03:19 2011 (r1036)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/base/TmHelper.java Mon Nov 28 07:02:47 2011 (r1037)
@@ -1232,7 +1232,7 @@
throw new InvalidGdlSchemaException("the constraint " + getAnyIdOfTopic(rootConstraint) + " must be bound extactly once to an occurrence or name type, but is: " + typeTopics.size());
} else {
// add the direct specified type
- result.add(typeTopics.get(0));
+ //result.add(typeTopics.get(0));
// get subtypes of typeTopic
JsArray<Topic> allTopics = tm.getTopics();
@@ -1258,7 +1258,7 @@
throw new InvalidGdlSchemaException("the constraint " + getAnyIdOfTopic(variantNameReifierConstraint) + " must be bound extactly once to a topic type, but is: " + reifierTypeTopics.size());
} else {
// add the direct specified type
- result.add(reifierTypeTopics.get(0));
+ //result.add(reifierTypeTopics.get(0));
// get subtypes of typeTopic
JsArray<Topic> allTopics = tm.getTopics();
@@ -1283,7 +1283,7 @@
throw new InvalidGdlSchemaException("the constraint " + getAnyIdOfTopic(variantNameScopeConstraint) + " must be bound extactly once to a topic type, but is: " + scopeTypeTopics.size());
} else {
// add the direct specified type
- result.add(scopeTypeTopics.get(0));
+ //result.add(scopeTypeTopics.get(0));
// get subtypes of typeTopic
JsArray<Topic> allTopics = tm.getTopics();
Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlCheckBox.java
==============================================================================
--- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlCheckBox.java Wed Nov 23 01:03:19 2011 (r1036)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlCheckBox.java Mon Nov 28 07:02:47 2011 (r1037)
@@ -3,9 +3,10 @@
import java.util.ArrayList;
import com.google.gwt.user.client.ui.CheckBox;
-
+import com.google.gwt.user.client.ui.Widget;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
+import us.isidor.gdl.anaToMia.Widgets.base.ButtonableObject;
import us.isidor.gdl.anaToMia.Widgets.base.GdlVisibleObject;
import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException;
import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException;
@@ -20,15 +21,15 @@
public GdlCheckBox(Topic tmRepresentative, Construct receivedData, GdlVisibleObject gdlParent) throws InvalidGdlSchemaException, ExecutionException{
super(tmRepresentative, receivedData, gdlParent);
// TODO: create a check box for each tm construct
- this.createcheckBox().setText("Check Box 1");
- this.createcheckBox().setText("Check Box 2");
- this.createcheckBox().setText("Check Box 3");
+ this.createCheckBox().setText("Check Box 1");
+ this.createCheckBox().setText("Check Box 2");
+ this.createCheckBox().setText("Check Box 3");
this.setNthButtons();
}
- public CheckBox createcheckBox() throws InvalidGdlSchemaException, ExecutionException{
+ public CheckBox createCheckBox() throws InvalidGdlSchemaException, ExecutionException{
CheckBox cb = new CheckBox();
cb.setName(this.getGroupName());
this.addToContainerPanel(cb);
@@ -52,6 +53,13 @@
@Override
public void fixValue(){
- // TODO: implement
+ for (Widget elem : this.subElements) {
+ ButtonableObject bo = (ButtonableObject)elem;
+ Widget wdgt = bo.getMainObject();
+ if(wdgt instanceof CheckBox){
+ CheckBox cb = (CheckBox)wdgt;
+ cb.setEnabled(false);
+ }
+ }
}
}
Modified: trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlRadioButton.java
==============================================================================
--- trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlRadioButton.java Wed Nov 23 01:03:19 2011 (r1036)
+++ trunk/src/anaToMia/GDL_Widgets/src/us/isidor/gdl/anaToMia/Widgets/button/GdlRadioButton.java Mon Nov 28 07:02:47 2011 (r1037)
@@ -2,11 +2,11 @@
import java.util.ArrayList;
-
import com.google.gwt.user.client.ui.RadioButton;
-
+import com.google.gwt.user.client.ui.Widget;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Construct;
import us.isidor.gdl.anaToMia.TopicMaps.TopicMapsModel.Topic;
+import us.isidor.gdl.anaToMia.Widgets.base.ButtonableObject;
import us.isidor.gdl.anaToMia.Widgets.base.GdlVisibleObject;
import us.isidor.gdl.anaToMia.Widgets.environment.ExecutionException;
import us.isidor.gdl.anaToMia.Widgets.environment.InvalidGdlSchemaException;
@@ -20,10 +20,10 @@
public GdlRadioButton(Topic tmRepresentative, Construct receivedData, GdlVisibleObject gdlParent) throws InvalidGdlSchemaException, ExecutionException{
super(tmRepresentative, receivedData, gdlParent);
- // TODO: create a radio button for each tm construct
- this.createRadioButton().setText("Radio Button 1");
- this.createRadioButton().setText("Radio Button 2");
- this.createRadioButton().setText("Radio Button 3");
+
+ if(receivedData != null && this.getConstraint() != null) this.setReceivedData();
+ else this.setDefaultValue();
+
this.setNthButtons();
}
@@ -38,19 +38,48 @@
@Override
public void addSubItem(String value) throws InvalidGdlSchemaException, ExecutionException {
- // TODO: implement
+ RadioButton rb = this.createRadioButton();
+ rb.setText(value);
+ rb.setValue(true);
+ }
+
+ public void addUncheckedSubItem(String value) throws InvalidGdlSchemaException, ExecutionException {
+ this.createRadioButton().setText(value);
+ }
+
+
+ @Override
+ protected void setReceivedData() throws InvalidGdlSchemaException, ExecutionException {
+ super.setReceivedData();
+ ArrayList<String> options = this.tmService.getAllPossibleValues();
+
+ for (String opt : options) this.addUncheckedSubItem(opt);
}
@Override
public ArrayList<String> getSelectedValues(){
- // TODO: implement
- return new ArrayList<String>();
+ ArrayList<String> result = new ArrayList<String>();
+
+ for (Widget elem : this.subElements) {
+ ButtonableObject bo = (ButtonableObject)elem;
+ Widget wdgt = bo.getMainObject();
+ if((wdgt instanceof RadioButton) && ((RadioButton)wdgt).getValue()) result.add(((RadioButton)wdgt).getText());
+ }
+
+ return result;
}
@Override
public void fixValue(){
- // TODO: implement
+ for (Widget elem : this.subElements) {
+ ButtonableObject bo = (ButtonableObject)elem;
+ Widget wdgt = bo.getMainObject();
+ if(wdgt instanceof RadioButton){
+ RadioButton rb = (RadioButton)wdgt;
+ rb.setEnabled(false);
+ }
+ }
}
}
Modified: trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm
==============================================================================
--- trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm Wed Nov 23 01:03:19 2011 (r1036)
+++ trunk/src/anaToMia/GDL_Widgets/war/gdl_widgets/Service_GDL_Schema.jtm Mon Nov 28 07:02:47 2011 (r1037)
@@ -171,6 +171,9 @@
{"subject_identifiers":["[gdlt:Button]"]},
{"subject_identifiers":["[gdlt:Action-Button]"]},
{"subject_identifiers":["[gdlt:Commit-Button]"]},
+ {"subject_identifiers":["[gdlt:Input-Button]"]},
+ {"subject_identifiers":["[gdlt:Check-Box]"]},
+ {"subject_identifiers":["[gdlt:Radio-Button]"]},
{"subject_identifiers":["[gdlsrv:service-schema]"], "instance_of":["si:[gdlt:Schema]"], "names":[{"type":"si:[gdl:schema-name]", "value":"GDL Schema for a Service UI"}]},
{"subject_identifiers":["[gdlsrv:service-default-editor-topic-view]"], "instance_of":["si:[gdlt:Default-Editor-Topic-View]"], "names":[{"type":"si:[gdl:view-name]", "value":"GDL Default Editor Topic View for instances of http://services.org/serviceregistry/model/types/Service"}], "occurrences":[{"type":"si:[gdl:id]", "value":"service_default_editor_topic_view_id"}, {"type":"si:[gdl:width]", "value":"552px"}, {"type":"si:[gdl:height]", "value":"800px"},{"type":"si:[gdl:background-color]", "value":"gray"}]},
@@ -228,7 +231,7 @@
{"subject_identifiers":["[gdlsrv:service-variant-name-iis-text-value-group]"], "instance_of":["si:[gdlt:Value-Group]"]},
{"subject_identifiers":["[model:service-variant-name-ii-constraint]"], "instance_of":["si:[gdlt:Variant-Name-Identifiers]"]},
- {"subject_identifiers":["[gdlsrv:service-variant-name-reifier-text]"], "instance_of":["si:[gdlt:Text]"], "occurrences":[{"type":"si:[gdl:id]", "value":"service_variant_name_reifier_text_id"}, {"type":"si:[gdl:readonly]", "value":"false"}, {"type":"si:[gdl:width]", "value":"470px"},{"type":"si:[gdl:cursor]", "value":"text"}]},
+ {"subject_identifiers":["[gdlsrv:service-variant-name-reifier-text]"], "instance_of":["si:[gdlt:Radio-Button]"], "occurrences":[{"type":"si:[gdl:id]", "value":"service_variant_name_reifier_text_id"}]},
{"subject_identifiers":["[gdlsrv:service-variant-name-reifier-text-position]"], "instance_of":["si:[gdlt:Position]"], "occurrences":[{"type":"si:[gdl:position-style]", "value":"absolute"}, {"type":"si:[gdl:top]", "value":"490px"}, {"type":"si:[gdl:left]", "value":"10px"}]},
{"subject_identifiers":["[gdlsrv:service-variant-name-reifier-text-value-group]"], "instance_of":["si:[gdlt:Value-Group]"]},
{"subject_identifiers":["[model:service-variant-name-reifier-constraint]"], "instance_of":["si:[gdlt:Variant-Name-Reifier]"]},
@@ -300,6 +303,9 @@
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdlt:Text-Object]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdlt:Button]"}]},
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdlt:Button]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdlt:Action-Button]"}]},
{"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdlt:Action-Button]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdlt:Commit-Button]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdlt:Button]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdlt:Input-Button]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdlt:Input-Button]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdlt:Radio-Button]"}]},
+ {"type":"si:[tmdm:supertype-subtype]", "roles":[{"type":"si:[tmdm:supertype]", "player":"si:[gdlt:Input-Button]"},{"type":"si:[tmdm:subtype]", "player":"si:[gdlt:Check-Box]"}]},
{"type":"si:[tmcl:constrained-topic-type]", "roles":[{"type":"si:[tmcl:constraint]", "player":"si:[model:service-psi-constraint]"},{"type":"si:[tmcl:constrained]", "player":"si:[types:Service]"}]},
More information about the Isidorus-cvs
mailing list