/**\r
- * @author Charles\r
+ * Basic IView implementation for displaying the test results list, by collection.\r
+ * \r
+ * This component creates a Table object and feed it with the results. It adds a collection chooser to its viewPane header.\r
+ * \r
+ * It creates the following commands : "loadtestlist", "polllistloading", "opentest", "download", "copytocollection", "deletetest".\r
*/\r
qx.Class.define("org.argeo.slc.web.TestList",\r
{\r
\r
properties : \r
{\r
+ /**\r
+ * The viewPane containing this applet.\r
+ */\r
view : {\r
init : null\r
},\r
+ /**\r
+ * The load list of available collection (Map of ids => labels)\r
+ */\r
collectionList : {\r
init : {},\r
check : "Map"\r
},\r
+ /**\r
+ * The current collection id selected.\r
+ */\r
collectionId:{\r
init : 'My Collection',\r
check : "String"\r
},\r
+ /**\r
+ * The applet commands.\r
+ */\r
commands : {\r
init : {\r
"loadtestlist" : {\r
\r
},\r
\r
+ /**\r
+ * Use SlcApi to load the available collections.\r
+ */\r
loadCollections : function(){\r
var request = org.argeo.slc.ria.SlcApi.getListCollectionsService();\r
var NSMap = {slc:"http://argeo.org/projects/slc/schemas"};\r
request.send();\r
},\r
\r
+ /**\r
+ * Load the results of the currently selected collection.\r
+ */\r
loadList : function(){\r
var model = this.table.getTableModel();\r
model.removeRows(0, model.getRowCount());\r
request.send(); \r
},\r
\r
+ /**\r
+ * Enable/disable the automatic reloading of the list.\r
+ * @param state {Boolean} Whether the automatic reloading must be started or stopped.\r
+ */\r
pollListLoading : function(state){\r
if(!this.timer){\r
this.timer = new qx.event.Timer(5000);\r
}\r
},\r
\r
+ /**\r
+ * Creates a menu gui component from the currently loaded collectionList.\r
+ * @param command {qx.event.Command} The command on which to attach the created menu. \r
+ * @param checkSelection {Boolean} Whether at the end, we must check the current viewSelection to enable/disable the command accordingly. \r
+ */\r
collectionListToMenu : function(command, checkSelection){\r
command.setEnabled(false);\r
command.clearMenus();\r
command.setEnabled(true);\r
}\r
},\r
- \r
+ /**\r
+ * Use SlcApi "addResult" service to add selected results to a given collection.\r
+ * If collectionId is "slc.client.create", first triggers a modal dialog to enter a new collection name, then retrigger itself with the new id.\r
+ * @param collectionId {String} The id of the destination collection, or "slc.client.create".\r
+ * @param selectionType {String} "current_collection"|"current_selection". The first adds the whole collection content to the destination, the second only selected results.\r
+ */\r
copySelectionToCollection:function(collectionId, selectionType){\r
if(collectionId == "slc.client.create"){\r
var modal = new org.argeo.ria.components.Modal("Create collection", "resource/slc/folder-new.png");\r
}\r
},\r
\r
+ /**\r
+ * Utilitary function to extract test unique id from the currently selected node.\r
+ * @return {String} The test unique id.\r
+ */\r
extractTestUuid: function(){\r
var NSMap = {slc:"http://argeo.org/projects/slc/schemas"};\r
var xmlNodes = this.getView().getViewSelection().getNodes();\r
return uuid;\r
},\r
\r
- collectionSelectorListener : function(event){\r
+ /**\r
+ * Listener of the collection selector (select box added to the viewpane header). \r
+ * @param event {qx.event.type.Event} The event.\r
+ */\r
+ collectionSelectorListener : function(event){\r
this.setCollectionId(event.getData());\r
this.loadList(); \r
},\r