Tab.js 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. MWF.xDesktop.requireApp("process.Xform", "$Module", null, false);
  2. MWF.require("MWF.widget.Tab", null, false);
  3. MWF.xApplication.process.Xform.Tab = MWF.APPTab = new Class({
  4. Extends: MWF.APP$Module,
  5. _loadUserInterface: function(){
  6. this.elements = [];
  7. this.containers = [];
  8. var style = "form";
  9. if (layout.mobile) style = "mobileForm";
  10. this.tab = new MWF.widget.Tab(this.node, {"style": style});
  11. this._setTabWidgetStyles();
  12. this.tab.tabNodeContainer = this.node.getFirst("div");
  13. this.tab.contentNodeContainer = this.node.getLast("div");
  14. this.tab.load();
  15. var tabs = this.tab.tabNodeContainer.getChildren("div");
  16. var contents = this.tab.contentNodeContainer.getChildren("div");
  17. tabs.each(function(tab, idx){
  18. this.tab.rebuildTab(contents[idx], contents[idx].getFirst(), tab);
  19. }.bind(this));
  20. this.tab.pages[0]._showTab();
  21. this.loadSubModule();
  22. },
  23. loadSubModule: function(){
  24. this.tab.pages.each(function(page){
  25. var node = page.tabNode;
  26. var json = this.form._getDomjson(node);
  27. var tab = this;
  28. var module = this.form._loadModule(json, node, function(){
  29. this.tab = tab;
  30. });
  31. this.elements.push(module);
  32. this.form.modules.push(module);
  33. node = page.contentNode;
  34. json = this.form._getDomjson(node);
  35. tab = this;
  36. module = this.form._loadModule(json, node, function(){
  37. this.tab = tab;
  38. });
  39. this.containers.push(module);
  40. this.form.modules.push(module);
  41. }.bind(this));
  42. },
  43. _setTabWidgetStyles: function(){
  44. if (this.json.tabNodeContainer) this.tab.css.tabNodeContainer = Object.clone(this.json.tabNodeContainer);
  45. if (this.json.contentNodeContainer) this.tab.css.contentNodeContainer = Object.clone(this.json.contentNodeContainer);
  46. this.tab.css.tabNode = Object.clone(this.json.tabStyles);
  47. this.tab.css.tabTextNode = Object.clone(this.json.tabTextStyles);
  48. this.tab.css.tabNodeCurrent = Object.clone(this.json.tabCurrentStyles);
  49. this.tab.css.tabTextNodeCurrent = Object.clone(this.json.tabTextCurrentStyles);
  50. }
  51. });
  52. MWF.xApplication.process.Xform.tab$Page = MWF.APPTab$Page = new Class({
  53. Extends: MWF.APP$Module
  54. });
  55. MWF.xApplication.process.Xform.tab$Content = MWF.APPTab$Content = new Class({
  56. Extends: MWF.APP$Module
  57. });