X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;ds=sidebyside;f=org.argeo.slc.webapp%2Fsrc%2Fmain%2Fwebapp%2Fargeo-ria-lib%2Fslc%2Fclass%2Forg%2Fargeo%2Fslc%2Fria%2Fexecution%2FSpecEditor.js;h=6d8683989e76c9b4ecba346b5ce748c773d5959f;hb=68ed7317e5fefb71258b552c1fb2ccd1c1f8cbc5;hp=d4b6217813db178876a315580af748ac8ed86e63;hpb=6ae24373b4153f19984831a5f456c18f763bf279;p=gpl%2Fargeo-slc.git diff --git a/org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/SpecEditor.js b/org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/SpecEditor.js index d4b621781..6d8683989 100644 --- a/org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/SpecEditor.js +++ b/org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/SpecEditor.js @@ -8,6 +8,9 @@ qx.Class.define("org.argeo.slc.ria.execution.SpecEditor", extend : qx.ui.window.Window, properties : { + /** + * The Spec to edit + */ batchEntrySpec : { check : "org.argeo.slc.ria.execution.BatchEntrySpec" } @@ -18,14 +21,15 @@ qx.Class.define("org.argeo.slc.ria.execution.SpecEditor", * Triggered when the user clicks the "save" button. */ "save" : "qx.event.type.Event", + /** + * Triggered when any data is modified + */ "modified" : "qx.event.type.Event" }, /** - * - * @param caption {String} Title of the window - * @param icon {String} Icon of the window - * @param text {String} Default content of the window. + * Opens an editor with the given values. + * @param batchEntrySpec {org.argeo.slc.ria.execution.BatchEntrySpec} The initial spec to edit */ construct : function(batchEntrySpec){ var editorLabel = "Edit Specs for "+batchEntrySpec.getLabel(); @@ -51,6 +55,9 @@ qx.Class.define("org.argeo.slc.ria.execution.SpecEditor", }, members : { + /** + * Builds the form from the BatchEntrySpec + */ createFormFromSpec : function(){ var values = this.getBatchEntrySpec().getValues(); for(var key in values){ @@ -66,7 +73,9 @@ qx.Class.define("org.argeo.slc.ria.execution.SpecEditor", } } }, - + /** + * Gather data from the form + */ saveFormToSpec : function(){ var values = this.getBatchEntrySpec().getValues(); for(var key in values){ @@ -117,6 +126,8 @@ qx.Class.define("org.argeo.slc.ria.execution.SpecEditor", * @param fieldLabel {String} Label of the field * @param defaultValue {String} The default value * @param choiceValues {Map} An map of values + * @param disabled {Boolean} The field is not writable + * @param subType {String} The type expected (string, integer, etc). */ _addFormInputText : function(formObject, fieldName, fieldLabel, defaultValue, disabled, subType, choiceValues){ var labelElement; @@ -221,8 +232,16 @@ qx.Class.define("org.argeo.slc.ria.execution.SpecEditor", }, this); this.cancelButton = new qx.ui.form.Button("Close"); this.cancelButton.addListener("execute", this._closeAndDestroy, this); + + this.saveCloseButton = new qx.ui.form.Button("Save & Close"); + this.saveCloseButton.addListener("execute", function(e){ + this.fireEvent("save"); + this._closeAndDestroy(); + }, this); + buttonPane.add(this.okButton); buttonPane.add(this.cancelButton); + buttonPane.add(this.saveCloseButton); }, /** * Close this modal window and destroy it.