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","Props"],
12 modKey : '001-Pman.Tab.BuilderProps',
13 module : Pman.Tab.BuilderProps,
15 parent : Pman.Tab.BuilderTree,
16 name : "Pman.Tab.BuilderProps",
22 Pman.Tab.BuilderProps = new Roo.util.Observable({
28 add : function(parentLayout, region)
32 this.parentLayout = parentLayout;
34 this.panel = parentLayout.addxtype({
39 xtype: 'PropertyGrid',
42 render : function (grid)
46 afteredit : function (e)
49 //this.currentNode.elConfig
53 cellclick : function (_self, rowIndex, ci, e)
59 // click on left col..
61 // make sure it's initialized..
62 _this.panel.menu = Roo.factory(_this.panel.menu);
64 _this.panel.menu.show(e.getTarget(), 'tr');
66 beforeedit : function (e)
68 Roo.log('beforeedit');
69 Roo.log(e.record.data);
70 var key = e.record.data.name;
71 var val = e.record.data.value;
73 if (key.match(/^\|/) || key.match(/^\!/)) {
74 Pman.Dialog.BuilderSourceEdit.show( { value : val }, function(d) {
75 // perhaps we should eval it..
77 _this.grid.currentNode.elConfig[key] = d.value;
78 _this.grid.setSourceFromNode(_this.grid.currentNode.elConfig);
79 _this.grid.fireEvent('propertychange',
80 Pman.Tab.BuilderProps.grid, key, d.value, false
87 propertychange : function (grid, id, v, oldval)
95 _this.grid.currentNode.elConfig[id] = v;
96 _this.grid.setSourceFromNode(_this.grid.currentNode.elConfig);
98 var bp = Pman.Tab.BuilderView.panel;
99 bp.redraw.defer(100,bp, [true]);
100 _this.grid.currentNode.setText(
101 Pman.Tab.BuilderTree.tree.configToText(_this.grid.currentNode.elConfig)
104 contextmenu : function (e)
106 // should we check e..??
107 _this.panel.menu2 = Roo.factory(_this.panel.menu2);
109 _this.panel.menu2.show(e.getTarget());
114 setCurrrentNode : function(node) {
117 this.view.el.unmask();
119 if (!node || !node.elConfig) {
120 this.currentNode = false;
121 this.setSourceFromNode({});
122 this.view.el.mask('select a node');
124 this.currentNode = node;
125 this.setSourceFromNode(this.currentNode.elConfig);
130 setSourceFromNode : function(config) {
134 for (var k in config) {
135 //if (k.charAt(0) == '*') {
136 // continue; // dont show props..
139 if (k == 'listeners') {
140 for (var kk in config[k]) {
141 cfg['!' + kk ] = config[k][kk];
150 if (typeof config[k] == 'object') {
153 var ec = Roo.encode(config[k]);
179 click : function (_self, e)
182 var rc = _this.grid.getSelectionModel().getSelectedCell();
183 var n = _this.grid.getDataSource().getAt(rc[0]).data.name;
188 delete _this.grid.currentNode.elConfig.listeners[n.substring(1)];
190 delete _this.grid.currentNode.elConfig[n];
193 _this.grid.setCurrrentNode(_this.grid.currentNode);
194 var bp = Pman.Tab.BuilderView.panel;
195 bp.redraw.defer(100,bp, [true]);
196 // update the tree's text
197 _this.grid.currentNode.setText(
198 Pman.Tab.BuilderTree.tree.configToText(_this.grid.currentNode.elConfig)
202 text : "Delete Property / Event"
214 click : function (_self, e)
217 // show a dialog to select property??
218 // or should we add a line and get clever with pulldowns..
219 var ec = _this.grid.currentNode.elConfig;
220 Pman.Dialog.BuilderProp.show({
221 xtype : ec.xtype || '',
222 xns: ec['|xns'] || '',
224 }, function (n,val) {
226 _this.grid.setCurrrentNode(_this.grid.currentNode);
227 var bp = Pman.Tab.BuilderView.panel;
228 bp.redraw.defer(100,bp, [true]);
229 // update the tree's text
230 _this.grid.currentNode.setText(
231 Pman.Tab.BuilderTree.tree.configToText(_this.grid.currentNode.elConfig)
236 text : "Add Property"
242 click : function (_self, e)
245 // show a dialog to select property??
246 // or should we add a line and get clever with pulldowns..
247 var ec = _this.grid.currentNode.elConfig;
248 Pman.Dialog.BuilderProp.show({
249 xtype : ec.xtype || '',
250 xns: ec['|xns'] || '',
252 }, function (n,val) {
253 ec[n] = val || "function () {\n\n}";
254 _this.grid.setCurrrentNode(_this.grid.currentNode);
255 var bp = Pman.Tab.BuilderView.panel;
256 bp.redraw.defer(100,bp, [true]);
257 // update the tree's text
258 _this.grid.currentNode.setText(
259 Pman.Tab.BuilderTree.tree.configToText(_this.grid.currentNode.elConfig)
264 text : "Add Event Handler"
274 click : function (_self, e)
277 // show a dialog to select property??
278 // or should we add a line and get clever with pulldowns..
281 text : "Add User Defined Property"
286 this.layout = this.panel.layout;