Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: af292d11c77489cf572928e97a25b810acf24fca (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
/*****************************************************************************
 * Copyright (c) 2014 CEA LIST 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
 *   
 *****************************************************************************/

package org.eclipse.papyrus.infra.nattable.wizard;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EOperation;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.nebula.widgets.nattable.NatTable;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
import org.eclipse.osgi.util.NLS;
import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager;
import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
import org.eclipse.papyrus.infra.nattable.model.factory.IAxisFactory;
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.nattableaxis.NattableaxisPackage;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AbstractHeaderAxisConfiguration;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerConfiguration;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerRepresentation;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.IAxisConfiguration;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.LocalTableHeaderAxisConfiguration;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.NattableaxisconfigurationFactory;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.PasteEObjectConfiguration;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TableHeaderAxisConfiguration;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.TreeFillingConfiguration;
import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.ILabelProviderConfiguration;
import org.eclipse.papyrus.infra.nattable.utils.Constants;
import org.eclipse.papyrus.infra.nattable.utils.FillingConfigurationUtils;
import org.eclipse.papyrus.infra.nattable.utils.HeaderAxisConfigurationManagementUtils;
import org.eclipse.papyrus.infra.nattable.utils.LabelProviderContextElementWrapper;
import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes;
import org.eclipse.papyrus.infra.nattable.utils.StringComparator;
import org.eclipse.papyrus.infra.nattable.utils.TableEditingDomainUtils;
import org.eclipse.papyrus.infra.nattable.wizard.pages.ConfigurePasteForCategoriesWizardPage;
import org.eclipse.papyrus.infra.nattable.wizard.pages.SelectCategoriesWizardPage;
import org.eclipse.papyrus.infra.services.labelprovider.service.LabelProviderService;
import org.eclipse.papyrus.infra.tools.util.TypeUtils;
import org.eclipse.papyrus.infra.widgets.providers.FlattenableRestrictedFilteredContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.IRestrictedContentProvider;
import org.eclipse.papyrus.infra.widgets.providers.IStaticContentProvider;
import org.eclipse.papyrus.infra.widgets.selectors.ReferenceSelector;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;

/**
 * @author VL222926
 *         This wizard allows to configure the categories to listen in the table And the paste action for each categories
 */
public class ConfigureTableCategoriesWizard extends AbstractTableWizard {

	/**
	 * the page used to choose the categories
	 */
	private SelectCategoriesWizardPage categoriesPage;

	/**
	 * the page used to configure the paste
	 */
	private ConfigurePasteForCategoriesWizardPage pastePage;

	/**
	 * the nattable model manager
	 */
	private INattableModelManager manager;

	/**
	 * the nattable widget
	 */
	private final NatTable natTable;

	/**
	 * the initial selection
	 */
	private List<Object> initialSelection;

	/**
	 *
	 * Constructor.
	 *
	 */
	public ConfigureTableCategoriesWizard(INattableModelManager manager) {
		this.manager = manager;
		this.natTable = (NatTable) ((IAdaptable) manager).getAdapter(NatTable.class);
		setWindowTitle("Configure Categories");
		this.initialSelection = createInitialSelection();
	}

	/**
	 * 
	 * @param selector
	 *            the reference selector
	 * @return
	 *         the content provider to use for the selector
	 */
	protected IStaticContentProvider createSelectorContentProvider(ReferenceSelector selector) {
		final IAxisManager editedAxisManager = this.manager.getColumnAxisManager();
		IStaticContentProvider provider = editedAxisManager.createPossibleAxisContentProvider(true);
		Assert.isNotNull(provider);

		return new FlattenableRestrictedFilteredContentProvider((IRestrictedContentProvider) provider, selector) {

			/**
			 * @see org.eclipse.papyrus.infra.widgets.providers.FlattenableRestrictedFilteredContentProvider#isValidValue(java.lang.Object)
			 *
			 * @param element
			 * @return
			 */
			@Override
			public boolean isValidValue(Object element) {
				// EMF dependency, must not be done here, it should be better with a new content provider service
				return (element instanceof EReference && ((EReference) element).isMany() && element != EcorePackage.eINSTANCE.getEModelElement_EAnnotations())
						|| (element instanceof EOperation && ((EOperation)element).isMany());
			}
		};

	}

	/**
	 * 
	 * @return
	 *         the created and initialized reference selector
	 */
	protected ReferenceSelector createReferenceSelector() {
		ReferenceSelector selector = new ReferenceSelector(false) {


			/**
			 * 
			 * @see org.eclipse.papyrus.infra.widgets.selectors.ReferenceSelector#createControls(org.eclipse.swt.widgets.Composite)
			 *
			 * @param parent
			 */
			@Override
			public void createControls(Composite parent) {
				super.createControls(parent);
				this.treeViewer.setComparator(new ViewerComparator(new StringComparator()));// should always be string element
			}
		};

		final LabelProviderService serv = this.natTable.getConfigRegistry().getConfigAttribute(NattableConfigAttributes.LABEL_PROVIDER_SERVICE_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.LABEL_PROVIDER_SERVICE_ID);
		final ILabelProvider labelProvider = serv.getLabelProvider();
		selector.setLabelProvider(labelProvider);
		selector.setContentProvider(createSelectorContentProvider(selector));
		return selector;

	}

	/**
	 * 
	 * @return
	 *         the page to use to select the categories to listen in the table
	 */
	protected SelectCategoriesWizardPage createSelectCategoriesPage() {
		this.categoriesPage = new SelectCategoriesWizardPage(createReferenceSelector());
		final LabelProviderService serv = this.natTable.getConfigRegistry().getConfigAttribute(NattableConfigAttributes.LABEL_PROVIDER_SERVICE_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.LABEL_PROVIDER_SERVICE_ID);
		this.categoriesPage.setLabelProvider(new ITreeItemWrappedObjectLabelProvider(serv.getLabelProvider(), this.natTable));
		this.categoriesPage.setInitialElementSelections(this.initialSelection);
		return this.categoriesPage;
	}

	/**
	 * 
	 * @return
	 *         the paste page used to configure the paste
	 */
	protected ConfigurePasteForCategoriesWizardPage createConfigurePastePage() {
		this.pastePage = new ConfigurePasteForCategoriesWizardPage(createReferenceSelector());
		final LabelProviderService serv = this.natTable.getConfigRegistry().getConfigAttribute(NattableConfigAttributes.LABEL_PROVIDER_SERVICE_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.LABEL_PROVIDER_SERVICE_ID);
		this.pastePage.setLabelProvider(new ITreeItemWrappedObjectLabelProvider(serv.getLabelProvider(), this.natTable));
		this.pastePage.setInitialElementSelections(this.initialSelection);
		return this.pastePage;
	}

	/**
	 * @see org.eclipse.jface.wizard.Wizard#addPages()
	 *
	 */
	@Override
	public void addPages() {
		super.addPages();
		addPage(createSelectCategoriesPage());
		// addPage(createConfigurePastePage());
	}

	/**
	 * 
	 * The label provider to use for the selected elements viewer
	 *
	 */
	private static class ITreeItemWrappedObjectLabelProvider implements ILabelProvider {

		/**
		 * default label provider
		 */
		private ILabelProvider wrappedLabelprovider;

		private NatTable natTable;

		private LabelProviderContextElementWrapper wrapper;
		
		/**
		 * 
		 * Constructor.
		 *
		 * @param wrappedProvider
		 */
		public ITreeItemWrappedObjectLabelProvider(ILabelProvider wrappedProvider, NatTable natTable) {
			this.wrappedLabelprovider = wrappedProvider;
			this.natTable = natTable;
			wrapper = new LabelProviderContextElementWrapper();
			wrapper.setConfigRegistry(natTable.getConfigRegistry());
		}

		/**
		 * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
		 *
		 * @param arg0
		 */
		@Override
		public void addListener(ILabelProviderListener arg0) {
			// nothing to do
		}

		/**
		 * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
		 *
		 */
		@Override
		public void dispose() {
			// nothing to do
		}

		/**
		 * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
		 *
		 * @param arg0
		 * @param arg1
		 * @return
		 */
		@Override
		public boolean isLabelProperty(Object arg0, String arg1) {
			return false;
		}

		/**
		 * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
		 *
		 * @param arg0
		 */
		@Override
		public void removeListener(ILabelProviderListener arg0) {
			// nothing to do
		}

		/**
		 * @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
		 *
		 * @param arg0
		 * @return
		 */
		@Override
		public Image getImage(Object arg0) {
			if (arg0 instanceof ITreeItemAxis) {
				arg0 = ((ITreeItemAxis) arg0).getElement();
			}
			return wrappedLabelprovider.getImage(arg0);
		}

		/**
		 * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
		 *
		 * @param arg0
		 * @return
		 */
		@Override
		public String getText(Object arg0) {
			Assert.isTrue(arg0 instanceof ITreeItemAxis);
			ITreeItemAxis axis = (ITreeItemAxis) arg0;
			Object element = axis.getElement();
			if (element instanceof String) {
				if (TypeUtils.isNaturalValue((String) element)) {
					Integer value = Integer.parseInt((String) element);
					int depth = value;
					if (depth == 0 && axis.getChildren().isEmpty()) {
						return NLS.bind("depth {0} (filled by user)", depth);
					} else {
						return NLS.bind("depth {0}", depth);
					}
				}
			}
			wrapper.setObject(axis);
			final LabelProviderService serv = this.natTable.getConfigRegistry().getConfigAttribute(NattableConfigAttributes.LABEL_PROVIDER_SERVICE_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.LABEL_PROVIDER_SERVICE_ID);
			ILabelProvider p = serv.getLabelProvider(wrapper);
			p = serv.getLabelProvider(Constants.HEADER_LABEL_PROVIDER_CONTEXT);
			return p.getText(wrapper);
			// return wrappedLabelprovider.getText(wrapper);
		}
	}

	/**
	 * 
	 * @return
	 *         the initial selection to use in the wizard page
	 */
	protected List<Object> createInitialSelection() {
		Table table = this.manager.getTable();
		EObject tableContext = table.getContext();

		// the number of elements in initial selection is the number of AxisManagerRepresentation for rows
		List<Object> initialSelection = new ArrayList<Object>();

		// 0. we iterate on the row axis manager representation
		for (AxisManagerRepresentation rep : getRowAxisManagerRepresentations(table)) {// this iteration has not been tested
			Map<Object, ITreeItemAxis> map = new HashMap<Object, ITreeItemAxis>();
			ITreeItemAxis rootAxis = IAxisFactory.createITreeItemAxis(null, tableContext, rep, null);
			map.put(tableContext, rootAxis);
			initialSelection.add(rootAxis);

			// 1. we cross the existing tree filling configuration
			for (TreeFillingConfiguration fillingConf : FillingConfigurationUtils.getTreeFillingConfiguration(table, rep)) {
				Integer depth = Integer.valueOf(fillingConf.getDepth());
				ITreeItemAxis axis = map.get(depth);
				// 2. we create an idAxis if required for the depth of the current filling configuration
				if (axis == null) {
					axis = IAxisFactory.createITreeItemAxis(rootAxis, depth, null, null);
					map.put(depth, axis);
				}

				// 3. we create an axis to represent the element represented by the TreeFillingConfiguration
				Object representedElement = fillingConf.getAxisUsedAsAxisProvider().getElement();
				for (ITreeItemAxis curr : axis.getChildren()) {
					if (curr.getElement() == representedElement) {
						continue;
					}
				}
				ITreeItemAxis categoryAxis = IAxisFactory.createITreeItemAxis(axis, representedElement, null, fillingConf.getAxisUsedAsAxisProvider().getAlias());
				if (fillingConf.getPasteConfiguration() != null) {
					// create an axis to configure the paste in the table
					IAxisFactory.createITreeItemAxis(categoryAxis, fillingConf.getPasteConfiguration(), null, null);
				}
			}
			// the 0 depth must always be here
			if (map.get(Integer.valueOf(0)) == null) {
				ITreeItemAxis axis = IAxisFactory.createITreeItemAxis(rootAxis, 0, null, null);
				map.put(Integer.valueOf(0), axis);
				rootAxis.getChildren().move(0, axis);
			}
		}

		return initialSelection;
	}


	/**
	 * @see org.eclipse.jface.wizard.Wizard#performFinish()
	 *
	 * @return
	 */
	@Override
	public boolean performFinish() {
		Table table = manager.getTable();
		List<ITreeItemAxis> configureCategoriesResult = new ArrayList<ITreeItemAxis>();
		for (Object curr : initialSelection) {
			configureCategoriesResult.add((ITreeItemAxis) curr);
		}
		Command cmd = getConfigureCategoriesCommand(configureCategoriesResult);
		EditingDomain domain = TableEditingDomainUtils.getTableEditingDomain(table);
		domain.getCommandStack().execute(cmd);
		return true;
	}

	private ILabelProviderConfiguration getLabelConfigurationForTreeFillingConfiguration(Table table, final IAxis axis) {
		TableHeaderAxisConfiguration conf = (TableHeaderAxisConfiguration) HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisInTableConfiguration(table);
		for (IAxisConfiguration tmp : conf.getOwnedAxisConfigurations()) {
			if (tmp instanceof TreeFillingConfiguration) {
				if(((TreeFillingConfiguration) tmp).getAxisUsedAsAxisProvider().eClass().equals(axis.eClass()) && null != ((TreeFillingConfiguration) tmp).getLabelProvider()){
					return ((TreeFillingConfiguration) tmp).getLabelProvider();
				}
			}
		}
		return null;
	}

	private String getLabelProviderContextForTreeFillingConfiguration(Table table, final IAxis axis) {
		if(axis.eClass().equals(NattableaxisPackage.eINSTANCE.getEOperationAxis()) || axis.eClass().equals(NattableaxisPackage.eINSTANCE.getEOperationTreeItemAxis())){
			return Constants.HEADER_LABEL_PROVIDER_TREE_FILLING_OPERATION_CONFIGURATION_CONTEXT;
		}
		return Constants.HEADER_LABEL_PROVIDER_TREE_FILLING_FEATURE_CONFIGURATION_CONTEXT;
	}


	protected Command getConfigureCategoriesCommand(final List<ITreeItemAxis> userSelection) {
		return new RecordingCommand(TableEditingDomainUtils.getTableEditingDomain(manager.getTable())) {

			@Override
			protected void doExecute() {
				Table table = manager.getTable();

				for (Object tmp : userSelection) {
					ITreeItemAxis root = (ITreeItemAxis) tmp;
					AxisManagerRepresentation representation = root.getManager();
					List<TreeFillingConfiguration> createdFillingConfiguration = new ArrayList<TreeFillingConfiguration>();
					List<PasteEObjectConfiguration> createdPasteEObjectConfiguration = new ArrayList<PasteEObjectConfiguration>();
					
					for (ITreeItemAxis depthItem : root.getChildren()) {
						Assert.isTrue(CategoriesWizardUtils.isDepthItem(depthItem));
						int wantedDepth = Integer.valueOf((String) depthItem.getElement());
						if (depthItem.getChildren().isEmpty()) {
							// we do nothing if there is no child, in standard usecase, it is only possible when wantedDepth==0;
							continue;
						}


						for (ITreeItemAxis categoryItem : depthItem.getChildren()) {

							// 1. try to find existing conf
							TreeFillingConfiguration newConf = findExistingTreeFillingConfiguration(table, representation, wantedDepth, categoryItem.getElement());
							if (null == newConf || EMFHelper.isReadOnly(newConf)) {
								PasteEObjectConfiguration copiedEObjectConfiguration = null;
								if(null != newConf){
									PasteEObjectConfiguration existingPasteConfiguration = newConf.getPasteConfiguration();
									copiedEObjectConfiguration = EcoreUtil.copy(existingPasteConfiguration);
									if(null != copiedEObjectConfiguration){
										createdPasteEObjectConfiguration.add(copiedEObjectConfiguration);
									}
								}
								// we create new TreeFillingConfiguration
								newConf = NattableaxisconfigurationFactory.eINSTANCE.createTreeFillingConfiguration();
								newConf.setDepth(wantedDepth);
								IAxis axis = IAxisFactory.createAxisForTypedElement(categoryItem.getElement(), representation, categoryItem.getAlias());
								newConf.setAxisUsedAsAxisProvider(axis);
								newConf.setLabelProvider(getLabelConfigurationForTreeFillingConfiguration(table, axis));
								newConf.setLabelProviderContext(getLabelProviderContextForTreeFillingConfiguration(table, axis));
								// Manage the paste configuration
								newConf.setPasteConfiguration(copiedEObjectConfiguration);
							} else {

								// update the alias if required
								String oldAlias = newConf.getAxisUsedAsAxisProvider().getAlias();
								String newAlias = categoryItem.getAlias();
								if ((oldAlias != null && !oldAlias.equals(newAlias)) || (newAlias != null && !newAlias.equals(oldAlias))) {
									newConf.getAxisUsedAsAxisProvider().setAlias(newAlias);
								}
							}


							createdFillingConfiguration.add(newConf);

							// TODO : manage paste
						}
					}

					LocalTableHeaderAxisConfiguration local = (LocalTableHeaderAxisConfiguration) HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisInTable(table);
					if (local == null) {
						local = HeaderAxisConfigurationManagementUtils.transformToLocalHeaderConfiguration((TableHeaderAxisConfiguration) HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisInTableConfiguration(table));
						table.setLocalRowHeaderAxisConfiguration(local);
					}
					List<AxisManagerConfiguration> axisManagerConfigurations = local.getAxisManagerConfigurations();
					AxisManagerConfiguration wantedAxisManagerConfiguration = null;
					for (AxisManagerConfiguration curr : axisManagerConfigurations) {
						if (curr.getAxisManager() == representation) {
							wantedAxisManagerConfiguration = curr;
						}
					}
					if (wantedAxisManagerConfiguration == null) {
						wantedAxisManagerConfiguration = NattableaxisconfigurationFactory.eINSTANCE.createAxisManagerConfiguration();
						wantedAxisManagerConfiguration.setAxisManager(representation);
						// TODO
						// /wantedAxisManagerConfiguration.setLocalHeaderLabelConfiguration(value);
						local.getAxisManagerConfigurations().add(wantedAxisManagerConfiguration);
					}
					local.getOwnedAxisConfigurations().clear();
					local.getOwnedAxisConfigurations().addAll(createdFillingConfiguration);
					local.getOwnedAxisConfigurations().addAll(createdPasteEObjectConfiguration);
					wantedAxisManagerConfiguration.getLocalSpecificConfigurations().clear();
					wantedAxisManagerConfiguration.getLocalSpecificConfigurations().addAll(createdFillingConfiguration);
				}
			}
		};
	}

	/**
	 * 
	 * @param table
	 * @param representedAxisManager
	 * @param depth
	 * @param representedObject
	 * @return
	 */
	// TODO : move me
	public static final TreeFillingConfiguration findExistingTreeFillingConfiguration(Table table, AxisManagerRepresentation representedAxisManager, int depth, Object representedObject) {
		List<TreeFillingConfiguration> existingConf = FillingConfigurationUtils.getTreeFillingConfigurationForDepth(table, representedAxisManager, depth);
		for (TreeFillingConfiguration treeFillingConfiguration : existingConf) {
			if (treeFillingConfiguration.getAxisUsedAsAxisProvider().getElement().equals(representedObject)) {
				return treeFillingConfiguration;
			}
		}
		return null;
	}

	/**
	 * 
	 * @param table
	 *            the table
	 * @return
	 *         the axis manager representation for rows
	 */
	private static final List<AxisManagerRepresentation> getRowAxisManagerRepresentations(Table table) {
		AbstractHeaderAxisConfiguration tmp = HeaderAxisConfigurationManagementUtils.getRowAbstractHeaderAxisInTableConfiguration(table);
		Assert.isTrue(tmp instanceof TableHeaderAxisConfiguration);
		TableHeaderAxisConfiguration conf = (TableHeaderAxisConfiguration) tmp;
		return conf.getAxisManagers();
	}



}

Back to the top