API Documentation
authorCharles du Jeu <charles.dujeu@gmail.com>
Sun, 7 Dec 2008 18:08:50 +0000 (18:08 +0000)
committerCharles du Jeu <charles.dujeu@gmail.com>
Sun, 7 Dec 2008 18:08:50 +0000 (18:08 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@1937 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

22 files changed:
org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/Application.js
org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/__init__.js [new file with mode: 0644]
org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/components/ILoadStatusable.js
org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/components/IPerspective.js
org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/components/IView.js
org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/components/Logger.js
org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/components/Modal.js
org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/components/ViewPane.js
org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/components/ViewSelection.js
org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/components/ViewsManager.js
org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/components/XmlRenderer.js
org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/components/__init__.js [new file with mode: 0644]
org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/event/Command.js
org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/event/CommandsManager.js
org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/event/ReloadEvent.js
org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/event/__init__.js [new file with mode: 0644]
org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/remote/RequestManager.js
org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/remote/__init__.js [new file with mode: 0644]
org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/test/__init__.js [new file with mode: 0644]
org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/util/Element.js
org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/util/__init__.js [new file with mode: 0644]
org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/slc/web/Perspective.js

index d754a1978adbb2cfb0130e43fcd71998affbbebe..5544aa9aea6646608d46475fff6669f7e6d7a6a7 100644 (file)
@@ -15,7 +15,7 @@
 ************************************************************************ */\r
 \r
 /**\r
- * This is the main application class of your custom application "slc"\r
+ * This is the main application class of an Argeo RIA.\r
  */\r
 qx.Class.define("org.argeo.ria.Application",\r
 {\r
diff --git a/org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/__init__.js b/org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/__init__.js
new file mode 100644 (file)
index 0000000..5ff6b21
--- /dev/null
@@ -0,0 +1,15 @@
+/**\r
+ * Generic package for the Argeo Rich Internet Application based on qooxdoo (www.qooxdoo.org).\r
+ * This is an empty application in itself, since it requires at least a basic implementation to be useful.\r
+ * \r
+ * \r
+ * The skeleton of an ArgeoRIA is the following : \r
+ * \r
+ * + GUI Application containing a menubar, a toolbar, and an empty space for custom Perspective.\r
+ * \r
+ * + Various managers : org.argeo.ria.components.ViewsManager for manipulating IView (VIEW), org.argeo.ria.event.CommandsManager \r
+ * for automatically wiring commands inside the application (CONTROLLER), and org.argeo.ria.remote.RequestManager for accessing the data (MODEL).\r
+ * \r
+ * + A simple configuration will allow to start your own Perspective inside the application.\r
+ *\r
+ */
\ No newline at end of file
index 11f4e10ec6ba812da22c5583cd3e3b1a2be33dec..dcb95547f00a6acdb2d054c9a221badee0a59168 100644 (file)
@@ -1,12 +1,19 @@
 /**\r
- * @author Charles du Jeu\r
  * \r
+ * Any component implementing this interface will generally be a user-interface indicating \r
+ * a "loading" status (button enabled/disabled, animated loading gif, etc...).\r
+ * The RequestManager can handle such an array of ILoadStatusable at the beginning/end of a Request.\r
+ * \r
+ * @author Charles du Jeu\r
  */\r
 qx.Interface.define("org.argeo.ria.components.ILoadStatusable", {\r
        \r
        members : {\r
-               setOnLoad : function(status){\r
-                       return true;\r
-               }\r
+               /**\r
+                * Sets the current status of the component.\r
+                * @param status {boolean} load status\r
+                * @return {Boolean}\r
+                */\r
+               setOnLoad : function(status){return true;}\r
        }\r
 });
\ No newline at end of file
index cf19ee12d58efd503e51c35b3f20ea1b879a2c93..88d3e870d43785cc5614ea24ed87f859fc5ccbfc 100644 (file)
@@ -1,11 +1,29 @@
 /**\r
- * @author Charles du Jeu\r
+ * This interface defines the main methods of an application Perpective.\r
+ * See the org.argeo.ria package documentation for more info on how to build an Application\r
+ * with this framework. \r
  * \r
+ * @author Charles du Jeu\r
  */\r
 qx.Interface.define("org.argeo.ria.components.IPerspective", {\r
        \r
        members : {\r
+               /**\r
+                * Initialize the available zones that will later contain IView implementations.\r
+                * This method is <b>in charge</b> of your panel to the main application zone \r
+                * (just below the toolbar).\r
+                * \r
+                * @param viewsManager {org.argeo.components.ViewsManager} the pane manager\r
+                * \r
+                */\r
                initViewPanes : function(viewsManager){return true;},\r
+               /**\r
+                * Once the zones are available and initialized, initialize the views here\r
+                * and add them to viewPanes. Trigger initial data loading, etc.\r
+                * \r
+                * @param viewsManager {org.argeo.components.ViewsManager} the pane manager\r
+                * \r
+                */\r
                initViews : function(viewsManager){return true}\r
        }\r
 });
\ No newline at end of file
index 619aecad44dc28ed10ad2d4666b3f117b100e756..3d3cd1aa3797aa7b3514a98e4b99369af1ecdfc5 100644 (file)
@@ -1,6 +1,13 @@
 /**\r
- * @author Charles du Jeu\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
+ * \r
+ * The typical lifecycle of an IView will be the following :\r
+ * <br>+ init(viewPane) : initialize basic GUI in the viewPane\r
+ * <br>+ getCommands() : wire the commands and add them to the toolbars/menubars\r
+ * <br>+ load(data) : loads the data itself.\r
  * \r
+ * @author Charles du Jeu\r
  */\r
 qx.Interface.define("org.argeo.ria.components.IView", {\r
        \r
@@ -9,14 +16,23 @@ qx.Interface.define("org.argeo.ria.components.IView", {
        },\r
        \r
        members : {\r
-               init : function(viewPane){\r
-                       return true;\r
-               },\r
-               load : function(data){\r
-                       return true;\r
-               },\r
-               addScroll : function(){\r
-                       return true;\r
-               }\r
+               /**\r
+                * The implementation should contain the GUI initialisation.\r
+                * @param viewPane {org.argeo.ria.components.ViewPane} The pane manager\r
+                * @return {Boolean}\r
+                */\r
+               init : function(viewPane){return true;},\r
+               /**\r
+                * The implementation should contain the real data loading (i.o. query...)\r
+                * @param data {mixed} Any data in any format\r
+                * @return {Boolean}\r
+                */\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
+                * @return {Boolean}\r
+                */\r
+               addScroll : function(){return true;}\r
        }\r
 });
\ No newline at end of file
index ab9a7a29c8c1ce38cacc9b57f2d29f85bcf246a6..9507d76eebe0433b772a9f5ddf032f9cf821bb5c 100644 (file)
@@ -1,12 +1,9 @@
-/* ************************************************************************\r
-\r
-  Copyright: 2008 Argeo\r
-\r
-   License: \r
-\r
-   Authors: Charles du Jeu\r
-\r
-************************************************************************ */\r
+/**\r
+ * A modal window like console for the logs. \r
+ * Also opens a small alert window (qooxdoo, not native) on errors.\r
+ * \r
+ * @author : Charles du Jeu\r
+ */\r
 qx.Class.define("org.argeo.ria.components.Logger",\r
 {\r
        type : "singleton",\r
@@ -69,6 +66,10 @@ qx.Class.define("org.argeo.ria.components.Logger",
        },\r
        \r
        members : {\r
+               /**\r
+                * Adds a log in the GUI component.\r
+                * @param entry {Map} A log entry\r
+                */\r
                process : function(entry){\r
                        var wrapper = qx.log.appender.Util.toHtml(entry);\r
                        var label = new qx.ui.basic.Label('<div class="messages"><div class="'+wrapper.className+'">'+wrapper.innerHTML+'</div></div>');\r
@@ -80,6 +81,9 @@ qx.Class.define("org.argeo.ria.components.Logger",
                        }\r
                        this._logPane.addAt(label, 0);\r
                },\r
+               /**\r
+                * Shows the GUI console and center it.\r
+                */\r
                toggle : function(){\r
                        this.show();\r
                        this.center();\r
index 6906599434bb14086dd73644d4ecdf19c5998746..2c8aef04d6f6ce9b7338f9402fa2cae82809e07d 100644 (file)
@@ -1,16 +1,18 @@
-/* ************************************************************************\r
-\r
-  Copyright: 2008 Argeo\r
-\r
-   License: \r
-\r
-   Authors: Charles du Jeu\r
-\r
-************************************************************************ */\r
+/**\r
+ * Generic modal popup window.\r
+ * It is layed out with a dock layout. When adding components to it, they are added as "center".\r
+ * @author Charles du Jeu\r
+ */\r
 qx.Class.define("org.argeo.ria.components.Modal",\r
 {\r
        extend : qx.ui.window.Window,\r
   \r
+       /**\r
+        * \r
+        * @param caption {String} Title of the window\r
+        * @param icon {String} Icon of the window\r
+        * @param text {String} Default content of the window.\r
+        */\r
        construct : function(caption, icon, text){\r
                this.base(arguments);\r
                this.set({\r
@@ -34,12 +36,23 @@ qx.Class.define("org.argeo.ria.components.Modal",
        },\r
        \r
        members : {\r
+               /**\r
+                * Display text inside the popup\r
+                * @param text {String} A string content for the popup\r
+                */\r
                addLabel:function(text){\r
                        this.add(new qx.ui.basic.Label(text), {edge:'center', width:'100%'});           \r
                },\r
+               /**\r
+                * Display a component (panel) in the center of the popup\r
+                * @param panel {qx.ui.core.Widget} A gui component (will be set at width 100%).\r
+                */\r
                addContent: function(panel){\r
                        this.add(panel, {edge:'center', width:'100%'});\r
                },\r
+               /**\r
+                * Automatically attach to the application root, then show.\r
+                */\r
                attachAndShow:function(){\r
                        org.argeo.ria.components.ViewsManager.getInstance().getApplicationRoot().add(this);                     \r
                        this.show();\r
index 25e8f10e6b186651ca8a6c1d3a7ff32f0668dc44..485a264c028bce0b7fb79c747c1f0b448c843911 100644 (file)
@@ -1,17 +1,21 @@
 /**
+ * A standard view container, referenced in the application by its unique id.
+ * It is managed by the ViewsManager singleton that works as the "View" part of an MVC model.
+ * @see org.argeo.ria.components.ViewsManager
  * @author Charles
  */
-/**
- * This is the main application class of your custom application "sparta"
- */
 qx.Class.define("org.argeo.ria.components.ViewPane",
 {
   extend : qx.ui.container.Composite,
   implement : [org.argeo.ria.components.ILoadStatusable],
 
-  construct : function(application, viewId, viewTitle, splitPaneData){
+  /**
+   * @param viewId {String} Unique id of this viewPane
+   * @param viewTitle {String} Readable Title of this viewPane
+   * @param splitPaneData {Map} Additionnal data to be used by splitpanes implementations.
+   */
+  construct : function(viewId, viewTitle, splitPaneData){
        this.base(arguments);
-       this.setApplication(application);
        this.setViewId(viewId);
        this._defaultViewTitle = viewTitle;
        this.setViewTitle(viewTitle);
@@ -25,13 +29,31 @@ qx.Class.define("org.argeo.ria.components.ViewPane",
 
   properties : 
   {
-       application : {init : null},
+       /**
+        * Unique id of the pane
+        */
        viewId : {init:""},
+       /**
+        * Human-readable title for this view
+        */
        viewTitle : {init:"", event:"changeViewTitle"},
-       viewSelection : { nullable:false },
-       ownScrollable : {init: false},
-       splitPaneData : {init  : null},
-       commands : {init : null, nullable:true}
+       /**
+        * Selection model for this view
+        */
+       viewSelection : { nullable:false, check:"org.argeo.ria.components.ViewSelection" },
+       /**
+        * Has its own scrollable content 
+        */
+       ownScrollable : {init: false, check:"Boolean"},
+       /**
+        *  Data concerning the split pane
+        */
+       splitPaneData : {init  : null, check:"Map"},
+       /**
+        * Map of commands definition
+        * @see org.argeo.ria.event.Command 
+        */
+       commands : {init : null, nullable:true, check:"Map"}
   },
   
   /*
@@ -42,6 +64,9 @@ qx.Class.define("org.argeo.ria.components.ViewPane",
 
   members :
   {
+       /**
+        * Creates a standard GUI for the viewPane, including a container for an IView.
+        */
        createGui : function(){
                this.setLayout(new qx.ui.layout.VBox());
                this.header = new qx.ui.container.Composite();
@@ -84,6 +109,10 @@ qx.Class.define("org.argeo.ria.components.ViewPane",
                */
        },
        
+       /**
+        * Sets the content of this pane.
+        * @param content {org.argeo.ria.components.IView} An IView implementation
+        */
        setContent : function(content){
                var addScrollable = (content.addScroll?content.addScroll():false);
                if(addScrollable){
@@ -96,6 +125,11 @@ qx.Class.define("org.argeo.ria.components.ViewPane",
                }
        },
        
+       /**
+        * Implementation of the ILoadStatusable interface.
+        * @see org.argeo.ria.components.ILoadStatusable
+        * @param load {Boolean} The loading status
+        */
        setOnLoad : function(load){
                if(!this.loadImage){
                        this.loadImage = new qx.ui.basic.Image('resource/slc/ajax-loader.gif');
@@ -107,6 +141,9 @@ qx.Class.define("org.argeo.ria.components.ViewPane",
                }
        },
        
+       /**
+        * Removes and destroy the IView content of this viewPane.
+        */
        empty: function(){
                if(this.getOwnScrollable() && this.scrollable){
                        this.remove(this.scrollable);
index 8f81f0a766f0bfc14347c3dd85bb51d171d2aca4..6c3e873abe37b1a0368e27fe4910ec036c012918 100644 (file)
@@ -1,7 +1,15 @@
+/**\r
+ * Generic selection model associated to an IView content opened in a given ViewPane.\r
+ * It contains in an array any row/data/node, and triggers changeSelection data events.\r
+ * @author Charles du Jeu\r
+ */\r
 qx.Class.define("org.argeo.ria.components.ViewSelection",\r
 {\r
   extend : qx.core.Object,\r
   \r
+  /**\r
+   * @param viewId {String} The ViewPane unique id\r
+   */\r
   construct : function(viewId){\r
        this.base(arguments);\r
        this.nodes = [];\r
@@ -9,6 +17,9 @@ qx.Class.define("org.argeo.ria.components.ViewSelection",
   },\r
 \r
   properties : {\r
+       /**\r
+        * The viewPane unique id \r
+        */\r
        viewId : {\r
        check : "String",\r
        nullable: false\r
@@ -16,6 +27,9 @@ qx.Class.define("org.argeo.ria.components.ViewSelection",
   },\r
   \r
   events : {\r
+       /**\r
+        * Triggered each time the selection changes.\r
+        */\r
        "changeSelection" : "qx.event.type.Data"\r
   },\r
   \r
@@ -27,24 +41,42 @@ qx.Class.define("org.argeo.ria.components.ViewSelection",
 \r
   members :\r
   {\r
+       /**\r
+        * Empty the selection\r
+        */\r
        clear : function(){\r
                this.nodes = [];\r
                this.triggerEvent();\r
        },\r
        \r
+       /**\r
+        * Add a row or xml node or whatever\r
+        * @param node {mixed} Data to add to the selection\r
+        */\r
     addNode : function(node) {\r
        this.nodes.push(node);\r
        this.triggerEvent();\r
     },\r
     \r
+    /**\r
+     * The number of rows/nodes selected\r
+     * @return {Integer}\r
+     */\r
     getCount : function() {\r
        return this.nodes.length;\r
     },\r
     \r
+    /**\r
+     * Returns the content of the selection \r
+     * @return {Array}\r
+     */\r
     getNodes : function(){\r
        return this.nodes;\r
     },\r
     \r
+    /**\r
+     * Creates and fire a data event changeSelection\r
+     */\r
     triggerEvent : function(){\r
        this.fireDataEvent("changeSelection", this);\r
     }\r
index 2678eba51920d78641748aa5665fd2c1ab34534d..2b0815d5ecddc7b94857d0cb2c6bafc5e1867a67 100644 (file)
@@ -1,4 +1,8 @@
 /**\r
+ * The main "view" manager (in a standard MVC conception) of the application.\r
+ * It register various containers org.argeo.ria.components.viewPane and feed them with org.argeo.ria.components.IView implementations.\r
+ * It is a singleton and can thus be called by any part of the application.\r
+ * \r
  * @author Charles du Jeu\r
  */\r
 qx.Class.define("org.argeo.ria.components.ViewsManager",\r
@@ -7,14 +11,27 @@ qx.Class.define("org.argeo.ria.components.ViewsManager",
   extend : qx.core.Object,\r
 \r
   properties : {\r
+       /**\r
+        * The application root (like Application.getRoot()), used to attach and show modal windows.\r
+        */\r
        applicationRoot : {init : null},\r
+       /**\r
+        * The main container for the org.argeo.ria.components.ViewPane instances. \r
+        */\r
        viewPanesContainer : {init: null}\r
   },\r
   construct : function(){\r
        this.views = {};\r
   },\r
   members : {\r
-       \r
+       /**\r
+        * Initialize and load a given IView implementation into a viewPane.\r
+        * The IView itself is returned.\r
+        * \r
+        * @param classObj {Clazz} The class object to instantiate\r
+        * @param viewPaneId {String} The unique ID of the view pane\r
+        * @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
@@ -31,19 +48,38 @@ qx.Class.define("org.argeo.ria.components.ViewsManager",
                return iView;\r
        },\r
        \r
+       /**\r
+        * Registers a new viewPane\r
+        * @param viewPane {org.argeo.ria.components.ViewPane} The new ViewPane instance\r
+        */\r
        registerViewPane : function(viewPane){\r
                this.views[viewPane.getViewId()] = viewPane;\r
                viewPane.getViewSelection().addListener("changeSelection", function(e){\r
                        org.argeo.ria.event.CommandsManager.getInstance().refreshCommands(e.getData());\r
                });             \r
        },\r
+       /**\r
+        * Returns a viewPane by its unique id.\r
+        * @param viewPaneId {String} The unique id\r
+        * @return {org.argeo.ria.components.ViewPane}\r
+        */\r
        getViewPaneById : function(viewPaneId){\r
                if(this.views[viewPaneId]) return this.views[viewPaneId];\r
                throw new Error("Cannot find view '"+viewPaneId+"'");           \r
        },\r
+       /**\r
+        * Returns a viewPane current viewSelection object\r
+        * @param viewPaneId {String} The unique id. \r
+        * @return {org.argeo.ria.components.ViewSelection}\r
+        */\r
        getViewPaneSelection : function(viewPaneId){\r
                return this.getViewPaneById(viewPaneId).getViewSelection();\r
        },\r
+       /**\r
+        * Changes a viewPane title dynamically.\r
+        * @param viewPaneId {String} ViewPane unique Id. \r
+        * @param viewTitle {String} the new title for this viewPane.\r
+        */\r
        setViewPaneTitle : function(viewPaneId, viewTitle){\r
                this.getViewPaneById(viewPaneId).setViewTitle(viewTitle);\r
        }\r
index e3c55791285c802c277d9d923f544fa6e5896237..68d287eb945df27ea824a57f6dd076c735c05e4c 100644 (file)
@@ -1,3 +1,10 @@
+/**\r
+ * Basic helper for SLC XML results to be displayed in a qx.ui.table.\r
+ * Overrides the html of the standard qx.ui.table.cellrenderer.String\r
+ *  \r
+ * TODO : put in org.argeo.slc.ria package\r
+ * \r
+ */\r
 qx.Class.define("org.argeo.ria.components.XmlRenderer",\r
 {\r
   extend : qx.ui.table.cellrenderer.String,\r
@@ -10,8 +17,11 @@ qx.Class.define("org.argeo.ria.components.XmlRenderer",
 \r
   members :\r
   {\r
-    // overridden\r
-       // TODO : Put this in org.argeo.slc.ria\r
+       /**\r
+        * Overrides the parent method.\r
+        * @param cellInfo {Map} The current cell data \r
+        * @return {String}\r
+        */\r
     _getContentHtml : function(cellInfo) {\r
        var xmlNode = cellInfo.rowData;\r
        if(!xmlNode) return "";\r
@@ -47,6 +57,11 @@ qx.Class.define("org.argeo.ria.components.XmlRenderer",
     },\r
     \r
     // overridden\r
+    /**\r
+     * Overrides parent method\r
+     * @param cellInfo {Map} Current cell data\r
+     * @return {String}\r
+     */\r
     _getCellClass : function(cellInfo) {\r
                return this.base(arguments, cellInfo);\r
     }\r
diff --git a/org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/components/__init__.js b/org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/components/__init__.js
new file mode 100644 (file)
index 0000000..3f9efaf
--- /dev/null
@@ -0,0 +1,5 @@
+/**\r
+ * Package containing GUI components and main interfaces for GUI components to \r
+ * be used by any argeo RIA application.\r
+ *\r
+ */
\ No newline at end of file
index b189189636af3432121a8b07d934087dce0904f1..0026170ade614afde3cd200de47ce08ff78dd2a9 100644 (file)
@@ -1,20 +1,49 @@
-qx.Class.define("org.argeo.ria.event.Command",\r
+/**\r
+ * The standard command for all actions. It registers keyboard shortcuts, centralizes \r
+ * command state, callback, etc. It is defined by command definitions that can be found \r
+ * in the CommandsManager. \r
+ */\r
+ qx.Class.define("org.argeo.ria.event.Command",\r
 {\r
   extend : qx.event.Command,\r
   implement : [org.argeo.ria.components.ILoadStatusable],\r
 \r
   properties : {\r
+       /**\r
+        * Unique id of the command \r
+        */\r
        id : {init:""},\r
+       /**\r
+        * Label of the command \r
+        */\r
        label : {init:""},\r
+       /**\r
+        * Icon of the command \r
+        */\r
        icon : {init:""},\r
+       /**\r
+        * Sub menu if needed \r
+        */\r
        menu : {\r
                nullable: true,\r
                event : "changeMenu"\r
        },\r
+       /**\r
+        * Callback associated to the submenu of the command \r
+        */\r
        menuCallback : {nullable:true},\r
+       /**\r
+        * Context used when triggering menuCallback \r
+        */\r
        menuContext : {nullable:true}\r
   },\r
   \r
+  /**\r
+   * @param id {String} Id of the command\r
+   * @param label {String} Label of the command\r
+   * @param icon {String} Icon of the command\r
+   * @param shortcut {String} Keyboard Shortcut (like alt+o, ctrl+z, etc..)\r
+   */\r
   construct : function(id, label, icon, shortcut){\r
        this.base(arguments, shortcut);\r
        this.setId(id);\r
@@ -24,6 +53,10 @@ qx.Class.define("org.argeo.ria.event.Command",
   \r
   members :\r
   {\r
+       /**\r
+        * Create a Button that suits a qx.ui.menu.MenuBar linked to this command\r
+        * @return {qx.ui.menu.Button}\r
+        */\r
        getMenuButton : function(){\r
                var button = new qx.ui.menu.Button(\r
                        this.getLabel(), \r
@@ -40,6 +73,10 @@ qx.Class.define("org.argeo.ria.event.Command",
                return button;\r
        },\r
        \r
+       /**\r
+        * Create a Button that suits a qx.ui.toolbar.Toolbar part linked to this command.\r
+        * @return {qx.ui.toolbar.MenuButton}\r
+        */\r
        getToolbarButton : function(){\r
                var button;\r
                if(this.getMenu()){\r
@@ -66,6 +103,10 @@ qx.Class.define("org.argeo.ria.event.Command",
                return button;\r
        },\r
                \r
+       /**\r
+        * Clones the command menu\r
+        * @return {qx.ui.menu.Menu}\r
+        */\r
        getMenuClone : function(){\r
                if(!this.menuClone){\r
                        this.menuClone = new qx.ui.menu.Menu();\r
@@ -74,11 +115,21 @@ qx.Class.define("org.argeo.ria.event.Command",
                return this.menuClone;\r
        },\r
        \r
+       /**\r
+        * Remove all existing menus and their clones.\r
+        */\r
        clearMenus : function(){\r
                this.getMenu().removeAll();\r
                this.getMenuClone().removeAll();\r
        },\r
        \r
+       /**\r
+        * Add button to a given submenu.\r
+        * @param label {String} The label of the button\r
+        * @param icon {String} The icon of the button\r
+        * @param commandId {String} The associated command id.\r
+        * @param menu {qx.ui.menu.Menu} The menu to which add the button\r
+        */\r
        addSubMenuButton : function(label, icon, commandId, menu){\r
                var button = new qx.ui.menu.Button(label, icon);\r
                button.setUserData("commandId", commandId);\r
@@ -91,19 +142,31 @@ qx.Class.define("org.argeo.ria.event.Command",
                }\r
        },\r
        \r
+       /**\r
+        * Triggers the menuCallback property in the right context.\r
+        * @param event {qx.event.type.Event} The firing event.\r
+        */\r
        executeSubMenuCallback : function(event){\r
                var button = event.getTarget();\r
                var callback = this.getMenuCallback();\r
                callback = qx.lang.Function.bind(callback, this.getMenuContext() || this);\r
                callback(button.getUserData("commandId"));              \r
        },      \r
-       \r
+       /**\r
+        * Adds a tooltip to a button.\r
+        * @param element {qx.ui.core.Widget} The element to which the command tooltip is added. \r
+        */\r
        addTooltip : function(element){\r
                if(this.getShortcut() != null){\r
                        element.setToolTip(new qx.ui.tooltip.ToolTip(this.getShortcut()));\r
                }               \r
        },\r
        \r
+       /**\r
+        * Implementation of the ILoadStatusable interface.\r
+        * Sets the whole command enabled if not loading and disabled if loading.\r
+        * @param status {Boolean} The loading status of the button. \r
+        */\r
        setOnLoad : function(status){\r
                this.setEnabled(!status);\r
        }\r
index 280df7578fc3d6f530e5a01375b8a0f8c2741b0d..7bd0957dd7d430605674f4ad9c1cc7456b497f87 100644 (file)
@@ -1,6 +1,10 @@
 /**\r
- * @author Charles\r
+ * The main controller (in a standard MVC point of view) of the application. It is a singleton\r
+ * 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
  * \r
+ * @author Charles du Jeu\r
  */\r
 qx.Class.define("org.argeo.ria.event.CommandsManager",\r
 {\r
@@ -15,6 +19,10 @@ qx.Class.define("org.argeo.ria.event.CommandsManager",
 \r
   properties : \r
   {\r
+       /**\r
+        * Commands definitions\r
+        * @see org.argeo.ria.event.Command for the definition Map details. \r
+        */\r
        definitions : {\r
                init : {\r
                        "stop" : {\r
@@ -65,12 +73,18 @@ qx.Class.define("org.argeo.ria.event.CommandsManager",
                        }\r
                }\r
        },\r
+       /**\r
+        * For internal use \r
+        */\r
        initialDefinitions : {\r
                init : {}\r
        }\r
   },\r
 \r
   events : {\r
+       /**\r
+        * Triggered when the whole commands list is changed.\r
+        */\r
        "changedCommands" : "qx.event.type.Event"\r
   },\r
   \r
@@ -82,6 +96,9 @@ qx.Class.define("org.argeo.ria.event.CommandsManager",
 \r
   members :\r
   {\r
+       /**\r
+        * Creates all the objects (if they are not already existing) from the definitions maps.\r
+        */\r
        createCommands : function(){\r
                this.menus = {};\r
                this.toolbars = {};\r
@@ -116,7 +133,11 @@ qx.Class.define("org.argeo.ria.event.CommandsManager",
                }\r
                this.setDefinitions(defs);\r
        },\r
-               \r
+         \r
+       /**\r
+        * Refresh the current commands status depending on the viewSelection.\r
+        * @param viewSelection {org.argeo.ria.components.ViewSelection} The current ViewSelection\r
+        */\r
        refreshCommands : function(viewSelection){\r
                var defs = this.getDefinitions();\r
                var xmlNodes = null;\r
@@ -131,6 +152,10 @@ qx.Class.define("org.argeo.ria.event.CommandsManager",
                }\r
        },\r
        \r
+       /**\r
+        * Record a menubar for the application\r
+        * @param menuBar {qx.ui.menubar.MenuBar} The application menubar\r
+        */\r
        registerMenuBar : function(menuBar){\r
                this.addListener("changedCommands", function(){\r
                        this.createMenuButtons(menuBar);\r
@@ -138,6 +163,10 @@ qx.Class.define("org.argeo.ria.event.CommandsManager",
                this.createMenuButtons(menuBar);\r
        },\r
 \r
+       /**\r
+        * Record a toolbar for the application\r
+        * @param toolBar {qx.ui.toolbar.ToolBar} The application toolbar\r
+        */\r
        registerToolBar : function(toolBar){\r
                this.addListener("changedCommands", function(){\r
                        this.createToolbarParts(toolBar);\r
@@ -145,6 +174,10 @@ qx.Class.define("org.argeo.ria.event.CommandsManager",
                this.createToolbarParts(toolBar);\r
        },      \r
        \r
+       /**\r
+        * Creates the real buttons and add them to the passed menuBar. \r
+        * @param menuBar {qx.ui.menubar.MenuBar} The application menubar\r
+        */\r
        createMenuButtons : function(menuBar){\r
                menuBar.removeAll();\r
                var anchors = {};\r
@@ -170,6 +203,11 @@ qx.Class.define("org.argeo.ria.event.CommandsManager",
                        menuBar.add(anchors.last);\r
                }\r
        },\r
+       \r
+       /**\r
+        * Creates the real buttons and add them to the passed toolbar. \r
+        * @param toolbar {qx.ui.toolbar.ToolBar} The application toolbar\r
+        */\r
        createToolbarParts : function(toolbar){\r
                toolbar.removeAll();\r
                for(var key in this.toolbars){\r
@@ -180,6 +218,11 @@ qx.Class.define("org.argeo.ria.event.CommandsManager",
                        });\r
                }\r
        },\r
+       /**\r
+        * Creates a context menu from an array of commands ids.\r
+        * @param commandIdsArray {Array} An array of string\r
+        * @return {qx.ui.menu.Menu}\r
+        */\r
        createMenuFromIds : function(commandIdsArray){\r
                var defs = this.getDefinitions();\r
                var contextMenu = new qx.ui.menu.Menu();\r
@@ -192,7 +235,11 @@ qx.Class.define("org.argeo.ria.event.CommandsManager",
                }\r
                return contextMenu;\r
        },\r
-       \r
+       /**\r
+        * Add a new set of commands definitions\r
+        * @param definitions {Map} a set of commands definitions.\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
                for(var key in definitions){\r
@@ -202,6 +249,10 @@ qx.Class.define("org.argeo.ria.event.CommandsManager",
                this.setDefinitions(crtDefs);\r
                this.fireEvent("changedCommands");\r
        },\r
+       /**\r
+        * Removes a whole set of commands by their definitions maps.\r
+        * @param definitions {Map} a set of commands definitions\r
+        */\r
        removeCommands : function(definitions){\r
                var crtDefs = this.getDefinitions();\r
                var initDefs = this.getInitialDefinitions();\r
@@ -216,19 +267,30 @@ qx.Class.define("org.argeo.ria.event.CommandsManager",
                this.setDefinitions(crtDefs);\r
                this.fireEvent("changedCommands");\r
        },\r
-       \r
+       /**\r
+        * Executes a command by its id.\r
+        * @param commandId {String} The command id.\r
+        */\r
        executeCommand : function(commandId){\r
                var defs = this.getDefinitions();\r
                if(defs[commandId] && defs[commandId].command.getEnabled()){\r
                        defs[commandId].command.execute();\r
                }\r
        },\r
+       /**\r
+        * Retrieves a command by its id.\r
+        * @param commandId {String} The command id.\r
+        */\r
        getCommandById : function(commandId){\r
                var defs = this.getDefinitions();\r
                if(defs[commandId] && defs[commandId].command){\r
                        return defs[commandId].command;\r
                }               \r
        },\r
+       /**\r
+        * Add a standard context menu to a toolbar for button look and feel (show icon, text, both).\r
+        * @param toolbar {qx.ui.toolbar.ToolBar} The toolbar\r
+        */\r
        addToolbarContextMenu : function(toolbar){\r
                var menu = new qx.ui.menu.Menu();\r
                var icon = new qx.ui.menu.RadioButton("Show Icons");\r
index d86b0d1fefb00b441a546cf80cc4672468005a53..2877a733523b11f3b66046fda56586ffcffb2c9c 100644 (file)
@@ -1,12 +1,8 @@
-/* ************************************************************************\r
-\r
-  Copyright: 2008 Argeo\r
-\r
-   License: \r
-\r
-   Authors: Charles du Jeu\r
-\r
-************************************************************************ */\r
+/**\r
+ * This can be triggered at the end of a IO Request. In that case, it contains\r
+ * a data type as an identifier, and the request response itself.\r
+ * Can be used this way to listen for data changes from various parts of the application.\r
+ */\r
 qx.Class.define("org.argeo.ria.event.ReloadEvent",\r
 {\r
        extend : qx.event.type.Event,\r
@@ -15,13 +11,24 @@ qx.Class.define("org.argeo.ria.event.ReloadEvent",
                this.base(arguments);\r
        },\r
        members : {\r
+               /**\r
+                * Basic initialisation of event\r
+                * @param dataType {String} a unique data identifier\r
+                * @param content {mixed} the retrieved data\r
+                */\r
                init: function(dataType, content){\r
                        this.setDataType(dataType);\r
                        this.setContent(content);                       \r
                }\r
        },\r
        properties :{\r
-               dataType : {init:null},\r
+               /**\r
+                * A unique data identifier \r
+                */\r
+               dataType : {init:null, check:"String"},\r
+               /**\r
+                * The new data content \r
+                */\r
                content : {init:null}\r
        }\r
 });
\ No newline at end of file
diff --git a/org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/event/__init__.js b/org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/event/__init__.js
new file mode 100644 (file)
index 0000000..417cbb5
--- /dev/null
@@ -0,0 +1,5 @@
+/**\r
+ * Event utilities, this package is the "controller" part of the application (in an classic MVC view).\r
+ * The commandsManager singleton is in charge of wiring all the commands inside the application.\r
+ *\r
+ */
\ No newline at end of file
index d6173b62a63d32bd36be3b882ecec0c1a653269f..0b79b272de38e3cf04d1b6dd37013e4fb66bc5c6 100644 (file)
@@ -1,9 +1,22 @@
+/**\r
+ * A management class for all request sent to the server\r
+ * Basically, to access the server, always get a new Request object from this class.\r
+ * It will then trigger various user-interface events during the Request lifecycle. \r
+ * \r
+ * For the moment, it's about the "Stop" button command, handling any passed ILoadStatusable states, \r
+ * and logging the Request status/errors.\r
+ * \r
+ * @author Charles du Jeu\r
+ */\r
 qx.Class.define("org.argeo.ria.remote.RequestManager",\r
 {\r
        type : "singleton",\r
        extend : qx.core.Object,\r
   \r
        events : {\r
+               /**\r
+                * Triggered on the user demand at the end of the Request \r
+                */\r
                "reload" : "org.argeo.ria.event.ReloadEvent"\r
        },\r
        \r
@@ -12,11 +25,26 @@ qx.Class.define("org.argeo.ria.remote.RequestManager",
        },\r
        \r
        members : {\r
-               \r
+               /**\r
+                * Sets the unique "stop" command of the application.\r
+                * @param stopCommand {org.argeo.ria.event.Command} The command\r
+                */\r
                setStopCommand : function(stopCommand){\r
                        this.command = stopCommand;\r
                },\r
                \r
+               /**\r
+                * Creates a Request and handle various parts of its lifecycle.\r
+                * @see org.argeo.ria.event.ReloadEvent\r
+                * @see org.argeo.ria.components.ILoadStatusable\r
+                * \r
+                * @param url {String} The server url\r
+                * @param method {String} Connexion method (POST, GET, etc.)\r
+                * @param responseType {String} Expected response mime type (application/xml, etc...).\r
+                * @param fireReloadEventType {String} On user-demand, if this parameter is not null, a org.argeo.ria.event.ReloadEvent will be triggered when the request is completed. \r
+                * @param iLoadStatusables {Array} An array of ILoadStatusable implementations that need to be updated by the Request state (loading/ended).\r
+                * @return {qx.io.remote.Request}\r
+                */\r
                getRequest : function(url, method, responseType, fireReloadEventType, iLoadStatusables){\r
                        var request = new qx.io.remote.Request(url, method, responseType);\r
                        if(iLoadStatusables){\r
@@ -35,20 +63,37 @@ qx.Class.define("org.argeo.ria.remote.RequestManager",
                        return request;\r
                },              \r
        \r
+               /**\r
+                * Creates a ReloadEvent and fire it.\r
+                * @param dataType {String} The data type \r
+                * @param content {mixed} The content of the request response.\r
+                */\r
                fireReloadEvent : function(dataType, content){\r
                        this.fireEvent("reload", org.argeo.ria.event.ReloadEvent, [dataType, content]);                 \r
                },\r
                \r
+               /**\r
+                * Triggered when request is created\r
+                * @param e {qx.event.type.Event} The event\r
+                */\r
                requestCreated : function(e){\r
                        var request = e.getTarget();\r
                        this.enableCommand(request);\r
                },\r
                \r
+               /**\r
+                * Triggered when request is completed normally\r
+                * @param e {qx.event.type.Event} The event\r
+                */\r
                requestCompleted : function(e){\r
                        var request = e.getTarget();\r
                        this.disableCommand(request);\r
                },\r
                \r
+               /**\r
+                * Triggered when request is completed abnormally\r
+                * @param e {qx.event.type.Event} The event\r
+                */\r
                requestTerminated : function(e){\r
                        var request = e.getTarget();\r
                        var errorType = e.getType();\r
@@ -64,6 +109,10 @@ qx.Class.define("org.argeo.ria.remote.RequestManager",
                        this.error(message);\r
                },\r
                \r
+               /**\r
+                * Triggered by a request creation. Update the GUI parts according to its status. \r
+                * @param request {qx.io.remote.Request} The current Request \r
+                */\r
                disableCommand : function(request){\r
                        this.command.setEnabled(false);\r
                        if(request.getUserData("iLoadStatusables")){\r
@@ -75,6 +124,10 @@ qx.Class.define("org.argeo.ria.remote.RequestManager",
                        }\r
                },\r
                \r
+               /**\r
+                * Triggered by a request ending. Update the GUI parts according to its status. \r
+                * @param request {qx.io.remote.Request} The current Request \r
+                */\r
                enableCommand : function(request){\r
                        this.command.setEnabled(true);\r
                        if(request.getUserData("iLoadStatusables")){\r
@@ -86,6 +139,11 @@ qx.Class.define("org.argeo.ria.remote.RequestManager",
                        this.command.addListener("execute", listener, request);\r
                },\r
                \r
+               /**\r
+                * Update the ILoadStatusable implementations\r
+                * @param iLoadStatusables {Array} An array of ILoadStatusable \r
+                * @param loadStatus {Boolean} The current status of a request \r
+                */\r
                updateGuiParts : function(iLoadStatusables, loadStatus){\r
                        for(var i=0;i<iLoadStatusables.length;i++){\r
                                if(qx.Class.implementsInterface(qx.Class.getByName(iLoadStatusables[i].classname), org.argeo.ria.components.ILoadStatusable)){\r
diff --git a/org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/remote/__init__.js b/org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/remote/__init__.js
new file mode 100644 (file)
index 0000000..ca5cf63
--- /dev/null
@@ -0,0 +1,4 @@
+/**\r
+ * Communication with server package. \r
+ *\r
+ */
\ No newline at end of file
diff --git a/org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/test/__init__.js b/org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/test/__init__.js
new file mode 100644 (file)
index 0000000..6700c72
--- /dev/null
@@ -0,0 +1,4 @@
+/**\r
+ * Unit tests to be executed by the TestRunner application.\r
+ *\r
+ */
\ No newline at end of file
index bfa90fee22d4e3d63bd99a41f49c91cccabd5197..3fbb6f04218fcbd3e8e49cd92ee0b786f40cee6e 100644 (file)
@@ -1,11 +1,7 @@
-/* ************************************************************************\r
-\r
-       Overrides the Qooxdoo qx.xml.Element to handle the namespace prefixes!!\r
-\r
-************************************************************************ */\r
-\r
 /**\r
  * Cross browser XML Element API\r
+ * \r
+ * Overrides the Qooxdoo qx.xml.Element to handle the namespace prefixes\r
  *\r
  * http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/81f3de54-3b79-46dc-8e01-73ca2d94cdb5.asp\r
  * http://developer.mozilla.org/en/docs/Parsing_and_serializing_XML\r
@@ -22,7 +18,7 @@ qx.Class.define("org.argeo.ria.util.Element",
      * @param query {String} XPath query\r
      * @param NSMap (Object) A map matching namespace prefixes to namespace URIS;\r
      * @return {Element} first matching element\r
-     * @signature function(element, query)\r
+     * @signature function(element, query, NSMap)\r
      */\r
     selectSingleNode : qx.core.Variant.select("qx.client",\r
     {\r
@@ -75,7 +71,7 @@ qx.Class.define("org.argeo.ria.util.Element",
      * @param query {String} XPath query\r
      * @param NSMap {Map} Mapping between namespaces prefixes and URI.\r
      * @return {Element[]} List of matching elements\r
-     * @signature function(element, query)\r
+     * @signature function(element, query, NSMap)\r
      */\r
     selectNodes : qx.core.Variant.select("qx.client",\r
     {\r
diff --git a/org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/util/__init__.js b/org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/util/__init__.js
new file mode 100644 (file)
index 0000000..d4ba4d1
--- /dev/null
@@ -0,0 +1,5 @@
+/**\r
+ * Various utilitary classes, especially qooxdoo framework extensions \r
+ * to fix various bugs or missing features.\r
+ *\r
+ */
\ No newline at end of file
index 7ab5045fdc03df9a45e28b80ca722277d08c0d96..2635efd86453e018576d859163dc433d0293b79e 100644 (file)
@@ -15,7 +15,7 @@ qx.Class.define("org.argeo.slc.web.Perspective",
        initViewPanes : function(viewsManager){\r
                \r
       var splitPane = new qx.ui.splitpane.Pane("horizontal");\r
-         var topLeft = new org.argeo.ria.components.ViewPane(this, "list", "Collection", {\r
+         var topLeft = new org.argeo.ria.components.ViewPane("list", "Collection", {\r
                orientation : "horizontal",\r
                min : 36\r
          });\r
@@ -23,7 +23,7 @@ qx.Class.define("org.argeo.slc.web.Perspective",
          viewsManager.registerViewPane(topLeft);\r
            \r
          splitPane.add(topLeft, 0);\r
-         var rightPane = new org.argeo.ria.components.ViewPane(this, "applet", "Test Detail");           \r
+         var rightPane = new org.argeo.ria.components.ViewPane("applet", "Test Detail");         \r
          viewsManager.registerViewPane(rightPane);\r
          splitPane.add(rightPane, 1);\r
       \r