X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.slc.webapp%2Fsrc%2Fmain%2Fwebapp%2Fargeo-ria-src%2Fclass%2Forg%2Fargeo%2Fria%2FApplication.js;h=a1e5901f18802149bf3ac692af8ec7ea8e71c8ab;hb=3e24f32c95b5ac3ec7fcae7000c4a8cfb857d514;hp=793bb90565078c88f9ffec1dcb554e179eb08c24;hpb=78d566f3265acbf80ccc158c01377b49ecac3492;p=gpl%2Fargeo-slc.git diff --git a/org.argeo.slc.webapp/src/main/webapp/argeo-ria-src/class/org/argeo/ria/Application.js b/org.argeo.slc.webapp/src/main/webapp/argeo-ria-src/class/org/argeo/ria/Application.js index 793bb9056..a1e5901f1 100644 --- a/org.argeo.slc.webapp/src/main/webapp/argeo-ria-src/class/org/argeo/ria/Application.js +++ b/org.argeo.slc.webapp/src/main/webapp/argeo-ria-src/class/org/argeo/ria/Application.js @@ -26,17 +26,29 @@ qx.Class.define("org.argeo.ria.Application", }, properties : { + /** + * Available perspective detected in the current compilation. + */ perspectives : { check : "Map", init : {} }, + /** + * Currently layouted perspective label + */ activePerspectiveName : { check : "String", init : "" }, + /** + * Currently layouted perspective. + */ activePerspective : { init : null }, + /** + * Basic command associated to the application, applicable to all perspectives. + */ commandsDefinitions : { init : { "stop" : { @@ -112,7 +124,17 @@ qx.Class.define("org.argeo.ria.Application", var viewsManager = org.argeo.ria.components.ViewsManager.getInstance(); viewsManager.setApplicationRoot(this.getRoot()); - + + /* + var appli = this; + qx.bom.Event.addNativeListener(window, "unload", function(){ + // TODO : Close perspective if one is open. + if(appli.getActivePerspective()){ + alert(appli.getActivePerspective()); + appli.getActivePerspective().remove(org.argeo.ria.components.ViewsManager.getInstance()); + } + }); + */ // Enable logging in debug variant if (qx.core.Variant.isSet("qx.debug", "on")) { @@ -181,6 +203,10 @@ qx.Class.define("org.argeo.ria.Application", this.loadPerspective(); }, + /** + * Load a given perspective by its name. + * @param perspectiveName {String} Perspective to load + */ loadPerspective : function(perspectiveName){ if(perspectiveName){ this.setActivePerspectiveName(perspectiveName); @@ -204,6 +230,9 @@ qx.Class.define("org.argeo.ria.Application", this.setActivePerspective(perspective); }, + /** + * After switching perspective, call this function to rebuild menu with the right selected. + */ rebuildPerspectiveMenus : function(){ var switchCommand = this.getCommandsDefinitions()["switchperspective"]; switchCommand.submenu = []; @@ -220,6 +249,29 @@ qx.Class.define("org.argeo.ria.Application", switchCommand.command.clearMenus(); switchCommand.command.setMenu(switchCommand.submenu); } + }, + + /** + * Specific action of calling an external URL without triggering the "close()" method + * of Application. + * @param hrefValue {String} A download url that should reply with specific "attachment" header to avoid leaving the application. + */ + javascriptDownloadLocation: function(hrefValue){ + this.interruptClose = true; + document.location.href = hrefValue; + this.interruptClose = false; + }, + + /** + * Called at Application ending (closing the browser). + */ + close : function(){ + if(this.interruptClose) return ; + if(this.getActivePerspective()){ + this.getActivePerspective().remove(org.argeo.ria.components.ViewsManager.getInstance()); + } + this.base(arguments); + } }