]>
git.argeo.org Git - gpl/argeo-slc.git/blob - components/ViewsManager.js
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
= new classObj
;
37 var viewPane
= this.getViewPaneById(viewPaneId
);
39 var commands
= iView
.getCommands();
42 viewPane
.setCommands(commands
);
43 org
.argeo
.ria
.event
.CommandsManager
.getInstance().addCommands(commands
, iView
);
45 viewPane
.setContent(iView
);
50 * Registers a new viewPane
51 * @param viewPane {org.argeo.ria.components.ViewPane} The new ViewPane instance
53 registerViewPane : function(viewPane
){
54 this.views
[viewPane
.getViewId()] = viewPane
;
55 viewPane
.getViewSelection().addListener("changeSelection", function(e
){
56 org
.argeo
.ria
.event
.CommandsManager
.getInstance().refreshCommands(e
.getData());
60 * Returns a viewPane by its unique id.
61 * @param viewPaneId {String} The unique id
62 * @return {org.argeo.ria.components.ViewPane}
64 getViewPaneById : function(viewPaneId
){
65 if(this.views
[viewPaneId
]) return this.views
[viewPaneId
];
66 throw new Error("Cannot find view '"+viewPaneId
+"'");
69 * Returns a viewPane current viewSelection object
70 * @param viewPaneId {String} The unique id.
71 * @return {org.argeo.ria.components.ViewSelection}
73 getViewPaneSelection : function(viewPaneId
){
74 return this.getViewPaneById(viewPaneId
).getViewSelection();
77 * Changes a viewPane title dynamically.
78 * @param viewPaneId {String} ViewPane unique Id.
79 * @param viewTitle {String} the new title for this viewPane.
81 setViewPaneTitle : function(viewPaneId
, viewTitle
){
82 this.getViewPaneById(viewPaneId
).setViewTitle(viewTitle
);