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%2Fcomponents%2FViewsManager.js;h=225bc693bca4ee9b6d7b28d1657eb5c3b5dbfe21;hb=86f06959d772c750a516780b448d5cbfa16cd48e;hp=56420d3b952afef236fc0d0feabf8f8f1949392c;hpb=81d7470df58e4d921fea676145b6fd7a477f7248;p=gpl%2Fargeo-slc.git diff --git a/org.argeo.slc.webapp/src/main/webapp/argeo-ria-src/class/org/argeo/ria/components/ViewsManager.js b/org.argeo.slc.webapp/src/main/webapp/argeo-ria-src/class/org/argeo/ria/components/ViewsManager.js index 56420d3b9..225bc693b 100644 --- a/org.argeo.slc.webapp/src/main/webapp/argeo-ria-src/class/org/argeo/ria/components/ViewsManager.js +++ b/org.argeo.slc.webapp/src/main/webapp/argeo-ria-src/class/org/argeo/ria/components/ViewsManager.js @@ -19,6 +19,9 @@ qx.Class.define("org.argeo.ria.components.ViewsManager", * The main container for the org.argeo.ria.components.ViewPane instances. */ viewPanesContainer : {init: null}, + /** + * Keeps the currently focused viewPane. + */ currentFocus : {init :null} }, construct : function(){ @@ -31,6 +34,7 @@ qx.Class.define("org.argeo.ria.components.ViewsManager", * * @param classObj {Clazz} The class object to instantiate * @param viewPaneId {String} The unique ID of the view pane + * @param data {Mixed} Any data provided by the opener. * @return {org.argeo.ria.components.IView} */ initIViewClass: function(classObj, viewPaneId, data){ @@ -48,7 +52,8 @@ qx.Class.define("org.argeo.ria.components.ViewsManager", viewPane.setCommands(commands); org.argeo.ria.event.CommandsManager.getInstance().addCommands(commands, "view:"+viewPaneId, viewPaneId); } - viewPane.setContent(iView); + viewPane.setContent(iView); + this.setViewPaneFocus(viewPane); return iView; }, @@ -64,13 +69,20 @@ qx.Class.define("org.argeo.ria.components.ViewsManager", org.argeo.ria.event.CommandsManager.getInstance().refreshCommands(viewSelection); }); viewPane.addListener("changeFocus", function(e){ - for(var key in this.views){ - this.views[key].blur(); - } - viewPane.focus(); - this.setCurrentFocus(viewPane); + this.setViewPaneFocus(e.getTarget()); }, this); }, + /** + * Sets a given viewPane as the currently focused one. Blur the others. + * @param viewPane {org.argeo.ria.components.ViewPane} The viewPane (or TabbedViewPane) to focus on. + */ + setViewPaneFocus : function(viewPane){ + for(var key in this.views){ + this.views[key].blur(); + } + this.setCurrentFocus(viewPane); + viewPane.focus(); + }, /** * Returns a viewPane by its unique id. * @param viewPaneId {String} The unique id