Blame view

js/app/views/PlotComponents/PlotStandardForm.js 21.8 KB
437c4dbc   Benjamin Renard   First implementat...
1
2
3
4
5
6
7
8
9
10
11
12
/**
 * Project   : AMDA-NG
 * Name      : PlotStandardForm.js
 * @class   amdaPlotComp.PlotStandardForm
 * @extends Ext.form.Panel
 * @brief   Standard Form used to define some options for a plot element
 * @author  Benjamin Renard
 * @version $Id: PlotStandardForm.js benjamin $
 */

Ext.define('amdaPlotComp.PlotStandardForm', {
	extend: 'Ext.form.Panel',
4dbd97ec   Menouard AZIB   Goal is reached b...
13
14
15

	requires: [
		'amdaPlotObj.PlotObjectConfig',
ba2fd748   Hacene SI HADJ MOHAND   selector ok
16
17
		'amdaPlotComp.EraseTrigger',
                                        'amdaPlotComp.PlotColorPicker'
437c4dbc   Benjamin Renard   First implementat...
18
	],
4dbd97ec   Menouard AZIB   Goal is reached b...
19
20
21
22
23
24
25
26
27
28

	//Object associated to this form
	object: null,

	//Link to the tree
	crtTree: null,
	desableTickNumber: true,
	desableTickSpacing: true,

	constructor: function (config) {
437c4dbc   Benjamin Renard   First implementat...
29
30
31
		this.init(config);
		this.callParent(arguments);
	},
4dbd97ec   Menouard AZIB   Goal is reached b...
32
33

	setObject: function (object) {
437c4dbc   Benjamin Renard   First implementat...
34
35
36
		this.object = object;
		this.loadRecord(this.object);
	},
4dbd97ec   Menouard AZIB   Goal is reached b...
37

437c4dbc   Benjamin Renard   First implementat...
38
	//To override to add form components
4dbd97ec   Menouard AZIB   Goal is reached b...
39
	getFormItems: function () {
437c4dbc   Benjamin Renard   First implementat...
40
41
		return [];
	},
4dbd97ec   Menouard AZIB   Goal is reached b...
42

0a295c3e   Benjamin Renard   Dynamic load of p...
43
	//Function called after element creation by PlotElementPanel
4dbd97ec   Menouard AZIB   Goal is reached b...
44
45
46
47
48
49
50
	updateElement: function (onAfterUpdate) {
		if (onAfterUpdate)
			onAfterUpdate();
	},

	//
	addStandardText: function (name, label, onChange) {
437c4dbc   Benjamin Renard   First implementat...
51
		return {
4dbd97ec   Menouard AZIB   Goal is reached b...
52
53
54
55
56
57
58
59
60
61
62
63
			xtype: 'textfield',
			name: name,
			fieldLabel: label,
			listeners: {
				change: function (field, newValue, oldValue, eOpts) {
					this.object.set(name, newValue);
					if (onChange != null)
						onChange(name, newValue, oldValue);
				},
				scope: this
			}
		};
437c4dbc   Benjamin Renard   First implementat...
64
	},
4dbd97ec   Menouard AZIB   Goal is reached b...
65
66

	addStandardFloat: function (name, label, min, max, allowBlank, onChange) {
003ba315   Benjamin Renard   Add Epoch Plot an...
67
		allowBlank = (typeof allowBlank !== 'undefined') ? allowBlank : false;
4dbd97ec   Menouard AZIB   Goal is reached b...
68

437c4dbc   Benjamin Renard   First implementat...
69
		return {
4dbd97ec   Menouard AZIB   Goal is reached b...
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
			xtype: 'numberfield',
			name: name,
			fieldLabel: label,
			decimalPrecision: 20,
			minValue: min,
			maxValue: max,
			allowBlank: allowBlank,
			listeners: {
				change: function (field, newValue, oldValue, eOpts) {
					this.object.set(name, newValue);
					if (onChange != null)
						onChange(name, newValue, oldValue);
				},
				scope: this
			}
		};
a3ed599f   Hacene SI HADJ MOHAND   rm 6954 ok
86
	},
4dbd97ec   Menouard AZIB   Goal is reached b...
87
	addStandardInteger: function (name, label, min, max, allowBlank, hidden, onChange) {
a3ed599f   Hacene SI HADJ MOHAND   rm 6954 ok
88
		allowBlank = (typeof allowBlank !== 'undefined') ? allowBlank : false;
4dbd97ec   Menouard AZIB   Goal is reached b...
89

a3ed599f   Hacene SI HADJ MOHAND   rm 6954 ok
90
		return {
4dbd97ec   Menouard AZIB   Goal is reached b...
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
			xtype: 'numberfield',
			name: name,
			fieldLabel: label,
			hidden: (hidden) ? true : false,
			regex: /^\d+$/,
			decimalPrecision: 20,
			minValue: min,
			maxValue: max,
			allowBlank: allowBlank,
			listeners: {
				change: function (field, newValue, oldValue, eOpts) {
					this.object.set(name, newValue);
					if (onChange != null)
						onChange(name, newValue, oldValue);
				},
				scope: this
			}
		};
437c4dbc   Benjamin Renard   First implementat...
109
	},
afb7b464   Benjamin Renard   Fix decimal preci...
110

4dbd97ec   Menouard AZIB   Goal is reached b...
111
	addStandardFloat2: function (name, label, min, max, allowBlank, hidden, onChange) {
afb7b464   Benjamin Renard   Fix decimal preci...
112
113
114
		allowBlank = (typeof allowBlank !== 'undefined') ? allowBlank : false;

		return {
afb7b464   Benjamin Renard   Fix decimal preci...
115
116
117
			xtype: 'textfield',
			name: name,
			fieldLabel: label,
4dbd97ec   Menouard AZIB   Goal is reached b...
118
119
			regex: /[-+]?(?:\d*\.?\d+|\d+\.?\d*)(?:[eE][-+]?\d+)?/,
			hidden: (hidden) ? true : false,
afb7b464   Benjamin Renard   Fix decimal preci...
120
121
122
123
124
125
126
127
128
129
130
			validator: function (val) {
				var errMsg = null;
				if (!allowBlank && Ext.isEmpty(val)) {
					errMsg = 'Blank value not allowed';
				}
				else if ((typeof min !== 'undefined') && (parseFloat(val) < min)) {
					errMsg = 'Min. allowed value is ' + min;
				}
				else if ((typeof max !== 'undefined') && (parseFloat(val) > max)) {
					errMsg = 'Max. allowed value is ' + max;
				}
4dbd97ec   Menouard AZIB   Goal is reached b...
131

afb7b464   Benjamin Renard   Fix decimal preci...
132
133
134
				return errMsg ? errMsg : true;
			},
			listeners: {
4dbd97ec   Menouard AZIB   Goal is reached b...
135
				change: function (field, newValue, oldValue, eOpts) {
afb7b464   Benjamin Renard   Fix decimal preci...
136
137
138
139
140
141
142
143
					this.object.set(name, newValue);
					if (onChange != null)
						onChange(name, newValue, oldValue);
				},
				scope: this
			}
		};
	},
4dbd97ec   Menouard AZIB   Goal is reached b...
144
145

	addStandardCombo: function (name, label, availableData, onChange) {
437c4dbc   Benjamin Renard   First implementat...
146
		var comboStore = Ext.create('Ext.data.Store', {
4dbd97ec   Menouard AZIB   Goal is reached b...
147
148
			fields: [amdaPlotObj.PlotObjectConfig.fieldComboBox.key, amdaPlotObj.PlotObjectConfig.fieldComboBox.value],
			data: availableData
437c4dbc   Benjamin Renard   First implementat...
149
		});
4dbd97ec   Menouard AZIB   Goal is reached b...
150

437c4dbc   Benjamin Renard   First implementat...
151
		return {
4dbd97ec   Menouard AZIB   Goal is reached b...
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
			xtype: 'combo',
			name: name,
			fieldLabel: label,
			store: comboStore,
			queryMode: 'local',
			displayField: 'value',
			valueField: 'key',
			editable: false,
			listeners: {
				change: function (combo, newValue, oldValue, eOpts) {
					if (onChange != null)
						onChange(name, newValue, oldValue);
					this.object.set(name, newValue);
				},
				scope: this
			}
		};
437c4dbc   Benjamin Renard   First implementat...
169
	},
4dbd97ec   Menouard AZIB   Goal is reached b...
170
171

	addStandardCheck: function (name, label, onChange, tooltip) {
d1bed2e2   Benjamin Renard   Change Isotropic ...
172

437c4dbc   Benjamin Renard   First implementat...
173
		return {
d1bed2e2   Benjamin Renard   Change Isotropic ...
174
175
176
177
			xtype: 'checkbox',
			name: name,
			boxLabel: label,
			listeners: {
4dbd97ec   Menouard AZIB   Goal is reached b...
178
				change: function (combo, newValue, oldValue, eOpts) {
d1bed2e2   Benjamin Renard   Change Isotropic ...
179
180
181
182
					this.object.set(name, newValue);
					if (onChange != null)
						onChange(name, newValue, oldValue);
				},
4dbd97ec   Menouard AZIB   Goal is reached b...
183
				render: function (c) {
d1bed2e2   Benjamin Renard   Change Isotropic ...
184
185
186
187
					if (tooltip) {
						Ext.create('Ext.tip.ToolTip', {
							target: c.getEl(),
							dismissDelay: 0,
4dbd97ec   Menouard AZIB   Goal is reached b...
188
							html: tooltip
d1bed2e2   Benjamin Renard   Change Isotropic ...
189
190
191
192
193
194
						});
					}
				},
				scope: this
			}
		};
437c4dbc   Benjamin Renard   First implementat...
195
	},
4dbd97ec   Menouard AZIB   Goal is reached b...
196

48fdb91e   Hacene SI HADJ MOHAND   us ok pour lines ...
197
	addStandardFieldSet: function (title, checkboxName, items, onChangeCheck, collapsed_ = true) {
437c4dbc   Benjamin Renard   First implementat...
198
		return {
4dbd97ec   Menouard AZIB   Goal is reached b...
199
200
201
202
			xtype: 'fieldset',
			cls: 'child-fieldset',
			title: title,
			collapsible: true,
48fdb91e   Hacene SI HADJ MOHAND   us ok pour lines ...
203
			collapsed: collapsed_,
4dbd97ec   Menouard AZIB   Goal is reached b...
204
205
206
207
208
209
			checkboxName: checkboxName,
			checkboxToggle: checkboxName != '',
			layout: {
				type: 'vbox',
				pack: 'start',
				align: 'stretch'
437c4dbc   Benjamin Renard   First implementat...
210
211
212
			},
			items: items,
			listeners: {
4dbd97ec   Menouard AZIB   Goal is reached b...
213
214
				expand: function (fieldset, eOpts) {
					if (checkboxName != '') {
437c4dbc   Benjamin Renard   First implementat...
215
						this.object.set(checkboxName, true);
dbb7bcbe   Benjamin Renard   Add curves defint...
216
217
218
						if (onChangeCheck != null)
							onChangeCheck(checkboxName, true, false);
					}
437c4dbc   Benjamin Renard   First implementat...
219
				},
4dbd97ec   Menouard AZIB   Goal is reached b...
220
221
				collapse: function (fieldset, eOpts) {
					if (checkboxName != '') {
437c4dbc   Benjamin Renard   First implementat...
222
						this.object.set(checkboxName, false);
dbb7bcbe   Benjamin Renard   Add curves defint...
223
224
225
						if (onChangeCheck != null)
							onChangeCheck(checkboxName, false, true);
					}
437c4dbc   Benjamin Renard   First implementat...
226
227
228
				},
				scope: this
			}
4dbd97ec   Menouard AZIB   Goal is reached b...
229
		};
437c4dbc   Benjamin Renard   First implementat...
230
	},
4dbd97ec   Menouard AZIB   Goal is reached b...
231
232

	addStandardFont: function (namePrefix) {
437c4dbc   Benjamin Renard   First implementat...
233
		var fontItems = [
4dbd97ec   Menouard AZIB   Goal is reached b...
234
235
236
237
			this.addStandardCombo(namePrefix + '-name', 'Name', amdaPlotObj.PlotObjectConfig.availableFontNames),
			{
				xtype: 'toolbar',
				bodyStyle: { background: '#dfe8f6' },
437c4dbc   Benjamin Renard   First implementat...
238
				border: false,
4dbd97ec   Menouard AZIB   Goal is reached b...
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
				items: [
					{
						xtype: 'numberfield',
						name: namePrefix + '-size',
						fieldLabel: 'Size',
						labelWidth: 60,
						width: 150,
						maxValue: 32,
						minValue: 6,
						value: 12,
						listeners: {
							change: function (field, newValue, oldValue, eOpts) {
								this.object.set(namePrefix + '-size', newValue);
							},
							scope: this
						}
					},
					' ',
					{
						xtype: 'checkbox',
						name: namePrefix + '-bold',
						boxLabel: '<b>B</b>',
						width: 30,
						listeners: {
							change: function (combo, newValue, oldValue, eOpts) {
								this.object.set(namePrefix + '-bold', newValue);
							},
							scope: this
						}
					},
					{
						xtype: 'checkbox',
						name: namePrefix + '-italic',
						boxLabel: '<i>I</i>',
						width: 30,
						listeners: {
							change: function (combo, newValue, oldValue, eOpts) {
								this.object.set(namePrefix + '-italic', newValue);
							},
							scope: this
						}
					}
				]
			}
437c4dbc   Benjamin Renard   First implementat...
283
		];
4dbd97ec   Menouard AZIB   Goal is reached b...
284
285

		return this.addStandardFieldSet('Font', namePrefix + '-activated', fontItems);
437c4dbc   Benjamin Renard   First implementat...
286
	},
4dbd97ec   Menouard AZIB   Goal is reached b...
287
288

	addStandardColor: function (name, label, availableData, onChange) {
437c4dbc   Benjamin Renard   First implementat...
289
		var comboStore = Ext.create('Ext.data.Store', {
4dbd97ec   Menouard AZIB   Goal is reached b...
290
291
			fields: ['color', 'value'],
			data: availableData
437c4dbc   Benjamin Renard   First implementat...
292
		});
4dbd97ec   Menouard AZIB   Goal is reached b...
293

437c4dbc   Benjamin Renard   First implementat...
294
		return {
4dbd97ec   Menouard AZIB   Goal is reached b...
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
			xtype: 'combo',
			name: name,
			fieldLabel: label,
			store: comboStore,
			queryMode: 'local',
			displayField: 'value',
			valueField: 'color',
			editable: false,
			tpl: Ext.create('Ext.XTemplate',
				'<ul class="x-list-plain"><tpl for=".">',
				'<li role="option" class="x-boundlist-item" style="color: {color};">{value}</li>',
				'</tpl></ul>'
			),
			// template for the content inside text field
			displayTpl: Ext.create('Ext.XTemplate',
				'<tpl for=".">',
				'{value}',
				'</tpl>'
			),


			listeners: {
				change: function (combo, newValue, oldValue, eOpts) {
					this.object.set(name, newValue);
					if (onChange != null)
						onChange(name, newValue, oldValue);
				},
				scope: this
			}
		};
437c4dbc   Benjamin Renard   First implementat...
325
	},
4dbd97ec   Menouard AZIB   Goal is reached b...
326
327

	addStandardParamDropTarget: function (name, label, onChange) {
17433635   Benjamin Renard   Add series and sp...
328
		return {
4dbd97ec   Menouard AZIB   Goal is reached b...
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
			xtype: 'erasetrigger',
			name: name,
			fieldLabel: label,
			emptyText: 'Drop a parameter',
			listeners: {
				change: function (field, newValue, oldValue, eOpts) {
					this.object.set(name, newValue);
					if (onChange != null)
						onChange(name, newValue, oldValue);
				},
				afterrender: function (field, eOpts) {
					var paramTarget = new Ext.dd.DropTarget(field.el.dom,
						{
							ddGroup: 'explorerTree',
							notifyEnter: function (ddSource, e, data) {
							},
							notifyDrop: function (ddSource, e, data) {
								var selectedRecord = ddSource.dragData.records[0];
								switch (selectedRecord.$className) {
									case 'amdaModel.LocalParamNode':
									case 'amdaModel.RemoteParamNode':
									case 'amdaModel.RemoteSimuParamNode':
										if (!selectedRecord.get('isParameter') || selectedRecord.get('disable'))
											return false;
										if (selectedRecord.get('alias') != "")
											field.setValue("#" + selectedRecord.get('alias'));
										else
											field.setValue(selectedRecord.get('id'));
										return true;
									case 'amdaModel.AliasNode':
										if (!selectedRecord.isLeaf())
											return false;
										field.setValue("#" + selectedRecord.get('text'));
										return true;
									case 'amdaModel.DerivedParamNode':
										if (!selectedRecord.isLeaf())
											return false;
										field.setValue("ws_" + selectedRecord.get('text'));
										return true;
									case 'amdaModel.MyDataParamNode':
										if (!selectedRecord.isLeaf())
											return false;
										field.setValue("wsd_" + selectedRecord.get('text'));
										return true;
									default:
										return false;
								}
								return true;
							}
						}
					);
				},
				scope: this
			}
		};
17433635   Benjamin Renard   Add series and sp...
384
	},
4dbd97ec   Menouard AZIB   Goal is reached b...
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402

	addStandardDate: function (name, label, onChange) {
		return {
			xtype: 'datefield',
			name: name,
			format: 'Y/m/d H:i:s',
			enforceMaxLength: true,
			maxLength: 19,
			fieldLabel: label,
			listeners: {
				change: function (field, newValue, oldValue, eOpts) {
					this.object.set(name, newValue);
					if (onChange != null)
						onChange(name, newValue, oldValue);
				},
				scope: this
			}
		};
6a801541   Benjamin Renard   Add possibility t...
403
	},
4dbd97ec   Menouard AZIB   Goal is reached b...
404
405

	addStandardLineItems: function (namePrefix) {
24b02d83   Benjamin Renard   Add definition of...
406
		return [
4dbd97ec   Menouard AZIB   Goal is reached b...
407
408
			this.addStandardCombo(namePrefix + '-style', 'Style', amdaPlotObj.PlotObjectConfig.availableLinesStyles),
			this.addStandardFloat(namePrefix + '-width', 'Width', 1, 10),
ba2fd748   Hacene SI HADJ MOHAND   selector ok
409
			//this.addStandardColor(namePrefix + '-color', 'Color', amdaPlotObj.PlotObjectConfig.availableColors), 
48fdb91e   Hacene SI HADJ MOHAND   us ok pour lines ...
410
                                                            this.addColorsPicker('serie-lines-color', 'Color')
24b02d83   Benjamin Renard   Add definition of...
411
412
		];
	},
4dbd97ec   Menouard AZIB   Goal is reached b...
413
414

	addStandardSymbolsItems: function (namePrefix) {
24b02d83   Benjamin Renard   Add definition of...
415
		return [
4dbd97ec   Menouard AZIB   Goal is reached b...
416
417
418
419
			this.addStandardCombo(namePrefix + '-type', 'Type', amdaPlotObj.PlotObjectConfig.availableSymbolsTypes),
			this.addStandardFloat(namePrefix + '-size', 'Size', 1, 10),
			this.addStandardColor(namePrefix + '-color', 'Color', amdaPlotObj.PlotObjectConfig.availableColors)
		];
24b02d83   Benjamin Renard   Add definition of...
420
	},
ba2fd748   Hacene SI HADJ MOHAND   selector ok
421
422
                     manageRGBcolors: function(namePrefix){
                         var rgb = this.object.get(namePrefix+'-rgb'); 
48fdb91e   Hacene SI HADJ MOHAND   us ok pour lines ...
423
424
425
426
427
                         if(rgb && rgb.length == 3){
                             var hexColor = this.rgbToHex(rgb);
                             this.object.set(namePrefix, hexColor);
                             this.getForm().findField(namePrefix+'-displayer').setValue(hexColor);
                         }
ba2fd748   Hacene SI HADJ MOHAND   selector ok
428
429
430
                     },
                     manageHEXcolors: function(namePrefix){
                         var hex = this.object.get(namePrefix);
48fdb91e   Hacene SI HADJ MOHAND   us ok pour lines ...
431
                         if(hex){
ba2fd748   Hacene SI HADJ MOHAND   selector ok
432
                              this.object.set(namePrefix+'-rgb', hexToRgb(hex));
48fdb91e   Hacene SI HADJ MOHAND   us ok pour lines ...
433
                          }
ba2fd748   Hacene SI HADJ MOHAND   selector ok
434
435
436
437
438
439
440
441
                     },
                     rgbToHex : function(rgb) {
                                return "#" + ((1 << 24) + (rgb[0] << 16) + (rgb[1] << 8) + rgb[2] ).toString(16).slice(1).toUpperCase();
                    },
                      hexToRgb: function(hex) {
                          var arrBuff = new ArrayBuffer(4);
                          var vw = new DataView(arrBuff);
                          vw.setUint32(0,parseInt(hex, 16),false);
48fdb91e   Hacene SI HADJ MOHAND   us ok pour lines ...
442
                          var arrByte = (new Uint8Array(arrBuff));
ba2fd748   Hacene SI HADJ MOHAND   selector ok
443

48fdb91e   Hacene SI HADJ MOHAND   us ok pour lines ...
444
                          return arrByte.slice(1,4);
ba2fd748   Hacene SI HADJ MOHAND   selector ok
445
                        },
48fdb91e   Hacene SI HADJ MOHAND   us ok pour lines ...
446
447
448
449
450
451
452
453
454
        
        /**
         * 
         * @param {type} namePrefix name of the variable in the opbject exp : 'serie-lines-color'
         * @param {type} name name of the field exp : Color 
         * @returns {PlotStandardFormAnonym$0.addStandardFieldSet.PlotStandardFormAnonym$10}
         */
                    addColorsPicker: function (namePrefix, name) {
                                                                  var me = this;
ba2fd748   Hacene SI HADJ MOHAND   selector ok
455
456
                        
                                        var colorPicker =  Ext.create('amdaPlotComp.PlotColorPicker', {
48fdb91e   Hacene SI HADJ MOHAND   us ok pour lines ...
457
                                                value: '000000',  // initial selected color
ba2fd748   Hacene SI HADJ MOHAND   selector ok
458
459
460
461
                                                renderTo: Ext.getBody(),
                                                listeners: {
                                                    select: function(picker, selColor) {
                                                        this.object.set(namePrefix, selColor);
48fdb91e   Hacene SI HADJ MOHAND   us ok pour lines ...
462
463
464
465
466
467
468
469
                                                        this.getForm().findField(namePrefix+'-displayer').setValue('#'+selColor);
                                                  
                                                        rgb = this.hexToRgb(selColor);
                                                         if(rgb && rgb.length ==3 ){
                                                             this.getForm().findField(namePrefix+'-R').setValue(rgb[0]);
                                                             this.getForm().findField(namePrefix+'-G').setValue(rgb[1]);
                                                             this.getForm().findField(namePrefix+'-B').setValue(rgb[2]);
                                                         }
ba2fd748   Hacene SI HADJ MOHAND   selector ok
470
471
472
473
                                                    },
                                                    scope: this
                                                }
                                            });
48fdb91e   Hacene SI HADJ MOHAND   us ok pour lines ...
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
                                        var colorDisplayer = {
                                                                                    xtype: 'displayfield',
                                                                                    name: namePrefix + '-displayer',
                                                                                    border:2,
                                                                                    fieldLabel: 'HEX:',
                                                                                    value:"#000000",
                                                                                    region:'center',
                                                                                    style: {
                                                                                        borderStyle: 'solid',
                                                                                        background: '#000000',
                                                                                    },
                                                                                    listeners: {
                                                                                        change: function (field, newValue, oldValue, eOpts) {
                                                                                           field.getEl().applyStyles({'background':newValue});
                                                                                        },
                                                                                        scope: this 
                                                                                    }
                                                                                };
		var rgbItems = 
ba2fd748   Hacene SI HADJ MOHAND   selector ok
493
494
495
496
                                                                                {
				xtype: 'toolbar',
				bodyStyle: { background: '#dfe8f6' },
				border: false,
48fdb91e   Hacene SI HADJ MOHAND   us ok pour lines ...
497
                                                                                name:namePrefix+'-rgb',
ba2fd748   Hacene SI HADJ MOHAND   selector ok
498
499
500
501
				items: [
                                                                                                  
					{
						xtype: 'numberfield',
48fdb91e   Hacene SI HADJ MOHAND   us ok pour lines ...
502
						name: namePrefix+'-R',
ba2fd748   Hacene SI HADJ MOHAND   selector ok
503
						fieldLabel: 'R',
48fdb91e   Hacene SI HADJ MOHAND   us ok pour lines ...
504
505
						labelWidth: 12,
						width: 65,
ba2fd748   Hacene SI HADJ MOHAND   selector ok
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
						maxValue: 255,
						minValue: 0,
						value: 0,
						listeners: {
							change: function (field, newValue, oldValue, eOpts) {
                                                                                                                                                                var rgb = this.object.get(namePrefix+"-rgb");
                                                                                                                                                                if(rgb && rgb.length ==3 )
                                                                                                                                                                    rgb[0] = newValue;
                                                                                                                                                                else
                                                                                                                                                                    rgb = [newValue,0,0];
								this.object.set(namePrefix+"-rgb", rgb)
                                                                                                                                                                this.manageRGBcolors(namePrefix);
							},
							scope: this
						}
					},
					' ',
                                                                                                     {
						xtype: 'numberfield',
48fdb91e   Hacene SI HADJ MOHAND   us ok pour lines ...
525
						name: namePrefix+'-G',
ba2fd748   Hacene SI HADJ MOHAND   selector ok
526
						fieldLabel: 'G',
48fdb91e   Hacene SI HADJ MOHAND   us ok pour lines ...
527
528
						labelWidth: 12,
						width: 65,
ba2fd748   Hacene SI HADJ MOHAND   selector ok
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
						maxValue: 255,
						minValue: 0,
						value: 0,
						listeners: {
							change: function (field, newValue, oldValue, eOpts) {
								var rgb = this.object.get(namePrefix+"-rgb");
                                                                                                                                                                if(rgb && rgb.length ==3 )
                                                                                                                                                                    rgb[1] = newValue;
                                                                                                                                                                else
                                                                                                                                                                    rgb = [0, newValue, 0];
								this.object.set(namePrefix+"-rgb", rgb);
                                                                                                                                                                this.manageRGBcolors(namePrefix);
							},
							scope: this
						}
					},
                                                                                                    ' ',
                                                                                                    {
						xtype: 'numberfield',
48fdb91e   Hacene SI HADJ MOHAND   us ok pour lines ...
548
						name: namePrefix+'-B',
ba2fd748   Hacene SI HADJ MOHAND   selector ok
549
						fieldLabel: 'B',
48fdb91e   Hacene SI HADJ MOHAND   us ok pour lines ...
550
551
						labelWidth: 12,
						width: 65,
ba2fd748   Hacene SI HADJ MOHAND   selector ok
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
						maxValue: 255,
						minValue: 0,
						value: 0,
						listeners: {
							change: function (field, newValue, oldValue, eOpts) {
								var rgb = this.object.get(namePrefix+"-rgb");
                                                                                                                                                                if(rgb && rgb.length ==3 )
                                                                                                                                                                    rgb[2] = newValue;
                                                                                                                                                                else
                                                                                                                                                                    rgb = [0,0,newValue];
								this.object.set(namePrefix+"-rgb", rgb);
                                                                                                                                                                this.manageRGBcolors(namePrefix);
							},
							scope: this
						}
					},
					
				]
			}
ba2fd748   Hacene SI HADJ MOHAND   selector ok
571

48fdb91e   Hacene SI HADJ MOHAND   us ok pour lines ...
572
573
574
575
576
577
578
579
580
581
582
583
		
                                        var items = [ this.addStandardCheck(namePrefix + '-auto','Auto', function(name, value, oldValue){
                                                                       me.getForm( ).findField(namePrefix + '-activated').setValue(!value);
                                                                       me.object.set(namePrefix,me.object.getDefaultColor(namePrefix));
                                                                    }),
           
                                              this.addStandardFieldSet('Select Color', namePrefix + '-activated',[colorPicker,colorDisplayer, rgbItems], function(name, value, oldValue){
                                                                        me.getForm( ).findField(namePrefix + '-auto').setValue(!value);                                                
                                                                    }),
                                        ];
		          
                                        return this.addStandardFieldSet(name,'', items, null, false);
ba2fd748   Hacene SI HADJ MOHAND   selector ok
584
	},
4dbd97ec   Menouard AZIB   Goal is reached b...
585
586

	init: function (config) {
437c4dbc   Benjamin Renard   First implementat...
587
		var me = this;
4dbd97ec   Menouard AZIB   Goal is reached b...
588

437c4dbc   Benjamin Renard   First implementat...
589
		var myConf = {
4dbd97ec   Menouard AZIB   Goal is reached b...
590
591
592
593
594
595
596
597
598
			bodyPadding: 5,
			bodyStyle: { background: '#dfe8f6' },
			border: false,
			layout: {
				type: 'vbox',
				pack: 'start',
				align: 'stretch'
			},
			items: this.getFormItems()
437c4dbc   Benjamin Renard   First implementat...
599
		};
4dbd97ec   Menouard AZIB   Goal is reached b...
600
601

		Ext.apply(this, Ext.apply(arguments, myConf));
437c4dbc   Benjamin Renard   First implementat...
602
	}
e0648247   Benjamin Renard   Set decimal preci...
603
});