X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.slc.webapp%2Fsrc%2Fmain%2Fwebapp%2Fsource%2Fclass%2Forg%2Fargeo%2Fria%2Fcomponents%2FViewsManager.js;h=2b0815d5ecddc7b94857d0cb2c6bafc5e1867a67;hb=2086a63ded097d7a0525aeeb441e6a1dad05cba6;hp=2678eba51920d78641748aa5665fd2c1ab34534d;hpb=8f4e4722a346442a8ed1ca84efa24b60bfaf3d19;p=gpl%2Fargeo-slc.git diff --git a/org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/components/ViewsManager.js b/org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/components/ViewsManager.js index 2678eba51..2b0815d5e 100644 --- a/org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/components/ViewsManager.js +++ b/org.argeo.slc.webapp/src/main/webapp/source/class/org/argeo/ria/components/ViewsManager.js @@ -1,4 +1,8 @@ /** + * The main "view" manager (in a standard MVC conception) of the application. + * It register various containers org.argeo.ria.components.viewPane and feed them with org.argeo.ria.components.IView implementations. + * It is a singleton and can thus be called by any part of the application. + * * @author Charles du Jeu */ qx.Class.define("org.argeo.ria.components.ViewsManager", @@ -7,14 +11,27 @@ qx.Class.define("org.argeo.ria.components.ViewsManager", extend : qx.core.Object, properties : { + /** + * The application root (like Application.getRoot()), used to attach and show modal windows. + */ applicationRoot : {init : null}, + /** + * The main container for the org.argeo.ria.components.ViewPane instances. + */ viewPanesContainer : {init: null} }, construct : function(){ this.views = {}; }, members : { - + /** + * Initialize and load a given IView implementation into a viewPane. + * The IView itself is returned. + * + * @param classObj {Clazz} The class object to instantiate + * @param viewPaneId {String} The unique ID of the view pane + * @return {org.argeo.ria.components.IView} + */ initIViewClass: function(classObj, viewPaneId){ //var iView = eval("new "+iViewClass+"()"); //var classObj = qx.Class.getByName(iViewClass); @@ -31,19 +48,38 @@ qx.Class.define("org.argeo.ria.components.ViewsManager", return iView; }, + /** + * Registers a new viewPane + * @param viewPane {org.argeo.ria.components.ViewPane} The new ViewPane instance + */ registerViewPane : function(viewPane){ this.views[viewPane.getViewId()] = viewPane; viewPane.getViewSelection().addListener("changeSelection", function(e){ org.argeo.ria.event.CommandsManager.getInstance().refreshCommands(e.getData()); }); }, + /** + * Returns a viewPane by its unique id. + * @param viewPaneId {String} The unique id + * @return {org.argeo.ria.components.ViewPane} + */ getViewPaneById : function(viewPaneId){ if(this.views[viewPaneId]) return this.views[viewPaneId]; throw new Error("Cannot find view '"+viewPaneId+"'"); }, + /** + * Returns a viewPane current viewSelection object + * @param viewPaneId {String} The unique id. + * @return {org.argeo.ria.components.ViewSelection} + */ getViewPaneSelection : function(viewPaneId){ return this.getViewPaneById(viewPaneId).getViewSelection(); }, + /** + * Changes a viewPane title dynamically. + * @param viewPaneId {String} ViewPane unique Id. + * @param viewTitle {String} the new title for this viewPane. + */ setViewPaneTitle : function(viewPaneId, viewTitle){ this.getViewPaneById(viewPaneId).setViewTitle(viewTitle); }