Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDirk Fauth2023-03-06 09:25:48 +0000
committerDirk Fauth2023-03-06 09:25:48 +0000
commit367ca992748c2f6bb751314cd62f9bb8e51b38e9 (patch)
tree82883414385d7c210c507794c075368ed27c2352
parent17f81956fec5ad31eaefa09a63c79a815473a095 (diff)
downloadorg.eclipse.nebula.widgets.nattable-367ca992748c2f6bb751314cd62f9bb8e51b38e9.tar.gz
org.eclipse.nebula.widgets.nattable-367ca992748c2f6bb751314cd62f9bb8e51b38e9.tar.xz
org.eclipse.nebula.widgets.nattable-367ca992748c2f6bb751314cd62f9bb8e51b38e9.zip
Bug 581321 - [GroupBy] list order changed after grouping a filtered list
Extended the regression fix for a possible ClassCastException so that the groupBy structure is ALWAYS removed prior to removing the sort and filter state, before the groupBy configuration is updated. Signed-off-by: Dirk Fauth <dirk.fauth@googlemail.com> Change-Id: Ibbd832fcaab4d019c714ce537eb15a9e3f5c514b
-rw-r--r--org.eclipse.nebula.widgets.nattable.extension.glazedlists/.settings/.api_filters11
-rw-r--r--org.eclipse.nebula.widgets.nattable.extension.glazedlists/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/groupBy/GroupByDataLayer.java25
-rw-r--r--org.eclipse.nebula.widgets.nattable.extension.glazedlists/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/groupBy/GroupByModel.java11
3 files changed, 11 insertions, 36 deletions
diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists/.settings/.api_filters b/org.eclipse.nebula.widgets.nattable.extension.glazedlists/.settings/.api_filters
deleted file mode 100644
index 29182a8f..00000000
--- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists/.settings/.api_filters
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<component id="org.eclipse.nebula.widgets.nattable.extension.glazedlists" version="2">
- <resource path="src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/groupBy/GroupByModel.java" type="org.eclipse.nebula.widgets.nattable.extension.glazedlists.groupBy.GroupByModel">
- <filter id="336658481">
- <message_arguments>
- <message_argument value="org.eclipse.nebula.widgets.nattable.extension.glazedlists.groupBy.GroupByModel"/>
- <message_argument value="LOAD_STATE_INDICATOR"/>
- </message_arguments>
- </filter>
- </resource>
-</component>
diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/groupBy/GroupByDataLayer.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/groupBy/GroupByDataLayer.java
index e9247810..d8419b0a 100644
--- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/groupBy/GroupByDataLayer.java
+++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/groupBy/GroupByDataLayer.java
@@ -640,18 +640,15 @@ public class GroupByDataLayer<T> extends DataLayer implements Observer {
// structure costs time
BusyIndicator.showWhile(Display.getDefault(), () -> {
List<Integer> indexes = new ArrayList<>();
- if (GroupByModel.LOAD_STATE_INDICATOR.equals(arg)) {
- // if the GroupByModel was loaded and not simply updated, there
- // can be situations where the groupby indexes and the
- // corresponding types per column are totally different. In this
- // case we first need to perform a clear operation without the
- // new groupby configuration, and then re-apply everything.
- // Otherwise the filter operation might trigger a list update
- // which then leads to ClassCastExceptions as the old
- // GroupByObjects are still in the TreeList.
- indexes.addAll(this.groupByModel.getGroupByColumnIndexes());
- this.groupByModel.getGroupByColumnIndexes().clear();
- }
+ // there can be situations where the groupby indexes and the
+ // corresponding types per column are totally different. In this
+ // case we first need to perform a clear operation without the
+ // new groupby configuration, and then re-apply everything.
+ // Otherwise the filter operation might trigger a list update
+ // which then leads to ClassCastExceptions as the old
+ // GroupByObjects are still in the TreeList.
+ indexes.addAll(this.groupByModel.getGroupByColumnIndexes());
+ this.groupByModel.getGroupByColumnIndexes().clear();
// if we know the sort model, we need to clear the sort model to
// avoid strange side effects while updating the tree structure
@@ -686,9 +683,7 @@ public class GroupByDataLayer<T> extends DataLayer implements Observer {
this.filterRowDataProvider.getFilterStrategy().applyFilter(original);
}
- if (GroupByModel.LOAD_STATE_INDICATOR.equals(arg)) {
- this.groupByModel.getGroupByColumnIndexes().addAll(indexes);
- }
+ this.groupByModel.getGroupByColumnIndexes().addAll(indexes);
updateTree();
diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/groupBy/GroupByModel.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/groupBy/GroupByModel.java
index f34c9de7..715ab72f 100644
--- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/groupBy/GroupByModel.java
+++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/groupBy/GroupByModel.java
@@ -29,15 +29,6 @@ public class GroupByModel extends Observable implements IPersistable {
public static final String PERSISTENCE_KEY_GROUP_BY_COLUMN_INDEXES = ".groupByColumnIndexes"; //$NON-NLS-1$
- /**
- * Argument that is passed to {@link #notifyObservers(Object)} to inform
- * about a complete change. Needed to handle the tree update slightly
- * different.
- *
- * @since 2.1
- */
- public static final String LOAD_STATE_INDICATOR = "LOAD_STATE"; //$NON-NLS-1$
-
private List<Integer> groupByColumnIndexes = new ArrayList<>();
/**
@@ -122,7 +113,7 @@ public class GroupByModel extends Observable implements IPersistable {
}
setChanged();
- notifyObservers(LOAD_STATE_INDICATOR);
+ notifyObservers();
}
/**

Back to the top