/**\r
+ * The main "view" manager (in a standard MVC conception) of the application.\r
+ * It register various containers org.argeo.ria.components.viewPane and feed them with org.argeo.ria.components.IView implementations.\r
+ * It is a singleton and can thus be called by any part of the application.\r
+ * \r
* @author Charles du Jeu\r
*/\r
qx.Class.define("org.argeo.ria.components.ViewsManager",\r
extend : qx.core.Object,\r
\r
properties : {\r
+ /**\r
+ * The application root (like Application.getRoot()), used to attach and show modal windows.\r
+ */\r
applicationRoot : {init : null},\r
+ /**\r
+ * The main container for the org.argeo.ria.components.ViewPane instances. \r
+ */\r
viewPanesContainer : {init: null}\r
},\r
construct : function(){\r
this.views = {};\r
},\r
members : {\r
- \r
+ /**\r
+ * Initialize and load a given IView implementation into a viewPane.\r
+ * The IView itself is returned.\r
+ * \r
+ * @param classObj {Clazz} The class object to instantiate\r
+ * @param viewPaneId {String} The unique ID of the view pane\r
+ * @return {org.argeo.ria.components.IView}\r
+ */\r
initIViewClass: function(classObj, viewPaneId){\r
//var iView = eval("new "+iViewClass+"()");\r
//var classObj = qx.Class.getByName(iViewClass);\r
return iView;\r
},\r
\r
+ /**\r
+ * Registers a new viewPane\r
+ * @param viewPane {org.argeo.ria.components.ViewPane} The new ViewPane instance\r
+ */\r
registerViewPane : function(viewPane){\r
this.views[viewPane.getViewId()] = viewPane;\r
viewPane.getViewSelection().addListener("changeSelection", function(e){\r
org.argeo.ria.event.CommandsManager.getInstance().refreshCommands(e.getData());\r
}); \r
},\r
+ /**\r
+ * Returns a viewPane by its unique id.\r
+ * @param viewPaneId {String} The unique id\r
+ * @return {org.argeo.ria.components.ViewPane}\r
+ */\r
getViewPaneById : function(viewPaneId){\r
if(this.views[viewPaneId]) return this.views[viewPaneId];\r
throw new Error("Cannot find view '"+viewPaneId+"'"); \r
},\r
+ /**\r
+ * Returns a viewPane current viewSelection object\r
+ * @param viewPaneId {String} The unique id. \r
+ * @return {org.argeo.ria.components.ViewSelection}\r
+ */\r
getViewPaneSelection : function(viewPaneId){\r
return this.getViewPaneById(viewPaneId).getViewSelection();\r
},\r
+ /**\r
+ * Changes a viewPane title dynamically.\r
+ * @param viewPaneId {String} ViewPane unique Id. \r
+ * @param viewTitle {String} the new title for this viewPane.\r
+ */\r
setViewPaneTitle : function(viewPaneId, viewTitle){\r
this.getViewPaneById(viewPaneId).setViewTitle(viewTitle);\r
}\r