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