1 //<script type="text/javascript">
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
5 Pman.Tab.BuilderProps = new Roo.XComponent({
6 part : ["Builder","Props"],
7 order : '001-Pman.Tab.BuilderProps',
9 parent : 'Pman.Tab.BuilderTree',
10 name : "Pman.Tab.BuilderProps",
22 xtype: 'PropertyGrid',
25 render : function (grid)
29 afteredit : function (e)
32 //this.currentNode.elConfig
36 cellclick : function (_self, rowIndex, ci, e)
42 // click on left col..
44 // make sure it's initialized..
45 _this.panel.menu = Roo.factory(_this.panel.menu);
47 _this.panel.menu.show(e.getTarget(), 'tr');
49 beforeedit : function (e)
51 Roo.log('beforeedit');
52 Roo.log(e.record.data);
53 var key = e.record.data.name;
54 var val = e.record.data.value;
56 if (key.match(/^\|/) || key.match(/^\!/)) {
57 Pman.Dialog.BuilderSourceEdit.show( { value : val }, function(d) {
58 // perhaps we should eval it..
60 _this.grid.currentNode.elConfig[key] = d.value;
61 _this.grid.setSourceFromNode(_this.grid.currentNode.elConfig);
62 _this.grid.fireEvent('propertychange',
63 Pman.Tab.BuilderProps.grid, key, d.value, false
70 propertychange : function (grid, id, v, oldval)
78 var ec = _this.grid.currentNode.elConfig;
81 ec.listeners = ec.listeners || {};
82 ec.listeners[id.substring(1)] = v;
83 if (typeof(ec[id]) != 'undefined') {
90 _this.grid.setSourceFromNode(ec);
92 var bp = Pman.Tab.BuilderView.panel;
93 bp.redraw.defer(100,bp, [true]);
94 _this.grid.currentNode.setText(
95 Pman.Builder.Tree.configToText(ec)
98 contextmenu : function (e)
100 // should we check e..??
101 _this.panel.menu2 = Roo.factory(_this.panel.menu2);
103 _this.panel.menu2.show(e.getTarget());
108 setCurrrentNode : function(node) {
111 this.view.el.unmask();
113 if (!node || !node.elConfig) {
114 this.currentNode = false;
115 this.setSourceFromNode({});
116 this.view.el.mask('select a node');
118 this.currentNode = node;
119 this.setSourceFromNode(this.currentNode.elConfig);
124 setSourceFromNode : function(config) {
128 for (var k in config) {
129 //if (k.charAt(0) == '*') {
130 // continue; // dont show props..
133 if (k == 'listeners') {
134 for (var kk in config[k]) {
135 cfg['!' + kk ] = config[k][kk];
144 if (typeof config[k] == 'object') {
147 var ec = Roo.encode(config[k]);
173 click : function (_self, e)
176 var rc = _this.grid.getSelectionModel().getSelectedCell();
177 var n = _this.grid.getDataSource().getAt(rc[0]).data.name;
182 Roo.MesssageBox.alert("Error", "Error, you can not do this to listeners");
186 var val = _this.grid.currentNode.elConfig[n];
187 delete _this.grid.currentNode.elConfig[n];
188 _this.grid.currentNode.elConfig[ n.substring(1)] = val;
191 var val = _this.grid.currentNode.elConfig[n];
192 delete _this.grid.currentNode.elConfig[n];
193 _this.grid.currentNode.elConfig['|'+ n] = val;
196 _this.grid.setCurrrentNode(_this.grid.currentNode);
197 var bp = Pman.Tab.BuilderView.panel;
198 bp.redraw.defer(100,bp, [true]);
199 // update the tree's text
200 _this.grid.currentNode.setText(
201 Pman.Builder.Tree.configToText(_this.grid.currentNode.elConfig)
205 text : "Toggle property as Javascript"
215 click : function (_self, e)
218 var rc = _this.grid.getSelectionModel().getSelectedCell();
219 var n = _this.grid.getDataSource().getAt(rc[0]).data.name;
225 delete _this.grid.currentNode.elConfig.listeners[n.substring(1)];
227 delete _this.grid.currentNode.elConfig[n];
232 delete _this.grid.currentNode.elConfig[n];
235 _this.grid.setCurrrentNode(_this.grid.currentNode);
236 var bp = Pman.Tab.BuilderView.panel;
237 bp.redraw.defer(100,bp, [true]);
238 // update the tree's text
239 _this.grid.currentNode.setText(
240 Pman.Builder.Tree.configToText(_this.grid.currentNode.elConfig)
244 text : "Delete Property / Event"
256 click : function (_self, e)
259 // show a dialog to select property??
260 // or should we add a line and get clever with pulldowns..
261 var ec = _this.grid.currentNode.elConfig;
263 Pman.Dialog.BuilderProp.show({
264 xtype : ec.xtype || '',
265 xns: ec['|xns'] || '',
267 }, function (n,val) {
269 _this.grid.setCurrrentNode(_this.grid.currentNode);
270 var bp = Pman.Tab.BuilderView.panel;
271 bp.redraw.defer(100,bp, [true]);
272 // update the tree's text
273 _this.grid.currentNode.setText(
274 Pman.Builder.Tree.configToText(_this.grid.currentNode.elConfig)
279 text : "Add Property"
285 click : function (_self, e)
288 // show a dialog to select property??
289 // or should we add a line and get clever with pulldowns..
290 var ec = _this.grid.currentNode.elConfig;
291 Pman.Dialog.BuilderProp.show({
292 xtype : ec.xtype || '',
293 xns: ec['|xns'] || '',
295 }, function (n,val) {
297 ec[n] = val || "function () {\n\n}";
298 _this.grid.setCurrrentNode(_this.grid.currentNode);
299 var bp = Pman.Tab.BuilderView.panel;
300 bp.redraw.defer(100,bp, [true]);
301 // update the tree's text
302 _this.grid.currentNode.setText(
303 Pman.Builder.Tree.configToText(_this.grid.currentNode.elConfig)
308 text : "Add Event Handler"
318 click : function (_self, e)
321 // show a dialog to select property??
322 // or should we add a line and get clever with pulldowns..
325 text : "Add User Defined Property"