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
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 c6cd0d9..d291674 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.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.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 @@
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 d69e3bf..54038f3 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 @@
// 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 @@
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) {