diff options
| author | Dirk Fauth | 2023-02-16 07:46:34 +0000 |
|---|---|---|
| committer | Dirk Fauth | 2023-02-17 10:27:24 +0000 |
| commit | 15edf08598338593e94604fcc451a79e12c21c17 (patch) | |
| tree | e181b2ee4acc5a498426553f1f46ffe4a22d5c2a | |
| parent | a6b52851cddf12bce8ca8c36f785e02fcd711556 (diff) | |
| download | org.eclipse.nebula.widgets.nattable-15edf08598338593e94604fcc451a79e12c21c17.tar.gz org.eclipse.nebula.widgets.nattable-15edf08598338593e94604fcc451a79e12c21c17.tar.xz org.eclipse.nebula.widgets.nattable-15edf08598338593e94604fcc451a79e12c21c17.zip | |
Bug 581534 - Performance grouping: incorrect group states with freeze
Signed-off-by: Dirk Fauth <dirk.fauth@googlemail.com>
Change-Id: I85efba43e5e648727b6dbbb1707fd7db0b91960b
8 files changed, 213 insertions, 42 deletions
diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/freeze/CompositeFreezeLayer.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/freeze/CompositeFreezeLayer.java index 3655bfc5..0b4546a8 100644 --- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/freeze/CompositeFreezeLayer.java +++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/freeze/CompositeFreezeLayer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2023 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -27,6 +27,8 @@ import org.eclipse.nebula.widgets.nattable.group.command.ViewportSelectRowGroupC import org.eclipse.nebula.widgets.nattable.layer.CompositeLayer; import org.eclipse.nebula.widgets.nattable.layer.ILayer; import org.eclipse.nebula.widgets.nattable.layer.IUniqueIndexLayer; +import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell; +import org.eclipse.nebula.widgets.nattable.layer.cell.LayerCell; import org.eclipse.nebula.widgets.nattable.layer.event.ColumnStructuralChangeEvent; import org.eclipse.nebula.widgets.nattable.layer.event.ILayerEvent; import org.eclipse.nebula.widgets.nattable.layer.event.RowStructuralChangeEvent; @@ -193,6 +195,40 @@ public class CompositeFreezeLayer extends CompositeLayer implements IUniqueIndex } /** + * Modifies a column spanned cell in case the spanned cell is in the frozen + * area but the origin column is not visible as the frozen state was created + * in scrolled state. + * + * @param cell + * The cell to check and modify. + * @return The given {@link ILayerCell} or a modified one in case it needs + * to be updated. + * + * @since 2.1 + */ + public ILayerCell modifyColumnSpanLayerCell(ILayerCell cell) { + int startColumn = cell.getOriginColumnPosition(); + int endColumn = cell.getOriginColumnPosition() + cell.getColumnSpan(); + int startColumnLayout = getLayoutXByColumnPosition(startColumn); + int endColumnLayout = getLayoutXByColumnPosition(endColumn); + + if (startColumnLayout > endColumnLayout || (startColumn < 0 && endColumn < 0)) { + int columnSpan = cell.getColumnSpan(); + columnSpan -= this.freezeLayer.getTopLeftPosition().columnPosition; + return new LayerCell( + cell.getLayer(), + 0, + cell.getOriginRowPosition(), + cell.getColumnPosition(), + cell.getRowPosition(), + columnSpan, + cell.getRowSpan()); + } + + return cell; + } + + /** * This method is used to determine the bounds of a cell with column span in * case of an active freeze. This is needed because column positions can be * ambiguous if the start column of a spanned cell is moved below the frozen @@ -215,8 +251,21 @@ public class CompositeFreezeLayer extends CompositeLayer implements IUniqueIndex int startColumnLayout = getLayoutXByColumnPosition(startColumn); int endColumnLayout = getLayoutXByColumnPosition(endColumn); + if (startColumnLayout > endColumnLayout && startColumn < 0) { + startColumnLayout = endColumnLayout; + startColumn = 0; + } + int start = startColumn; - int end = isFrozen() && endColumnLayout == 1 ? endColumn - this.viewportLayer.getScrollableLayer().getColumnPositionByX(this.viewportLayer.getOrigin().getX()) : endColumn; + int end = endColumn; + if (isFrozen() && endColumnLayout == 1) { + int scrollAdjust = 0; + if (this.freezeLayer.getTopLeftPosition().columnPosition >= 0) { + scrollAdjust = this.freezeLayer.getUnderlyingLayerByPosition(0, 0).getStartXOfColumnPosition(this.freezeLayer.getTopLeftPosition().columnPosition); + } + end = endColumn - this.viewportLayer.getScrollableLayer().getColumnPositionByX(this.viewportLayer.getOrigin().getX() - scrollAdjust); + } + ILayer startLayer = null; int startX = 0; @@ -226,15 +275,15 @@ public class CompositeFreezeLayer extends CompositeLayer implements IUniqueIndex // position is, we use the same layout for calculating start/end if (endColumnLayout == 0 || startColumn == columnPosition) { - startX = getStartXOfColumnPosition(startColumn); + startX = getStartXOfColumnPosition(startColumnLayout, startColumn); int column = startColumn; for (; column <= endColumn; column++) { width += getColumnWidthByPosition(column); } } else { startLayer = getChildLayerByLayoutCoordinate(endColumnLayout, 1); - start = start - this.viewportLayer.getMinimumOriginColumnPosition(); - end = endColumn - this.viewportLayer.getMinimumOriginColumnPosition(); + start = start - this.viewportLayer.getMinimumOriginColumnPosition() + this.freezeLayer.getTopLeftPosition().columnPosition; + end = endColumn - this.viewportLayer.getMinimumOriginColumnPosition() + this.freezeLayer.getTopLeftPosition().columnPosition; startX = this.freezeLayer.getWidth() + startLayer.getStartXOfColumnPosition(start); int column = start; for (; column <= end; column++) { @@ -258,6 +307,58 @@ public class CompositeFreezeLayer extends CompositeLayer implements IUniqueIndex } /** + * Specialization of {@link #getStartXOfColumnPosition(int)} that avoids + * resolving the child layer in the composition structure. + * + * @param layoutX + * The x position of the layer in the composition structure + * (either frozen area or non-frozen area). + * @param columnPosition + * The column position in the layer. + * @return The x offset of the column in the specified layer in the + * composition structure, or -1. + */ + private int getStartXOfColumnPosition(int layoutX, int columnPosition) { + ILayer childLayer = this.getChildLayerLayout()[layoutX][0]; + int childColumnPosition = columnPosition - getColumnPositionOffset(layoutX); + return getWidthOffset(layoutX) + childLayer.getStartXOfColumnPosition(childColumnPosition); + } + + /** + * Modifies a row spanned cell in case the spanned cell is in the frozen + * area but the origin row is not visible as the frozen state was created in + * scrolled state. + * + * @param cell + * The cell to check and modify. + * @return The given {@link ILayerCell} or a modified one in case it needs + * to be updated. + * + * @since 2.1 + */ + public ILayerCell modifyRowSpanLayerCell(ILayerCell cell) { + int startRow = cell.getOriginRowPosition(); + int endRow = cell.getOriginRowPosition() + cell.getRowSpan(); + int startRowLayout = getLayoutYByRowPosition(startRow); + int endRowLayout = getLayoutYByRowPosition(endRow); + + if (startRowLayout > endRowLayout || (startRow < 0 && endRow < 0)) { + int rowSpan = cell.getRowSpan(); + rowSpan -= this.freezeLayer.getTopLeftPosition().rowPosition; + return new LayerCell( + cell.getLayer(), + cell.getOriginColumnPosition(), + 0, + cell.getColumnPosition(), + cell.getRowPosition(), + cell.getColumnSpan(), + rowSpan); + } + + return cell; + } + + /** * This method is used to determine the bounds of a cell with row span in * case of an active freeze. This is needed because row positions can be * ambiguous if the start row of a spanned cell is moved below the frozen @@ -280,8 +381,21 @@ public class CompositeFreezeLayer extends CompositeLayer implements IUniqueIndex int startRowLayout = getLayoutYByRowPosition(startRow); int endRowLayout = getLayoutYByRowPosition(endRow); + if (startRowLayout > endRowLayout && startRow < 0) { + startRowLayout = endRowLayout; + startRow = 0; + } + int start = startRow; - int end = isFrozen() && endRowLayout == 1 ? endRow - this.viewportLayer.getScrollableLayer().getRowPositionByY(this.viewportLayer.getOrigin().getY()) : endRow; + int end = endRow; + if (isFrozen() && endRowLayout == 1) { + int scrollAdjust = 0; + if (this.freezeLayer.getTopLeftPosition().rowPosition >= 0) { + scrollAdjust = this.freezeLayer.getUnderlyingLayerByPosition(0, 0).getStartYOfRowPosition(this.freezeLayer.getTopLeftPosition().rowPosition); + } + end = endRow - this.viewportLayer.getScrollableLayer().getRowPositionByY(this.viewportLayer.getOrigin().getY() - scrollAdjust); + } + ILayer startLayer = null; int startY = 0; @@ -291,15 +405,15 @@ public class CompositeFreezeLayer extends CompositeLayer implements IUniqueIndex // position is, we use the same layout for calculating start/end if (endRowLayout == 0 || startRow == rowPosition) { - startY = getStartYOfRowPosition(startRow); + startY = getStartYOfRowPosition(startRowLayout, startRow); int row = startRow; for (; row <= endRow; row++) { height += getRowHeightByPosition(row); } } else { startLayer = getChildLayerByLayoutCoordinate(1, endRowLayout); - start = start - this.viewportLayer.getMinimumOriginRowPosition(); - end = endRow - this.viewportLayer.getMinimumOriginRowPosition(); + start = start - this.viewportLayer.getMinimumOriginRowPosition() + this.freezeLayer.getTopLeftPosition().rowPosition; + end = endRow - this.viewportLayer.getMinimumOriginRowPosition() + this.freezeLayer.getTopLeftPosition().rowPosition; startY = this.freezeLayer.getHeight() + startLayer.getStartYOfRowPosition(start); int row = start; for (; row <= end; row++) { @@ -322,6 +436,24 @@ public class CompositeFreezeLayer extends CompositeLayer implements IUniqueIndex return new int[] { startY, height }; } + /** + * Specialization of {@link #getStartYOfRowPosition(int)} that avoids + * resolving the child layer in the composition structure. + * + * @param layoutY + * The y position of the layer in the composition structure + * (either frozen area or non-frozen area). + * @param rowPosition + * The row position in the layer. + * @return The y offset of the row in the specified layer in the composition + * structure, or -1. + */ + private int getStartYOfRowPosition(int layoutY, int rowPosition) { + ILayer childLayer = this.getChildLayerLayout()[0][layoutY]; + int childRowPosition = rowPosition - getRowPositionOffset(layoutY); + return getHeightOffset(layoutY) + childLayer.getStartYOfRowPosition(childRowPosition); + } + // Persistence @Override diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/group/performance/ColumnGroupHeaderLayer.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/group/performance/ColumnGroupHeaderLayer.java index b3e66743..4e2a67fb 100644 --- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/group/performance/ColumnGroupHeaderLayer.java +++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/group/performance/ColumnGroupHeaderLayer.java @@ -909,7 +909,7 @@ public class ColumnGroupHeaderLayer extends AbstractLayerTransform { } } - return new LayerCell( + ILayerCell cell = new LayerCell( this, start, row, @@ -917,6 +917,12 @@ public class ColumnGroupHeaderLayer extends AbstractLayerTransform { rowPosition, columnSpan, rowSpan); + + if (this.compositeFreezeLayer != null) { + cell = this.compositeFreezeLayer.modifyColumnSpanLayerCell(cell); + } + + return cell; } else { // for the level there is no group, check if the level below has // a group to calculate the row spanning diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/group/performance/RowGroupHeaderLayer.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/group/performance/RowGroupHeaderLayer.java index 09bd6a1f..390f58e5 100644 --- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/group/performance/RowGroupHeaderLayer.java +++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/group/performance/RowGroupHeaderLayer.java @@ -902,7 +902,7 @@ public class RowGroupHeaderLayer extends AbstractLayerTransform { } } - return new LayerCell( + ILayerCell cell = new LayerCell( this, column, start, @@ -910,6 +910,12 @@ public class RowGroupHeaderLayer extends AbstractLayerTransform { rowPosition, columnSpan, rowSpan); + + if (this.compositeFreezeLayer != null) { + cell = this.compositeFreezeLayer.modifyRowSpanLayerCell(cell); + } + + return cell; } else { // for the level there is no group, check if the level below has // a group to calculate the row spanning diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/hideshow/AbstractColumnHideShowLayer.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/hideshow/AbstractColumnHideShowLayer.java index a0c49f3b..af339312 100644 --- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/hideshow/AbstractColumnHideShowLayer.java +++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/hideshow/AbstractColumnHideShowLayer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2023 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -20,6 +20,7 @@ import java.util.HashSet; import org.eclipse.collections.api.map.primitive.IntIntMap; import org.eclipse.collections.api.map.primitive.MutableIntIntMap; import org.eclipse.collections.impl.factory.primitive.IntIntMaps; +import org.eclipse.nebula.widgets.nattable.command.ILayerCommand; import org.eclipse.nebula.widgets.nattable.coordinate.PositionUtil; import org.eclipse.nebula.widgets.nattable.coordinate.Range; import org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform; @@ -28,6 +29,7 @@ import org.eclipse.nebula.widgets.nattable.layer.IUniqueIndexLayer; import org.eclipse.nebula.widgets.nattable.layer.LayerUtil; import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell; import org.eclipse.nebula.widgets.nattable.layer.cell.SpanningLayerCell; +import org.eclipse.nebula.widgets.nattable.layer.command.ConfigureScalingCommand; import org.eclipse.nebula.widgets.nattable.layer.event.ILayerEvent; import org.eclipse.nebula.widgets.nattable.layer.event.IStructuralChangeEvent; import org.eclipse.nebula.widgets.nattable.layer.event.VisualRefreshEvent; @@ -112,6 +114,14 @@ public abstract class AbstractColumnHideShowLayer extends AbstractLayerTransform super.handleLayerEvent(event); } + @Override + public boolean doCommand(ILayerCommand command) { + if (command instanceof ConfigureScalingCommand) { + invalidateCache(); + } + return super.doCommand(command); + } + // Horizontal features // Columns diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/hideshow/AbstractRowHideShowLayer.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/hideshow/AbstractRowHideShowLayer.java index b8f88341..2a0ba8cb 100644 --- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/hideshow/AbstractRowHideShowLayer.java +++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/hideshow/AbstractRowHideShowLayer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2023 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -20,6 +20,7 @@ import java.util.HashSet; import org.eclipse.collections.api.map.primitive.IntIntMap; import org.eclipse.collections.api.map.primitive.MutableIntIntMap; import org.eclipse.collections.impl.factory.primitive.IntIntMaps; +import org.eclipse.nebula.widgets.nattable.command.ILayerCommand; import org.eclipse.nebula.widgets.nattable.coordinate.PositionUtil; import org.eclipse.nebula.widgets.nattable.coordinate.Range; import org.eclipse.nebula.widgets.nattable.layer.AbstractLayerTransform; @@ -28,6 +29,7 @@ import org.eclipse.nebula.widgets.nattable.layer.IUniqueIndexLayer; import org.eclipse.nebula.widgets.nattable.layer.LayerUtil; import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell; import org.eclipse.nebula.widgets.nattable.layer.cell.SpanningLayerCell; +import org.eclipse.nebula.widgets.nattable.layer.command.ConfigureScalingCommand; import org.eclipse.nebula.widgets.nattable.layer.event.ILayerEvent; import org.eclipse.nebula.widgets.nattable.layer.event.IStructuralChangeEvent; import org.eclipse.nebula.widgets.nattable.layer.event.VisualRefreshEvent; @@ -113,6 +115,14 @@ public abstract class AbstractRowHideShowLayer extends AbstractLayerTransform im super.handleLayerEvent(event); } + @Override + public boolean doCommand(ILayerCommand command) { + if (command instanceof ConfigureScalingCommand) { + invalidateCache(); + } + return super.doCommand(command); + } + // Horizontal features // Columns diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/layer/cell/AbstractLayerCell.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/layer/cell/AbstractLayerCell.java index 4c4f6c55..ec605a34 100644 --- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/layer/cell/AbstractLayerCell.java +++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/layer/cell/AbstractLayerCell.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Edwin Park and others. + * Copyright (c) 2012, 2023 Edwin Park and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -39,11 +39,8 @@ public abstract class AbstractLayerCell implements ILayerCell { public DisplayMode getDisplayMode() { if (!this.isDisplayModeCached) { this.isDisplayModeCached = true; - - this.displayMode = getLayer().getDisplayModeByPosition( - getColumnPosition(), getRowPosition()); + this.displayMode = getLayer().getDisplayModeByPosition(getColumnPosition(), getRowPosition()); } - return this.displayMode; } @@ -51,11 +48,8 @@ public abstract class AbstractLayerCell implements ILayerCell { public LabelStack getConfigLabels() { if (!this.isConfigLabelsCached) { this.isConfigLabelsCached = true; - - this.configLabels = getLayer().getConfigLabelsByPosition( - getColumnPosition(), getRowPosition()); + this.configLabels = getLayer().getConfigLabelsByPosition(getColumnPosition(), getRowPosition()); } - return this.configLabels; } @@ -63,11 +57,8 @@ public abstract class AbstractLayerCell implements ILayerCell { public Object getDataValue() { if (!this.isDataValueCached) { this.isDataValueCached = true; - - this.dataValue = getLayer().getDataValueByPosition(getColumnPosition(), - getRowPosition()); + this.dataValue = getLayer().getDataValueByPosition(getColumnPosition(), getRowPosition()); } - return this.dataValue; } @@ -76,11 +67,8 @@ public abstract class AbstractLayerCell implements ILayerCell { if (!this.isBoundsCached) { this.isBoundsCached = true; - this.bounds = getLayer().getBoundsByPosition(getColumnPosition(), - getRowPosition()); + this.bounds = getLayer().getBoundsByPosition(getColumnPosition(), getRowPosition()); } - return this.bounds; } - -} +}
\ No newline at end of file diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/layer/cell/LayerCell.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/layer/cell/LayerCell.java index b36ec1a4..d4595556 100644 --- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/layer/cell/LayerCell.java +++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/layer/cell/LayerCell.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2020 Original authors and others. + * Copyright (c) 2012, 2023 Original authors and others. * * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 @@ -27,20 +27,23 @@ public class LayerCell extends AbstractLayerCell { private int columnSpan; private int rowSpan; - public LayerCell(ILayer layer, int columnPosition, int rowPosition, - DataCell cell) { - this(layer, cell.columnPosition, cell.rowPosition, columnPosition, - rowPosition, cell.columnSpan, cell.rowSpan); + public LayerCell(ILayer layer, int columnPosition, int rowPosition, DataCell cell) { + this(layer, cell.columnPosition, cell.rowPosition, columnPosition, rowPosition, cell.columnSpan, cell.rowSpan); } public LayerCell(ILayer layer, int columnPosition, int rowPosition) { - this(layer, columnPosition, rowPosition, columnPosition, rowPosition, - 1, 1); + this(layer, columnPosition, rowPosition, columnPosition, rowPosition, 1, 1); } - public LayerCell(ILayer layer, int originColumnPosition, - int originRowPosition, int columnPosition, int rowPosition, - int columnSpan, int rowSpan) { + public LayerCell( + ILayer layer, + int originColumnPosition, + int originRowPosition, + int columnPosition, + int rowPosition, + int columnSpan, + int rowSpan) { + this.layer = layer; this.originColumnPosition = originColumnPosition; @@ -126,6 +129,15 @@ public class LayerCell extends AbstractLayerCell { return false; if (this.rowSpan != other.rowSpan) return false; + + Object thisData = this.getDataValue(); + Object otherData = other.getDataValue(); + if ((thisData != null && otherData == null) + || (thisData == null && otherData != null) + || (thisData != null && !thisData.equals(otherData))) { + return false; + } + return true; } @@ -138,6 +150,7 @@ public class LayerCell extends AbstractLayerCell { result = prime * result + this.originColumnPosition; result = prime * result + this.originRowPosition; result = prime * result + this.rowSpan; + result = prime * result + ((this.getDataValue() == null) ? 0 : this.getDataValue().hashCode()); return result; } diff --git a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/selection/SelectionLayer.java b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/selection/SelectionLayer.java index 37d1b275..e6a84e9a 100644 --- a/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/selection/SelectionLayer.java +++ b/org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/selection/SelectionLayer.java @@ -323,8 +323,14 @@ public class SelectionLayer extends AbstractIndexLayerTransform { Set<ILayerCell> selectedCells = new LinkedHashSet<>(); PositionCoordinate[] selectedCoords = getSelectedCellPositions(); + Set<MutableIntList> unique = new LinkedHashSet<>(); for (PositionCoordinate coord : selectedCoords) { - selectedCells.add(getCellByPosition(coord.columnPosition, coord.rowPosition)); + ILayerCell cell = getCellByPosition(coord.columnPosition, coord.rowPosition); + MutableIntList cellConfig = IntLists.mutable.of(cell.getOriginColumnPosition(), cell.getOriginRowPosition(), cell.getColumnSpan(), cell.getRowSpan()); + if (!unique.contains(cellConfig)) { + unique.add(cellConfig); + selectedCells.add(cell); + } } return selectedCells; |
