},\r
\r
properties : {\r
+ /**\r
+ * Available perspective detected in the current compilation.\r
+ */\r
perspectives : {\r
check : "Map",\r
init : {}\r
},\r
+ /**\r
+ * Currently layouted perspective label\r
+ */\r
activePerspectiveName : {\r
check : "String",\r
init : ""\r
},\r
+ /**\r
+ * Currently layouted perspective.\r
+ */\r
activePerspective : {\r
init : null\r
},\r
+ /**\r
+ * Basic command associated to the application, applicable to all perspectives.\r
+ */\r
commandsDefinitions : {\r
init : {\r
"stop" : {\r
\r
var viewsManager = org.argeo.ria.components.ViewsManager.getInstance();\r
viewsManager.setApplicationRoot(this.getRoot());\r
- \r
+ \r
+ /*\r
+ var appli = this;\r
+ qx.bom.Event.addNativeListener(window, "unload", function(){\r
+ // TODO : Close perspective if one is open. \r
+ if(appli.getActivePerspective()){\r
+ alert(appli.getActivePerspective());\r
+ appli.getActivePerspective().remove(org.argeo.ria.components.ViewsManager.getInstance());\r
+ } \r
+ });\r
+ */\r
// Enable logging in debug variant\r
if (qx.core.Variant.isSet("qx.debug", "on"))\r
{\r
this.loadPerspective();\r
},\r
\r
+ /**\r
+ * Load a given perspective by its name.\r
+ * @param perspectiveName {String} Perspective to load\r
+ */\r
loadPerspective : function(perspectiveName){\r
if(perspectiveName){\r
this.setActivePerspectiveName(perspectiveName);\r
this.setActivePerspective(perspective);\r
},\r
\r
+ /**\r
+ * After switching perspective, call this function to rebuild menu with the right selected.\r
+ */\r
rebuildPerspectiveMenus : function(){\r
var switchCommand = this.getCommandsDefinitions()["switchperspective"];\r
switchCommand.submenu = [];\r
switchCommand.command.clearMenus();\r
switchCommand.command.setMenu(switchCommand.submenu);\r
}\r
+ },\r
+\r
+ /**\r
+ * Specific action of calling an external URL without triggering the "close()" method\r
+ * of Application.\r
+ * @param hrefValue {String} A download url that should reply with specific "attachment" header to avoid leaving the application.\r
+ */\r
+ javascriptDownloadLocation: function(hrefValue){\r
+ this.interruptClose = true;\r
+ document.location.href = hrefValue;\r
+ this.interruptClose = false;\r
+ },\r
+ \r
+ /**\r
+ * Called at Application ending (closing the browser).\r
+ */\r
+ close : function(){\r
+ if(this.interruptClose) return ; \r
+ if(this.getActivePerspective()){\r
+ this.getActivePerspective().remove(org.argeo.ria.components.ViewsManager.getInstance());\r
+ } \r
+ this.base(arguments);\r
+\r
}\r
\r
}\r