Pman.Tab.BuilderView.js
[Pman.Builder] / Pman.Tab.BuilderView.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5
6
7 // register the module first
8 Pman.on('beforeload', function()
9 {
10     Pman.register({
11         modKey : '001-Pman.Tab.BuilderView',
12         module : Pman.Tab.BuilderView,
13         region : 'center',
14         parent : Pman.Tab.BuilderTab,
15         name : "Pman.Tab.BuilderView",
16         disabled : false, 
17         permname: '' 
18     });
19 });
20
21 Pman.Tab.BuilderView = new Roo.util.Observable({
22
23     panel : false,
24     disabled : false,
25     parentLayout:  false,
26
27     add : function(parentLayout, region)
28     {
29
30         var _this = this;
31         this.parentLayout = parentLayout;
32
33         this.panel = parentLayout.addxtype({
34             xtype: 'ContentPanel',
35             xns: Roo,
36             listeners : {
37                 activate : function (_self)
38                 {
39                     _this.panel = _self;
40                 }
41             },
42             region : 'center',
43             title : "View",
44             toJS : function(n) {
45                 var bt = Pman.Tab.BuilderTree;
46                 if (!n) {
47                     return this.toJS(bt.tree.root);
48                 }
49             
50                 var _this = this;
51                 var ret = bt.cloneConfig(n.elConfig);
52                 
53                 // flag to prevent rendering..
54                 if ((typeof(ret['+buildershow']) != 'undefined') && !ret['+buildershow']) {
55                     return false;
56                 }
57             
58                 ret.id = typeof(ret.id) == 'undefined' ? 'builder-' + n.id : ret.id;
59             
60                 if (n.childNodes.length) {
61                     ret.items = [];
62                     n.eachChild(function(cn) {
63                         var add = _this.toJS(cn);
64                         if (add === false) {
65                             return;
66                         }
67                         
68                         
69                         ret.items.push(add);
70                     });
71                         
72                 }
73                 return ret;
74             },
75             clearAll : function(isAuto) {
76             //        this.renderObj = { isBuilder : true };
77             
78                     
79                     if (this.panelroot) {
80                         this.scroll = this.panelroot.el.getScroll();
81                         this.layout.remove('center', this.panelroot);
82                         this.panelroot = false;
83                     }
84                     if (this.dialogroot) {
85                         this.dialogroot.remove();
86                         this.dialogroot = false;
87                     }
88             },
89             redraw : function(isAuto)
90                 {
91                     
92                     // top level is not relivant
93             
94             //          var btop =  Pman.Tab.BuilderTop2;
95               //      if (isAuto && btop.redrawBtn  && !btop.redrawBtn.auto) {
96                 //        return; /// auto redraw is turned off..
97                   //  }
98                     
99                     this.clearAll(isAuto);
100                     
101                     var cfg =  this.toJS();
102                     if (!cfg.items[0]) {
103                         return;
104                     }
105                     
106                     
107                     this.munge(cfg.items[0]);
108                     
109                     // we draw either a dialog or a tab..
110                     
111                     if (cfg.items[0].xtype == 'LayoutDialog') {
112                         
113                         cfg.items[0].modal = false;
114                         var xy  = this.panel.el.getXY();
115                         cfg.items[0].x = xy[0];
116                         cfg.items[0].y = xy[1];
117                         cfg.items[0].constraintoviewport = false;
118                     
119                         this.dialogroot = Roo.get( document.body).createChild();
120                          
121                         this.dialog = new Roo[cfg.items[0].xtype](this.dialogroot, cfg.items[0]);
122                         this.dialog.el.on('click', this.panelClick, this);
123                         this.dialog.show();
124                         return;
125                         
126                     }
127                     
128                          // force center region..
129                     cfg.items[0].region = 'center';
130                     cfg.items[0].background = false;
131                     
132                     this.panelroot = this.layout.addxtype(cfg.items[0]);
133                     
134                      
135                     //this.highlightElement(Pman.Tab.BuilderTree.currentNode);
136                     
137                     if (this.panelroot.el) {
138                             this.panelroot.el.scrollTo('top', this.scroll.top);
139                             this.panelroot.el.scrollTo('left', this.scroll.left);
140                         
141                     }
142                 }
143         });
144         this.layout = this.panel.layout;
145
146     }
147 });