]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - org.argeo.slc.webapp/src/main/webapp/argeo-ria-src/class/org/argeo/ria/event/CommandsManager.js
Documentation
[gpl/argeo-slc.git] / org.argeo.slc.webapp / src / main / webapp / argeo-ria-src / class / org / argeo / ria / event / CommandsManager.js
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