X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.slc.webapp%2Fsrc%2Fmain%2Fwebapp%2Fargeo-ria-lib%2Fslc%2Fclass%2Forg%2Fargeo%2Fslc%2Fria%2FApplet.js;h=4d43a12073153a92d02ff198a66b5a300d683b50;hb=3e24f32c95b5ac3ec7fcae7000c4a8cfb857d514;hp=8bc2fed76a5800f930f5cd40ccacb78cf4be5e9a;hpb=fbb37515d94515993468c998516fe8341189ef84;p=gpl%2Fargeo-slc.git diff --git a/org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc/class/org/argeo/slc/ria/Applet.js b/org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc/class/org/argeo/slc/ria/Applet.js index 8bc2fed76..4d43a1207 100644 --- a/org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc/class/org/argeo/slc/ria/Applet.js +++ b/org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc/class/org/argeo/slc/ria/Applet.js @@ -15,6 +15,7 @@ qx.Class.define("org.argeo.slc.ria.Applet", this.setLayout(new qx.ui.layout.VBox()); this.passedStatus = "PASSED"; this.failedStatus = "FAILED"; + this.loaded = false; }, properties : @@ -25,57 +26,92 @@ qx.Class.define("org.argeo.slc.ria.Applet", view : { init : null }, + viewSelection : { + nullable:false, + check:"org.argeo.ria.components.ViewSelection" + }, + instanceId : { + init : "" + }, + instanceLabel : { + init : "" + }, /** * Commands definition, see {@link org.argeo.ria.event.CommandsManager#definitions} */ commands : { init : { "close" : { - label : "Close Result", + label : "Close Current", icon : "resource/slc/window-close.png", shortcut : "Control+w", enabled : true, menu : "Test", toolbar : "result", callback : function(e){ - // Call service to delete - this.getView().empty(); + this.getView().closeCurrent(); + //this.getView().empty(); + }, - selectionChange : function(viewId, xmlNode){ + command : null + } + /*, + "copytocollection" : { + shared : true, + selectionChange : function(viewId, xmlNode){ if(viewId != "applet") return; + if(!xmlNode){ + this.setEnabled(false); + }else{ + this.setEnabled(true); + } + } + }, + "deletetest" : { + shared : true, + callback : function(e){ + //this.debug(this); + alert("Should delete applet selection in " + this.getInstanceId()); }, - command : null - } + selectionChange : function(viewId, xmlNode){ + if(viewId != "applet") return; + if(!xmlNode){ + this.setEnabled(false); + }else{ + this.setEnabled(true); + } + } + } + */ } } }, members : { - /** - * Called at applet creation. Just registers viewPane. - * @param viewPane {org.argeo.ria.components.ViewPane} The viewPane. - */ - init : function(viewPane){ + init : function(viewPane, xmlNode){ this.setView(viewPane); + this.setViewSelection(new org.argeo.ria.components.ViewSelection(viewPane.getViewId())); + this.data = xmlNode; + if(this.data){ + this.testId = org.argeo.ria.util.Element.getSingleNodeText(this.data, "slc:uuid"); + this.setInstanceId("test:"+this.testId); + this.setInstanceLabel("Test " + this.testId.substring(0,4)+"..."); + } }, - /** - * Load a given test : the data passed must be an XML node containing the test unique ID. - * @param xmlNode {Element} The text xml description. - */ - load : function(xmlNode){ - this.data = xmlNode; - if(!xmlNode) return; + load : function(){ + if(!this.data) return; + if(this.loaded) return; // Load XML or Whatever var service; - var NSMap = {slc:"http://argeo.org/projects/slc/schemas"}; - var testId = qx.dom.Node.getText(org.argeo.ria.util.Element.selectSingleNode(this.data, "slc:uuid")); - this.getView().setViewTitle("Test "+testId); - var request = org.argeo.slc.ria.SlcApi.getLoadResultService(testId); + //this.testId = qx.dom.Node.getText(org.argeo.ria.util.Element.selectSingleNode(this.data, "slc:uuid")); + this.getView().setViewTitle("Test "+this.testId); + var request = org.argeo.slc.ria.SlcApi.getLoadResultService(this.testId); request.addListener("completed", function(response){ this.createXmlGui(response.getContent()); this.getView().setOnLoad(false); + this.loaded = true; }, this); this.getView().setOnLoad(true); request.send(); @@ -86,6 +122,10 @@ qx.Class.define("org.argeo.slc.ria.Applet", return false; }, + close : function(){ + + }, + /** * Creates the GUI. * @param responseXml {Document} The xml response of the "load" query. @@ -192,18 +232,18 @@ qx.Class.define("org.argeo.slc.ria.Applet", columnModel.setDataCellRenderer(1, new org.argeo.slc.ria.StatusCellRenderer()); this.tree.getSelectionManager().getSelectionModel().addListener("changeSelection", function(e){ - var viewSelection = this.getView().getViewSelection(); + var viewSelection = this.getViewSelection(); viewSelection.clear(); var nodes = this.tree.getDataModel().getSelectedNodes(); if(nodes.length){ viewSelection.addNode(nodes[0]); - this.getView().setViewSelection(viewSelection); } + this.getView().focus(); }, this); var contextMenu = org.argeo.ria.event.CommandsManager.getInstance().createMenuFromIds(["close"]); this.tree.setContextMenu(contextMenu); - + }, /**