Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 026c812e0ad69a44f7e790b5bb8b09dbce74dfa2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
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
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
283
284
285
286
287
288
289
290
291
292
293
294
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
325
326
327
328
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
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
/*****************************************************************************
 * Copyright (c) 2014, 2016 CEA LIST, Esterel Technologies SAS and others.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   CEA LIST - Initial API and implementation
 *   Sebastien Bordes (Esterel Technologies SAS) - Bug 497756
 *
 *****************************************************************************/

package org.eclipse.papyrus.infra.nattable.manager.axis;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;

import org.eclipse.core.runtime.Assert;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.transaction.RollbackException;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.nebula.widgets.nattable.NatTable;
import org.eclipse.nebula.widgets.nattable.hideshow.RowHideShowLayer;
import org.eclipse.nebula.widgets.nattable.hideshow.command.MultiRowHideCommand;
import org.eclipse.nebula.widgets.nattable.hideshow.command.MultiRowShowCommand;
import org.eclipse.nebula.widgets.nattable.layer.ILayer;
import org.eclipse.nebula.widgets.nattable.sort.ISortModel;
import org.eclipse.nebula.widgets.nattable.tree.TreeLayer;
import org.eclipse.papyrus.infra.emf.gmf.util.GMFUnsafe;
import org.eclipse.papyrus.infra.nattable.Activator;
import org.eclipse.papyrus.infra.nattable.layer.PapyrusGridLayer;
import org.eclipse.papyrus.infra.nattable.layerstack.RowHeaderHierarchicalLayerStack;
import org.eclipse.papyrus.infra.nattable.manager.cell.CellManagerFactory;
import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
import org.eclipse.papyrus.infra.nattable.manager.table.ITreeNattableModelManager;
import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerRepresentation;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TreeFillingConfiguration;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.NattableaxisproviderPackage;
import org.eclipse.papyrus.infra.nattable.tree.ITreeItemAxisHelper;
import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
import org.eclipse.papyrus.infra.nattable.utils.EventListHelper;
import org.eclipse.papyrus.infra.nattable.utils.FillingConfigurationUtils;
import org.eclipse.papyrus.infra.nattable.utils.StyleUtils;

/**
 * @author VL222926
 *
 */
public abstract class AbstractTreeAxisManagerForEventList extends AbstractAxisManagerForEventList implements ITreeItemAxisManagerForEventList {

	/**
	 * a map with the elements managed by this axis manager : keys are semantic elements and values a set of the representation of these elements in the table
	 */
	protected Map<Object, Set<ITreeItemAxis>> managedElements = new HashMap<Object, Set<ITreeItemAxis>>();

	/**
	 * the list of axis which have been expanded one time
	 */
	protected Set<ITreeItemAxis> alreadyExpanded = new HashSet<ITreeItemAxis>();

	/**
	 * the current filling configuration used by this axis manager
	 */
	protected List<TreeFillingConfiguration> currentFillingConfiguration;

	protected ITreeItemAxisComparator comparator;

	/**
	 * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#init(org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager, org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerRepresentation,
	 *      org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider)
	 *
	 * @param manager
	 * @param rep
	 * @param provider
	 */
	@Override
	public void init(INattableModelManager manager, AxisManagerRepresentation rep, AbstractAxisProvider provider) {
		super.init(manager, rep, provider);
		this.currentFillingConfiguration = FillingConfigurationUtils.getTreeFillingConfiguration(getTable(), representedAxisManager);
		this.comparator = new ITreeItemAxisComparator(this.tableManager, this);
	}

	/**
	 *
	 * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManagerForEventList#addListeners()
	 *
	 */
	@Override
	protected void addListeners() {
		// nothing to do here
	}

	/**
	 *
	 * @param parentAxis
	 *            the parent axis
	 * @param objectToAdd
	 *            the object to add as child of the parent axis
	 * @return
	 * 		the created {@link ITreeItemAxis} representing objectToAdd
	 */
	protected ITreeItemAxis addObject(final ITreeItemAxis parentAxis, final Object objectToAdd) {
		final ITreeItemAxis newAxis = createITreeItemAxis(parentAxis, objectToAdd);
		if (objectToAdd instanceof TreeFillingConfiguration) {
			TreeFillingConfiguration conf = (TreeFillingConfiguration) objectToAdd;
			if (this.alreadyExpanded.contains(parentAxis)) {
				// if the representation of the notifier has already been expanded, we need to add the new value to the list, if not it will be done during the expand of the notifier
				// we must to expand tree filling configuration when its is hidden and its parent is expanded
				if (StyleUtils.isHiddenDepth(getTableManager(), conf.getDepth())) {


					try {
						if (null != getTableEditingDomain()) {
							GMFUnsafe.write(getTableEditingDomain(), new Runnable() {

								@Override
								public void run() {
									newAxis.setExpanded(true);
								}
							});
						} else {
							newAxis.setExpanded(true);
						}
					} catch (InterruptedException e) {
						Activator.log.error(e);
					} catch (RollbackException e) {
						Activator.log.error(e);
					}
					this.alreadyExpanded.add(newAxis);
				}
			}
		}
		ITreeItemAxisHelper.linkITreeItemAxisToSemanticElement(this.managedElements, newAxis);
		EventListHelper.addToEventList(this.eventList, newAxis);

		return newAxis;
	}


	/**
	 * TODO : find a better way to get the tree layer
	 *
	 * @return
	 * 		the tree layer
	 */
	private TreeLayer getTreeLayer() {
		NatTable natTable = (NatTable) getTableManager().getAdapter(NatTable.class);
		ILayer layer = natTable.getLayer();
		if (layer instanceof PapyrusGridLayer) {
			PapyrusGridLayer gridLayer = (PapyrusGridLayer) layer;
			ILayer rowLayer = gridLayer.getRowHeaderLayer();
			if (rowLayer instanceof RowHeaderHierarchicalLayerStack) {
				return ((RowHeaderHierarchicalLayerStack) rowLayer).getTreeLayer();
			}
		}
		throw new UnknownError("TreeLayer has not been found"); //$NON-NLS-1$
	}

	/**
	 * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#canBeUsedAsColumnManager()
	 *
	 * @return
	 * 		always false
	 */
	@Override
	public boolean canBeUsedAsColumnManager() {
		return false;
	}

	/**
	 * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#canCreateAxisElement(java.lang.String)
	 *
	 * @param elementId
	 * @return
	 */
	@Override
	public boolean canCreateAxisElement(String elementId) {
		return true;
	}


	/**
	 * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#canDestroyAxis(java.lang.Integer)
	 *
	 * @param axisPosition
	 * @return
	 */
	@Override
	public boolean canDestroyAxis(Integer axisPosition) {
		IAxis axis = (IAxis) getTableManager().getRowElementsList().get(axisPosition.intValue());// we need to have the tree list here and not the basic event list!
		if (axis instanceof ITreeItemAxis && !(((ITreeItemAxis)axis).getElement() instanceof TreeFillingConfiguration)) {
			return ((ITreeItemAxis) axis).getParent() == null;
		}
		return false;
	}

	/**
	 * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#canDropAxisElement(java.util.Collection)
	 *
	 * @param objectsToAdd
	 * @return
	 */
	@Override
	public boolean canDropAxisElement(Collection<Object> objectsToAdd) {
		// drop is allowed only when first level is not filled DnD
		return FillingConfigurationUtils.hasTreeFillingConfigurationForDepth(this.tableManager.getTable(), representedAxisManager, 0) == false && super.canDropAxisElement(objectsToAdd);
	}

	/**
	 * @see org.eclipse.papyrus.infra.nattable.manager.axis.ITreeItemAxisManagerForEventList#compare(org.eclipse.nebula.widgets.nattable.sort.ISortModel, int, org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis,
	 *      org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis)
	 *
	 * @param sortModel
	 * @param depth
	 * @param axis1
	 * @param axis2
	 * @return
	 * @see Comparator#compare(Object, Object)
	 */
	@Override
	public int compare(ISortModel sortModel, int depth, ITreeItemAxis axis1, ITreeItemAxis axis2) {
		return this.comparator.compare(axis1, axis2);
	}

	/**
	 *
	 * @param parentAxis
	 *            the parent axis
	 * @param objectToAdd
	 *            the object to add
	 * @return
	 * 		the ITreeItemAxis created to represents this object
	 */
	protected abstract ITreeItemAxis createITreeItemAxis(ITreeItemAxis parentAxis, Object objectToAdd);

	/**
	 * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManagerForEventList#dispose()
	 *
	 */
	@Override
	public void dispose() {
		super.dispose();
		this.managedElements.clear();
		this.alreadyExpanded.clear();
	}

	/**
	 *
	 * @param notification
	 *            update the list of the managed objects if its required
	 */
	protected void featureValueHasChanged(final Notification notification) {
		// nothing to do
	}

	/**
	 * This method add children representing TreeFillingConfiguration, only if there will be subelement to display for the TreeFillingConfiguration
	 *
	 * @param axis
	 *            a axis representing a semantic element
	 */
	protected void fillChildrenForSemanticElement(final ITreeItemAxis axis) {
		if (axis == null || axis.getChildren().size() == 0) {
			int nextDepth = -1;
			Object context;
			if (axis == null) {
				nextDepth = 0;
				context = getTableContext();
			} else {
				nextDepth = getSemanticDepth(axis) + 1;
				context = axis.getElement();
				Assert.isTrue(!(context instanceof TreeFillingConfiguration));
			}
			final List<TreeFillingConfiguration> confs = FillingConfigurationUtils.getTreeFillingConfigurationForDepth(getTable(), representedAxisManager, nextDepth);
			for (TreeFillingConfiguration current : confs) {
				final Collection<?> values = getFilteredValueAsCollection(current, context, nextDepth);
				if (values.size() != 0) {
					ITreeItemAxis newAxis = addObject(axis, current);
					if (nextDepth == 0) {
						for (Object curr : values) {
							addObject(newAxis, curr);
						}
					}
				}
			}
		}
	}

	/**
	 * Fills the list with the children of the axis-> children are semantic elements
	 *
	 * @param axis
	 *            an axis representing a tree filling configuration
	 */
	protected void fillChildrenForTreeFillingConfiguration(ITreeItemAxis axis) {
		Object tmp = axis.getElement();
		Assert.isTrue(tmp instanceof TreeFillingConfiguration);
		TreeFillingConfiguration conf = (TreeFillingConfiguration) tmp;
		ITreeItemAxis parent = axis.getParent();
		int nextDepth = conf.getDepth();
		Object context = null;
		if (parent != null) {
			context = parent.getElement();
		} else {
			context = getTableContext();
		}
		final Collection<?> values = getFilteredValueAsCollection(conf, context, nextDepth);
		for (final Object value : values) {
			addObject(axis, value);
		}
	}

	/**
	 *
	 * @param element
	 *            an element
	 */
	public void fillListWithGrandSon(final ITreeItemAxis element) {
		Object context = element.getElement();
		if (context instanceof TreeFillingConfiguration) {
			for (ITreeItemAxis child : element.getChildren()) {
				// child is a semantic element
				fillChildrenForSemanticElement(child);
			}
			return;
		}
		for (ITreeItemAxis child : element.getChildren()) {
			// child is a tree filling configuration
			fillChildrenForTreeFillingConfiguration(child);
		}
	}

	/**
	 * @see org.eclipse.papyrus.infra.nattable.manager.axis.ITreeItemAxisManagerForEventList#fillRoot()
	 *
	 */
	@Override
	public void fillListWithRoots() {
		if (false == FillingConfigurationUtils.hasTreeFillingConfigurationForDepth(tableManager.getTable(), representedAxisManager, 0)) {
			for (IAxis current : getRepresentedContentProvider().getAxis()) {
				if (current instanceof ITreeItemAxis) {
					Assert.isTrue((current.getElement() instanceof TreeFillingConfiguration) == false);
					ITreeItemAxisHelper.linkITreeItemAxisToSemanticElement(this.managedElements, (ITreeItemAxis) current);
					fillChildrenForSemanticElement((ITreeItemAxis) current);
				}
			}
			return;
		}
		fillChildrenForSemanticElement(null);
	}


	/**
	 *
	 * @param iaxis
	 * @param rowElement
	 *            the element
	 * @return
	 * 		a collection of all values for the intersection of the iaxis and the row element. These values are not yet filtered by the method {@link #isAllowedContents(Object, Object, TreeFillingConfiguration, int)}
	 * 
	 * @deprecated : use directly CellManagerFactory.INSTANCE.getCrossValueAsCollection(iaxis, rowElement, this.tableManager);
	 */
	@Deprecated
	protected final Collection<?> getCellValueAsCollection(final Object iaxis, final Object rowElement) {
		return CellManagerFactory.INSTANCE.getCrossValueAsCollection(iaxis, rowElement, this.tableManager);
	}

	/**
	 *
	 * @param axis
	 *            an object
	 * @return
	 * 		the depth of the axis
	 */
	protected int getDepth(final ITreeItemAxis axis) {
		final INattableModelManager manager = getTableManager();
		if (manager instanceof ITreeNattableModelManager) {
			return ((ITreeNattableModelManager) manager).getTreeItemDepth(axis);
		}
		return 0;
	}

	/**
	 *
	 * @param conf
	 *            axis used as row provider
	 * @param rowElement
	 *            row element
	 * @param depth
	 *            the depth of the new element
	 * @return
	 * 		a collection with all values accepted as children of the rowElement. Returned values have been filtered by the method {@link #isAllowedContents(Object, Object, TreeFillingConfiguration, int)}
	 */
	protected final Collection<?> getFilteredValueAsCollection(final TreeFillingConfiguration conf, final Object rowElement, final int depth) {
		Collection<?> values = CellManagerFactory.INSTANCE.getCrossValueAsCollection(conf.getAxisUsedAsAxisProvider(), rowElement, getTableManager());
		Collection<Object> returnedValues = new ArrayList<Object>();
		Object parent = AxisUtils.getRepresentedElement(rowElement);
		for (Object current : values) {
			if (isAllowedContents(current, parent, conf, depth)) {
				returnedValues.add(current);
			}
		}
		return returnedValues;
	}

	/**
	 *
	 * @param axis
	 *            an axis
	 * @return
	 * 		the real depth of an element (semantic or {@link TreeFillingConfiguration}), that is to say than for {@link TreeFillingConfiguration} we return {@link TreeFillingConfiguration#getDepth()} and for a semantic element
	 *         we returns the depth of the {@link TreeFillingConfiguration} parent of the {@link ITreeItemAxis} represented it.
	 */
	public final int getSemanticDepth(final ITreeItemAxis axis) {
		final INattableModelManager manager = getTableManager();
		if (manager instanceof ITreeNattableModelManager) {
			return ((ITreeNattableModelManager) manager).getSemanticDepth(axis);
		}
		return 0;
	}

	protected Table getTable() {
		return this.tableManager.getTable();
	}

	/**
	 * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#initializeManagedObjectList()
	 *
	 */
	@Override
	protected void initializeManagedObjectList() {
		// now it is not used
	}

	/**
	 * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#isAllowedContents(java.lang.Object)
	 * @deprecated for ITreeItemAxisManagerForEventList, we must use isAllowedContents(Object, int depth)
	 * @param object
	 * @return
	 */
	@Override
	@Deprecated
	public boolean isAllowedContents(Object object) {
		return super.isAllowedContents(object);
	}

	/**
	 * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#isAlreadyManaged(java.lang.Object)
	 *
	 * @param object
	 * @return
	 */
	@Override
	public boolean isAlreadyManaged(Object object) {
		if (this.managedElements.containsKey(object)) {
			for (final ITreeItemAxis current : this.managedElements.get(object)) {
				// an element can be displayed several time in the table, but only one as root
				if (current.eContainer() != null) {
					return true;
				}
			}
		}
		return false;
	}

	/**
	 *
	 * @see org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager#isDynamic()
	 *
	 * @return
	 */
	@Override
	public boolean isDynamic() {
		return true;
	}

	/**
	 *
	 * @see org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager#isSlave()
	 *
	 * @return
	 */
	@Override
	public boolean isSlave() {
		return false;
	}

	protected final void removeObject(final ITreeItemAxis axis) {
		if (axis != null) {
			Collection<ITreeItemAxis> children = new ArrayList<ITreeItemAxis>(axis.getChildren());
			for (ITreeItemAxis current : children) {
				removeObject(current);
				// EventListHelper.removeFromEventList(eventList, current);
				// ITreeItemAxisHelper.unlinkITreeItemAxisToSemanticElement(this.managedElements, current);
				// ITreeItemAxisHelper.destroyITreeItemAxis(getTableEditingDomain(), current);
			}
			final ITreeItemAxis parentAxis = axis.getParent();
	
			EventListHelper.removeFromEventList(eventList, axis);
			this.alreadyExpanded.remove(axis);
			ITreeItemAxisHelper.unlinkITreeItemAxisToSemanticElement(this.managedElements, axis);
			final TransactionalEditingDomain tableEditingDomain = getTableEditingDomain();
			if(null != tableEditingDomain){
				ITreeItemAxisHelper.destroyITreeItemAxis(tableEditingDomain, axis);
			}
			if (parentAxis != null) {
				final Object representedElement = parentAxis.getElement();
				if (representedElement instanceof TreeFillingConfiguration && parentAxis.getChildren().size() == 0) {
					removeObject(parentAxis);
				}
			}
		}
	}

	/**
	 * @see org.eclipse.papyrus.infra.nattable.manager.axis.ITreeItemAxisManagerForEventList#setExpanded(org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis, java.util.List, boolean)
	 *
	 * @param element
	 * @param path
	 * @param expanded
	 */
	@Override
	public void setExpanded(final ITreeItemAxis element, List<ITreeItemAxis> path, boolean expanded) {
		if (!expanded) {
			return;
		}
		if (!this.alreadyExpanded.contains(element)) {
			fillListWithGrandSon(element);
			this.alreadyExpanded.add(element);
		}
	}

	/**
	 * Update the list of the managed objects, ignoring ordered elements
	 *
	 * @param toAdd
	 *            the list of the elements to add to the managed objects list
	 * @param toRemove
	 *            the list of the elements to remove to the managed objects list
	 */
	protected void updateManagedList(final List<Object> toAdd, final List<Object> toRemove) {
		// nothing to do
	}

	/**
	 *
	 * @param notification
	 *            a notification
	 * @return
	 *         <code>true</code> if the notification must be ignored
	 */
	@Override
	protected boolean ignoreEvent(final Notification notification) {
		boolean res = super.ignoreEvent(notification);
		if (res) {
			return res;
		}
		Object feature = notification.getFeature();
		if (feature instanceof EStructuralFeature) {
			if (feature == NattableaxisproviderPackage.eINSTANCE.getAxisProvider_Axis()) {
				return false;
			}
			EObject parent = ((EStructuralFeature) feature).eContainer();
			while (parent.eContainer() != null) {
				parent = parent.eContainer();
			}
			return parent == NattablePackage.eINSTANCE;
		}
		return false;
	}

	/**
	 * @see org.eclipse.papyrus.infra.nattable.manager.axis.ITreeItemAxisManagerForEventList#fillListWithChildren(org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.ITreeItemAxis)
	 *
	 * @param axis
	 */
	@Override
	public void fillListWithChildren(final ITreeItemAxis parentAxis) {
		Object element = parentAxis.getElement();
		if (element instanceof TreeFillingConfiguration) {
			fillChildrenForTreeFillingConfiguration(parentAxis);
			return;
		}
		fillChildrenForSemanticElement(parentAxis);
	}

	/**
	 *
	 * @param notification
	 */
	@Override
	protected void manageSetNotification(Notification notification) {
		manageAddNotification(notification);
		manageRemoveNotification(notification);
	}

	/**
	 * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManagerForEventList#manageUnsetNotification(org.eclipse.emf.common.notify.Notification)
	 *
	 * @param notification
	 */
	@Override
	protected void manageUnsetNotification(Notification notification) {
		manageRemoveNotification(notification);
		manageAddNotification(notification);
	}


	/**
	 *
	 * @param toTest
	 *            the value to test
	 * @param conf
	 *            a tree filling configuration
	 * @param semanticParent
	 *            the context to use to get values
	 * @return
	 *         <code>true</code> if the value can be displayed as a child of the {@link TreeFillingConfiguration}
	 */
	protected boolean isProvidedByTreeFillingConfiguration(final Object toTest, final TreeFillingConfiguration conf, final Object semanticParent) {
		Collection<?> values = getFilteredValueAsCollection(conf, semanticParent, conf.getDepth());
		return values.contains(toTest);
	}

	/**
	 *
	 * @param possibleRepresentation
	 *            a list owning possible representation of an element
	 * @param object
	 *            the element
	 * @return
	 * 		the {@link ITreeItemAxis} representing this element or <code>null</code> if not found
	 */
	public static final ITreeItemAxis getITreeItemAxisRepresentingObject(final Collection<ITreeItemAxis> possibleRepresentation, Object object) {
		for (ITreeItemAxis axis : possibleRepresentation) {
			if (axis.getElement() == object) {
				return axis;
			}
		}
		return null;
	}

	/**
	 * Adds the new axis to the list, and add its direct children
	 *
	 * @param axis
	 *            the new axis to add to the list
	 */
	protected void manageAddITreeItemAxisForSemanticElement(final ITreeItemAxis axis) {
		Assert.isTrue((axis.getElement() instanceof TreeFillingConfiguration) == false);
		ITreeItemAxisHelper.linkITreeItemAxisToSemanticElement(this.managedElements, axis);
		fillListWithChildren(axis);
	}

	/**
	 * @param notification
	 */
	@Override
	protected void manageAddNotification(Notification notification) {
		Object notifier = notification.getNotifier();
		Object newValue = notification.getNewValue();
		Object feature = notification.getFeature();
		// case 1 - the user added a new root axis by DnD
		if (feature == NattableaxisproviderPackage.eINSTANCE.getAxisProvider_Axis() && newValue instanceof ITreeItemAxis && ((ITreeItemAxis) newValue).getElement() instanceof EObject) {
			manageAddITreeItemAxisForSemanticElement((ITreeItemAxis) newValue);
			return;
		}

		// case 2 : the notifier is the context of the table and we have filling configuration for level 0
		if (notifier == getTableContext() && FillingConfigurationUtils.hasTreeFillingConfigurationForDepth(getTable(), 0)) {
			for (final TreeFillingConfiguration current : FillingConfigurationUtils.getTreeFillingConfigurationForDepth(getTable(), representedAxisManager, 0)) {
				if (isProvidedByTreeFillingConfiguration(newValue, current, notifier)) {
					Set<ITreeItemAxis> parentRepresentation = this.managedElements.get(current);
					// we are on the root, so the set is null or its size is 1;
					Assert.isTrue(parentRepresentation == null || parentRepresentation.size() == 1);
					ITreeItemAxis parentConf = null;
					if (parentRepresentation == null) {
						parentConf = addObject(null, current);
					} else {
						parentConf = parentRepresentation.iterator().next();
					}
					// this allows to avoid the double same entry on the same level (especially for the stereotyped elements)
					if (!managedElements.containsKey(newValue)) {
						addObject(parentConf, newValue);
					}
				}
			}
			return;
		}

		// case 3 - the notifier is a known element
		if (this.managedElements.containsKey(notifier) && !this.managedElements.containsKey(newValue)) {
			final Set<ITreeItemAxis> itemAxisRepresentations = this.managedElements.get(notifier);
			// we need to add a child for each representation of its parent in the table
			for (final ITreeItemAxis curr : itemAxisRepresentations) {

				// we update the conf only when the parent of the representation has already been filled (so expanded)
				if (curr.getParent() == null || this.alreadyExpanded.contains(curr.getParent())) {
					// 1.1 : get the depth for the new value
					int nextDepth = getSemanticDepth(curr) + 1;

					// 1.2 verify than the new value is allowed
					if (FillingConfigurationUtils.hasTreeFillingConfigurationForDepth(getTable(), representedAxisManager, nextDepth)) {

						// we cross the possible confs for this level
						for (TreeFillingConfiguration conf : FillingConfigurationUtils.getTreeFillingConfigurationForDepth(getTable(), representedAxisManager, nextDepth)) {
							if (isProvidedByTreeFillingConfiguration(newValue, conf, notifier)) {
								// we must add the value
								ITreeItemAxis confRep = getITreeItemAxisRepresentingObject(curr.getChildren(), conf);


								if (confRep == null) {
									confRep = addObject(curr, conf);
								}
								// if the representation of the notifier has already been expanded, we need to add the new value to the list, if not it will be done during the expand of the notifier
								if (this.alreadyExpanded.contains(curr)) {
									addObject(confRep, newValue);
								}
							}
						}
					}
				}
			}
		}
	}

	/**
	 * @param notification
	 */
	@Override
	protected void manageAddManyNotification(final Notification notification) {
		final Object tmpValues = notification.getNewValue();
		if (!(tmpValues instanceof Collection<?>)) {
			return;
		}

		final Collection<?> values = (Collection<?>) tmpValues;
		Object notifier = notification.getNotifier();
		Object feature = notification.getFeature();

		// case 1 - the user added a new roots axis by DnD
		if (feature == NattableaxisproviderPackage.eINSTANCE.getAxisProvider_Axis()) {
			for (Object value : values) {
				if (value instanceof ITreeItemAxis && !(((ITreeItemAxis) value).getElement() instanceof ITreeItemAxis)) {
					manageAddITreeItemAxisForSemanticElement((ITreeItemAxis) value);
				}
			}
			return;
		}

		// case 2 : the notifier is the context of the table and we have filling configuration for level 0
		if (notifier == getTableContext() && FillingConfigurationUtils.hasTreeFillingConfigurationForDepth(getTable(), 0)) {
			for (final TreeFillingConfiguration current : FillingConfigurationUtils.getTreeFillingConfigurationForDepth(getTable(), representedAxisManager, 0)) {

				// all values to display for this conf
				Collection<?> rows = getFilteredValueAsCollection(current, notifier, 0);
				// all values to add
				values.retainAll(rows);

				if (values.size() > 0) {
					Set<ITreeItemAxis> parentRepresentation = this.managedElements.get(current);
					// we are on the root, so the set is null or its size is 1;
					Assert.isTrue(parentRepresentation == null || parentRepresentation.size() == 1);
					ITreeItemAxis confRep;
					if (parentRepresentation == null) {
						confRep = addObject(null, current);
					} else {
						confRep = parentRepresentation.iterator().next();
					}
					// only one representation
					for (Object currVal : values) {
						addObject(confRep, currVal);
					}
				}
			}
			return;
		}

		// case 3 - the notifier is a known element
		if (!this.managedElements.containsKey(notifier)) {
			return;
		}
		final Set<ITreeItemAxis> itemAxisRepresentations = this.managedElements.get(notifier);
		// we need to add a child for each representation of its parent in the table
		for (final ITreeItemAxis curr : itemAxisRepresentations) {

			if (curr.getParent() == null || this.alreadyExpanded.contains(curr.getParent())) {
				// 1.1 : get the depth for the new value
				int nextDepth = getSemanticDepth(curr) + 1;
				for (Object newValue : values) {
					// 1.2 verify than the new value is allowed
					if (FillingConfigurationUtils.hasTreeFillingConfigurationForDepth(getTable(), representedAxisManager, nextDepth)) {

						// we cross the possible confs for this level
						for (TreeFillingConfiguration conf : FillingConfigurationUtils.getTreeFillingConfigurationForDepth(getTable(), representedAxisManager, nextDepth)) {
							if (isProvidedByTreeFillingConfiguration(newValue, conf, notifier)) {
								// we must add the value
								ITreeItemAxis confRep = getITreeItemAxisRepresentingObject(curr.getChildren(), conf);
								if (confRep == null) {
									confRep = addObject(curr, conf);
								}
								// if the representation of the notifier has already been expanded, we need to add the new value to the list, if not it will be done during the expand of the notifier
								if (this.alreadyExpanded.contains(curr)) {
									addObject(confRep, newValue);
								}
							}
						}
					}
				}
			}
		}
	}

	/**
	 * @param notification
	 */
	@Override
	protected void manageMoveNotification(Notification notification) {
		// no usecase found
	}

	protected void manageRemoveITreeItemAxisForSemanticElement(final ITreeItemAxis axis) {
		Assert.isTrue((axis.getElement() instanceof TreeFillingConfiguration) == false);
		removeObject(axis);
	}

	/**
	 * @param notification
	 */
	@Override
	protected void manageRemoveNotification(Notification notification) {
		final Object oldValue = notification.getOldValue();

		// a ITreeItemAxis is destroyed
		if (oldValue instanceof ITreeItemAxis && !(((IAxis) oldValue).getElement() instanceof TreeFillingConfiguration)) {
			removeObject((ITreeItemAxis) oldValue);
			return;
		}

		manageRemoveSemanticElement(oldValue);
	}

	protected void manageRemoveSemanticElement(Object object) {
		Assert.isTrue(false == (object instanceof ITreeItemAxis));
		Assert.isTrue(false == (object instanceof TreeFillingConfiguration));
		if (this.managedElements.containsKey(object)) {
			Collection<ITreeItemAxis> itemAxisRepresentations = new ArrayList<ITreeItemAxis>(this.managedElements.get(object));
			for (final ITreeItemAxis current : itemAxisRepresentations) {
				ITreeItemAxis parent = current.getParent();
				if(null != parent){
					// must always be a TreeFillingConfiguration
					TreeFillingConfiguration conf = (TreeFillingConfiguration) parent.getElement();
					Object context;
					ITreeItemAxis greatParent = parent.getParent();
					if (greatParent == null) {
						context = getTableContext();
					} else {
						context = greatParent.getElement();
					}
					Collection<?> values = getCellValueAsCollection(conf.getAxisUsedAsAxisProvider(), context);
					if (!values.contains(object)) {
						removeObject(current);
					}
				}
			}
		}
	}


	/**
	 * @param notification
	 */
	@Override
	protected void manageRemoveManyNotification(Notification notification) {
		final Object tmpOldValues = notification.getOldValue();
		if (!(tmpOldValues instanceof Collection<?>)) {
			return;
		}

		Collection<?> oldValues = (Collection<?>) tmpOldValues;
		Object feature = notification.getFeature();

		// case 1 - a root IAxis has been destroyed by the user
		if (feature == NattableaxisproviderPackage.eINSTANCE.getAxisProvider_Axis()) {
			for (Object value : oldValues) {
				if (value instanceof ITreeItemAxis && !(((ITreeItemAxis) value).getElement() instanceof ITreeItemAxis)) {
					manageRemoveITreeItemAxisForSemanticElement((ITreeItemAxis) value);
				}
			}
			return;
		}

		// case 2 - a semantic element has been removed
		for (Object val : oldValues) {
			manageRemoveSemanticElement(val);
		}
	}


	/**
	 * @see org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager#canDestroyAxisElement(java.lang.Integer)
	 *
	 * @param axisIndex
	 * @return
	 */
	@Override
	public boolean canDestroyAxisElement(Integer axisIndex) {
		return false;
	}


	/**
	 * @see org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager#getDestroyAxisElementCommand(org.eclipse.emf.transaction.TransactionalEditingDomain, java.lang.Integer)
	 *
	 * @param domain
	 * @param axisPosition
	 * @return
	 */
	@Override
	public Command getDestroyAxisElementCommand(TransactionalEditingDomain domain, Integer axisPosition) {
		return null;
	}

	/**
	 * Update the children of semanticElementRepresentation OR the roots of the table if the parameter is <code>null</code>
	 *
	 * Not really tested and not yet used in an offical Papyrus table
	 *
	 * @param semanticElementRepresentation
	 *            a {@link ITreeItemAxis} for which we want update the children, could be <code>null</code>, in this case we will update the root elements of the table
	 */
	protected void updateChildren(final ITreeItemAxis semanticElementRepresentation) {
		Assert.isTrue(semanticElementRepresentation == null || !(semanticElementRepresentation.getElement() instanceof TreeFillingConfiguration));
		ITreeItemAxis current = semanticElementRepresentation;
		if (current == null || (current.getParent() != null && this.alreadyExpanded.contains(current.getParent()))) {
			int nextDepth;
			Object context;
			if (semanticElementRepresentation == null) {
				nextDepth = 0;
				context = getTableContext();
			} else {
				nextDepth = getSemanticDepth(semanticElementRepresentation) + 1;
				context = semanticElementRepresentation.getElement();
			}

			List<TreeFillingConfiguration> confs = FillingConfigurationUtils.getTreeFillingConfigurationForDepth(getTable(), representedAxisManager, nextDepth);
			for (TreeFillingConfiguration conf : confs) {
				ITreeItemAxis confRep = null;
				if (current != null) {
					confRep = getITreeItemAxisRepresentingObject(current.getChildren(), conf);
				} else if (nextDepth == 0) {
					if (managedElements.containsKey(conf)) {
						// we are on the root of the table, so the configuration can be represented only one time in the map
						confRep = managedElements.get(conf).iterator().next();
					}
				}

				final Collection<?> values = getFilteredValueAsCollection(conf, context, nextDepth);
				Set<Object> knownElements = new HashSet<Object>();
				List<ITreeItemAxis> toRemove = new ArrayList<ITreeItemAxis>();
				if (confRep != null) {
					List<ITreeItemAxis> children = new ArrayList<ITreeItemAxis>(confRep.getChildren());
					for (ITreeItemAxis child : children) {
						Object tmp = child.getElement();
						if (!values.contains(tmp)) {
							toRemove.add(child); // we can't remove them now, because confRep could be destroy here, and maybe we need it after
						}
						knownElements.add(child.getElement());
					}
					if (alreadyExpanded.contains(current)) {
						for (Object val : values) {
							if (!knownElements.contains(val)) {
								addObject(confRep, val);
							}
						}
					}

					for (ITreeItemAxis axis : toRemove) {
						removeObject(axis);
					}
				} else if (false == values.isEmpty()) {
					confRep = addObject(current, conf);
					if (alreadyExpanded.contains(current) || current == null) {// current==null for root
						for (Object val : values) {
							addObject(confRep, val);
						}
					}
				}
			}
		}
	}


	/**
	 * This method updates the contents of the table
	 *
	 * @param semanticElement
	 *            the semantic element for which we want to update the visibility
	 */
	protected void updateSemanticElement(final Object semanticElement) {
		if (FillingConfigurationUtils.hasTreeFillingConfigurationForDepth(getTable(), representedAxisManager, 0)) {
			// we update all the roots of the table : the element could be now visible or hidden
			updateChildren(null);
		}

		if (this.managedElements.containsKey(semanticElement)) {
			for (ITreeItemAxis sementicItemRep : this.managedElements.get(semanticElement)) {
				updateChildren(sementicItemRep);
			}
		}
	}


	/**
	 * @see org.eclipse.papyrus.infra.nattable.manager.axis.ITreeItemAxisManagerForEventList#managedHideShowCategoriesForDepth(java.util.List, java.util.List)
	 *
	 * @param depthToHide
	 * @param depthToShow
	 */
	@Override
	public void managedHideShowCategoriesForDepth(List<Integer> depthToHide, List<Integer> depthToShow) {
		hideCategories(depthToHide);
		showCategoriesForDepth(depthToShow);
	}

	/**
	 *
	 * @param depthToHide
	 *            the list of the depth for which we want to hide the categories
	 */
	protected void hideCategories(final List<Integer> depthToHide) {
		if (depthToHide == null || depthToHide.isEmpty()) {
			return;
		}
		RowHideShowLayer rowHideLayer = getRowHideShowLayer();
		if (rowHideLayer == null) {
			return;
		}
		NatTable natTable = (NatTable) getTableManager().getAdapter(NatTable.class);
		if (natTable == null) {
			return;
		}
		if (depthToHide != null && depthToHide.size() > 0) {
			Set<Integer> indexesToHide = new TreeSet<Integer>();
			for (Integer curr : depthToHide) {
				List<TreeFillingConfiguration> fillingConf = FillingConfigurationUtils.getTreeFillingConfigurationForDepth(getTable(), representedAxisManager, curr);
				for (TreeFillingConfiguration treeFillingConfiguration : fillingConf) {
					if (this.managedElements.containsKey(treeFillingConfiguration)) {
						for (ITreeItemAxis axis : this.managedElements.get(treeFillingConfiguration)) {
							int index = getTableManager().getRowElementsList().indexOf(axis);
							ITreeItemAxis parentAxis = axis.getParent();
							if (parentAxis != null && parentAxis.isExpanded() && !axis.isExpanded()) {
								getTreeLayer().expandTreeRow(index);
								index = getTableManager().getRowElementsList().indexOf(axis);
							} else if (parentAxis == null) {
								getTreeLayer().expandTreeRow(index);
								index = getTableManager().getRowElementsList().indexOf(axis);
							}

							if (index != -1) {// -1 when not yet visible
								int convertedIndex = rowHideLayer.underlyingToLocalRowPosition(natTable, index);
								indexesToHide.add(convertedIndex);
							}
						}
					}
				}
			}

			if (indexesToHide.size() > 0) {
				int[] ar = new int[indexesToHide.size()];
				Iterator<Integer> iter = indexesToHide.iterator();
				int i = 0;
				while (iter.hasNext()) {
					ar[i] = iter.next();
					i++;
				}
				natTable.doCommand(new MultiRowHideCommand(rowHideLayer, ar));
			}
		}
	}

	/**
	 *
	 * @param depthToHide
	 *            the list of the depth for which we want to hide the categories
	 */
	protected void showCategoriesForDepth(final List<Integer> depthToShow) {
		if (depthToShow == null || depthToShow.isEmpty()) {
			return;
		}
		NatTable natTable = (NatTable) getTableManager().getAdapter(NatTable.class);
		if (natTable == null) {
			return;
		}
		List<Integer> indexesToShow = new ArrayList<Integer>();
		for (Integer curr : depthToShow) {
			List<TreeFillingConfiguration> fillingConf = FillingConfigurationUtils.getTreeFillingConfigurationForDepth(getTable(), representedAxisManager, curr);
			for (TreeFillingConfiguration treeFillingConfiguration : fillingConf) {
				if (this.managedElements.containsKey(treeFillingConfiguration)) {
					for (ITreeItemAxis axis : this.managedElements.get(treeFillingConfiguration)) {
						indexesToShow.add(getTableManager().getRowElementsList().indexOf(axis));
					}
				}
			}
		}
		if (indexesToShow.size() > 0) {
			natTable.doCommand(new MultiRowShowCommand(indexesToShow));
		}
	}

	/**
	 *
	 * @return
	 * 		the row hide show layer
	 */
	protected final RowHideShowLayer getRowHideShowLayer() {
		if (this.tableManager != null && this.tableManager.getBodyLayerStack() != null) {
			return this.tableManager.getBodyLayerStack().getRowHideShowLayer();
		}
		return null;
	}

	/**
	 * @see org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManagerForEventList#fillingConfigurationsHaveChanged()
	 *
	 */
	@Override
	public void fillingConfigurationsHaveChanged() {
		List<TreeFillingConfiguration> oldFillingConfiguration = this.currentFillingConfiguration;
		List<TreeFillingConfiguration> newFillingConf = FillingConfigurationUtils.getTreeFillingConfiguration(getTable(), this.representedAxisManager);
		this.currentFillingConfiguration = newFillingConf;
		if (oldFillingConfiguration.equals(newFillingConf)) {
			return;
		}


		// 1. we remove all filling configuration which have been deleted
		List<TreeFillingConfiguration> confToRemove = new ArrayList<TreeFillingConfiguration>(oldFillingConfiguration);
		confToRemove.removeAll(newFillingConf);
		for (TreeFillingConfiguration current : confToRemove) {
			if (managedElements.containsKey(current)) {
				Set<ITreeItemAxis> axisRepresentation = new HashSet<ITreeItemAxis>(managedElements.get(current));
				for (ITreeItemAxis tmp : axisRepresentation) {
					removeObject(tmp);
				}
			}
		}

		List<TreeFillingConfiguration> confToAdd = new ArrayList<TreeFillingConfiguration>(newFillingConf);
		confToAdd.removeAll(oldFillingConfiguration);
		if (confToAdd.isEmpty()) {
			return;
		}
		for (TreeFillingConfiguration treeFillingConfiguration : confToAdd) {
			int depth = treeFillingConfiguration.getDepth();
			if (depth == 0) {
				updateChildren(null);
			} else {
				for (TreeFillingConfiguration previousConfig : FillingConfigurationUtils.getTreeFillingConfigurationForDepth(getTable(), representedAxisManager, depth - 1)) {
					if (this.managedElements.containsKey(previousConfig)) {
						for (ITreeItemAxis axis : this.managedElements.get(previousConfig)) {
							for (ITreeItemAxis child : axis.getChildren()) {
								updateSemanticElement(child.getElement());
							}
						}
					}
				}
			}
		}
	}
}

Back to the top