/** * @author Charles */ qx.Class.define("org.argeo.slc.web.TestList", { extend : qx.ui.container.Composite, implement : [org.argeo.ria.components.IView], construct : function(){ this.base(arguments, new qx.ui.layout.VBox()); var model = new qx.ui.table.model.Simple(); model.setColumns(["Test Case", "Date"]); this.table = new qx.ui.table.Table(model, { tableColumnModel: function(obj){ return new qx.ui.table.columnmodel.Resize(obj) } }); }, properties : { view : { init : null }, collectionList : { init : {}, check : "Map" }, collectionId:{ init : 'My Collection', check : "String" }, commands : { init : { "loadtestlist" : { label : "Load Collection", icon : "resource/slc/view-refresh.png", shortcut : "Control+l", enabled : true, menu : "Collection", toolbar : "collection", callback : function(e){ this.loadList(); }, command : null }, "copyfullcollection" : { label : "Copy to...", icon : "resource/slc/edit-copy.png", shortcut : null, enabled : false, menu : "Collection", toolbar : "collection", callback : function(e){ // Call service to copy }, submenu : {}, submenuCallback : function(commandId){ this.copySelectionToCollection(commandId, "current_collection"); }, init : function(){ // Call at command creation org.argeo.ria.remote.RequestManager.getInstance().addListener("reload", function(event){ if(event.getDataType() == "collection" || event.getDataType() == "test_cases"){ var testList = org.argeo.ria.components.ViewsManager.getInstance().getViewPaneById("list").getContent(); testList.collectionListToMenu(this); } }, this); }, command : null }, "opentest" : { label : "Open", icon : "resource/slc/media-playback-start.png", shortcut : "Control+o", enabled : false, menu : "Selection", toolbar : "selection", callback : function(e){ var viewsManager = org.argeo.ria.components.ViewsManager.getInstance(); var classObj = org.argeo.slc.web.Applet; var iView = viewsManager.initIViewClass(classObj, "applet"); var xmlNodes = viewsManager.getViewPaneSelection("list").getNodes(); iView.load(xmlNodes[0]); }, selectionChange : function(viewId, xmlNodes){ if(viewId != "list") return; this.setEnabled(false); if(xmlNodes == null || !xmlNodes.length) return; this.setEnabled(true); }, command : null }, "download" : { label : "Download as...", icon : "resource/slc/go-down.png", shortcut : null, enabled : false, menu : "Selection", toolbar : "selection", callback : function(e){ }, command : null, submenu : {}, submenuCallback : function(commandId){ var uuid = this.extractTestUuid(); var urls = { xsl : "resultView.xslt", xml : "resultViewXml.xslt", xls : "resultView.xls", pdf : "resultView.pdf" }; var url = "../"+urls[commandId]+"?uuid="+uuid; if(commandId == "xls" || commandId == "pdf"){ document.location.href = url; }else{ var win = window.open(url); } }, init : function(command){ this.setMenu([ {'label':"Xsl", 'icon':'resource/slc/mime-xsl.png', 'commandId':'xsl'}, {'label':"Xml", 'icon':'resource/slc/mime-xml.png', 'commandId':'xml'}, {'label':"Excel", 'icon':'resource/slc/mime-xls.png', 'commandId':'xls'}, {'label':"Pdf", 'icon':'resource/slc/mime-pdf.png', 'commandId':'pdf'} ]); }, selectionChange : function(viewId, xmlNodes){ if(viewId!="list")return; //this.clearMenus(); this.setEnabled(false); if(xmlNodes == null || !xmlNodes.length) return; this.setEnabled(true); /* var reports = qx.xml.Element.selectNodes(xmlNodes[0],'report[@type="download"]'); if(reports == null || !reports.length)return; var submenus = []; for(var i=0; i