check:"org.argeo.ria.components.ViewSelection"
},
instanceId : {init:""},
- instanceLabel : {init:""},
+ instanceLabel : {init:""},
+ /**
+ * A boolean registering whether the SpecEditor must autoOpen or not when a spec is added to the Batch.
+ */
autoOpen : {
init : true,
check : "Boolean"
},
statics : {
+ /**
+ * Loader for the "flow" level : takes a folder containing "moduleData" and create its children.
+ * @param folder {qx.ui.tree.TreeFolder} A Tree folder containing in the key "moduleData" of its user data a map containing the keys {name,version}
+ */
flowLoader : function(folder){
var moduleData = folder.getUserData("moduleData");
//var req = org.argeo.ria.remote.RequestManager.getInstance().getRequest("../argeo-ria-src/stub.xml", "GET", "application/xml");
req.send();
},
+ /**
+ * Loader for the "modules" level : takes any tree folder, currently the root folder.
+ * @param folder {qx.ui.tree.TreeFolder} The root folder
+ */
modulesLoader : function(folder){
var req = org.argeo.slc.ria.SlcApi.getListModulesService();
req.addListener("completed", function(response){
splitPane.add(this.tree, 0);
splitPane.add(this.listPane, 1);
},
-
+
+ /**
+ * Adds a given ExecutionFlow to the batch
+ * @param target {mixed} The dropped target, can be a TreeFile (add) or a ListItem (reorder).
+ * @param after {qx.ui.form.ListItem} Optional list item : if set, the flow will be added as a new list item positionned after this one.
+ */
_addFlowToBatch : function(target, after){
//this.debug(target);
if(!target){
if(menu.length) command.setEnabled(true);
},
+ /**
+ * Create XMLString to send for execution
+ * @return {String}
+ */
currentBatchToXml : function(){
var selection = this.list.getChildren();
var xmlString = "";
return xmlString;
},
+ /**
+ * Called at execution
+ * @param agentUuid {String} The id of the target agent
+ */
executeBatchOnAgent : function(agentUuid){
//var xmlString = agentUuid + this.currentBatchToXml();
var xmlString = "<slc:executionSpecs>"+this.currentBatchToXml()+"</slc:executionSpecs>";
extend : org.argeo.slc.ria.execution.Spec,\r
\r
properties : {\r
+ /**\r
+ * Reference module\r
+ */\r
module :{},\r
+ /**\r
+ * Reference flow\r
+ */\r
flow : {},\r
+ /**\r
+ * Original Spec (values shall stay untouched).\r
+ */\r
originalSpec : {} \r
},\r
\r
+ /**\r
+ * Instance of BatchEntrySpec\r
+ * @param module {org.argeo.slc.ria.execution.Module} Reference module\r
+ * @param flow {org.argeo.slc.ria.execution.Flow} Reference flow\r
+ */\r
construct : function(module, flow){\r
this.base(arguments);\r
this.setModule(module);\r
},\r
\r
members : {\r
- \r
+ /**\r
+ * Create a label to display in the batch list.\r
+ * @return {String} The label\r
+ */\r
getLabel : function(){\r
var label = this.getModule().getName();\r
label += "/" + this.getModule().getVersion();\r
executionSpec : {\r
check : "org.argeo.slc.ria.execution.Spec"\r
},\r
+ /**\r
+ * The values to init the ExecutionSpec\r
+ */\r
values : {\r
check : "Node"\r
},\r
},\r
\r
statics : {\r
+ /**\r
+ * Xpath to the name \r
+ */\r
XPATH_NAME : "@name",\r
+ /**\r
+ * XPath to the ExecutionSpec name\r
+ */\r
XPATH_EXEC_SPEC_NAME : "@executionSpec",\r
+ /**\r
+ * XPath to the values\r
+ */\r
XPATH_VALUES : "slc:values"\r
},\r
\r
var values = org.argeo.ria.util.Element.selectNodes(xmlNode, this.self(arguments).XPATH_VALUES);\r
this.setValues(values[0]);\r
},\r
+ /**\r
+ * Get a given value inside the values map\r
+ * @param key {String} The key of the value \r
+ * @param specType {String} Expected type (currently "primitive" and "ref" are supported)\r
+ * @param specSubType {String} Expected subtype (depends on the type)\r
+ * @return {String} Value if it is set.\r
+ */\r
getValue: function(key, specType, specSubType){\r
var xpath;\r
if(specType == "primitive"){\r
members : {\r
/**\r
* Add an execution flow to this module\r
- * @param executionFlow {org.argeo.slc.ria.execution.Flow}\r
+ * @param executionFlow {org.argeo.slc.ria.execution.Flow} An instance of execution.Flow\r
*/\r
addExecutionFlow : function(executionFlow){\r
var spec = this.getExecutionSpecByName(executionFlow.getExecutionSpecName());\r
\r
/**\r
* Add an execution Spec to this module\r
- * @param executionSpec {org.argeo.slc.ria.execution.Spec}\r
+ * @param executionSpec {org.argeo.slc.ria.execution.Spec} An instance of ExecutionSpec\r
*/\r
addExecutionSpec : function(executionSpec){\r
this.getExecutionSpecs()[executionSpec.getName()] = executionSpec;\r
},\r
- \r
+ /**\r
+ * Find an execution spec by its name\r
+ * @param name {String} Name of the spec\r
+ * @return {org.argeo.slc.ria.execution.Spec} The spec\r
+ */\r
getExecutionSpecByName : function(name){\r
return this.getExecutionSpecs()[name];\r
},\r
\r
+ /**\r
+ * Find an execution flow by its name\r
+ * @param name {String} name of the flow\r
+ * @return {org.argeo.slc.ria.execution.Flow} The flow\r
+ */\r
getExecutionFlowByName : function(name){\r
return this.getExecutionFlows()[name];\r
},\r
}\r
this.setValues(parsedValues);\r
},\r
+ /**\r
+ * XML Representation of this object.\r
+ * @return {String} An XML String\r
+ */\r
toXml : function(){\r
var valuesXml = '';\r
var values = this.getValues();\r
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
* 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
},\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
}\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
* @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
check : "String",\r
init : ""\r
},\r
+ /**\r
+ * The type of this value, for the moment "primitive" and "ref" are supported \r
+ */\r
specType : {\r
check : "String",\r
init : "" \r
},\r
+ /**\r
+ * Subtype, depending on the "type". \r
+ */\r
specSubType : {\r
check : "String"\r
},\r
+ /**\r
+ * Whether it is a parameter or not \r
+ */\r
parameter : {\r
check : "Boolean"\r
},\r
+ /**\r
+ * Whether it is frozen on the server, i.e. disabled in the form \r
+ */\r
frozen : {\r
check : "Boolean"\r
},\r
+ /**\r
+ * Should not be editable nor seeable, thus hidden \r
+ */\r
hidden : {\r
check : "Boolean"\r
},\r
+ /**\r
+ * The real value \r
+ */\r
value : {\r
nullable : true\r
},\r
}\r
},\r
\r
+ /**\r
+ * Apply the value from the node\r
+ * @param xmlNode {Node} Castor representation of this object\r
+ */\r
_applyXmlValue : function(xmlNode){\r
var xpath;\r
if(this.getSpecType() == "primitive"){\r
this.setValue(org.argeo.ria.util.Element.getSingleNodeText(xmlNode, xpath));\r
},\r
\r
+ /**\r
+ * Create an XML Representation of this value\r
+ * @return {String} The XML String\r
+ */\r
toXml : function(){\r
var valueTag = '<slc:value>'+this.getValue()+'</slc:value>';\r
var specAttribute = '';\r
extend : qx.ui.tree.TreeFolder,\r
\r
properties : {\r
+ /**\r
+ * The current state of the folder, usually "empty" => "loading" => "loaded"\r
+ */\r
"state" : {\r
check : "String",\r
init : "empty",\r
apply : "_applyState"\r
},\r
+ /**\r
+ * String to display as a child node during loading\r
+ */\r
"loadingString" : {\r
check : "String",\r
init : "Loading..."\r
},\r
+ /**\r
+ * Function that will load the children of this folder\r
+ */\r
"loader" : {\r
check : "Function",\r
init : function(treeFolder){treeFolder.setLoaded();}\r
},\r
+ /**\r
+ * Optionnal data describing the "drag" behaviour of the created children.\r
+ * First level is "file" or "folder", and for each of them, supported keys are "type" and "action". \r
+ */\r
"dragData": {\r
check : "Map",\r
init : {}\r
}\r
},\r
\r
+ /**\r
+ * Creates a new instance of DynamicTreeFolder\r
+ * @param label {String} Label of the folder\r
+ * @param loader {Function} Function that will load the children \r
+ * @param loadingString {String} String to display as a child node during loading\r
+ * @param dragData {Map} Optionnal data describing the "drag" behaviour of the created children.\r
+ */\r
construct : function(label, loader, loadingString, dragData){\r
this.base(arguments, label);\r
if(loader) this.setLoader(loader);\r
},\r
\r
members : {\r
- \r
+ /**\r
+ * Add an item to the folder \r
+ * @param varargs {Mixed} One or many children to add\r
+ */\r
add : function(varargs){\r
this.base(arguments, varargs);\r
for (var i=0, l=arguments.length; i<l; i++)\r
}\r
},\r
\r
+ /**\r
+ * If there is dragData set, init the drag behaviour of a child\r
+ * @param treeItem {qx.ui.tree.AbstractTreeItem} Newly created child\r
+ */\r
appendDragData : function(treeItem){\r
var dragData = this.getDragData();\r
var nodeTypeDetected = false;\r
\r
},\r
\r
+ /**\r
+ * Set the state to "loaded"\r
+ */\r
setLoaded : function(){\r
this.setState("loaded");\r
},\r
+ /**\r
+ * Called when "state" is set to a new value\r
+ * @param state {String} the new state\r
+ */\r
_applyState : function(state){\r
if(state == "loaded"){\r
if(this.loadingChild){\r
this.addLoadingChild();\r
}\r
},\r
+ /**\r
+ * Create a temporary child with the loadingString label and add it.\r
+ */\r
addLoadingChild : function(){\r
this.loadingChild = new qx.ui.tree.TreeFile(this.getLoadingString());\r
this.add(this.loadingChild);\r
},\r
+ /**\r
+ * Call loader function.\r
+ */\r
load : function(){ \r
var loaderFunc = this.getLoader();\r
loaderFunc(this);\r
},\r
+ /**\r
+ * Empty then call loader function.\r
+ */\r
reload : function(){\r
this.removeAll();\r
this.setState("loading");\r