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=f4e38a4084211662b58faa004fe74c20f0398f05;hb=6ae24373b4153f19984831a5f456c18f763bf279;hp=6452a3a87f313761fed6a9bf8670ef52ff2b5f6e;hpb=81d7470df58e4d921fea676145b6fd7a477f7248;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 6452a3a87..f4e38a408 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 @@ -84,6 +84,9 @@ qx.Class.define("org.argeo.ria.event.CommandsManager", init : {}, check : "Map" }, + /** + * Special command definitions that are shared between focusable parts. + */ sharedDefinitions : { init: {}, check: "Map" @@ -105,6 +108,10 @@ qx.Class.define("org.argeo.ria.event.CommandsManager", members : { + /** + * Initialize the manager with basic definitions. + * @param initDefinitions {Map} A map of commands definitions. + */ init : function(initDefinitions){ this.setDefinitions(initDefinitions); this.setInitialDefinitions(qx.lang.Object.copy(initDefinitions)); @@ -133,6 +140,9 @@ qx.Class.define("org.argeo.ria.event.CommandsManager", command.setEnabled(definition.enabled); if(definition.toggle){ command.setToggle(true); + if(definition.toggleInitialState){ + command.setToggleInitialState(definition.toggleInitialState); + } } this._attachListener(command, definition.callback, definition.callbackContext); if(definition.init){ @@ -185,6 +195,7 @@ qx.Class.define("org.argeo.ria.event.CommandsManager", if(!definition.selectionChange) continue; if(shared[key]){ var currentFocus = org.argeo.ria.components.ViewsManager.getInstance().getCurrentFocus(); + //this.debug(currentFocus); if(!currentFocus) continue; var sharedComm = shared[key][currentFocus.getViewId()]; if(sharedComm && sharedComm.selectionChange){ @@ -283,7 +294,8 @@ qx.Class.define("org.argeo.ria.event.CommandsManager", /** * 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. + * @param focusablePartId {String} A string identifying the associated focusable part, like "view:viewId". */ addCommands : function(definitions, callbackContext, focusablePartId){ var crtDefs = this.getDefinitions(); @@ -308,6 +320,7 @@ qx.Class.define("org.argeo.ria.event.CommandsManager", /** * Removes a whole set of commands by their definitions maps. * @param definitions {Map} a set of commands definitions + * @param focusablePartId {String} A string identifying the associated focusable part, like "view:viewId". */ removeCommands : function(definitions, focusablePartId){ var crtDefs = this.getDefinitions(); @@ -409,6 +422,8 @@ qx.Class.define("org.argeo.ria.event.CommandsManager", } var currentFocus = org.argeo.ria.components.ViewsManager.getInstance().getCurrentFocus(); if(currentFocus && currentFocus.getViewId() && callbacks[currentFocus.getViewId()]){ + var currentViewId = currentFocus.getViewId(); + view = org.argeo.ria.components.ViewsManager.getInstance().getViewPaneById(currentViewId).getContent(); var binded = qx.lang.Function.bind(callbacks[currentFocus.getViewId()], view); binded(event); return;