this._splitPane = new qx.ui.splitpane.Pane("horizontal"); \r
this._secondSplit = new qx.ui.splitpane.Pane("vertical");\r
this._secondSplit.setDecorator(null);\r
+ this._thirdSplit = new qx.ui.splitpane.Pane("horizontal");\r
+ this._thirdSplit.setDecorator(null);\r
\r
var selectorPane = new org.argeo.ria.components.ViewPane("selector", "Available Scripts");\r
selectorPane.set({width:290});\r
viewsManager.registerViewPane(selectorPane);\r
\r
var batchPane = new org.argeo.ria.components.ViewPane("batch", "Batch");\r
- batchPane.set({height:300});\r
+ batchPane.set({width: 600, height:300});\r
viewsManager.registerViewPane(batchPane);\r
\r
var logPane = new org.argeo.ria.components.ViewPane("main", "Executions Log");\r
- viewsManager.registerViewPane(logPane); \r
+ viewsManager.registerViewPane(logPane);\r
\r
- this._secondSplit.add(batchPane, 0); \r
+ var specEditorPane = new org.argeo.ria.components.ViewPane("editor", "Specs Editor");\r
+ specEditorPane.set({width:200});\r
+ viewsManager.registerViewPane(specEditorPane);\r
+ \r
+ this._secondSplit.add(this._thirdSplit, 0); \r
this._secondSplit.add(logPane, 1); \r
\r
+ this._thirdSplit.add(batchPane, 0);\r
+ this._thirdSplit.add(specEditorPane, 1);\r
+ \r
this._splitPane.add(selectorPane, 0); \r
this._splitPane.add(this._secondSplit, 1);\r
\r
var batchApplet = viewsManager.initIViewClass(org.argeo.slc.ria.BatchView, "batch");\r
batchApplet.load();\r
\r
+ var editor = viewsManager.initIViewClass(org.argeo.slc.ria.SpecsEditorView, "editor");\r
+ editor.load();\r
+ \r
var logger = viewsManager.initIViewClass(org.argeo.slc.ria.SlcExecLoggerApplet, "main");\r
logger.load();\r
},\r
},\r
command : null\r
},\r
+ /*\r
"toggleopenonadd" : {\r
label : "Auto edit on Add",\r
icon : "resource/slc/document-open.png",\r
}\r
},\r
selectionChange : function(viewId, selection) {\r
- if (viewId != "form:list")\r
+ if (viewId != "batch:list")\r
return;\r
this.setEnabled(false);\r
if ((selection && selection.length == 1)) {\r
},\r
command : null\r
},\r
+ */\r
"removefrombatch" : {\r
label : "Remove from batch",\r
icon : "resource/slc/edit-delete.png",\r
modal.attachAndShow();\r
},\r
selectionChange : function(viewId, selection) {\r
- if (viewId != "form:list")\r
+ if (viewId != "batch:list")\r
return;\r
this.setEnabled(false);\r
if ((selection && selection.length > 0))\r
this.list.setDroppable(true);\r
this.list.setDraggable(true);\r
this.list.setContextMenu(org.argeo.ria.event.CommandsManager\r
- .getInstance().createMenuFromIds(["editexecutionspecs",\r
- "removefrombatch"]));\r
+ .getInstance().createMenuFromIds(["removefrombatch"]));\r
\r
this.list.addListener("dragstart", function(e) {\r
e.addType(["items"]);\r
\r
this.list.addListener("changeSelection", function(e) {\r
var viewSelection = this.getViewSelection();\r
- viewSelection.setViewId("form:list");\r
+ viewSelection.setViewId("batch:list");\r
viewSelection.clear();\r
var listSel = this.list.getSortedSelection();\r
for (var i = 0; i < listSel.length; i++) {\r
var label = batchEntry.getLabel();\r
var icon = target.getIcon() || "resource/slc/office-document.png";\r
var item = new qx.ui.form.ListItem(label, icon);\r
+ /*\r
item.addListener("dblclick", function(e) {\r
this.getCommands()["editexecutionspecs"].command\r
.execute();\r
}, this);\r
+ */\r
item.setUserData("batchEntrySpec", batchEntry);\r
item.setPaddingTop(1);\r
item.setPaddingBottom(2);\r
this.list.add(item);\r
}\r
this.list.select(item);\r
+ /*\r
if (this.getAutoOpen() && !skipAutoOpen) {\r
this.getCommands()["editexecutionspecs"].command.execute();\r
}\r
+ */\r
},\r
\r
/**\r
--- /dev/null
+/**\r
+ * Applet for the batch manager\r
+ */\r
+qx.Class.define("org.argeo.slc.ria.SpecsEditorView",\r
+{\r
+ extend : qx.ui.container.Composite,\r
+ implement : [org.argeo.ria.components.IView], \r
+\r
+ properties : \r
+ {\r
+ /**\r
+ * The commands definition Map that will be automatically added and wired to the menubar and toolbar.\r
+ * See {@link org.argeo.ria.event.CommandsManager#definitions} for the keys to use for defining commands.\r
+ */\r
+ commands : {\r
+ init : {\r
+ "updateData" : {\r
+ label : "Edit Execution Specs",\r
+ icon : "resource/slc/document-open.png",\r
+ shortcut : null,\r
+ enabled : false,\r
+ menu : null,\r
+ toolbar : null,\r
+ callback : function(e) {},\r
+ selectionChange : function(viewId, selection) {\r
+ if (viewId != "batch:list")\r
+ return;\r
+ if ((selection && selection.length == 1)) {\r
+ var view = org.argeo.ria.components.ViewsManager.getInstance().getViewPaneById("editor").getContent();\r
+ view.setBatchEntrySpec(selection[0].getUserData("batchEntrySpec"));\r
+ }\r
+ },\r
+ command : null \r
+ }\r
+ }\r
+ },\r
+ view : {\r
+ init : null\r
+ }, \r
+ viewSelection : {\r
+ nullable:false, \r
+ check:"org.argeo.ria.components.ViewSelection"\r
+ },\r
+ instanceId : {init:""},\r
+ instanceLabel : {init:""},\r
+ batchEntrySpec : {\r
+ init : null, \r
+ nullable:true,\r
+ event : "changeBatchEntrySpec"\r
+ }\r
+ \r
+ },\r
+ \r
+ construct : function(){\r
+ this.base(arguments);\r
+ this.setLayout(new qx.ui.layout.Dock()); \r
+ },\r
+ \r
+ members : {\r
+ /**\r
+ * The implementation should contain the GUI initialisation.\r
+ * This is the role of the manager to actually add the graphical component to the pane, \r
+ * so it's not necessary to do it here. \r
+ * @param viewPane {org.argeo.ria.components.ViewPane} The pane manager\r
+ * @param data {Mixed} Any object or data passed by the initiator of the view\r
+ * @return {Boolean}\r
+ */\r
+ init : function(viewPane, data){\r
+ this.setView(viewPane); \r
+ this.setViewSelection(new org.argeo.ria.components.ViewSelection(viewPane.getViewId()));\r
+ \r
+ this.addListener("changeBatchEntrySpec", this.updateData, this); \r
+ },\r
+ /**\r
+ * The implementation should contain the real data loading (i.o. query...)\r
+ * @return {Boolean}\r
+ */\r
+ load : function(){\r
+ this._createLayout();\r
+ this.getView().setViewTitle("Specs Editor");\r
+ },\r
+ \r
+ /**\r
+ * Update the table\r
+ * @param event {qx.event.type.DataEvent}\r
+ */\r
+ updateData : function(event){\r
+ var batchEntry = event.getData();\r
+ if(batchEntry == null){\r
+ this.tableModel.setData([]);\r
+ return;\r
+ }\r
+ var values = batchEntry.getValues();\r
+ var data = [];\r
+ for(var key in values){\r
+ var valueObj = values[key];\r
+ var hidden = valueObj.getHidden();\r
+ var type = valueObj.getSpecType();\r
+ if(type == "primitive" && !hidden){\r
+ metadata = {\r
+ key : key,\r
+ disabled : valueObj.getFrozen(),\r
+ type : type,\r
+ subType : valueObj.getSpecSubType() \r
+ }\r
+ data.push([key, valueObj.getValue(), metadata]);\r
+ }\r
+ } \r
+ this.tableModel.setData(data);\r
+ },\r
+ \r
+ /**\r
+ * Creates the main applet layout.\r
+ */\r
+ _createLayout : function() {\r
+ this.tableModel = new qx.ui.table.model.Simple(); \r
+ this.tableModel.setColumns(["Attribute Name", "Value"]);\r
+ this.tableModel.setColumnEditable(1, true);\r
+ this.table = new qx.ui.table.Table(this.tableModel, {\r
+ tableColumnModel: function(obj){\r
+ return new qx.ui.table.columnmodel.Resize(obj)\r
+ }\r
+ });\r
+ this.table.set({\r
+ decorator : null,\r
+ statusBarVisible: false,\r
+ showCellFocusIndicator:true,\r
+ columnVisibilityButtonVisible : false\r
+ });\r
+ \r
+ this.table.addListener("dataEdited", function(e){\r
+ var data = e.getData();\r
+ var rowData = this.tableModel.getRowData(data.row);\r
+ var metaData = rowData[2];\r
+ var values = this.getBatchEntrySpec().getValues();\r
+ values[metaData.key].setValue(data.value);\r
+ }, this);\r
+ \r
+ var columnModel = this.table.getTableColumnModel();\r
+ var factory = new org.argeo.slc.ria.execution.CellEditorFactory();\r
+ columnModel.setCellEditorFactory(1, factory);\r
+ columnModel.setDataCellRenderer(1, factory);\r
+ columnModel.getBehavior().setWidth(0, "70%");\r
+ this.add(this.table, {edge:"center"});\r
+ }, \r
+ \r
+ /**\r
+ * Whether this component is already contained in a scroller (return false) or not (return true).\r
+ * @return {Boolean}\r
+ */\r
+ addScroll : function(){return false;},\r
+ /**\r
+ * Called at destruction time\r
+ * Perform all the clean operations (stopping polling queries, etc.) \r
+ */\r
+ close : function(){return true;}\r
+ }\r
+ \r
+\r
+});
\ No newline at end of file
--- /dev/null
+/*******************************************************************************
+ *
+ * Argeo
+ *
+ ******************************************************************************/
+
+/**
+ * A cell editor factory creating text fields or disabled text fields.
+ *
+ */
+qx.Class.define("org.argeo.slc.ria.execution.CellEditorFactory",
+{
+ extend : qx.ui.table.cellrenderer.Default,
+ implement : qx.ui.table.ICellEditorFactory,
+
+ /*
+ * ****************************************************************************
+ * CONSTRUCTOR
+ * ****************************************************************************
+ */
+
+ construct : function() {
+ this.base(arguments);
+ },
+
+ /*
+ * ****************************************************************************
+ * PROPERTIES
+ * ****************************************************************************
+ */
+
+ properties : {
+
+ /**
+ * function that validates the result the function will be called with
+ * the new value and the old value and is supposed to return the value
+ * that is set as the table value.
+ */
+ validationFunction : {
+ check : "Function",
+ nullable : true,
+ init : null
+ }
+
+ },
+
+ /*
+ * ****************************************************************************
+ * MEMBERS
+ * ****************************************************************************
+ */
+ members : {
+
+ // overridden
+ _getContentHtml : function(cellInfo) {
+ var table = cellInfo.table;
+ var tableModel = table.getTableModel();
+ var rowData = tableModel.getRowData(cellInfo.row);
+ var metaData = rowData[2];
+ if (metaData.disabled) {
+ return '<span style="color:#999;">' + qx.bom.String.escape(this._formatValue(cellInfo)) + '</span>';
+ }else{
+ return qx.bom.String.escape(this._formatValue(cellInfo));
+ }
+ },
+
+
+ // interface implementation
+ createCellEditor : function(cellInfo) {
+ var table = cellInfo.table;
+ var tableModel = table.getTableModel();
+ var rowData = tableModel.getRowData(cellInfo.row);
+ var metaData = rowData[2];
+ if (metaData.disabled) {
+ return null; // var cellEditor = new
+ // qx.ui.table.celleditor.TextField();
+ }
+
+ var cellEditor = new qx.ui.form.TextField;
+ cellEditor.setAppearance("table-editor-textfield");
+ cellEditor.originalValue = cellInfo.value;
+ if (cellInfo.value === null) {
+ cellInfo.value = "";
+ }
+ cellEditor.setValue("" + cellInfo.value);
+
+ cellEditor.addListener("appear", function() {
+ cellEditor.selectAll();
+ });
+
+ var validationFunc;
+ if (metaData.subType == "integer") {
+ validationFunc = function(newValue, oldValue){
+ var isNum = !isNaN(newValue * 1);
+ if (!isNum) {
+ alert("Warning, this field only accepts Integers!");
+ return oldValue;
+ }
+ return newValue;
+ };
+ }
+
+ cellEditor.setUserData("validationFunc", validationFunc);
+
+ return cellEditor;
+ },
+
+ // interface implementation
+ getCellEditorValue : function(cellEditor) {
+ var value = cellEditor.getValue();
+ var validationFunc = cellEditor.getUserData("validationFunc");
+
+ // validation function will be called with new and old value
+ // var validationFunc = this.getValidationFunction();
+ if (validationFunc) {
+ value = validationFunc(value, cellEditor.originalValue);
+ }
+
+ if (typeof cellEditor.originalValue == "number") {
+ value = parseFloat(value);
+ }
+
+ return value;
+ }
+ }
+});