From: Charles du Jeu Date: Mon, 8 Dec 2008 19:13:05 +0000 (+0000) Subject: Organize actions / Factorise actions code in class members X-Git-Tag: argeo-slc-2.1.7~2297 X-Git-Url: http://git.argeo.org/?a=commitdiff_plain;h=d0e9ed62482bd35d41869d0bbfbdec62698993c4;p=gpl%2Fargeo-slc.git Organize actions / Factorise actions code in class members git-svn-id: https://svn.argeo.org/slc/trunk@1965 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- diff --git a/org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/slc/web/TestList.js b/org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/slc/web/TestList.js index 29505adec..231aad6f9 100644 --- a/org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/slc/web/TestList.js +++ b/org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/slc/web/TestList.js @@ -37,20 +37,45 @@ qx.Class.define("org.argeo.slc.web.TestList", icon : "resource/slc/view-refresh.png", shortcut : "Control+l", enabled : true, - menu : "File", - toolbar : "test", + 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/document-open.png", + icon : "resource/slc/media-playback-start.png", shortcut : "Control+o", enabled : false, menu : "Selection", - toolbar : "test", + toolbar : "selection", callback : function(e){ var viewsManager = org.argeo.ria.components.ViewsManager.getInstance(); var classObj = org.argeo.slc.web.Applet; @@ -75,7 +100,7 @@ qx.Class.define("org.argeo.slc.web.TestList", shortcut : null, enabled : false, menu : "Selection", - toolbar : "test", + toolbar : "selection", callback : function(e){ }, command : null, submenu : {}, @@ -125,7 +150,7 @@ qx.Class.define("org.argeo.slc.web.TestList", shortcut : "Control+d", enabled : false, menu : "Selection", - toolbar : "test", + toolbar : "selection", callback : function(e){ // Call service to delete }, @@ -143,30 +168,21 @@ qx.Class.define("org.argeo.slc.web.TestList", shortcut : "Control+c", enabled : false, menu : "Selection", - toolbar : "test", + toolbar : "selection", callback : function(e){ // Call service to copy }, submenu : {}, + submenuCallback : function(commandId){ + this.copySelectionToCollection(commandId, "current_selection"); + }, init : function(){ // Call at command creation org.argeo.ria.remote.RequestManager.getInstance().addListener("reload", function(event){ - if(event.getDataType() != "collection") return; - this.setEnabled(false); - this.clearMenus(); - var collectionList = event.getContent(); - if(!collectionList) return; - var submenus = []; - for(var key in collectionList){ - submenus.push({ - "label":collectionList[key], - "icon":null, - "commandId":key - }); + if(event.getDataType() == "collection" || event.getDataType() == "test_cases"){ + var testList = org.argeo.ria.components.ViewsManager.getInstance().getViewPaneById("list").getContent(); + testList.collectionListToMenu(this, true); } - this.setMenu(submenus); - var viewSelection = org.argeo.ria.components.ViewsManager.getInstance().getViewPaneSelection("list"); - if(viewSelection.getCount()) this.setEnabled(true); }, this); }, selectionChange : function(viewId, xmlNodes){ @@ -231,7 +247,7 @@ qx.Class.define("org.argeo.slc.web.TestList", var collectionList = event.getContent(); select.removeAll(); for(key in collectionList){ - var item = new qx.ui.form.ListItem(collectionList[key], null, key); + var item = new qx.ui.form.ListItem(collectionList[key], "resource/slc/folder.png", key); select.add(item); if(key == this.getCollectionId()){ select.setSelected(item); @@ -263,7 +279,6 @@ qx.Class.define("org.argeo.slc.web.TestList", request.addListener("completed", function(response){ xml = response.getContent(); qx.log.Logger.info("Successfully loaded XML"); - //var resManager = org.argeo.ria.event.ResourcesManager.getInstance().fireReloadEvent("test_cases", xml); var nodes = qx.xml.Element.selectNodes(xml, "//data"); for(var i=0; i