+++ /dev/null
-/**\r
- * A more elaborate views container than ViewPane, as it can handle multiple contents\r
- * at once via a TabView.\r
- * See {@link org.argeo.ria.components.ViewPane}.\r
- */\r
-qx.Class.define("org.argeo.ria.components.TabbedViewPane",\r
-{\r
- extend : qx.ui.container.Composite,\r
- implement : [org.argeo.ria.components.ILoadStatusable],\r
-\r
- /**\r
- * @param viewId {String} Unique id of this viewPane\r
- * @param viewTitle {String} Readable Title of this viewPane\r
- */\r
- construct : function(viewId, viewTitle){\r
- this.base(arguments);\r
- this.setViewId(viewId);\r
- this._defaultViewTitle = viewTitle; \r
- this.setLayout(new qx.ui.layout.Canvas());\r
- this.blurredDecorator = new qx.ui.decoration.Uniform(1, "solid", "#000");\r
- this.blurredDecorator.setBackgroundImage("decoration/app-header.png");\r
- this.blurredDecorator.setBackgroundRepeat("scale");\r
- this.setDecorator(this.blurredDecorator);\r
-\r
- this.focusedDecorator = new qx.ui.decoration.Uniform(1, "solid", "#065fb2");\r
- this.focusedDecorator.setBackgroundImage("decoration/app-header.png");\r
- this.focusedDecorator.setBackgroundRepeat("scale");\r
- \r
- this.tabView = new qx.ui.tabview.TabView();\r
- this.tabView.setAppearance("widget");\r
- // Empty mode\r
- this.add(this.tabView, {top: 7, width:"100%", bottom:0});\r
- this.tabView.setBackgroundColor("#fff");\r
- this.tabView.setMarginTop(27);\r
- \r
- this.tabView.addListener("changeSelected", function(){\r
- this.fireEvent("changeSelection");\r
- }, this);\r
- \r
- \r
- this.setFocusable(true);\r
- this.addListener("click", function(e){\r
- this.fireDataEvent("changeFocus", this);\r
- }, this); \r
- \r
- this.pageIds = {};\r
- },\r
-\r
- properties : {\r
- /**\r
- * Unique id of the pane\r
- */\r
- viewId : {init:""},\r
- /**\r
- * Human-readable title for this view\r
- */\r
- viewTitle : {init:"", event:"changeViewTitle"},\r
- /**\r
- * Has its own scrollable content \r
- */\r
- ownScrollable : {init: false, check:"Boolean"},\r
- /**\r
- * Map of commands definition\r
- * @see org.argeo.ria.event.Command \r
- */\r
- commands : {init : null, nullable:true, check:"Map"}\r
- \r
- },\r
- \r
- members : {\r
- /**\r
- * Checks if the pane already contains a given view, identified by its instance id\r
- * @param contentId {Mixed} The instance id to check\r
- * @return {Boolean}\r
- */\r
- contentExists : function(contentId){\r
- if(this.pageIds[contentId]){\r
- this.tabView.setSelected(this.pageIds[contentId]);\r
- return this.pageIds[contentId].getUserData("argeoria.iview");\r
- } \r
- },\r
- /**\r
- * Sets a new instance in the tabbed pane.\r
- * @param content {org.argeo.ria.components.IView} The applet to add.\r
- */\r
- setContent : function(content){\r
- if(!this.tabView.getChildren().length){\r
- this.tabView.setBackgroundColor("transparent");\r
- this.tabView.setMarginTop(0); \r
- }\r
- var contentId = content.getInstanceId();\r
- var page = new qx.ui.tabview.Page(content.getInstanceLabel());\r
- this.pageIds[contentId] = page;\r
- page.setPadding(0);\r
- page.setLayout(new qx.ui.layout.Canvas());\r
- page.add(content, {width:"100%", top:0, bottom:0});\r
- this.tabView.add(page); \r
- page.setUserData("argeoria.iview", content); \r
- content.getViewSelection().addListener("changeSelection", function(e){\r
- this.fireEvent("changeSelection");\r
- }, this);\r
- this.tabView.setSelected(page);\r
- },\r
- /**\r
- * Get the currently selected tab content, if any.\r
- * @return {org.argeo.ria.components.IView} The currently selected view.\r
- */\r
- getContent : function(){\r
- if(this._getCrtPage()){\r
- return this._getCrtPage().getUserData("argeoria.iview");\r
- }\r
- return null;\r
- },\r
- /**\r
- * Get the currently selected tab ViewSelection object.\r
- * @return {org.argeo.ria.components.ViewSelection} The view selection object of the currently selected view.\r
- */\r
- getViewSelection : function(){\r
- if(!this.getContent()) return null;\r
- return this.getContent().getViewSelection();\r
- },\r
- /**\r
- * Return the currently selected tab Page.\r
- * @return {qx.ui.tabview.Page} The page\r
- */\r
- _getCrtPage : function(){\r
- return this.tabView.getSelected();\r
- },\r
- /**\r
- * Closes the currently selected view and remove all tabs components (button, page).\r
- */\r
- closeCurrent : function(){\r
- var crtPage = this._getCrtPage();\r
- if(!crtPage) return;\r
- var iView = crtPage.getUserData("argeoria.iview");\r
- var iViewInstance = iView.getInstanceId();\r
- iView.close(); \r
- this.tabView.remove(crtPage);\r
- delete(this.pageIds[iViewInstance]); \r
- if(!this.tabView.getChildren().length){ // No more tabs : remove commands!\r
- if(this.getCommands()){\r
- org.argeo.ria.event.CommandsManager.getInstance().removeCommands(this.getCommands(), this.getViewId());\r
- this.setCommands(null);\r
- } \r
- this.tabView.setBackgroundColor("#fff");\r
- this.tabView.setMarginTop(27);\r
- } \r
- },\r
- /**\r
- * Call closeCurrent() recursively until there is no more page.\r
- */\r
- empty : function(){\r
- var crtPage = this._getCrtPage();\r
- while(crtPage){\r
- this.closeCurrent();\r
- crtPage = this._getCrtPage();\r
- }\r
- },\r
- /**\r
- * Sets the tabView on "load" state. Nothing is done at the moment.\r
- * @param load {Boolean} Load status\r
- */\r
- setOnLoad : function(load){\r
- \r
- },\r
- /**\r
- * Sets a graphical indicator that this pane has the focus. A blue border.\r
- */\r
- focus : function(){\r
- if(this.hasFocus) return;\r
- this.fireEvent("changeSelection");\r
- this.setDecorator(this.focusedDecorator);\r
- this.hasFocus = true;\r
- }, \r
- /**\r
- * Remove a graphical focus indicator on this pane.\r
- */\r
- blur : function(){\r
- this.hasFocus = false;\r
- this.setDecorator(this.blurredDecorator);\r
- }\r
- }\r
-});
\ No newline at end of file