Pman.Tab.BuilderView.bjs
[Pman.Builder] / Pman.Tab.BuilderView.bjs
1 {
2     "id": "roo-file-166",
3     "name": "Pman.Tab.BuilderView",
4     "parent": "Pman.Tab.BuilderTab",
5     "title": "Pman.Tab.BuilderView",
6     "path": "/home/alan/gitlive/Pman.Builder/Pman.Tab.BuilderView.bjs",
7     "items": [
8         {
9             "listeners": {
10                 "activate": "function (_self)\n{\n    _this.panel = _self;\n}"
11             },
12             "region": "center",
13             "title": "View",
14             "xtype": "ContentPanel",
15             "|clearAll": "function(isAuto) {\n//        this.renderObj = { isBuilder : true };\n\n        \n        if (this.panelroot) {\n            this.scroll = this.panelroot.el.getScroll();\n            this.layout.remove('center', this.panelroot);\n            this.panelroot = false;\n        }\n        if (this.dialogroot) {\n            this.dialogroot.remove();\n            this.dialogroot = false;\n        }\n}\n",
16             "|munge": "function(cfg, keyname) {\n    keyname = keyname || false;\n    \n    this.renderObj = this.renderObj || {};\n    \n    var xitems = false;\n    if (cfg.items) {\n        xitems = cfg.items;\n        delete cfg.items;\n    }\n    \n    if (typeof(cfg.background) != 'undefined') {\n        cfg.background = false;\n    }\n    \n    \n    for(var p in cfg){\n        // key is not string?!?!?!!?\n        if (typeof(p) != 'string') {\n            continue;\n        }\n        \n        if (typeof(cfg[p]) == 'object') { // listeners!!!\n            this.munge(cfg[p], p);\n            continue;\n        }\n        // SPECIAL - PIPE\n        if (p.charAt(0) == '|' || keyname=='listeners') {\n            \n            if (!cfg[p].length) {\n                delete cfg[p];\n                continue;\n            }\n            var str = cfg[p];\n            if (str.match(/\\s*function/)) {\n                var btz = str.split('{');\n                str = btz.shift()  +'{ try {' + btz.join('{') + \n                    ' catch (e) { Roo.log(e) } }';\n            }\n            try {\n                var _tmp = false;\n                var _this = this.renderObj; /// fake '_this' object..\n                // stupid IE can not return objects evaluated..\n                /**\n                 eval:var:_this  \n                 eval:var:_tmp \n                **/\n                \n                \n                eval('_tmp =(' + str + ')');\n                cfg[p.replace(/^\\|/, '')] = _tmp;\n                if (typeof(_tmp) == 'undefined') {\n                    alert(cfg[p]);\n                }\n               \n            } catch(e) {  console.log('Error evaluating: '  + str); };\n            if (p.charAt(0) == '|' ) {\n                delete cfg[p];\n            }\n                \n            \n            continue;\n        }\n        // skip '*'\n        if ((p.charAt(0) == '*') || (p.charAt(0) == '+')) {\n            delete cfg[p];\n            continue;\n        }\n        // normal..\n          \n    }\n    // now for all the children.. (items)\n    if (xitems === false) {\n        return;\n    }\n    cfg.items = [];\n    for (var i = 0; i < xitems.length; i++) {\n        // if +builderhide set !!!! drop it!!\n        \n        \n        var xi = xitems[i];\n        if (typeof(xi['*prop']) != 'undefined') {\n            var pr = xi['*prop'];\n            this.munge(xi);\n            // if prop is an array - then it's items are really the value..\n            if (pr.match(/\\[\\]$/)) {\n                pr = pr.replace(/\\[\\]$/, '');\n                if (typeof(cfg[pr]) == 'undefined') {\n                    cfg[pr] = [];\n                }\n                cfg[pr].push(xi);\n                continue;\n            }\n            if (xi.xtype && xi.xtype  == 'Array') {\n                cfg[pr] = xi.items;\n            } else {\n                cfg[pr] = xi;\n            }\n            \n            \n            continue;\n        }\n        this.munge(xi);\n        cfg.items.push(xi);\n    }\n    \n    if (cfg.items.length == 0) {\n        delete cfg.items;\n    }\n    // remove listeners if there are none..\n    if (typeof(cfg['listeners']) != 'undefined') {\n        var n =0;\n        for (var i in cfg.listeners) { n++; }\n        if (!n) {\n            delete cfg['listeners'];\n        }\n        \n    }\n    \n    if (typeof(cfg.id) != 'undefined') {\n        cfg.id = 'pman-dyn-' + cfg.id;\n    }\n        \n        \n}\n",
17             "|redraw": "function(isAuto)\n    {\n        \n        // top level is not relivant\n\n//          var btop =  Pman.Tab.BuilderTop2;\n  //      if (isAuto && btop.redrawBtn  && !btop.redrawBtn.auto) {\n    //        return; /// auto redraw is turned off..\n      //  }\n        \n        this.clearAll(isAuto);\n        \n        var cfg =  this.toJS();\n        if (!cfg.items[0]) {\n            return;\n        }\n        \n        \n        this.munge(cfg.items[0]);\n        \n        // we draw either a dialog or a tab..\n        \n        if (cfg.items[0].xtype == 'LayoutDialog') {\n            \n            cfg.items[0].modal = false;\n            var xy  = this.el.getXY();\n            cfg.items[0].x = xy[0];\n            cfg.items[0].y = xy[1];\n            cfg.items[0].constraintoviewport = false;\n        \n            this.dialogroot = Roo.get( document.body).createChild();\n             \n            this.dialog = new Roo[cfg.items[0].xtype](this.dialogroot, cfg.items[0]);\n          //  this.dialog.el.on('click', this.panelClick, this);\n            this.dialog.show();\n            return;\n            \n        }\n        \n             // force center region..\n        cfg.items[0].region = 'center';\n        cfg.items[0].background = false;\n        \n        this.panelroot = this.layout.addxtype(cfg.items[0]);\n        \n         \n        //this.highlightElement(Pman.Tab.BuilderTree.currentNode);\n        \n        if (this.panelroot.el) {\n                this.panelroot.el.scrollTo('top', this.scroll.top);\n                this.panelroot.el.scrollTo('left', this.scroll.left);\n            \n        }\n    }",
18             "|toJS": "function(n) {\n    var bt = Pman.Tab.BuilderTree.tree;\n    if (!n) {\n        return this.toJS(bt.root);\n    }\n\n    var _this = this;\n    var ret = bt.cloneConfig(n.elConfig);\n    \n    // flag to prevent rendering..\n    if ((typeof(ret['+buildershow']) != 'undefined') && !ret['+buildershow']) {\n        return false;\n    }\n\n    ret.id = typeof(ret.id) == 'undefined' ? 'builder-' + n.id : ret.id;\n\n    if (n.childNodes.length) {\n        ret.items = [];\n        n.eachChild(function(cn) {\n            var add = _this.toJS(cn);\n            if (add === false) {\n                return;\n            }\n            \n            \n            ret.items.push(add);\n        });\n            \n    }\n    return ret;\n}\n",
19             "|xns": "Roo"
20         }
21     ],
22     "permname": "",
23     "modOrder": "001"
24 }