X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.slc.webapp%2Fsrc%2Fmain%2Fwebapp%2Fargeo-ria-src%2Fclass%2Forg%2Fargeo%2Fria%2Fevent%2FCommandsManager.js;h=422856f18f75bab79ac17fd7e2646f3e4e4ee777;hb=fbb37515d94515993468c998516fe8341189ef84;hp=0f6f1182a9817b3df28e04edc9b632222be533f6;hpb=78e2e2aa5067f09dc6633ebceee13d524f8f0951;p=gpl%2Fargeo-slc.git diff --git a/org.argeo.slc.webapp/src/main/webapp/argeo-ria-src/class/org/argeo/ria/event/CommandsManager.js b/org.argeo.slc.webapp/src/main/webapp/argeo-ria-src/class/org/argeo/ria/event/CommandsManager.js index 0f6f1182a..422856f18 100644 --- a/org.argeo.slc.webapp/src/main/webapp/argeo-ria-src/class/org/argeo/ria/event/CommandsManager.js +++ b/org.argeo.slc.webapp/src/main/webapp/argeo-ria-src/class/org/argeo/ria/event/CommandsManager.js @@ -3,6 +3,7 @@ * thus can be called by any part of the application. * This will wire all the commands that can be defined dynamically by any IView, and add their * corresponding buttons to the application menubar and toolbars. + * See the "definitions" property documentation below for more info on how to define new commands. * * @author Charles du Jeu */ @@ -20,7 +21,56 @@ qx.Class.define("org.argeo.ria.event.CommandsManager", properties : { /** - * Commands definitions + * The commands definitions is a Map described as below + *
+ * { + * label : "", + * | The label of the action + * + * icon : "", + * | The icon image + * + * shortcut : "", + * | The keyboard shortcut, as defined in qooxdoo (Control+s, Alt+k, etc.). Warning, the letter must be lowercase. + * + * enabled : true, + * | Whether it is enabled or disabled at creation + * + * menu : ""|null, + * | The menu group to which the command will be added. If null, will not appear in the menus. + * + * menuPosition : "first"|"last" + * | Optional : force the menu group to be first or last in the menubar. + * + * toolbar : ""|null, + * | The toolbar group to which the command will be added. If null, will not appear in the toolbars. + * + * init : function(){}, + * | Optional function called at command creation. + * | Function context : the command itself + * + * callback : function(e){}, + * | The main callback to be triggered when command is executed. + * | Function context : the current class (not the command!) + * + * selectionChange : function(viewPaneId, xmlNodes){}, + * | Optional function called each time a selectionChange is detected in one of the active viewPane. + * | The origin viewPaneId and the new selection as a map of nodes are passed as arguments. + * | Function context : the command itself. + * + * submenu : [{label:"", icon:"", commandId:""}, ...], + * | If set, the command will create a submenu, being in a menu or in the toolbar. + * | The submenu is created with the various array entries, and the submenuCallback function + * | will be called with the 'commandId' parameter when a submenu entry is selected. + * + * submenuCallback : function(commandId){}, + * | Callback if command is a submenu (cf. above). + * | Function context : the current class/ + * + * command : null + * | For internal use only, caching the actual org.argeo.ria.event.Command object. + * } + ** @see org.argeo.ria.event.Command for the definition Map details. */ definitions : { @@ -85,7 +135,7 @@ qx.Class.define("org.argeo.ria.event.CommandsManager", events : { /** - * Triggered when the whole commands list is changed. + * Triggered when the whole commands list is changed. Mainly used internally by the manager. */ "changedCommands" : "qx.event.type.Event" }, @@ -244,9 +294,9 @@ qx.Class.define("org.argeo.ria.event.CommandsManager", return contextMenu; }, /** - * Add a new set of commands definitions + * Add a new set of commands definitions. See the definitions property of this class. * @param definitions {Map} a set of commands definitions. - * @param callbackContext {qx.ui.core.Object} The context used inside the commands callbacks. + * @param callbackContext {qx.ui.core.Object} The context used inside the commands callbacks. */ addCommands : function(definitions, callbackContext){ var crtDefs = this.getDefinitions();