Blame view

js/app/models/PlotObjects/PlotTreeNode.js 7.69 KB
437c4dbc   Benjamin Renard   First implementat...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/**
 * Project      : AMDA-NG
 * Name         : PlotTreeNode.js
 * @class   amdaPlotObj.PlotTreeNode
 * @extends Ext.data.Model
 * @brief   Plot Tree Node Definition 
 * @author  Benjamin Renard
 * @version $Id: PlotTreeNode.js benjamin $
 ******************************************************************************
 *    FT Id     :   Date   : Name - Description
 ******************************************************************************
 *	:           :23/07/2015: BRE  - file creation
 */

Ext.define('amdaPlotObj.PlotTreeNode', {
	extend: 'Ext.data.Model', 	
dbb7bcbe   Benjamin Renard   Add curves defint...
17
	
437c4dbc   Benjamin Renard   First implementat...
18
19
20
21
22
23
24
25
26
27
28
29
	//Node type
	type: '',
	
	//Node text
	text: '',
	
	//Node icon class
	iconCls: '',
	
	//Node leaf
	leaf: false,
	
abe09878   Benjamin Renard   Add panels and ax...
30
31
32
	//Node expanded
	expanded : true,
	
17433635   Benjamin Renard   Add series and sp...
33
34
35
	//Node can be removed by user
	removable : false,
	
437c4dbc   Benjamin Renard   First implementat...
36
37
38
	//Link to the object associated to this node 
	object: null,
	
abe09878   Benjamin Renard   Add panels and ax...
39
40
41
	//Additional information about a node to show in the tree view
	getAdditionalText : null,
	
2a0b8d2c   Benjamin Renard   Restore node stat...
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
	getNodeStateKey : null,
	
	getNodeState : function()
	{
		if (!this.getNodeStateKey || !this.object)
			return;
		return this.object.get(this.getNodeStateKey());
	},
	
	setNodeState : function(state)
	{
		if (!this.getNodeStateKey || !this.object)
			return;
		this.object.set(this.getNodeStateKey(), state);
	},
	
437c4dbc   Benjamin Renard   First implementat...
58
59
60
61
62
63
	constructor : function(config)
    {
		this.callParent(arguments);
		this.set('text',this.text);
		this.set('iconCls',this.iconCls);
		this.set('leaf',this.leaf);
abe09878   Benjamin Renard   Add panels and ax...
64
		this.set('type',this.type);
17433635   Benjamin Renard   Add series and sp...
65
		this.set('removable',this.removable);
7f23e0f7   Erdogan Furkan   #5119 -Done. Adde...
66
		if (config && config.object) {
437c4dbc   Benjamin Renard   First implementat...
67
			this.object = config.object;
7f23e0f7   Erdogan Furkan   #5119 -Done. Adde...
68
69
			this.set('qtip', config.object.get('info'));
		}
2a0b8d2c   Benjamin Renard   Restore node stat...
70
71
72
73
74
75
		if (this.getNodeState() != 2)
			this.set('expanded',(this.getNodeState() == 1));
		else {
			this.set('expanded',this.expanded);
			this.setNodeState(this.expanded ? 1 : 0);
		}
7f23e0f7   Erdogan Furkan   #5119 -Done. Adde...
76
		
437c4dbc   Benjamin Renard   First implementat...
77
78
79
80
81
82
83
84
85
86
87
88
    }	
}, function () {
    Ext.data.NodeInterface.decorate(this);
});

Ext.define('amdaPlotObj.PlotPageTreeNode', {
	extend: 'amdaPlotObj.PlotTreeNode',
	
	iconCls: 'icon-plot-page',
	
	text: 'Page',
	
abe09878   Benjamin Renard   Add panels and ax...
89
90
	type: 'page',
	
2a0b8d2c   Benjamin Renard   Restore node stat...
91
92
93
94
95
	getNodeStateKey: function()
	{
		return 'page-node-state';
	},
	
abe09878   Benjamin Renard   Add panels and ax...
96
97
	getAdditionalText: function()
	{
fd5552a4   Benjamin Renard   Info for plot ele...
98
		return ' ('+this.object.getPageShortInfo()+')';
abe09878   Benjamin Renard   Add panels and ax...
99
	}
437c4dbc   Benjamin Renard   First implementat...
100
101
102
103
104
105
106
107
108
109
110
});

Ext.define('amdaPlotObj.PlotLayoutTreeNode', {
	extend: 'amdaPlotObj.PlotTreeNode',
	
	leaf: true,
	
	iconCls: 'icon-plot-layout',
	
	text: 'Layout',
	
003ba315   Benjamin Renard   Add Epoch Plot an...
111
112
113
114
	type: 'layout',
	
	getAdditionalText: function()
	{
fd5552a4   Benjamin Renard   Info for plot ele...
115
		return ' ('+this.object.getLayoutShortInfo()+')';
003ba315   Benjamin Renard   Add Epoch Plot an...
116
	}
437c4dbc   Benjamin Renard   First implementat...
117
118
119
120
121
122
123
124
125
});

Ext.define('amdaPlotObj.PlotPanelsTreeNode', {
	extend: 'amdaPlotObj.PlotTreeNode',
	
	iconCls: 'icon-plot-panels',
	
	text: 'Panels list',
	
2a0b8d2c   Benjamin Renard   Restore node stat...
126
127
128
129
130
131
	type: 'panels',
	
	getNodeStateKey: function()
	{
		return 'panels-node-state';
	}
437c4dbc   Benjamin Renard   First implementat...
132
133
134
135
136
137
138
139
140
});

Ext.define('amdaPlotObj.PlotPanelTreeNode', {
	extend: 'amdaPlotObj.PlotTreeNode',
	
	iconCls: 'icon-plot-panel',
	
	text: 'Panel',
	
abe09878   Benjamin Renard   Add panels and ax...
141
142
	type: 'panel',
	
17433635   Benjamin Renard   Add series and sp...
143
144
	removable: true,
	
2a0b8d2c   Benjamin Renard   Restore node stat...
145
146
147
148
149
	getNodeStateKey: function()
	{
		return 'panel-node-state';
	},
	
abe09878   Benjamin Renard   Add panels and ax...
150
151
	getAdditionalText: function()
	{
fd5552a4   Benjamin Renard   Info for plot ele...
152
		return ' ('+this.object.getPanelShortInfo()+')';
abe09878   Benjamin Renard   Add panels and ax...
153
	}
437c4dbc   Benjamin Renard   First implementat...
154
155
});

abe09878   Benjamin Renard   Add panels and ax...
156
Ext.define('amdaPlotObj.PlotAxesTreeNode', {
437c4dbc   Benjamin Renard   First implementat...
157
158
	extend: 'amdaPlotObj.PlotTreeNode',
	
abe09878   Benjamin Renard   Add panels and ax...
159
	expanded: false,
437c4dbc   Benjamin Renard   First implementat...
160
	
abe09878   Benjamin Renard   Add panels and ax...
161
	iconCls: 'icon-plot-axes',
437c4dbc   Benjamin Renard   First implementat...
162
	
abe09878   Benjamin Renard   Add panels and ax...
163
164
	text: 'Axes',
	
2a0b8d2c   Benjamin Renard   Restore node stat...
165
166
167
168
169
170
	type: 'axes',
	
	getNodeStateKey: function()
	{
		return 'axes-node-state';
	}
437c4dbc   Benjamin Renard   First implementat...
171
172
173
174
175
});

Ext.define('amdaPlotObj.PlotTimeAxisTreeNode', {
	extend: 'amdaPlotObj.PlotTreeNode',
	
abe09878   Benjamin Renard   Add panels and ax...
176
177
	leaf: true,
	
437c4dbc   Benjamin Renard   First implementat...
178
179
180
181
182
183
184
	iconCls: 'icon-plot-axis-t',
	
	text: 'Time Axis',
	
	type: 'time-axis'
});

abe09878   Benjamin Renard   Add panels and ax...
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
Ext.define('amdaPlotObj.PlotEpochAxisTreeNode', {
	extend: 'amdaPlotObj.PlotTreeNode',
	
	leaf: true,
	
	iconCls: 'icon-plot-axis-e',
	
	text: 'Epoch Axis',
	
	type: 'epoch-axis'
});

Ext.define('amdaPlotObj.PlotXAxisTreeNode', {
	extend: 'amdaPlotObj.PlotTreeNode',
	
	leaf: true,
	
	iconCls: 'icon-plot-axis-x',
	
	text: 'X Axis',
	
	type: 'x-axis'
});

Ext.define('amdaPlotObj.PlotYLeftAxisTreeNode', {
	extend: 'amdaPlotObj.PlotTreeNode',
	
	leaf: true,
	
	iconCls: 'icon-plot-axis-y-left',
	
	text: 'Y Left Axis',
	
	type: 'y-left-axis'
});

Ext.define('amdaPlotObj.PlotYRightAxisTreeNode', {
	extend: 'amdaPlotObj.PlotTreeNode',
	
	leaf: true,
	
	iconCls: 'icon-plot-axis-y-right',
	
	text: 'Y Right Axis',
	
	type: 'y-right-axis'
});

Ext.define('amdaPlotObj.PlotColorAxisTreeNode', {
	extend: 'amdaPlotObj.PlotTreeNode',
	
	leaf: true,
	
	iconCls: 'icon-plot-axis-color',
	
	text: 'Color Axis',
	
	type: 'color-axis'
});

17433635   Benjamin Renard   Add series and sp...
245
246
247
248
249
250
251
Ext.define('amdaPlotObj.PlotParamsTreeNode', {
	extend: 'amdaPlotObj.PlotTreeNode',
	
	iconCls: 'icon-plot-params',
	
	text: 'Params',
	
2a0b8d2c   Benjamin Renard   Restore node stat...
252
253
254
255
256
257
	type: 'params',
	
	getNodeStateKey: function()
	{
		return 'params-node-state';
	}
17433635   Benjamin Renard   Add series and sp...
258
});
abe09878   Benjamin Renard   Add panels and ax...
259

17433635   Benjamin Renard   Add series and sp...
260
261
262
263
264
265
266
267
268
269
270
271
Ext.define('amdaPlotObj.PlotParamTreeNode', {
	extend: 'amdaPlotObj.PlotTreeNode',
	
	leaf: true,
	
	//iconCls: 'icon-plot-params',
	
	text: '',
	
	type: 'param',
	
	removable: true,
8caed468   Benjamin Renard   Fix axes ranges d...
272
273

	panelObject: null,
17433635   Benjamin Renard   Add series and sp...
274
275
276
	
	getAdditionalText: function()
	{
dbb7bcbe   Benjamin Renard   Add curves defint...
277
278
		var parentNode = this.parentNode;
		var plotType = parentNode.object.get('panel-plot-type');
fd5552a4   Benjamin Renard   Info for plot ele...
279
		return this.object.getShortInfo(plotType);
17433635   Benjamin Renard   Add series and sp...
280
281
	}
});
abe09878   Benjamin Renard   Add panels and ax...
282

94abdb37   Benjamin Renard   Add params legend...
283
284
285
286
287
288
289
290
291
Ext.define('amdaPlotObj.PlotAdditionalObjectsTreeNode', {
	extend: 'amdaPlotObj.PlotTreeNode',
	
	expanded: false,
	
	iconCls: 'icon-plot-add-objs',
	
	text: 'Additional Objects',
	
2a0b8d2c   Benjamin Renard   Restore node stat...
292
293
294
295
296
297
	type: 'objects',
	
	getNodeStateKey: function()
	{
		return 'add-objects-node-state';
	}
94abdb37   Benjamin Renard   Add params legend...
298
299
});

437c4dbc   Benjamin Renard   First implementat...
300
301
302
Ext.define('amdaPlotObj.PlotLegendsTreeNode', {
	extend: 'amdaPlotObj.PlotTreeNode',
	
94abdb37   Benjamin Renard   Add params legend...
303
	iconCls: 'icon-plot-add-legends',
437c4dbc   Benjamin Renard   First implementat...
304
305
306
	
	text: 'Legends',
	
2a0b8d2c   Benjamin Renard   Restore node stat...
307
308
309
310
311
312
	type: 'legends',
	
	getNodeStateKey: function()
	{
		return 'legends-node-state';
	}
437c4dbc   Benjamin Renard   First implementat...
313
});
94abdb37   Benjamin Renard   Add params legend...
314
315
316
317
318
319
320
321
322
323

Ext.define('amdaPlotObj.PlotSeriesLegendTreeNode', {
	extend: 'amdaPlotObj.PlotTreeNode',
	
	leaf: true,
	
	iconCls: 'icon-plot-add-legend-series',
	
	text: 'Series Legend',
	
dbb7bcbe   Benjamin Renard   Add curves defint...
324
325
326
327
	type: 'series-legend',
	
	getAdditionalText: function()
	{
fd5552a4   Benjamin Renard   Info for plot ele...
328
329
330
		if (this.object.get('panel-legend-series'))
			return ' ('+this.object.get('panel-legend-series').getShortInfo()+')';
		return '';
dbb7bcbe   Benjamin Renard   Add curves defint...
331
	}
94abdb37   Benjamin Renard   Add params legend...
332
333
334
335
336
337
338
339
340
});

Ext.define('amdaPlotObj.PlotTextLegendsTreeNode', {
	extend: 'amdaPlotObj.PlotTreeNode',
	
	iconCls: 'icon-plot-add-legends-text',
	
	text: 'Text Legends',
	
2a0b8d2c   Benjamin Renard   Restore node stat...
341
342
343
344
345
346
	type: 'text-legends',
	
	getNodeStateKey: function()
	{
		return 'text-legends-node-state';
	}
94abdb37   Benjamin Renard   Add params legend...
347
348
349
350
351
352
353
354
355
356
357
});

Ext.define('amdaPlotObj.PlotTextLegendTreeNode', {
	extend: 'amdaPlotObj.PlotTreeNode',
	
	leaf: true,
	
	iconCls: 'icon-plot-add-legend-text',
	
	text: 'Text Legend',
	
339866c4   Benjamin Renard   Add text legend d...
358
359
	type: 'text-legend',
	
dbb7bcbe   Benjamin Renard   Add curves defint...
360
361
362
363
	removable: true,
	
	getAdditionalText: function()
	{
fd5552a4   Benjamin Renard   Info for plot ele...
364
		return ' ('+this.object.getShortInfo()+')';
dbb7bcbe   Benjamin Renard   Add curves defint...
365
	}
94abdb37   Benjamin Renard   Add params legend...
366
367
});

829160b3   Benjamin Renard   Add constants def...
368
369
370
371
372
373
374
Ext.define('amdaPlotObj.PlotDrawingObjectsTreeNode', {
	extend: 'amdaPlotObj.PlotTreeNode',
	
	iconCls: 'icon-plot-add-drawing-objs',
	
	text: 'Drawing objects',
	
2a0b8d2c   Benjamin Renard   Restore node stat...
375
376
377
378
379
380
	type: 'drawing-objects',
	
	getNodeStateKey: function()
	{
		return 'drawing-objects-node-state';
	}
829160b3   Benjamin Renard   Add constants def...
381
382
383
384
385
386
387
388
389
390
391
392
393
});

Ext.define('amdaPlotObj.PlotConstantTreeNode', {
	extend: 'amdaPlotObj.PlotTreeNode',
	
	leaf: true,
	
	iconCls: 'icon-plot-add-drawing-constant',
	
	text: 'Constant',
	
	type: 'constant',
	
dbb7bcbe   Benjamin Renard   Add curves defint...
394
395
396
397
	removable: true,
	
	getAdditionalText: function()
	{
fd5552a4   Benjamin Renard   Info for plot ele...
398
		return ' ('+this.object.getShortInfo()+')';
dbb7bcbe   Benjamin Renard   Add curves defint...
399
	}
829160b3   Benjamin Renard   Add constants def...
400
401
});

a8c54fb9   Benjamin Renard   Add text object p...
402
403
404
405
406
407
408
409
410
411
412
413
414
Ext.define('amdaPlotObj.PlotTextTreeNode', {
	extend: 'amdaPlotObj.PlotTreeNode',
	
	leaf: true,
	
	iconCls: 'icon-plot-add-drawing-text',
	
	text: 'Text',
	
	type: 'text-obj',
	
	removable: true
});
dbb7bcbe   Benjamin Renard   Add curves defint...
415
416
417
418
419
420
421
422
423
424
425
426
427
428

Ext.define('amdaPlotObj.PlotCurveTreeNode', {
	extend: 'amdaPlotObj.PlotTreeNode',
	
	leaf: true,
	
	iconCls: 'icon-plot-add-drawing-curve',
	
	text: 'Curve',
	
	type: 'curve',
	
	removable: true
});
486cc3c7   Benjamin Renard   Add fill elements...
429
430
431
432
433
434
435
436

Ext.define('amdaPlotObj.PlotFillsTreeNode', {
	extend: 'amdaPlotObj.PlotTreeNode',
	
	iconCls: 'icon-plot-add-fills',
	
	text: 'Fills',
	
2a0b8d2c   Benjamin Renard   Restore node stat...
437
438
439
440
441
442
	type: 'fills',
	
	getNodeStateKey: function()
	{
		return 'fills-node-state';
	}
486cc3c7   Benjamin Renard   Add fill elements...
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
});

Ext.define('amdaPlotObj.PlotFillTreeNode', {
	extend: 'amdaPlotObj.PlotTreeNode',
	
	leaf: true,
	
	iconCls: 'icon-plot-add-fill',
	
	text: 'Fill',
	
	type: 'fill',
		
	removable: true,
	
	getAdditionalText: function()
	{
		return ' ('+this.object.getShortInfo()+')';
	}
});