]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc-web/class/org/argeo/slc/web/TestList.js
Documentation
[gpl/argeo-slc.git] / org.argeo.slc.webapp / src / main / webapp / argeo-ria-lib / slc-web / class / org / argeo / slc / web / TestList.js
index 8aaf5e14e215ff95de23e3c64e58445c0bd3af3d..cd7f6d913167943dc1997a75207636fa2782b650 100644 (file)
@@ -1,5 +1,9 @@
 /**\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
@@ -19,17 +23,29 @@ qx.Class.define("org.argeo.slc.web.TestList",
 \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
@@ -264,6 +280,9 @@ qx.Class.define("org.argeo.slc.web.TestList",
                  \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
@@ -282,6 +301,9 @@ qx.Class.define("org.argeo.slc.web.TestList",
                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
@@ -301,6 +323,10 @@ qx.Class.define("org.argeo.slc.web.TestList",
                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
@@ -314,6 +340,11 @@ qx.Class.define("org.argeo.slc.web.TestList",
                }\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
@@ -338,7 +369,12 @@ qx.Class.define("org.argeo.slc.web.TestList",
                        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
@@ -370,6 +406,10 @@ qx.Class.define("org.argeo.slc.web.TestList",
                }\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
@@ -377,7 +417,11 @@ qx.Class.define("org.argeo.slc.web.TestList",
                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