]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc/class/org/argeo/slc/ria/execution/SpecEditor.js
git-svn-id: https://svn.argeo.org/slc/trunk@2380 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc
[gpl/argeo-slc.git] / org.argeo.slc.webapp / src / main / webapp / argeo-ria-lib / slc / class / org / argeo / slc / ria / execution / SpecEditor.js
index d4b6217813db178876a315580af748ac8ed86e63..6d8683989e76c9b4ecba346b5ce748c773d5959f 100644 (file)
@@ -8,6 +8,9 @@ qx.Class.define("org.argeo.slc.ria.execution.SpecEditor",
        extend : qx.ui.window.Window,\r
   \r
        properties : {\r
+               /**\r
+                * The Spec to edit\r
+                */\r
                batchEntrySpec : {\r
                        check : "org.argeo.slc.ria.execution.BatchEntrySpec"\r
                }\r
@@ -18,14 +21,15 @@ qx.Class.define("org.argeo.slc.ria.execution.SpecEditor",
                 * Triggered when the user clicks the "save" button. \r
                 */\r
                "save" : "qx.event.type.Event",\r
+               /**\r
+                * Triggered when any data is modified\r
+                */\r
                "modified" : "qx.event.type.Event"\r
 \r
        },\r
        /**\r
-        * \r
-        * @param caption {String} Title of the window\r
-        * @param icon {String} Icon of the window\r
-        * @param text {String} Default content of the window.\r
+        * Opens an editor with the given values. \r
+        * @param batchEntrySpec {org.argeo.slc.ria.execution.BatchEntrySpec} The initial spec to edit\r
         */\r
        construct : function(batchEntrySpec){\r
                var editorLabel = "Edit Specs for "+batchEntrySpec.getLabel();\r
@@ -51,6 +55,9 @@ qx.Class.define("org.argeo.slc.ria.execution.SpecEditor",
        },\r
        \r
        members : {\r
+               /**\r
+                * Builds the form from the BatchEntrySpec\r
+                */\r
                createFormFromSpec : function(){\r
                        var values = this.getBatchEntrySpec().getValues();\r
                        for(var key in values){\r
@@ -66,7 +73,9 @@ qx.Class.define("org.argeo.slc.ria.execution.SpecEditor",
                                }\r
                        }\r
                },\r
-               \r
+               /**\r
+                * Gather data from the form\r
+                */\r
                saveFormToSpec : function(){\r
                        var values = this.getBatchEntrySpec().getValues();\r
                        for(var key in values){\r
@@ -117,6 +126,8 @@ qx.Class.define("org.argeo.slc.ria.execution.SpecEditor",
                 * @param fieldLabel {String} Label of the field\r
                 * @param defaultValue {String} The default value\r
                 * @param choiceValues {Map} An map of values\r
+                * @param disabled {Boolean} The field is not writable\r
+                * @param subType {String} The type expected (string, integer, etc).\r
                 */\r
                _addFormInputText : function(formObject, fieldName, fieldLabel, defaultValue, disabled, subType, choiceValues){\r
                        var labelElement;\r
@@ -221,8 +232,16 @@ qx.Class.define("org.argeo.slc.ria.execution.SpecEditor",
                        }, this);\r
                        this.cancelButton = new qx.ui.form.Button("Close");\r
                        this.cancelButton.addListener("execute", this._closeAndDestroy, this);\r
+\r
+                       this.saveCloseButton = new qx.ui.form.Button("Save & Close");\r
+                       this.saveCloseButton.addListener("execute", function(e){\r
+                               this.fireEvent("save");\r
+                               this._closeAndDestroy();\r
+                       }, this);\r
+                       \r
                        buttonPane.add(this.okButton);\r
                        buttonPane.add(this.cancelButton);\r
+                       buttonPane.add(this.saveCloseButton);\r
                },\r
                /**\r
                 * Close this modal window and destroy it.\r