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              : function() {
45                 
46             },
47             clearAll : function(isAuto) {
48             //        this.renderObj = { isBuilder : true };
49             
50                     
51                     if (this.panelroot) {
52                         this.scroll = this.panelroot.el.getScroll();
53                         this.layout.remove('center', this.panelroot);
54                         this.panelroot = false;
55                     }
56                     if (this.dialogroot) {
57                         this.dialogroot.remove();
58                         this.dialogroot = false;
59                     }
60             },
61             redraw : function(isAuto)
62                 {
63                     
64                     // top level is not relivant
65             
66             //          var btop =  Pman.Tab.BuilderTop2;
67               //      if (isAuto && btop.redrawBtn  && !btop.redrawBtn.auto) {
68                 //        return; /// auto redraw is turned off..
69                   //  }
70                     
71                     this.clearAll(isAuto);
72                     
73                     var cfg =  this.toJS();
74                     if (!cfg.items[0]) {
75                         return;
76                     }
77                     
78                     
79                     this.munge(cfg.items[0]);
80                     
81                     // we draw either a dialog or a tab..
82                     
83                     if (cfg.items[0].xtype == 'LayoutDialog') {
84                         
85                         cfg.items[0].modal = false;
86                         var xy  = this.panel.el.getXY();
87                         cfg.items[0].x = xy[0];
88                         cfg.items[0].y = xy[1];
89                         cfg.items[0].constraintoviewport = false;
90                     
91                         this.dialogroot = Roo.get( document.body).createChild();
92                          
93                         this.dialog = new Roo[cfg.items[0].xtype](this.dialogroot, cfg.items[0]);
94                         this.dialog.el.on('click', this.panelClick, this);
95                         this.dialog.show();
96                         return;
97                         
98                     }
99                     
100                          // force center region..
101                     cfg.items[0].region = 'center';
102                     cfg.items[0].background = false;
103                     
104                     this.panelroot = this.layout.addxtype(cfg.items[0]);
105                     
106                      
107                     //this.highlightElement(Pman.Tab.BuilderTree.currentNode);
108                     
109                     if (this.panelroot.el) {
110                             this.panelroot.el.scrollTo('top', this.scroll.top);
111                             this.panelroot.el.scrollTo('left', this.scroll.left);
112                         
113                     }
114                 },
115             toJS : function(n) {
116                 var bt = Pman.Tab.BuilderTree;
117                 if (!n) {
118                     return this.toJS(bt.tree.root);
119                 }
120             
121                 var _this = this;
122                 var ret = bt.cloneConfig(n.elConfig);
123                 
124                 // flag to prevent rendering..
125                 if ((typeof(ret['+buildershow']) != 'undefined') && !ret['+buildershow']) {
126                     return false;
127                 }
128             
129                 ret.id = typeof(ret.id) == 'undefined' ? 'builder-' + n.id : ret.id;
130             
131                 if (n.childNodes.length) {
132                     ret.items = [];
133                     n.eachChild(function(cn) {
134                         var add = _this.toJS(cn);
135                         if (add === false) {
136                             return;
137                         }
138                         
139                         
140                         ret.items.push(add);
141                     });
142                         
143                 }
144                 return ret;
145             }
146         });
147         this.layout = this.panel.layout;
148
149     }
150 });