1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
7 // register the module first
8 Pman.on('beforeload', function()
11 part : ["Builder","Tree"],
12 modKey : '001-Pman.Tab.BuilderTree',
13 module : Pman.Tab.BuilderTree,
15 parent : Pman.Tab.BuilderTab,
16 name : "Pman.Tab.BuilderTree",
22 Pman.Tab.BuilderTree = new Roo.util.Observable({
28 add : function(parentLayout, region)
32 this.parentLayout = parentLayout;
34 this.panel = parentLayout.addxtype({
35 xtype: 'NestedLayoutPanel',
39 xtype: 'BorderLayout',
46 activate : function (_self)
49 _this.tree = _self.tree;
50 _this.menu = _self.menu;
52 if (_this.hasMouseEvent) {
56 _this.hasMouseEvent = true;
57 this.el.on('mouseover', function() { _this.isMouseOver= true; });
58 this.el.on('mouseout', function() { _this.isMouseOver = false; });
67 beforenodedrop : function (e)
70 return Pman.Builder.Tree.handleDropNode(e);
73 click : function (node, e)
76 // console.log(e.button);
77 Pman.BuilderTree.setCurrentNode(node);
83 contextmenu : function (node, e)
87 this.getSelectionModel().select(node);
88 Pman.Builder.Tree.setCurrentNode(node);
90 _this.menu = Roo.factory(_this.menu);
92 _this.menu.show(node.ui.textNode, 'tr');
96 var xt = node.elConfig.xtype;
98 if (typeof(node.elConfig['*prop']) != 'undefined') {
99 altx = node.parentNode.elConfig.xtype +'.' + node.elConfig['*prop'];
101 var mn = Pman.Tab.BuilderPalete.getMenu(xt,altx);
105 mn.show(e.getTarget());
111 nodedragover : function (e)
114 return Pman.Builder.Tree.handleDragOver(e);
121 containerScroll : true,
122 ddGroup : 'component',
125 dupeNode : function(node)
127 var cfg = this.cloneConfig(node.elConfig);
129 var newNode = new Roo.tree.TreeNode(
132 text: this.configToText(cfg)
135 newNode.elConfig = cfg;
136 node.eachChild(function(n) {
137 newNode.appendChild(this.dupeNode(n));
143 loadBJS : function(module, part) {
146 url : baseURL + '/Roo/Builder_part.php',
151 success : function(res)
156 if (!res.data.json.length) {
157 var cfg = _t.defaultElConfig();
158 cfg.name = Pman.Tab.BuilderTop.filesel.lastData.name;
159 cfg.part = Pman.Tab.BuilderTop.filesel.lastData.name;
166 _t.loadTree(JSON.parse(res.data.json));
176 loadTree : function(o) {
178 this.root.elConfig = o;
179 this.root.setText(this.configToText(this.root.elConfig));
180 this.appendNode(this.root, o.items[0]);
181 this.root.expand(true);
182 Pman.Tab.BuilderView.panel.redraw();
183 this.setCurrentNode(this.root,true);
185 nodeXtype : function(n) {
186 if (!n) {return ''; }
187 var xt = n.elConfig.xtype || '';
188 var xns= n.elConfig['|xns'] || '';
189 xns += xns.length ? '.' : '';
192 renderer : function(n) { return n.text; },
193 setCurrentNode : function(node,select) {
194 this.currentNode = node || this.root;
196 //Pman.Tab.BuilderView.highlightElement(this.currentNode);
198 var p = Pman.Tab.BuilderProps.grid;
199 if (p) { //may not be ready yet..
200 p.setCurrrentNode(this.currentNode);
204 this.currentNode.setText(this.configToText(this.currentNode.elConfig));
206 if (select) { //&& node !== this.tree.root) {
207 if (this.currentNode !== this.root) {
208 this.currentNode.ensureVisible();
210 this.currentNode.expand(false,false);
211 this.currentNode.select();
214 Pman.Tab.BuilderPalette.grid.getSelectionModel().clearSelections();
215 Pman.Tab.BuilderPalette.grid.view.refresh();
221 return this.toJS(this.root);
224 var ret = this.cloneConfig(n.elConfig);
225 if (n.childNodes.length) {
227 n.eachChild(function(cn) {
228 ret.items.push(_this.toJS(cn));
237 xtype: 'DefaultSelectionModel',
244 elConfig : function() {
255 name : "Module Name",
271 click : function (_self)
273 Roo.MessageBox.confirm("Confirm", "Are you sure you want to delete that node?",
278 _this.tree.deleteCurrent();
289 text : "Save as template"
296 xtype: 'LayoutRegion',
300 xtype: 'LayoutRegion',
307 this.layout = this.panel.layout;