Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Lorenzo2020-05-14 13:20:01 +0000
committerJeremie Tatibouet2020-05-28 07:13:38 +0000
commit858c3fd427bbe6c46adad203e17204295d271c4c (patch)
tree727dbea3102a0fa00724e48a574d3910ffd01c78 /plugins
parentee72c27b2b3276ff3128148e289061f6f4433f3e (diff)
downloadorg.eclipse.papyrus-858c3fd427bbe6c46adad203e17204295d271c4c.tar.gz
org.eclipse.papyrus-858c3fd427bbe6c46adad203e17204295d271c4c.tar.xz
org.eclipse.papyrus-858c3fd427bbe6c46adad203e17204295d271c4c.zip
Bug 562619: [Table][TreeTable][Performance] each cell edition is followed by a reconfiguration of cell editors and row filter
- revert the previous contribution for the same bug (562619) on class PapyrusNatTableComparatorChooser - customize the refresh to recalculate only one time the comparator for a structural refresh Change-Id: I610ca4f688787eb59503d7b0e816f20394c79f5a Signed-off-by: Vincent Lorenzo <vincent.lorenzo@cea.fr>
Diffstat (limited to 'plugins')
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layer/CustomDataLayer.java51
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layer/FilterRowDataLayer.java11
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layer/PapyrusSpanningDataLayer.java11
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/ColumnHeaderLayerStack.java65
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/RowHeaderLayerStack.java11
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/refresh/CustomStructuralRefreshCommand.java70
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/refresh/CustomStructuralRefreshCommandHandler.java51
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/refresh/CustomStructuralRefreshEvent.java63
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/refresh/StructuralRefreshConfiguration.java61
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java5
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java6
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/sort/PapyrusCompositeGlazedListSortModel.java40
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/sort/PapyrusGlazedListsSortModel.java14
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/sort/PapyrusNatTableComparatorChooser.java24
14 files changed, 401 insertions, 82 deletions
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layer/CustomDataLayer.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layer/CustomDataLayer.java
new file mode 100755
index 00000000000..235906b8fb0
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layer/CustomDataLayer.java
@@ -0,0 +1,51 @@
+/*****************************************************************************
+ * Copyright (c) 2020 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) <vincent.lorenzo@cea.fr> - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.layer;
+
+import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
+import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
+import org.eclipse.papyrus.infra.nattable.manager.refresh.StructuralRefreshConfiguration;
+
+/**
+ * This layer has been created to change the structural refresh behavior of NatTable (bug 562619)
+ *
+ * @since 6.7
+ */
+public class CustomDataLayer extends DataLayer {
+
+ /**
+ * Constructor.
+ *
+ * @param dataProvider
+ * @param defaultColumnWidth
+ * @param defaultRowHeight
+ */
+ public CustomDataLayer(IDataProvider dataProvider, int defaultColumnWidth, int defaultRowHeight) {
+ super(dataProvider, defaultColumnWidth, defaultRowHeight);
+ addConfiguration(new StructuralRefreshConfiguration());
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param dataProvider
+ */
+ public CustomDataLayer(IDataProvider dataProvider) {
+ super(dataProvider);
+ addConfiguration(new StructuralRefreshConfiguration());
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layer/FilterRowDataLayer.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layer/FilterRowDataLayer.java
index e6745d56fdd..b9eb746d021 100755
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layer/FilterRowDataLayer.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layer/FilterRowDataLayer.java
@@ -1,14 +1,15 @@
/*******************************************************************************
- * Copyright (c) 2012, 2013 Original authors and others.
+ * Copyright (c) 2012, 2013, 2020 Original authors and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* Original authors and others - initial API and implementation
+ * Vincent Lorenzo (CEA LIST) <vincent.lorenzo@cea.fr> - Bug 562619
******************************************************************************/
package org.eclipse.papyrus.infra.nattable.layer;
@@ -25,6 +26,7 @@ import org.eclipse.nebula.widgets.nattable.layer.ILayer;
import org.eclipse.nebula.widgets.nattable.layer.LabelStack;
import org.eclipse.nebula.widgets.nattable.layer.event.RowStructuralRefreshEvent;
import org.eclipse.papyrus.infra.nattable.dataprovider.FilterRowDataProvider;
+import org.eclipse.papyrus.infra.nattable.manager.refresh.StructuralRefreshConfiguration;
import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
/**
@@ -34,7 +36,7 @@ import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
*
* @param <T>
* type of the underlying row object
- *
+ *
* Duplicated and adapted code from Nattable
*/
public class FilterRowDataLayer<T> extends DataLayer {
@@ -47,9 +49,10 @@ public class FilterRowDataLayer<T> extends DataLayer {
public FilterRowDataLayer(IFilterStrategy<T> filterStrategy, ILayer columnHeaderLayer, IDataProvider columnHeaderDataProvider, INattableModelManager tableManager) {
- super(new FilterRowDataProvider<T>(filterStrategy, columnHeaderLayer, columnHeaderDataProvider, tableManager));
+ super(new FilterRowDataProvider<>(filterStrategy, columnHeaderLayer, columnHeaderDataProvider, tableManager));
addConfiguration(new DefaultFilterRowConfiguration());
+ addConfiguration(new StructuralRefreshConfiguration());// bug 562619
}
@SuppressWarnings("unchecked")
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layer/PapyrusSpanningDataLayer.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layer/PapyrusSpanningDataLayer.java
index 3a2a616d80e..36fe8fa3c7d 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layer/PapyrusSpanningDataLayer.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layer/PapyrusSpanningDataLayer.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2014-2015 CEA LIST and others.
+ * Copyright (c) 2014-2015, 2020 CEA LIST and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -12,7 +12,7 @@
* CEA LIST - Initial API and implementation
* Camille Letavernier - CEA LIST - Bug 464168 - Use the Context's EditingDomain
* Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Bug 504077
- *
+ * Vincent Lorenzo (CEA LIST) <vincent.lorenzo@cea.fr> - Bug 562619
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.layer;
@@ -22,6 +22,7 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.nebula.widgets.nattable.data.ISpanningDataProvider;
import org.eclipse.nebula.widgets.nattable.layer.SpanningDataLayer;
import org.eclipse.nebula.widgets.nattable.resize.event.ColumnResizeEvent;
+import org.eclipse.papyrus.infra.nattable.manager.refresh.StructuralRefreshConfiguration;
import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
/**
@@ -47,7 +48,7 @@ public class PapyrusSpanningDataLayer extends SpanningDataLayer {
public PapyrusSpanningDataLayer(final TransactionalEditingDomain contextDomain, ISpanningDataProvider dataProvider, int defaultColumnWidth, int defaultRowHeight) {
super(dataProvider, defaultColumnWidth, defaultRowHeight);
this.contextDomain = contextDomain;
-
+ addConfiguration(new StructuralRefreshConfiguration());
}
/**
@@ -58,6 +59,7 @@ public class PapyrusSpanningDataLayer extends SpanningDataLayer {
public PapyrusSpanningDataLayer(final TransactionalEditingDomain contextDomain, ISpanningDataProvider dataProvider) {
super(dataProvider);
this.contextDomain = contextDomain;
+ addConfiguration(new StructuralRefreshConfiguration());
}
@@ -75,6 +77,7 @@ public class PapyrusSpanningDataLayer extends SpanningDataLayer {
super(spanProvider, defaultCellWidth, defaultCellHeight);
this.contextDomain = contextEditingDomain;
this.manager = manager;
+ addConfiguration(new StructuralRefreshConfiguration());
}
/**
@@ -111,7 +114,7 @@ public class PapyrusSpanningDataLayer extends SpanningDataLayer {
*/
public void setColumnWidthPercentageByPosition(int columnPosition, int width, boolean fireEvent) {
this.columnWidthConfig.setPercentage(columnPosition, width);
- if (fireEvent){
+ if (fireEvent) {
fireLayerEvent(new ColumnResizeEvent(this, columnPosition));
}
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/ColumnHeaderLayerStack.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/ColumnHeaderLayerStack.java
index 70be179bddf..55a8b3c3e93 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/ColumnHeaderLayerStack.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/ColumnHeaderLayerStack.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
+ * Copyright (c) 2012, 2020 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
@@ -11,7 +11,7 @@
*
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
+ * Vincent Lorenzo (CEA LIST) <vincent.lorenzo@cea.fr> - Bug 562619
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.layerstack;
@@ -28,6 +28,7 @@ import org.eclipse.nebula.widgets.nattable.sort.SortHeaderLayer;
import org.eclipse.papyrus.infra.nattable.configuration.PapyrusColumnHeaderStyleConfiguration;
import org.eclipse.papyrus.infra.nattable.configuration.PapyrusColumnResizeBindingsConfiguration;
import org.eclipse.papyrus.infra.nattable.dataprovider.BodyDataProvider;
+import org.eclipse.papyrus.infra.nattable.layer.CustomDataLayer;
import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
import org.eclipse.papyrus.infra.nattable.sort.IPapyrusSortModel;
import org.eclipse.papyrus.infra.nattable.sort.PapyrusCompositeGlazedListSortModel;
@@ -35,15 +36,20 @@ import org.eclipse.papyrus.infra.nattable.utils.DefaultSizeUtils;
/**
*
- * @author Vincent Lorenzo
+ * The column header layer stack
*
*/
public class ColumnHeaderLayerStack extends AbstractLayerTransform {
+ /**
+ * column header index data layer
+ */
+ private DataLayer indexDataLayer;
- DataLayer indexDataLayer;
-
- DataLayer labelDataLayer;
+ /**
+ * column header label data layer
+ */
+ private DataLayer labelDataLayer;
/**
*
@@ -55,11 +61,11 @@ public class ColumnHeaderLayerStack extends AbstractLayerTransform {
*/
@Deprecated
public ColumnHeaderLayerStack(final IDataProvider dataProvider, final BodyLayerStack bodyLayer, final BodyDataProvider bodyDataProvider, final IPapyrusSortModel sortModel) {
- DataLayer dataLayer = new DataLayer(dataProvider, DefaultSizeUtils.getDefaultCellWidth(), DefaultSizeUtils.getDefaultCellHeight());
+ DataLayer dataLayer = new CustomDataLayer(dataProvider, DefaultSizeUtils.getDefaultCellWidth(), DefaultSizeUtils.getDefaultCellHeight());
ColumnHeaderLayer colHeaderLayer = new ColumnHeaderLayer(dataLayer, bodyLayer.getViewportLayer(), bodyLayer.getSelectionLayer(), false);
colHeaderLayer.addConfiguration(new PapyrusColumnResizeBindingsConfiguration());
colHeaderLayer.addConfiguration(new PapyrusColumnHeaderStyleConfiguration());
- SortHeaderLayer<ISortModel> sortHeaderLayer = new SortHeaderLayer<ISortModel>(colHeaderLayer, sortModel, false);
+ SortHeaderLayer<ISortModel> sortHeaderLayer = new SortHeaderLayer<>(colHeaderLayer, sortModel, false);
setUnderlyingLayer(sortHeaderLayer);
setRegionName(GridRegion.COLUMN_HEADER);
@@ -79,17 +85,15 @@ public class ColumnHeaderLayerStack extends AbstractLayerTransform {
*/
public ColumnHeaderLayerStack(final IDataProvider indexDataProvider, final IDataProvider labelDataProvider, final BodyLayerStack bodyLayer, final IPapyrusSortModel sortModel) {
// 1. create the index row layer
- final DataLayer dataLayer = new DataLayer(indexDataProvider, DefaultSizeUtils.getDefaultCellWidth(), DefaultSizeUtils.getDefaultCellHeight());
- indexDataLayer = dataLayer;
- ColumnHeaderLayer indexHeader = new ColumnHeaderLayer(dataLayer, bodyLayer.getViewportLayer(), bodyLayer.getSelectionLayer(), false);
+ this.indexDataLayer = new CustomDataLayer(indexDataProvider, DefaultSizeUtils.getDefaultCellWidth(), DefaultSizeUtils.getDefaultCellHeight());
+ ColumnHeaderLayer indexHeader = new ColumnHeaderLayer(this.indexDataLayer, bodyLayer.getViewportLayer(), bodyLayer.getSelectionLayer(), false);
// 2. create a composite layer to be able to have several columns in row header + add label header
final CompositeLayer compositeLayer = new CompositeLayer(1, 2);
compositeLayer.setChildLayer(GridRegion.COLUMN_HEADER, indexHeader, 0, 0);
- final DataLayer labelLayer = new DataLayer(labelDataProvider, DefaultSizeUtils.getDefaultCellWidth(), DefaultSizeUtils.getDefaultCellHeight());
- labelDataLayer = labelLayer;
- final ColumnHeaderLayer labelHeaderLayer = new ColumnHeaderLayer(labelLayer, bodyLayer.getViewportLayer(), bodyLayer.getSelectionLayer(), false);
+ this.labelDataLayer = new CustomDataLayer(labelDataProvider, DefaultSizeUtils.getDefaultCellWidth(), DefaultSizeUtils.getDefaultCellHeight());
+ final ColumnHeaderLayer labelHeaderLayer = new ColumnHeaderLayer(this.labelDataLayer, bodyLayer.getViewportLayer(), bodyLayer.getSelectionLayer(), false);
labelHeaderLayer.setRegionName(GridRegion.ROW_HEADER);
compositeLayer.setChildLayer(GridRegion.COLUMN_HEADER, labelHeaderLayer, 0, 1);
@@ -103,7 +107,7 @@ public class ColumnHeaderLayerStack extends AbstractLayerTransform {
compositeLayer.addConfiguration(new PapyrusColumnResizeBindingsConfiguration());
compositeLayer.addConfiguration(new PapyrusColumnHeaderStyleConfiguration());
- SortHeaderLayer<ISortModel> sortHeaderLayer = new SortHeaderLayer<ISortModel>(compositeLayer, sortModel, false);
+ SortHeaderLayer<ISortModel> sortHeaderLayer = new SortHeaderLayer<>(compositeLayer, sortModel, false);
setUnderlyingLayer(sortHeaderLayer);
setRegionName(GridRegion.COLUMN_HEADER);
@@ -114,17 +118,15 @@ public class ColumnHeaderLayerStack extends AbstractLayerTransform {
// TODO : add IConfigRegistry ?
public ColumnHeaderLayerStack(final INattableModelManager manager, final IDataProvider indexDataProvider, final IDataProvider labelDataProvider, final BodyLayerStack bodyLayer, final IPapyrusSortModel sortModel) {
// 1. create the index row layer
- final DataLayer dataLayer = new DataLayer(indexDataProvider, DefaultSizeUtils.getDefaultCellWidth(), DefaultSizeUtils.getDefaultCellHeight());
- indexDataLayer = dataLayer;
- ColumnHeaderLayer indexHeader = new ColumnHeaderLayer(dataLayer, bodyLayer.getViewportLayer(), bodyLayer.getSelectionLayer(), false);
+ this.indexDataLayer = new CustomDataLayer(indexDataProvider, DefaultSizeUtils.getDefaultCellWidth(), DefaultSizeUtils.getDefaultCellHeight());
+ ColumnHeaderLayer indexHeader = new ColumnHeaderLayer(this.indexDataLayer, bodyLayer.getViewportLayer(), bodyLayer.getSelectionLayer(), false);
// 2. create a composite layer to be able to have several columns in row header + add label header
final CompositeLayer compositeLayer = new CompositeLayer(1, 2);
compositeLayer.setChildLayer(GridRegion.COLUMN_HEADER, indexHeader, 0, 0);
- final DataLayer labelLayer = new DataLayer(labelDataProvider, DefaultSizeUtils.getDefaultCellWidth(), DefaultSizeUtils.getDefaultCellHeight());
- labelDataLayer = labelLayer;
- final ColumnHeaderLayer labelHeaderLayer = new ColumnHeaderLayer(labelLayer, bodyLayer.getViewportLayer(), bodyLayer.getSelectionLayer(), false);
+ this.labelDataLayer = new CustomDataLayer(labelDataProvider, DefaultSizeUtils.getDefaultCellWidth(), DefaultSizeUtils.getDefaultCellHeight());
+ final ColumnHeaderLayer labelHeaderLayer = new ColumnHeaderLayer(this.labelDataLayer, bodyLayer.getViewportLayer(), bodyLayer.getSelectionLayer(), false);
labelHeaderLayer.setRegionName(GridRegion.ROW_HEADER);
compositeLayer.setChildLayer(GridRegion.COLUMN_HEADER, labelHeaderLayer, 0, 1);
@@ -137,21 +139,30 @@ public class ColumnHeaderLayerStack extends AbstractLayerTransform {
compositeLayer.addConfiguration(new PapyrusColumnResizeBindingsConfiguration());
compositeLayer.addConfiguration(new PapyrusColumnHeaderStyleConfiguration());
-
- ((PapyrusCompositeGlazedListSortModel)sortModel).setColumnHeaderLayer(compositeLayer);
- SortHeaderLayer<ISortModel> sortHeaderLayer = new SortHeaderLayer<ISortModel>(compositeLayer, sortModel, false);
+
+ ((PapyrusCompositeGlazedListSortModel) sortModel).setColumnHeaderLayer(compositeLayer);
+ SortHeaderLayer<ISortModel> sortHeaderLayer = new SortHeaderLayer<>(compositeLayer, sortModel, false);
setUnderlyingLayer(sortHeaderLayer);
setRegionName(GridRegion.COLUMN_HEADER);
}
-
+ /**
+ *
+ * @return
+ * the column header index data layer
+ */
public DataLayer getColumnIndexDataLayer() {
- return indexDataLayer;
+ return this.indexDataLayer;
}
+ /**
+ *
+ * @return
+ * the column header label data layer
+ */
public DataLayer getColumnLabelDataLayer() {
- return labelDataLayer;
+ return this.labelDataLayer;
}
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/RowHeaderLayerStack.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/RowHeaderLayerStack.java
index 90c7f912f54..84aea10fd27 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/RowHeaderLayerStack.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/layerstack/RowHeaderLayerStack.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2012 CEA LIST.
+ * Copyright (c) 2012, 2020 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
@@ -11,7 +11,7 @@
*
* Contributors:
* Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Bug 562619
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.layerstack;
@@ -31,6 +31,7 @@ import org.eclipse.papyrus.infra.nattable.configuration.PapyrusRowHeaderStyleCon
import org.eclipse.papyrus.infra.nattable.configuration.PapyrusRowResizeBindingsConfiguration;
import org.eclipse.papyrus.infra.nattable.dataprovider.RowIndexHeaderDataProvider;
import org.eclipse.papyrus.infra.nattable.dataprovider.RowLabelHeaderDataProvider;
+import org.eclipse.papyrus.infra.nattable.layer.CustomDataLayer;
import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
import org.eclipse.papyrus.infra.nattable.utils.DefaultSizeUtils;
import org.eclipse.swt.SWT;
@@ -101,7 +102,7 @@ public class RowHeaderLayerStack extends AbstractLayerTransform {
*/
@Deprecated
public RowHeaderLayerStack(final IDataProvider dataProvider, final BodyLayerStack bodyLayer) {
- final DataLayer dataLayer = new DataLayer(dataProvider, RowHeaderLayerStack.DEFAULT_COLUMN_WIDTH, RowHeaderLayerStack.DEFAULT_ROW_HEIGHT);
+ final DataLayer dataLayer = new CustomDataLayer(dataProvider, RowHeaderLayerStack.DEFAULT_COLUMN_WIDTH, RowHeaderLayerStack.DEFAULT_ROW_HEIGHT);
// I know that selection layer is probably false
final RowHeaderLayer rowHeaderLayer = new RowHeaderLayer(dataLayer, bodyLayer, /* bodyLayer.getSelectionLayer() */new SelectionLayer(dataLayer), false);
rowHeaderLayer.addConfiguration(new PapyrusRowResizeBindingsConfiguration());
@@ -243,7 +244,7 @@ public class RowHeaderLayerStack extends AbstractLayerTransform {
* @return
*/
protected DataLayer createLabelDataLayer() {
- return new DataLayer(getLabelDataProvider(), RowHeaderLayerStack.DEFAULT_COLUMN_WIDTH, RowHeaderLayerStack.DEFAULT_ROW_HEIGHT);
+ return new CustomDataLayer(getLabelDataProvider(), RowHeaderLayerStack.DEFAULT_COLUMN_WIDTH, RowHeaderLayerStack.DEFAULT_ROW_HEIGHT);
}
/**
@@ -260,7 +261,7 @@ public class RowHeaderLayerStack extends AbstractLayerTransform {
* @return
*/
protected DataLayer createIndexDataLayer() {
- return new DataLayer(getIndexDataProvider(), RowHeaderLayerStack.DEFAULT_COLUMN_WIDTH, RowHeaderLayerStack.DEFAULT_ROW_HEIGHT);
+ return new CustomDataLayer(getIndexDataProvider(), RowHeaderLayerStack.DEFAULT_COLUMN_WIDTH, RowHeaderLayerStack.DEFAULT_ROW_HEIGHT);
}
/**
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/refresh/CustomStructuralRefreshCommand.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/refresh/CustomStructuralRefreshCommand.java
new file mode 100755
index 00000000000..9adda4971d7
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/refresh/CustomStructuralRefreshCommand.java
@@ -0,0 +1,70 @@
+/*****************************************************************************
+ * Copyright (c) 2020 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) <vincent.lorenzo@cea.fr> - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.manager.refresh;
+
+import org.eclipse.nebula.widgets.nattable.command.ILayerCommand;
+import org.eclipse.nebula.widgets.nattable.command.StructuralRefreshCommand;
+
+/**
+ * This command has been created to change the structural refresh behavior of NatTable (bug 562619)
+ *
+ * @since 6.7
+ *
+ */
+public class CustomStructuralRefreshCommand extends StructuralRefreshCommand {
+
+ /**
+ * boolean indicating that this command instance already notified the sort model
+ */
+ private boolean sortModelIsAlreadyNotified = false;
+
+ /**
+ *
+ * Constructor.
+ *
+ */
+ public CustomStructuralRefreshCommand() {
+ // nothing to do
+ }
+
+ /**
+ * Specific behavior, the clone method returns the same instance
+ *
+ * @see org.eclipse.nebula.widgets.nattable.command.StructuralRefreshCommand#cloneCommand()
+ *
+ * @return
+ */
+ @Override
+ public ILayerCommand cloneCommand() {
+ return this;
+ }
+
+ /**
+ * @return
+ * <code>true</code> if this command has already updated the comparator chooser
+ */
+ public boolean isSortModelAlreadyNotified() {
+ return this.sortModelIsAlreadyNotified;
+ }
+
+ /**
+ * set the field sortModelIsAlreadyNotified to true
+ */
+ public void setSortModelAlreadyNotified() {
+ this.sortModelIsAlreadyNotified = true;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/refresh/CustomStructuralRefreshCommandHandler.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/refresh/CustomStructuralRefreshCommandHandler.java
new file mode 100755
index 00000000000..7ec012b0892
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/refresh/CustomStructuralRefreshCommandHandler.java
@@ -0,0 +1,51 @@
+/*****************************************************************************
+ * Copyright (c) 2020 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) <vincent.lorenzo@cea.fr> - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.manager.refresh;
+
+import org.eclipse.nebula.widgets.nattable.command.ILayerCommandHandler;
+import org.eclipse.nebula.widgets.nattable.layer.ILayer;
+
+/**
+ * This command handler has been created to change the structural refresh behavior of NatTable (bug 562619)
+ *
+ * @since 6.7
+ *
+ */
+public class CustomStructuralRefreshCommandHandler implements ILayerCommandHandler<CustomStructuralRefreshCommand> {
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.command.ILayerCommandHandler#getCommandClass()
+ *
+ * @return
+ */
+ @Override
+ public Class<CustomStructuralRefreshCommand> getCommandClass() {
+ return CustomStructuralRefreshCommand.class;
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.command.ILayerCommandHandler#doCommand(org.eclipse.nebula.widgets.nattable.layer.ILayer, org.eclipse.nebula.widgets.nattable.command.ILayerCommand)
+ *
+ * @param targetLayer
+ * @param command
+ * @return
+ */
+ @Override
+ public boolean doCommand(final ILayer targetLayer, final CustomStructuralRefreshCommand command) {
+ targetLayer.fireLayerEvent(new CustomStructuralRefreshEvent(targetLayer, command));
+ return false;
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/refresh/CustomStructuralRefreshEvent.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/refresh/CustomStructuralRefreshEvent.java
new file mode 100755
index 00000000000..8422af8ba10
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/refresh/CustomStructuralRefreshEvent.java
@@ -0,0 +1,63 @@
+/*****************************************************************************
+ * Copyright (c) 2020 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) <vincent.lorenzo@cea.fr> - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.manager.refresh;
+
+import org.eclipse.nebula.widgets.nattable.layer.ILayer;
+import org.eclipse.nebula.widgets.nattable.layer.event.StructuralRefreshEvent;
+
+/**
+ * This event has been created to change the structural refresh behavior of NatTable (bug 562619)
+ *
+ * @since 6.7
+ *
+ */
+public class CustomStructuralRefreshEvent extends StructuralRefreshEvent {
+
+ /**
+ * The command from which this event has been created
+ */
+ private CustomStructuralRefreshCommand command;
+
+ /**
+ * Constructor.
+ *
+ * @param layer
+ * the layer laucnhing the event
+ * @param command
+ * the command initializing this event
+ */
+ public CustomStructuralRefreshEvent(final ILayer layer, final CustomStructuralRefreshCommand command) {
+ super(layer);
+ this.command = command;
+ }
+
+ /**
+ *
+ * @return
+ * <code>true</code> if the SortModel has already been notified
+ */
+ public boolean isSortModelAlreadyNotified() {
+ return this.command.isSortModelAlreadyNotified();
+ }
+
+ /**
+ * the sort model calls this method in order to be able to know it has already been notified
+ */
+ public void setSortModelAlreadyNotified() {
+ this.command.setSortModelAlreadyNotified();
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/refresh/StructuralRefreshConfiguration.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/refresh/StructuralRefreshConfiguration.java
new file mode 100755
index 00000000000..dfbd78a676a
--- /dev/null
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/refresh/StructuralRefreshConfiguration.java
@@ -0,0 +1,61 @@
+/*****************************************************************************
+ * Copyright (c) 2020 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) <vincent.lorenzo@cea.fr> - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.nattable.manager.refresh;
+
+import org.eclipse.nebula.widgets.nattable.command.StructuralRefreshCommand;
+import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+import org.eclipse.nebula.widgets.nattable.config.IConfiguration;
+import org.eclipse.nebula.widgets.nattable.layer.ILayer;
+import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
+
+/**
+ * @author Vincent Lorenzo (CEA LIST) <vincent.lorenzo@cea.fr>
+ *
+ */
+public class StructuralRefreshConfiguration implements IConfiguration {
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.config.IConfiguration#configureLayer(org.eclipse.nebula.widgets.nattable.layer.ILayer)
+ *
+ * @param layer
+ */
+ @Override
+ public void configureLayer(final ILayer layer) {
+ layer.unregisterCommandHandler(StructuralRefreshCommand.class);
+ layer.registerCommandHandler(new CustomStructuralRefreshCommandHandler());
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.config.IConfiguration#configureRegistry(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)
+ *
+ * @param configRegistry
+ */
+ @Override
+ public void configureRegistry(IConfigRegistry configRegistry) {
+ // nothing to do
+ }
+
+ /**
+ * @see org.eclipse.nebula.widgets.nattable.config.IConfiguration#configureUiBindings(org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry)
+ *
+ * @param uiBindingRegistry
+ */
+ @Override
+ public void configureUiBindings(UiBindingRegistry uiBindingRegistry) {
+ // nothing to do
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java
index 5d388ed20ba..851630278f7 100755
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/AbstractNattableWidgetManager.java
@@ -18,7 +18,7 @@
* Thanh Liem PHAN (ALL4TEC) thanhliem.phan@all4tec.net - Bug 459220, 417095
* Vincent Lorenzo (CEA LIST) - bug 525221
* Nicolas Fauvergue (CEA LIST) - bug 509971
- * Vincent Lorenzo (CEA LIST) - bug 561300
+ * Vincent Lorenzo (CEA LIST) - bug 561300, 562619
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.manager.table;
@@ -116,6 +116,7 @@ import org.eclipse.papyrus.infra.nattable.fillhandle.config.PapyrusFillHandleCon
import org.eclipse.papyrus.infra.nattable.filter.configuration.FilterConfigurationRegistry;
import org.eclipse.papyrus.infra.nattable.filter.configuration.IFilterConfiguration;
import org.eclipse.papyrus.infra.nattable.internal.export.image.PapyrusImageExportCommand;
+import org.eclipse.papyrus.infra.nattable.layer.CustomDataLayer;
import org.eclipse.papyrus.infra.nattable.layer.FilterRowHeaderComposite;
import org.eclipse.papyrus.infra.nattable.layer.PapyrusGridLayer;
import org.eclipse.papyrus.infra.nattable.layerstack.BodyLayerStack;
@@ -448,7 +449,7 @@ public abstract class AbstractNattableWidgetManager implements INattableModelMan
// init the filter visibility
this.filterColumnHeaderComposite.setFilterRowVisible(HeaderAxisConfigurationManagementUtils.getColumnAbstractHeaderAxisConfigurationUsedInTable(this.table).isDisplayFilter());
- final CornerLayer cornerLayer = new CornerLayer(new DataLayer(cornerDataProvider), this.rowHeaderLayerStack, filterColumnHeaderComposite);
+ final CornerLayer cornerLayer = new CornerLayer(new CustomDataLayer(cornerDataProvider), this.rowHeaderLayerStack, filterColumnHeaderComposite);
cornerLayer.addConfiguration(new CornerConfiguration(this));
this.gridLayer = new PapyrusGridLayer(TransactionUtil.getEditingDomain(tableContext), this.bodyLayerStack, filterColumnHeaderComposite, this.rowHeaderLayerStack, cornerLayer);
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java
index 86def26d544..2d2f3d9ca63 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/manager/table/NattableModelManager.java
@@ -86,6 +86,7 @@ import org.eclipse.papyrus.infra.nattable.manager.axis.CompositeAxisManager;
import org.eclipse.papyrus.infra.nattable.manager.axis.IAxisManager;
import org.eclipse.papyrus.infra.nattable.manager.axis.ICompositeAxisManager;
import org.eclipse.papyrus.infra.nattable.manager.cell.CellManagerFactory;
+import org.eclipse.papyrus.infra.nattable.manager.refresh.CustomStructuralRefreshCommand;
import org.eclipse.papyrus.infra.nattable.messages.Messages;
import org.eclipse.papyrus.infra.nattable.model.nattable.NattablePackage;
import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
@@ -1204,8 +1205,9 @@ public class NattableModelManager extends AbstractNattableWidgetManager implemen
final SelectionLayer selectionLayer = getBodyLayerStack().getSelectionLayer();
selectionLayer.doCommand(new ClearAllSelectionsCommand());
-
- this.natTable.refresh();
+ // this.natTable.refresh();
+ // custom refresh for bug 562619
+ this.natTable.doCommand(new CustomStructuralRefreshCommand());
// Refresh the nattable columns size in the case of named style
doFillColumnsSize();
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/sort/PapyrusCompositeGlazedListSortModel.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/sort/PapyrusCompositeGlazedListSortModel.java
index ec19e2bbda7..47b1a42bd75 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/sort/PapyrusCompositeGlazedListSortModel.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/sort/PapyrusCompositeGlazedListSortModel.java
@@ -1,6 +1,6 @@
/*****************************************************************************
- * Copyright (c) 2015 CEA LIST and others.
- *
+ * Copyright (c) 2015, 2020 CEA LIST and others.
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -10,7 +10,7 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
- *
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - bug 562619
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.sort;
@@ -49,7 +49,12 @@ public class PapyrusCompositeGlazedListSortModel extends AbstractGlazedListSortM
private boolean isTableInverted = false;
/**
- *
+ * the column header layer (it doesn't change even if the table is inverted)
+ */
+ private ILayer columnHeaderLayer;
+
+ /**
+ *
* Constructor.
*
* @param manager
@@ -87,7 +92,7 @@ public class PapyrusCompositeGlazedListSortModel extends AbstractGlazedListSortM
*/
@Override
public void handleLayerEvent(ILayerEvent event) {
-
+
}
@@ -182,18 +187,24 @@ public class PapyrusCompositeGlazedListSortModel extends AbstractGlazedListSortM
*/
@Override
public void clear() {
-
- }
-
+ }
/**
* @param compositeLayer
*/
- // TODO : try to remove me
public void setColumnHeaderLayer(ILayer compositeLayer) {
- this.rowSortModel.setColumnHeaderLayer(compositeLayer);
- this.columnSortModel.setColumnHeaderLayer(compositeLayer);
+ this.columnHeaderLayer = compositeLayer;
+ this.rowSortModel.clear();
+ this.columnSortModel.clear();
+ if (this.isTableInverted) {
+ compositeLayer.removeLayerListener(this.columnSortModel);
+ // the sort model is in charge to add the listener on the new column header layer
+ this.rowSortModel.setColumnHeaderLayer(compositeLayer);
+ } else {
+ compositeLayer.removeLayerListener(this.rowSortModel);
+ this.columnSortModel.setColumnHeaderLayer(compositeLayer);
+ }
}
@@ -219,8 +230,8 @@ public class PapyrusCompositeGlazedListSortModel extends AbstractGlazedListSortM
@Override
public void setTableInverted(boolean isInverted) {
this.isTableInverted = isInverted;
- this.rowSortModel.clear();
- this.columnSortModel.clear();
+ // we re-set the column header layer to use the good one
+ setColumnHeaderLayer(this.columnHeaderLayer);
}
@@ -232,9 +243,8 @@ public class PapyrusCompositeGlazedListSortModel extends AbstractGlazedListSortM
*/
@Override
public Comparator<?> getColumnComparator(int columnIndex) {
-
+
return null;
}
-
}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/sort/PapyrusGlazedListsSortModel.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/sort/PapyrusGlazedListsSortModel.java
index b23c588038e..2f7ccd4d59f 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/sort/PapyrusGlazedListsSortModel.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/sort/PapyrusGlazedListsSortModel.java
@@ -9,7 +9,7 @@
*
* Contributors:
* Original authors and others - initial API and implementation
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Bug 562646
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Bug 562646, 562619
******************************************************************************/
package org.eclipse.papyrus.infra.nattable.sort;
@@ -26,6 +26,7 @@ import org.eclipse.nebula.widgets.nattable.layer.event.ILayerEvent;
import org.eclipse.nebula.widgets.nattable.layer.event.StructuralRefreshEvent;
import org.eclipse.nebula.widgets.nattable.sort.SortDirectionEnum;
import org.eclipse.papyrus.infra.nattable.glazedlists.PapyrusSortingState;
+import org.eclipse.papyrus.infra.nattable.manager.refresh.CustomStructuralRefreshEvent;
import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
import org.eclipse.papyrus.infra.nattable.sort.copy.NatTableComparatorChooser;
@@ -99,7 +100,7 @@ public class PapyrusGlazedListsSortModel extends AbstractGlazedListSortModel {
}
protected IConfigRegistry getConfigRegistry() {
- NatTable nat = getTableManager().getAdapter(NatTable.class);
+ NatTable nat = (NatTable) getTableManager().getAdapter(NatTable.class);
return nat.getConfigRegistry();
}
@@ -140,6 +141,11 @@ public class PapyrusGlazedListsSortModel extends AbstractGlazedListSortModel {
@Override
public void handleLayerEvent(ILayerEvent event) {
+ if (event instanceof CustomStructuralRefreshEvent
+ && ((CustomStructuralRefreshEvent) event).isSortModelAlreadyNotified()) {
+ return; // already managed, nothing to do
+ }
+
if (event instanceof StructuralRefreshEvent && ((StructuralRefreshEvent) event).isHorizontalStructureChanged()) {
String test = getComparatorChooser().toString();
if (test.contains("-")) { //$NON-NLS-1$
@@ -150,6 +156,10 @@ public class PapyrusGlazedListsSortModel extends AbstractGlazedListSortModel {
this.comparatorChooser = null;
getComparatorChooser().fromString(test);
}
+
+ if (event instanceof CustomStructuralRefreshEvent) {
+ ((CustomStructuralRefreshEvent) event).setSortModelAlreadyNotified();
+ }
}
/**
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/sort/PapyrusNatTableComparatorChooser.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/sort/PapyrusNatTableComparatorChooser.java
index 202b3725e8a..cbfa8da2aca 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/sort/PapyrusNatTableComparatorChooser.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/sort/PapyrusNatTableComparatorChooser.java
@@ -1,6 +1,6 @@
/*****************************************************************************
- * Copyright (c) 2015, 2020 CEA LIST and others.
- *
+ * Copyright (c) 2015 CEA LIST and others.
+ *
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -10,13 +10,11 @@
*
* Contributors:
* CEA LIST - Initial API and implementation
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Bug 562619
+ *
*****************************************************************************/
package org.eclipse.papyrus.infra.nattable.sort;
-import java.util.Comparator;
-
import org.eclipse.papyrus.infra.nattable.sort.copy.NatTableComparatorChooser;
import ca.odell.glazedlists.SortedList;
@@ -38,20 +36,4 @@ public class PapyrusNatTableComparatorChooser extends NatTableComparatorChooser<
super(sortedList, tableFormat);
}
- /**
- * @see org.eclipse.papyrus.infra.nattable.glazedlists.copy.AbstractTableComparatorChooser#rebuildComparator()
- * @since 6.7
- *
- */
- @Override
- protected void rebuildComparator() {
- final Comparator<?> newComparator = sortingState.buildComparator();
- final Comparator<?> previousComparator = sortedList.getComparator();
- if (newComparator != null || previousComparator != null) {
- // bug 562619
- // in other cases, we do nothing to avoid useless notification from the event list
- super.rebuildComparator();
- }
-
- }
}

Back to the top