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 modKey : '001-Pman.Tab.BuilderProps',
12 module : Pman.Tab.BuilderProps,
14 parent : Pman.Tab.BuilderTree,
15 name : "Pman.Tab.BuilderProps",
21 Pman.Tab.BuilderProps = new Roo.util.Observable({
27 add : function(parentLayout, region)
31 this.parentLayout = parentLayout;
33 this.panel = parentLayout.addxtype({
38 xtype: 'PropertyGrid',
41 render : function (grid)
45 afteredit : function (e)
48 //this.currentNode.elConfig
52 cellclick : function (_self, rowIndex, ci, e)
58 // click on left col..
60 // make sure it's initialized..
61 _this.panel.menu = Roo.factory(_this.panel.menu);
63 _this.panel.menu.show(e.getTarget(), 'tr');
65 beforeedit : function (e)
67 Roo.log('beforeedit');
68 Roo.log(e.record.data);
69 var key = e.record.data.name;
70 var val = e.record.data.value;
72 if (key.match(/^\|/) || key.match(/^\!/)) {
73 Pman.Dialog.BuilderSourceEdit.show( { value : val }, function(d) {
74 // perhaps we should eval it..
76 _this.grid.currentNode.elConfig[key] = d.value;
77 _this.grid.setSourceFromNode(_this.grid.currentNode.elConfig);
78 _this.grid.fireEvent('propertychange',
79 Pman.Tab.BuilderProps.grid, key, d.value, false
86 propertychange : function (grid, id, v, oldval)
94 _this.grid.currentNode.elConfig[id] = v;
95 _this.grid.setSourceFromNode(_this.grid.currentNode.elConfig);
97 var bp = Pman.Tab.BuilderView.panel;
98 bp.redraw.defer(100,bp, [true]);
99 _this.grid.currentNode.setText(
100 Pman.Tab.BuilderTree.tree.configToText(_this.grid.currentNode.elConfig)
103 contextmenu : function (e)
105 // should we check e..??
106 _this.panel.menu2 = Roo.factory(_this.panel.menu2);
108 _this.panel.menu2.show(e.getTarget(), '');
113 setCurrrentNode : function(node) {
116 this.view.el.unmask();
118 if (!node || !node.elConfig) {
119 this.currentNode = false;
120 this.setSourceFromNode({});
121 this.view.el.mask('select a node');
123 this.currentNode = node;
124 this.setSourceFromNode(this.currentNode.elConfig);
129 setSourceFromNode : function(config) {
133 for (var k in config) {
134 //if (k.charAt(0) == '*') {
135 // continue; // dont show props..
138 if (k == 'listeners') {
139 for (var kk in config[k]) {
140 cfg['!' + kk ] = config[k][kk];
149 if (typeof config[k] == 'object') {
152 var ec = Roo.encode(config[k]);
178 click : function (_self, e)
181 var rc = _this.grid.getSelectionModel().getSelectedCell();
182 var n = _this.grid.getDataSource().getAt(rc[0]).data.name;
187 delete _this.grid.currentNode.elConfig.listeners[n.substring(1)];
189 delete _this.grid.currentNode.elConfig[n];
192 _this.grid.setCurrrentNode(_this.grid.currentNode);
193 var bp = Pman.Tab.BuilderView.panel;
194 bp.redraw.defer(100,bp, [true]);
195 // update the tree's text
196 _this.grid.currentNode.setText(
197 Pman.Tab.BuilderTree.tree.configToText(_this.grid.currentNode.elConfig)
201 text : "Delete Property / Event"
213 click : function (_self, e)
216 // show a dialog to select property??
217 // or should we add a line and get clever with pulldowns..
218 var ec = _this.grid.currentNode.elConfig;
219 Pman.Dialog.BuilderProp.show({
220 xtype : ec.xtype || '',
223 }, function (n,val) {
225 _this.grid.setCurrrentNode(_this.grid.currentNode);
226 var bp = Pman.Tab.BuilderView.panel;
227 bp.redraw.defer(100,bp, [true]);
228 // update the tree's text
229 _this.grid.currentNode.setText(
230 Pman.Tab.BuilderTree.tree.configToText(_this.grid.currentNode.elConfig)
235 text : "Add Property"
241 click : function (_self, e)
244 // show a dialog to select property??
245 // or should we add a line and get clever with pulldowns..
246 var ec = _this.grid.currentNode.elConfig;
247 Pman.Dialog.BuilderProp.show({
248 xtype : ec.xtype || '',
251 }, function (n,val) {
252 ec[n] = val || "function () {\n\n}";
253 _this.grid.setCurrrentNode(_this.grid.currentNode);
254 var bp = Pman.Tab.BuilderView.panel;
255 bp.redraw.defer(100,bp, [true]);
256 // update the tree's text
257 _this.grid.currentNode.setText(
258 Pman.Tab.BuilderTree.tree.configToText(_this.grid.currentNode.elConfig)
263 text : "Add Event Handler"
273 click : function (_self, e)
276 // show a dialog to select property??
277 // or should we add a line and get clever with pulldowns..
280 text : "Add User Defined Property"
285 this.layout = this.panel.layout;