Blame view

js/app/models/PlotObjects/PlotTreeNode.js 7.68 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);
437c4dbc   Benjamin Renard   First implementat...
70
71
		if (config && config.object)
			this.object = config.object;
2a0b8d2c   Benjamin Renard   Restore node stat...
72
73
74
75
76
77
		if (this.getNodeState() != 2)
			this.set('expanded',(this.getNodeState() == 1));
		else {
			this.set('expanded',this.expanded);
			this.setNodeState(this.expanded ? 1 : 0);
		}
437c4dbc   Benjamin Renard   First implementat...
78
79
80
81
82
83
84
85
86
87
88
89
    }	
}, 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...
90
91
	type: 'page',
	
2a0b8d2c   Benjamin Renard   Restore node stat...
92
93
94
95
96
	getNodeStateKey: function()
	{
		return 'page-node-state';
	},
	
abe09878   Benjamin Renard   Add panels and ax...
97
98
	getAdditionalText: function()
	{
fd5552a4   Benjamin Renard   Info for plot ele...
99
		return ' ('+this.object.getPageShortInfo()+')';
abe09878   Benjamin Renard   Add panels and ax...
100
	}
437c4dbc   Benjamin Renard   First implementat...
101
102
103
104
105
106
107
108
109
110
111
});

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

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

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

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

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

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

17433635   Benjamin Renard   Add series and sp...
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
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...
276
277
		var parentNode = this.parentNode;
		var plotType = parentNode.object.get('panel-plot-type');
fd5552a4   Benjamin Renard   Info for plot ele...
278
		return this.object.getShortInfo(plotType);
17433635   Benjamin Renard   Add series and sp...
279
280
	}
});
abe09878   Benjamin Renard   Add panels and ax...
281

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

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

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

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

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

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

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

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

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...
428
429
430
431
432
433
434
435

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

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