]> git.argeo.org Git - gpl/argeo-slc.git/commitdiff
Documentation
authorCharles du Jeu <charles.dujeu@gmail.com>
Fri, 9 Jan 2009 11:42:35 +0000 (11:42 +0000)
committerCharles du Jeu <charles.dujeu@gmail.com>
Fri, 9 Jan 2009 11:42:35 +0000 (11:42 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@2061 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc-web/class/org/argeo/slc/web/Perspective.js
org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc-web/class/org/argeo/slc/web/TestList.js
org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc/class/org/argeo/slc/ria/Applet.js
org.argeo.slc.webapp/src/main/webapp/argeo-ria-lib/slc/class/org/argeo/slc/ria/SlcApi.js
org.argeo.slc.webapp/src/main/webapp/argeo-ria-src/class/org/argeo/ria/components/IView.js
org.argeo.slc.webapp/src/main/webapp/argeo-ria-src/class/org/argeo/ria/components/Logger.js
org.argeo.slc.webapp/src/main/webapp/argeo-ria-src/class/org/argeo/ria/components/Modal.js
org.argeo.slc.webapp/src/main/webapp/argeo-ria-src/class/org/argeo/ria/components/ViewPane.js
org.argeo.slc.webapp/src/main/webapp/argeo-ria-src/class/org/argeo/ria/components/ViewsManager.js
org.argeo.slc.webapp/src/main/webapp/argeo-ria-src/class/org/argeo/ria/event/CommandsManager.js

index 6671b5fe6a244d11e721f35543bd8794198b2759..fc0e471b71368334e96772602873359fe3fc9e68 100644 (file)
@@ -1,5 +1,5 @@
 /**\r
- * @author Charles\r
+ * IPerspective Implementation : Horizontal split pane defining two panes, "list" and "applet".\r
  */\r
 qx.Class.define("org.argeo.slc.web.Perspective",\r
 {\r
@@ -34,8 +34,7 @@ qx.Class.define("org.argeo.slc.web.Perspective",
        initViews : function(viewsManager){\r
          var view = viewsManager.initIViewClass(org.argeo.slc.web.TestList, "list");\r
          view.load();\r
-         //var command = org.argeo.ria.event.CommandsManager.getInstance().executeCommand("loadtestlist");\r
-         view.loadCollections(); // We know it is a TestList!\r
+         view.loadCollections();\r
          view.loadList();\r
        }\r
        \r
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
index 987e0a8b2f40e1e640189d0256a8bae51b6a717e..8bc2fed76a5800f930f5cd40ccacb78cf4be5e9a 100644 (file)
@@ -1,5 +1,9 @@
 /**
- * @author Charles
+ * The canonical SLC applet for test result viewing. It will display a TreeTestResult in a TreeVirtual component
+ * composed of four columns : test name, state (passed/failed/error), message and date.
+ * 
+ * It makes use of the StatusCellRenderer class for the "state" cell being a background-colored cell, the color depending on the FAILED or PASSED state message. 
+ * The only associated command is the "Close" command.
  */
 qx.Class.define("org.argeo.slc.ria.Applet",
 {
@@ -15,9 +19,15 @@ qx.Class.define("org.argeo.slc.ria.Applet",
 
   properties : 
   {
+       /**
+        * The viewPane inside which this applet is added. 
+        */
        view : {
                init : null
        },
+       /**
+        * Commands definition, see {@link org.argeo.ria.event.CommandsManager#definitions} 
+        */
        commands : {
                init : {
                        "close" : {
@@ -40,18 +50,20 @@ qx.Class.define("org.argeo.slc.ria.Applet",
        }
   },
 
-  /*
-  *****************************************************************************
-     MEMBERS
-  *****************************************************************************
-  */
-
   members :
   {
+       /**
+        * Called at applet creation. Just registers viewPane.
+        * @param viewPane {org.argeo.ria.components.ViewPane} The viewPane.
+        */
        init : function(viewPane){
                this.setView(viewPane);
        },
        
+       /**
+        * 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;
@@ -73,7 +85,11 @@ qx.Class.define("org.argeo.slc.ria.Applet",
        addScroll : function(){
                return false;
        },
-               
+       
+       /**
+        * Creates the GUI.
+        * @param responseXml {Document} The xml response of the "load" query.
+        */
        createXmlGui : function(responseXml){
                var NSMap = {
                        "slc" : "http://argeo.org/projects/slc/schemas"
@@ -190,6 +206,10 @@ qx.Class.define("org.argeo.slc.ria.Applet",
                
        },
        
+       /**
+        * Goes up the parents recursively to set a whole tree branch in "failed" mode.
+        * @param id {Integer} The id of the child node.
+        */
        _setParentBranchAsFailed : function(id){
                var model = this.tree.getDataModel();
                while(id != null && id!=0){
@@ -202,6 +222,12 @@ qx.Class.define("org.argeo.slc.ria.Applet",
                }               
        },
        
+       /**
+        * Recursively make sur the last children are of qx.ui.treevirtual.SimpleTreeDataModel.Type.LEAF type.
+        * 
+        * @param tree {qx.ui.treevirtual.TreeVirtual} The main tree of the applet.
+        * @param nodeId {Integer} Current node id. 
+        */
        _refineLeaves : function(tree, nodeId){
                var node = tree.nodeGet(nodeId);                
                if(node.children && node.children.length){
@@ -213,6 +239,11 @@ qx.Class.define("org.argeo.slc.ria.Applet",
                }
        },
        
+       /**
+        * Alternatively to the createXmlGui, create a simple HtmlElement and append the query responseText.
+        * Not used but sample.
+        * @param responseText {String} Html code to display.
+        */
        createHtmlGui : function(responseText){
                var htmlElement = new qx.ui.embed.Html(responseText);
                htmlElement.setOverflowX("auto");
index dd3632594d06764bdf2e59347af0026ec40c30cb..82486cf56fdd7f24412a080c84d2c899f5fbd355 100644 (file)
@@ -1,3 +1,12 @@
+/**\r
+ * SLC API Client implementation :\r
+ * This class encapsulate the various SLC services available. It just creates the Request object\r
+ * and return them, it does not execute them. \r
+ * Available services are : \r
+ * + loadResult / removeResult / addResult\r
+ * + listCollection / listResults\r
+ * When using it, be sure the static constant DEFAULT_CONTEXT is pointing to the right URL.\r
+ */\r
 qx.Class.define("org.argeo.slc.ria.SlcApi",\r
 {\r
   extend : qx.core.Object,\r
index 3d3cd1aa3797aa7b3514a98e4b99369af1ecdfc5..e4c8be677ee87adc789f1301078486e24df440e0 100644 (file)
@@ -1,6 +1,8 @@
 /**\r
  * Interface for a standard 'view' of an argeo RIA. A view is an independant applet that \r
  * will be integrated inside a ViewPane. \r
+ * If this view is to implement a selection (a list, a tree, etc) that will trigger changes on commands, \r
+ * it must trigger a viewSelection#changeSelection event.\r
  * \r
  * The typical lifecycle of an IView will be the following :\r
  * <br>+ init(viewPane) : initialize basic GUI in the viewPane\r
 qx.Interface.define("org.argeo.ria.components.IView", {\r
        \r
        properties : {\r
+               /**\r
+                * The commands definition Map that will be automatically added and wired to the menubar and toolbar.\r
+                * See {@link org.argeo.ria.event.CommandsManager#definitions} for the keys to use for defining commands.\r
+                */\r
                commands : {}\r
        },\r
        \r
        members : {\r
                /**\r
                 * The implementation should contain the GUI initialisation.\r
+                * This is the role of the manager to actually add the graphical component to the pane, \r
+                * so it's not necessary to do it here. \r
                 * @param viewPane {org.argeo.ria.components.ViewPane} The pane manager\r
                 * @return {Boolean}\r
                 */\r
@@ -29,8 +37,7 @@ qx.Interface.define("org.argeo.ria.components.IView", {
                 */\r
                load : function(data){return true;},\r
                /**\r
-                * Whether this component is already contained in a scroller \r
-                * (return false) or not (return true).\r
+                * Whether this component is already contained in a scroller (return false) or not (return true).\r
                 * @return {Boolean}\r
                 */\r
                addScroll : function(){return true;}\r
index a4c8f448c045985115eff5fcfc0d5febfdf35371..5b3365b3667f375a416c3cdf666879301e682835 100644 (file)
@@ -91,6 +91,11 @@ qx.Class.define("org.argeo.ria.components.Logger",
                        this.center();\r
                },\r
                \r
+               /**\r
+                * Show a given info log in a small popup right-top aligned. \r
+                * The popup will disappear after 5 seconds.\r
+                * @param content {qx.ui.basic.Label} The content of the popup to display \r
+                */\r
                showLogAsPopup:function(content){\r
                        if(!this.popup){\r
                      this.popup = new qx.ui.popup.Popup(new qx.ui.layout.Canvas()).set({\r
index b69c1580f36b749be49051da2d3defbf32d3ee0a..e0895f48ccb84582b55ca94a1d48b5ed59b66883 100644 (file)
@@ -53,11 +53,18 @@ qx.Class.define("org.argeo.ria.components.Modal",
                        org.argeo.ria.components.ViewsManager.getInstance().getApplicationRoot().add(this);                     \r
                        this.show();\r
                },\r
+               /**\r
+                * Adds a close button bottom-center aligned to the popup\r
+                */\r
                addCloseButton : function(){\r
                        this.closeButton = new qx.ui.form.Button("Close");\r
                        this.closeButton.addListener("execute", this._closeAndDestroy, this);\r
                        this.add(this.closeButton, {edge:'south'});                     \r
                },\r
+               /**\r
+                * Adds two buttons bottom-center aligned (Ok and Cancel). \r
+                * Ok button has no listener by default, Cancel will close and destroy the popup.\r
+                */\r
                addOkCancel : function(){\r
                        var buttonPane = new qx.ui.container.Composite(new qx.ui.layout.HBox(5, 'right'));\r
                        buttonPane.setAlignX("center");\r
@@ -68,6 +75,12 @@ qx.Class.define("org.argeo.ria.components.Modal",
                        buttonPane.add(this.cancelButton);\r
                        buttonPane.add(this.okButton);\r
                },\r
+               /**\r
+                * Adds a prompt form to the popup : a question, followed by a text input.\r
+                * @param questionString {String} The question to ask to the user \r
+                * @param validationCallback {Function} Callback to apply : takes the text input value as unique argument.\r
+                * @param callbackContext {Object} Context for the callback, optional.\r
+                */\r
                makePromptForm:function(questionString, validationCallback, callbackContext){\r
                        this.add(new qx.ui.basic.Label(questionString), {edge:'north'});\r
                        var textField = new qx.ui.form.TextField();\r
@@ -82,6 +95,9 @@ qx.Class.define("org.argeo.ria.components.Modal",
                                if(valid) this._closeAndDestroy();\r
                        }, this);\r
                },\r
+               /**\r
+                * Close this modal window and destroy it.\r
+                */\r
                _closeAndDestroy : function(){\r
                        this.hide();\r
                        this.destroy();                 \r
index e04970c4388420c54df81b805e1dcc7c55a6950b..a239f91a41e32d846f6db0cd63e6cbf89e16df6e 100644 (file)
@@ -143,7 +143,12 @@ qx.Class.define("org.argeo.ria.components.ViewPane",
                        this.add(this.guiContent, {flex:1});
                }
        },
-               
+       /**
+        * Adds a graphical component too the header of the view pane.
+        * It is added as "center" in the dock layout, and will override the view pane title label.
+        * For example, you can add your own title, or add a switch, or buttons, etc.
+        * @param component {qx.ui.core.Widget} The graphical component to add.
+        */
        addHeaderComponent : function(component){
                this.header.setPadding(4);
                this.header.add(component, {edge:"center"});
index 2b0815d5ecddc7b94857d0cb2c6bafc5e1867a67..5a1da280ae5e7bdb710b240a848300b0277f803d 100644 (file)
@@ -33,8 +33,6 @@ qx.Class.define("org.argeo.ria.components.ViewsManager",
         * @return {org.argeo.ria.components.IView}\r
         */\r
        initIViewClass: function(classObj, viewPaneId){\r
-               //var iView = eval("new "+iViewClass+"()");\r
-               //var classObj = qx.Class.getByName(iViewClass);\r
                var iView = new classObj;\r
                var viewPane = this.getViewPaneById(viewPaneId);\r
                iView.init(viewPane);           \r
index 0f6f1182a9817b3df28e04edc9b632222be533f6..422856f18f75bab79ac17fd7e2646f3e4e4ee777 100644 (file)
@@ -3,6 +3,7 @@
  * thus can be called by any part of the application.\r
  * This will wire all the commands that can be defined dynamically by any IView, and add their\r
  * corresponding buttons to the application menubar and toolbars.\r
+ * See the "definitions" property documentation below for more info on how to define new commands.\r
  * \r
  * @author Charles du Jeu\r
  */\r
@@ -20,7 +21,56 @@ qx.Class.define("org.argeo.ria.event.CommandsManager",
   properties : \r
   {\r
        /**\r
-        * Commands definitions\r
+        * The commands definitions is a Map described as below\r
+        * <pre>\r
+        * {\r
+        *      <b>label : "",</b> \r
+        *       | The label of the action\r
+        * \r
+        *      <b>icon : "",</b> \r
+        *       | The icon image\r
+        * \r
+        *      <b>shortcut : "",</b>\r
+        *       | The keyboard shortcut, as defined in qooxdoo (Control+s, Alt+k, etc.). Warning, the letter must be lowercase.\r
+        * \r
+        *      <b>enabled : true,</b>\r
+        *       | Whether it is enabled or disabled at creation\r
+        * \r
+        *      <b>menu : ""|null,</b>\r
+        *       | The menu group to which the command will be added. If null, will not appear in the menus.\r
+        * \r
+        *      <b>menuPosition : "first"|"last"</b>\r
+        *       | Optional : force the menu group to be first or last in the menubar.\r
+        *   \r
+        *      <b>toolbar : ""|null,</b>\r
+        *       | The toolbar group to which the command will be added. If null, will not appear in the toolbars.\r
+        * \r
+        *      <b>init : function(){},</b>\r
+        *       | Optional function called at command creation.\r
+        *       | Function context : the command itself\r
+        * \r
+        *      <b>callback : function(e){},</b>\r
+        *       | The main callback to be triggered when command is executed.\r
+        *       | Function context : the current class (not the command!)\r
+        *  \r
+        *      <b>selectionChange : function(viewPaneId, xmlNodes){},</b>\r
+        *       | Optional function called each time a selectionChange is detected in one of the active viewPane.\r
+        *       | The origin viewPaneId and the new selection as a map of nodes are passed as arguments.\r
+        *       | Function context : the command itself.\r
+        * \r
+        *      <b>submenu : [{label:"", icon:"", commandId:""}, ...],</b>\r
+        *       | If set, the command will create a submenu, being in a menu or in the toolbar.\r
+        *       | The submenu is created with the various array entries, and the submenuCallback function\r
+        *       | will be called with the 'commandId' parameter when a submenu entry is selected.\r
+        * \r
+        *      <b>submenuCallback : function(commandId){},</b>\r
+        *       | Callback if command is a submenu (cf. above).\r
+        *       | Function context : the current class/\r
+        * \r
+        *      <b>command : null</b>\r
+        *       | For internal use only, caching the actual org.argeo.ria.event.Command object.\r
+        * }\r
+        * </pre>\r
         * @see org.argeo.ria.event.Command for the definition Map details. \r
         */\r
        definitions : {\r
@@ -85,7 +135,7 @@ qx.Class.define("org.argeo.ria.event.CommandsManager",
 \r
   events : {\r
        /**\r
-        * Triggered when the whole commands list is changed.\r
+        * Triggered when the whole commands list is changed. Mainly used internally by the manager.\r
         */\r
        "changedCommands" : "qx.event.type.Event"\r
   },\r
@@ -244,9 +294,9 @@ qx.Class.define("org.argeo.ria.event.CommandsManager",
                return contextMenu;\r
        },\r
        /**\r
-        * Add a new set of commands definitions\r
+        * Add a new set of commands definitions. See the definitions property of this class.\r
         * @param definitions {Map} a set of commands definitions.\r
-        * @param callbackContext {qx.ui.core.Object} The context used inside the commands callbacks.\r
+        * @param callbackContext {qx.ui.core.Object} The context used inside the commands callbacks. \r
         */\r
        addCommands : function(definitions, callbackContext){\r
                var crtDefs = this.getDefinitions();            \r