Preview.php
[Pman.Builder] / Pman.Tab.BuilderTree.js
index 709de73..2a0375d 100644 (file)
@@ -2,36 +2,19 @@
 
 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
 
-
-
-// register the module first
-Pman.on('beforeload', function()
-{
-    Pman.register({
-        part :  ["Builder","Tree"],
-        modKey : '001-Pman.Tab.BuilderTree',
-        module : Pman.Tab.BuilderTree,
-        region : 'center',
-        parent : Pman.Tab.BuilderTab,
-        name : "Pman.Tab.BuilderTree",
-        disabled : false, 
-        permname: '' 
-    });
-});
-
-Pman.Tab.BuilderTree = new Roo.util.Observable({
-
-    panel : false,
-    disabled : false,
-    parentLayout:  false,
-
-    add : function(parentLayout, region)
+Pman.Tab.BuilderTree = new Roo.XComponent({
+    part     :  ["Builder","Tree"],
+    order    : '001-Pman.Tab.BuilderTree',
+    region   : 'center',
+    parent   : 'Pman.Tab.BuilderTab',
+    name     : "Pman.Tab.BuilderTree",
+    disabled : false, 
+    permname : '', 
+    _tree : function()
     {
-
         var _this = this;
-        this.parentLayout = parentLayout;
-
-        this.panel = parentLayout.addxtype({
+        var MODULE = this;
+        return {
             xtype: 'NestedLayoutPanel',
             xns: Roo,
             region : 'west',
@@ -54,8 +37,8 @@ Pman.Tab.BuilderTree = new Roo.util.Observable({
                                 }
                                 
                                 _this.hasMouseEvent = true;
-                                 this.el.on('mouseover', function() { _this.isMouseOver= true; });
-                                this.el.on('mouseout', function() { _this.isMouseOver = false; });
+                              //   this.el.on('mouseover', function() { _this.isMouseOver= true; });
+                                 // this.el.on('mouseout', function() { _this.isMouseOver = false; });
                             
                             }
                         },
@@ -160,18 +143,75 @@ Pman.Tab.BuilderTree = new Roo.util.Observable({
                                     listeners : {
                                         click : function (_self)
                                         {
-                                            Roo.MessageBox.confirm("Confirm", "Are you sure you want to delete that node?",
-                                                function(r) {
-                                                    if (r!='yes') {
-                                                        return;
-                                                    }
-                                                    _this.tree.deleteCurrent();
-                                                }
+                                            
+                                            var str = Pman.Builder.Tree.currentNodeType();
+                                            if (typeof(Pman.Builder.Wizard[str]) == 'undefined') {
+                                                Roo.MessageBox.alert("Sorry", "No wizard exists for " + str);
+                                                return;
+                                            }
+                                            var cn = Pman.Builder.Tree.currentNode;
+                                            if (typeof(cn.elConfig['.builderCfg']) == 'undefined') {
+                                                Roo.MessageBox.alert("Sorry", "No configuration exists for " + str);
+                                                return;
+                                            }
+                                            
+                                            
+                                            var cfg = Roo.decode(cn.elConfig['.builderCfg']);
+                                            
+                                            Roo.log(cfg);
+                                            Pman.Dialog.BuilderAddTable.show( 
+                                                cfg,  
+                                                function(data) {
+                                        
+                                                     
+                                                    var res = Pman.Builder.Wizard[str](data); // with old..
+                                                     Pman.Builder.Tree.replaceCurrentNode( res );
+                                                     Pman.Tab.BuilderView.panel.redraw();
+                                         
+                                               }
                                             );
+                                        
+                                           
+                                            // otherwise, call back with template??
+                                            
+                                           
+                                           
                                                 
                                         }
                                     },
-                                    text : "Delete Node"
+                                    text : "Edit Using Wizard"
+                                },
+                                {
+                                    xtype: 'Separator',
+                                    xns: Roo.menu
+                                },
+                                {
+                                    xtype: 'Item',
+                                    xns: Roo.menu,
+                                    listeners : {
+                                        click : function (_self)
+                                        {
+                                            
+                                              
+                                            Pman.Builder.Tree.collapseToggle();
+                                                
+                                        }
+                                    },
+                                    text : "Toggle Collapse"
+                                },
+                                {
+                                    xtype: 'Item',
+                                    xns: Roo.menu,
+                                    listeners : {
+                                        click : function (_self)
+                                        {
+                                            
+                                              
+                                            Pman.Builder.Tree.createSharedPart();
+                                                
+                                        }
+                                    },
+                                    text : "Create shared part from this node"
                                 },
                                 {
                                     xtype: 'Separator',
@@ -188,7 +228,7 @@ Pman.Tab.BuilderTree = new Roo.util.Observable({
                                                     if (r!='yes') {
                                                         return;
                                                     }
-                                                    _this.tree.deleteCurrent();
+                                                   Pman.Builder.Tree.deleteCurrent();
                                                 }
                                             );
                                                 
@@ -216,8 +256,6 @@ Pman.Tab.BuilderTree = new Roo.util.Observable({
                     split : true
                 }
             }
-        });
-        this.layout = this.panel.layout;
-
+        };
     }
 });