Blame view

js/app/models/PlotObjects/PlotTreeNode.js 7.74 KB
437c4dbc   Benjamin Renard   First implementat...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/**
 * 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...
18
19
20
21
	requires: [
	           'amdaPlotObj.PlotObjectConfig'
	],
	
437c4dbc   Benjamin Renard   First implementat...
22
23
24
25
26
27
28
29
30
31
32
33
	//Node type
	type: '',
	
	//Node text
	text: '',
	
	//Node icon class
	iconCls: '',
	
	//Node leaf
	leaf: false,
	
abe09878   Benjamin Renard   Add panels and ax...
34
35
36
	//Node expanded
	expanded : true,
	
17433635   Benjamin Renard   Add series and sp...
37
38
39
	//Node can be removed by user
	removable : false,
	
437c4dbc   Benjamin Renard   First implementat...
40
41
42
	//Link to the object associated to this node 
	object: null,
	
abe09878   Benjamin Renard   Add panels and ax...
43
44
45
	//Additional information about a node to show in the tree view
	getAdditionalText : null,
	
2a0b8d2c   Benjamin Renard   Restore node stat...
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
	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...
62
63
64
65
66
67
	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...
68
		this.set('type',this.type);
17433635   Benjamin Renard   Add series and sp...
69
		this.set('removable',this.removable);
7f23e0f7   Erdogan Furkan   #5119 -Done. Adde...
70
		if (config && config.object) {
437c4dbc   Benjamin Renard   First implementat...
71
			this.object = config.object;
7f23e0f7   Erdogan Furkan   #5119 -Done. Adde...
72
73
			this.set('qtip', config.object.get('info'));
		}
2a0b8d2c   Benjamin Renard   Restore node stat...
74
75
76
77
78
79
		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...
80
		
437c4dbc   Benjamin Renard   First implementat...
81
82
83
84
85
86
87
88
89
90
91
92
    }	
}, 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...
93
94
	type: 'page',
	
2a0b8d2c   Benjamin Renard   Restore node stat...
95
96
97
98
99
	getNodeStateKey: function()
	{
		return 'page-node-state';
	},
	
abe09878   Benjamin Renard   Add panels and ax...
100
101
	getAdditionalText: function()
	{
fd5552a4   Benjamin Renard   Info for plot ele...
102
		return ' ('+this.object.getPageShortInfo()+')';
abe09878   Benjamin Renard   Add panels and ax...
103
	}
437c4dbc   Benjamin Renard   First implementat...
104
105
106
107
108
109
110
111
112
113
114
});

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

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

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

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

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

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

17433635   Benjamin Renard   Add series and sp...
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
Ext.define('amdaPlotObj.PlotParamTreeNode', {
	extend: 'amdaPlotObj.PlotTreeNode',
	
	leaf: true,
	
	//iconCls: 'icon-plot-params',
	
	text: '',
	
	type: 'param',
	
	removable: true,
	
	getAdditionalText: function()
	{
dbb7bcbe   Benjamin Renard   Add curves defint...
279
280
		var parentNode = this.parentNode;
		var plotType = parentNode.object.get('panel-plot-type');
fd5552a4   Benjamin Renard   Info for plot ele...
281
		return this.object.getShortInfo(plotType);
17433635   Benjamin Renard   Add series and sp...
282
283
	}
});
abe09878   Benjamin Renard   Add panels and ax...
284

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

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

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

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

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...
360
361
	type: 'text-legend',
	
dbb7bcbe   Benjamin Renard   Add curves defint...
362
363
364
365
	removable: true,
	
	getAdditionalText: function()
	{
fd5552a4   Benjamin Renard   Info for plot ele...
366
		return ' ('+this.object.getShortInfo()+')';
dbb7bcbe   Benjamin Renard   Add curves defint...
367
	}
94abdb37   Benjamin Renard   Add params legend...
368
369
});

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

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...
396
397
398
399
	removable: true,
	
	getAdditionalText: function()
	{
fd5552a4   Benjamin Renard   Info for plot ele...
400
		return ' ('+this.object.getShortInfo()+')';
dbb7bcbe   Benjamin Renard   Add curves defint...
401
	}
829160b3   Benjamin Renard   Add constants def...
402
403
});

a8c54fb9   Benjamin Renard   Add text object p...
404
405
406
407
408
409
410
411
412
413
414
415
416
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...
417
418
419
420
421
422
423
424
425
426
427
428
429
430

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...
431
432
433
434
435
436
437
438

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

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()+')';
	}
});