]>
git.argeo.org Git - gpl/argeo-slc.git/blob - org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/components/ViewsManager.js
2b0815d5ecddc7b94857d0cb2c6bafc5e1867a67
2 * The main "view" manager (in a standard MVC conception) of the application.
3 * It register various containers org.argeo.ria.components.viewPane and feed them with org.argeo.ria.components.IView implementations.
4 * It is a singleton and can thus be called by any part of the application.
6 * @author Charles du Jeu
8 qx
.Class
.define("org.argeo.ria.components.ViewsManager",
11 extend
: qx
.core
.Object
,
15 * The application root (like Application.getRoot()), used to attach and show modal windows.
17 applicationRoot
: {init
: null},
19 * The main container for the org.argeo.ria.components.ViewPane instances.
21 viewPanesContainer
: {init
: null}
23 construct : function(){
28 * Initialize and load a given IView implementation into a viewPane.
29 * The IView itself is returned.
31 * @param classObj {Clazz} The class object to instantiate
32 * @param viewPaneId {String} The unique ID of the view pane
33 * @return {org.argeo.ria.components.IView}
35 initIViewClass: function(classObj
, viewPaneId
){
36 //var iView = eval("new "+iViewClass+"()");
37 //var classObj = qx.Class.getByName(iViewClass);
38 var iView
= new classObj
;
39 var viewPane
= this.getViewPaneById(viewPaneId
);
41 var commands
= iView
.getCommands();
44 viewPane
.setCommands(commands
);
45 org
.argeo
.ria
.event
.CommandsManager
.getInstance().addCommands(commands
, iView
);
47 viewPane
.setContent(iView
);
52 * Registers a new viewPane
53 * @param viewPane {org.argeo.ria.components.ViewPane} The new ViewPane instance
55 registerViewPane : function(viewPane
){
56 this.views
[viewPane
.getViewId()] = viewPane
;
57 viewPane
.getViewSelection().addListener("changeSelection", function(e
){
58 org
.argeo
.ria
.event
.CommandsManager
.getInstance().refreshCommands(e
.getData());
62 * Returns a viewPane by its unique id.
63 * @param viewPaneId {String} The unique id
64 * @return {org.argeo.ria.components.ViewPane}
66 getViewPaneById : function(viewPaneId
){
67 if(this.views
[viewPaneId
]) return this.views
[viewPaneId
];
68 throw new Error("Cannot find view '"+viewPaneId
+"'");
71 * Returns a viewPane current viewSelection object
72 * @param viewPaneId {String} The unique id.
73 * @return {org.argeo.ria.components.ViewSelection}
75 getViewPaneSelection : function(viewPaneId
){
76 return this.getViewPaneById(viewPaneId
).getViewSelection();
79 * Changes a viewPane title dynamically.
80 * @param viewPaneId {String} ViewPane unique Id.
81 * @param viewTitle {String} the new title for this viewPane.
83 setViewPaneTitle : function(viewPaneId
, viewTitle
){
84 this.getViewPaneById(viewPaneId
).setViewTitle(viewTitle
);