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;
224 delete _this.grid.currentNode.elConfig.listeners[n.substring(1)];
226 delete _this.grid.currentNode.elConfig[n];
229 _this.grid.setCurrrentNode(_this.grid.currentNode);
230 var bp = Pman.Tab.BuilderView.panel;
231 bp.redraw.defer(100,bp, [true]);
232 // update the tree's text
233 _this.grid.currentNode.setText(
234 Pman.Builder.Tree.configToText(_this.grid.currentNode.elConfig)
238 text : "Delete Property / Event"
250 click : function (_self, e)
253 // show a dialog to select property??
254 // or should we add a line and get clever with pulldowns..
255 var ec = _this.grid.currentNode.elConfig;
257 Pman.Dialog.BuilderProp.show({
258 xtype : ec.xtype || '',
259 xns: ec['|xns'] || '',
261 }, function (n,val) {
263 _this.grid.setCurrrentNode(_this.grid.currentNode);
264 var bp = Pman.Tab.BuilderView.panel;
265 bp.redraw.defer(100,bp, [true]);
266 // update the tree's text
267 _this.grid.currentNode.setText(
268 Pman.Builder.Tree.configToText(_this.grid.currentNode.elConfig)
273 text : "Add Property"
279 click : function (_self, e)
282 // show a dialog to select property??
283 // or should we add a line and get clever with pulldowns..
284 var ec = _this.grid.currentNode.elConfig;
285 Pman.Dialog.BuilderProp.show({
286 xtype : ec.xtype || '',
287 xns: ec['|xns'] || '',
289 }, function (n,val) {
291 ec[n] = val || "function () {\n\n}";
292 _this.grid.setCurrrentNode(_this.grid.currentNode);
293 var bp = Pman.Tab.BuilderView.panel;
294 bp.redraw.defer(100,bp, [true]);
295 // update the tree's text
296 _this.grid.currentNode.setText(
297 Pman.Builder.Tree.configToText(_this.grid.currentNode.elConfig)
302 text : "Add Event Handler"
312 click : function (_self, e)
315 // show a dialog to select property??
316 // or should we add a line and get clever with pulldowns..
319 text : "Add User Defined Property"