Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDirk Fauth2022-12-15 14:38:54 +0000
committerDirk Fauth2022-12-15 14:38:54 +0000
commit9375ae03a5744d1737195ee457a871e225919ff5 (patch)
treea4a38264b04dec3d801a4029e0b8a1267d8cebe6
parenta870cb859eb6e9035bf2dc3394a672d02fda36d3 (diff)
downloadorg.eclipse.nebula.widgets.nattable-9375ae03a5744d1737195ee457a871e225919ff5.tar.gz
org.eclipse.nebula.widgets.nattable-9375ae03a5744d1737195ee457a871e225919ff5.tar.xz
org.eclipse.nebula.widgets.nattable-9375ae03a5744d1737195ee457a871e225919ff5.zip
Bug 581005 - Support mixed filter row
Fixed a regression caused by incorrect index-position handling Signed-off-by: Dirk Fauth <dirk.fauth@googlemail.com> Change-Id: I82a9a5f403207416e0fe6e7a915248f7fb9a9bad
-rw-r--r--org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_603_Filter/_6037_MixedFilterRowExample.java9
-rw-r--r--org.eclipse.nebula.widgets.nattable.extension.glazedlists/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/ComboBoxFilterRowHeaderComposite.java10
2 files changed, 13 insertions, 6 deletions
diff --git a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_603_Filter/_6037_MixedFilterRowExample.java b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_603_Filter/_6037_MixedFilterRowExample.java
index c6cd0d97..d291674e 100644
--- a/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_603_Filter/_6037_MixedFilterRowExample.java
+++ b/org.eclipse.nebula.widgets.nattable.examples/src/org/eclipse/nebula/widgets/nattable/examples/_600_GlazedLists/_603_Filter/_6037_MixedFilterRowExample.java
@@ -89,6 +89,7 @@ import org.eclipse.nebula.widgets.nattable.grid.layer.DefaultColumnHeaderDataLay
import org.eclipse.nebula.widgets.nattable.grid.layer.DefaultRowHeaderDataLayer;
import org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer;
import org.eclipse.nebula.widgets.nattable.grid.layer.RowHeaderLayer;
+import org.eclipse.nebula.widgets.nattable.hideshow.ColumnHideShowLayer;
import org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform;
import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
import org.eclipse.nebula.widgets.nattable.layer.ILayer;
@@ -101,6 +102,7 @@ import org.eclipse.nebula.widgets.nattable.painter.cell.CheckBoxPainter;
import org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter;
import org.eclipse.nebula.widgets.nattable.painter.cell.decorator.PaddingDecorator;
import org.eclipse.nebula.widgets.nattable.persistence.command.DisplayPersistenceDialogCommandHandler;
+import org.eclipse.nebula.widgets.nattable.reorder.ColumnReorderLayer;
import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer;
import org.eclipse.nebula.widgets.nattable.style.CellStyleAttributes;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
@@ -502,8 +504,11 @@ public class _6037_MixedFilterRowExample extends AbstractNatExample {
this.glazedListsEventLayer =
new GlazedListsEventLayer<>(this.bodyDataLayer, this.filterList);
- this.selectionLayer = new SelectionLayer(getGlazedListsEventLayer());
- ViewportLayer viewportLayer = new ViewportLayer(getSelectionLayer());
+ ColumnReorderLayer reorderLayer = new ColumnReorderLayer(this.glazedListsEventLayer);
+ ColumnHideShowLayer hideShowLayer = new ColumnHideShowLayer(reorderLayer);
+
+ this.selectionLayer = new SelectionLayer(hideShowLayer);
+ ViewportLayer viewportLayer = new ViewportLayer(this.selectionLayer);
FreezeLayer freezeLayer = new FreezeLayer(this.selectionLayer);
CompositeFreezeLayer compositeFreezeLayer =
diff --git a/org.eclipse.nebula.widgets.nattable.extension.glazedlists/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/ComboBoxFilterRowHeaderComposite.java b/org.eclipse.nebula.widgets.nattable.extension.glazedlists/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/ComboBoxFilterRowHeaderComposite.java
index d69e3bf9..54038f35 100644
--- a/org.eclipse.nebula.widgets.nattable.extension.glazedlists/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/ComboBoxFilterRowHeaderComposite.java
+++ b/org.eclipse.nebula.widgets.nattable.extension.glazedlists/src/org/eclipse/nebula/widgets/nattable/extension/glazedlists/filterrow/ComboBoxFilterRowHeaderComposite.java
@@ -740,21 +740,22 @@ public class ComboBoxFilterRowHeaderComposite<T> extends CompositeLayer implemen
// where the editors are not yet configured, we remove the value
// reactively on accessing it for a consistent view.
+ int columnIndex = getColumnIndexByPosition(compositeColumnPosition);
if (compositeRowPosition == 1
&& !isFilterRowComboBoxCellEditor(compositeColumnPosition)
&& EditConstants.SELECT_ALL_ITEMS_VALUE.equals(filterValue)) {
- this.filterRowDataLayer.getFilterRowDataProvider().getFilterIndexToObjectMap().remove(compositeColumnPosition);
+ this.filterRowDataLayer.getFilterRowDataProvider().getFilterIndexToObjectMap().remove(columnIndex);
filterValue = null;
}
return filterValue;
}
- private boolean isFilterRowComboBoxCellEditor(int column) {
+ private boolean isFilterRowComboBoxCellEditor(int columnPosition) {
ICellEditor cellEditor = this.configRegistry.getConfigAttribute(
EditConfigAttributes.CELL_EDITOR,
DisplayMode.NORMAL,
- this.filterRowDataLayer.getConfigLabelsByPosition(column, 0));
+ this.filterRowDataLayer.getConfigLabelsByPosition(columnPosition, 0));
return (cellEditor instanceof FilterRowComboBoxCellEditor);
}
@@ -789,11 +790,12 @@ public class ComboBoxFilterRowHeaderComposite<T> extends CompositeLayer implemen
else if (command instanceof ClearFilterCommand
&& command.convertToTargetLayer(this)) {
int columnPosition = ((ClearFilterCommand) command).getColumnPosition();
+ int columnIndex = getColumnIndexByPosition(columnPosition);
if (isFilterRowComboBoxCellEditor(columnPosition)) {
this.filterRowDataLayer.setDataValueByPosition(
columnPosition,
0,
- getComboBoxDataProvider().getValues(columnPosition, 0));
+ getComboBoxDataProvider().getValues(columnIndex, 0));
handled = true;
}
} else if (command instanceof ClearAllFiltersCommand) {

Back to the top