Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDirk Fauth2022-11-07 11:05:18 +0000
committerDirk Fauth2022-11-07 11:05:18 +0000
commit8346f341b1c07792083e783d6b8f6d35bb237032 (patch)
tree9cd6630fb7b4513864cff7ba3d4257b76d45ca73
parent60745539c48acaac8472a59e752370b6a6b5a904 (diff)
downloadorg.eclipse.nebula.widgets.nattable-8346f341b1c07792083e783d6b8f6d35bb237032.tar.gz
org.eclipse.nebula.widgets.nattable-8346f341b1c07792083e783d6b8f6d35bb237032.tar.xz
org.eclipse.nebula.widgets.nattable-8346f341b1c07792083e783d6b8f6d35bb237032.zip
Bug 580995 - selectAll in FilterNatCombo selects also filtered items
Fixed issue on selectAll in filtered state if non-visible items are checked. Signed-off-by: Dirk Fauth <dirk.fauth@googlemail.com> Change-Id: I3ce9d9e5256fea708ff6b15919c80bd92ec90910
-rw-r--r--org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/filterrow/combobox/FilterNatCombo.java29
1 files changed, 16 insertions, 13 deletions
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/filterrow/combobox/FilterNatCombo.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/filterrow/combobox/FilterNatCombo.java
index 8fb0fed4..478260c5 100644
--- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/filterrow/combobox/FilterNatCombo.java
+++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/filterrow/combobox/FilterNatCombo.java
@@ -356,18 +356,22 @@ public class FilterNatCombo extends NatCombo {
this.selectAllItemViewer.addCheckStateListener(event -> {
boolean performCheck = event.getChecked();
- if (!performCheck && (getSelectionCount() < FilterNatCombo.this.itemList.size())) {
- // checked but grayed, so not all items selected
- // treat it as if the action is to select all
- performCheck = true;
- }
-
- if (performCheck) {
- // select all
- FilterNatCombo.this.dropdownTable.selectAll();
- } else {
- // deselect all
- FilterNatCombo.this.dropdownTable.deselectAll();
+ boolean grayed = getSelectionCount() < FilterNatCombo.this.itemList.size();
+ // if not all items are checked, but we want to uncheck all via the
+ // grayed select all checkbox, we need to double check the state of
+ // all visible items. This is necessary because one could filter
+ // dropdown where already an item is unselected and tries then to
+ // select all visibles only.
+ if (!performCheck && grayed) {
+ boolean allVisibleUnchecked = true;
+ for (TableItem tableItem : FilterNatCombo.this.dropdownTable.getItems()) {
+ if (tableItem.getChecked()) {
+ allVisibleUnchecked = false;
+ }
+ }
+ if (allVisibleUnchecked) {
+ performCheck = true;
+ }
}
// after selection is performed we need to ensure that
@@ -379,7 +383,6 @@ public class FilterNatCombo extends NatCombo {
// sync the selectionStateMap based on the state of the select
// all checkbox
for (TableItem tableItem : FilterNatCombo.this.dropdownTable.getItems()) {
- // for (String item : FilterNatCombo.this.itemList) {
FilterNatCombo.this.selectionStateMap.put(tableItem.getText(), performCheck);
}

Back to the top