2 * Applet for the batch manager
4 qx
.Class
.define("org.argeo.slc.ria.SpecsEditorView",
6 extend
: qx
.ui
.container
.Composite
,
7 implement
: [org
.argeo
.ria
.components
.IView
],
12 * The commands definition Map that will be automatically added and wired to the menubar and toolbar.
13 * See {@link org.argeo.ria.event.CommandsManager#definitions} for the keys to use for defining commands.
18 label
: "Edit Execution Specs",
19 icon
: "org/argeo/slc/ria/document-open.png",
24 callback : function(e
) {},
25 selectionChange : function(viewId
, selection
) {
26 if (viewId
!= "batch:list")
28 var view
= org
.argeo
.ria
.components
.ViewsManager
.getInstance().getViewPaneById("editor").getContent();
29 if ((selection
&& selection
.length
== 1)) {
30 view
.setBatchEntrySpec(selection
[0].getUserData("batchEntrySpec"));
32 view
.setBatchEntrySpec(null);
44 check
:"org.argeo.ria.components.ViewSelection"
46 instanceId
: {init
:""},
47 instanceLabel
: {init
:""},
51 event
: "changeBatchEntrySpec"
56 construct : function(){
58 this.setLayout(new qx
.ui
.layout
.Dock());
63 * The implementation should contain the GUI initialisation.
64 * This is the role of the manager to actually add the graphical component to the pane,
65 * so it's not necessary to do it here.
66 * @param viewPane {org.argeo.ria.components.ViewPane} The pane manager
67 * @param data {Mixed} Any object or data passed by the initiator of the view
70 init : function(viewPane
, data
){
71 this.setView(viewPane
);
72 this.setViewSelection(new org
.argeo
.ria
.components
.ViewSelection(viewPane
.getViewId()));
74 this.addListener("changeBatchEntrySpec", this.updateData
, this);
75 this._emptyTitleString
= "Script Parameters (select a script to edit)";
76 this._editorTitleString
= "Script '%1' Parameters";
79 * The implementation should contain the real data loading (i.o. query...)
84 this.getView().setViewTitle(this._emptyTitleString
);
89 * @param event {qx.event.type.DataEvent}
91 updateData : function(event
){
92 var batchEntry
= event
.getData();
93 if(batchEntry
== null){
94 this.tableModel
.setData([]);
95 this.getView().setViewTitle(this._emptyTitleString
);
98 this.getView().setViewTitle(qx
.lang
.String
.format(this._editorTitleString
, [batchEntry
.getFlow().getName()]));
99 var values
= batchEntry
.getValues();
101 for(var key
in values
){
102 var valueObj
= values
[key
];
103 var hidden
= valueObj
.getHidden();
104 var type
= valueObj
.getSpecType();
105 if((type
== "primitive" || type
== "ref")&& !hidden
){
108 disabled
: valueObj
.getFrozen(),
110 subType
: valueObj
.getSpecSubType(),
111 refList
: (type
=="ref"?valueObj
.getRefList():[])
113 data
.push([key
, valueObj
.getValue(), metadata
]);
116 this.tableModel
.setData(data
);
120 * Creates the main applet layout.
122 _createLayout : function() {
123 this.tableModel
= new qx
.ui
.table
.model
.Simple();
124 this.tableModel
.setColumns(["Attribute Name", "Value"]);
125 this.tableModel
.setColumnEditable(1, true);
126 this.table
= new qx
.ui
.table
.Table(this.tableModel
, {
127 tableColumnModel: function(obj
){
128 return new qx
.ui
.table
.columnmodel
.Resize(obj
)
133 statusBarVisible
: false,
134 showCellFocusIndicator
:true,
135 columnVisibilityButtonVisible
: false
138 this.table
.addListener("dataEdited", function(e
){
139 var data
= e
.getData();
140 var rowData
= this.tableModel
.getRowData(data
.row
);
141 var metaData
= rowData
[2];
142 var values
= this.getBatchEntrySpec().getValues();
143 values
[metaData
.key
].setValue(data
.value
);
146 var columnModel
= this.table
.getTableColumnModel();
147 var factory
= new org
.argeo
.slc
.ria
.execution
.CellEditorFactory();
148 columnModel
.setCellEditorFactory(1, factory
);
149 columnModel
.setDataCellRenderer(1, factory
);
150 columnModel
.getBehavior().setWidth(0, "40%");
151 this.add(this.table
, {edge
:"center"});
155 * Whether this component is already contained in a scroller (return false) or not (return true).
158 addScroll : function(){return false;},
160 * Called at destruction time
161 * Perform all the clean operations (stopping polling queries, etc.)
163 close : function(){return true;}