Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDirk Fauth2023-02-22 12:44:57 +0000
committerDirk Fauth2023-02-22 12:44:57 +0000
commite8a4a549ca4192d07ea599a47a27182b2289b865 (patch)
treee9e982f8fce0aad25ce48eb52d05ebc7488804b9
parentc5a73bcf731e63b71eeaeb4e71e2a99ff0ff0085 (diff)
downloadorg.eclipse.nebula.widgets.nattable-e8a4a549ca4192d07ea599a47a27182b2289b865.tar.gz
org.eclipse.nebula.widgets.nattable-e8a4a549ca4192d07ea599a47a27182b2289b865.tar.xz
org.eclipse.nebula.widgets.nattable-e8a4a549ca4192d07ea599a47a27182b2289b865.zip
Bug 581572 - Reordering collapsed groups modify group
Signed-off-by: Dirk Fauth <dirk.fauth@googlemail.com> Change-Id: Ifc4011d1aee3112fd1f365f7d7628bf9b7ce875a
-rw-r--r--org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/group/performance/ColumnGroupHeaderLayer.java17
-rw-r--r--org.eclipse.nebula.widgets.nattable.core/src/org/eclipse/nebula/widgets/nattable/group/performance/RowGroupHeaderLayer.java15
2 files changed, 32 insertions, 0 deletions
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 4e2a67fb..36d2b651 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
@@ -1021,6 +1021,7 @@ public class ColumnGroupHeaderLayer extends AbstractLayerTransform {
ILayerCell cell = this.underlyingLayer.getCellByPosition(columnPosition, 0);
if (cell != null) {
cell = new TransformedLayerCell(cell) {
+
@Override
public ILayer getLayer() {
return ColumnGroupHeaderLayer.this;
@@ -1040,6 +1041,7 @@ public class ColumnGroupHeaderLayer extends AbstractLayerTransform {
public int getOriginRowPosition() {
return rowPosition - (span - 1);
}
+
};
}
return cell;
@@ -2269,6 +2271,21 @@ public class ColumnGroupHeaderLayer extends AbstractLayerTransform {
if (groupModel != null) {
Group group = groupModel.getGroupByPosition(fromColumnPosition);
if (group != null) {
+
+ if (group.isCollapsed()) {
+ int groupStart = group.getVisibleStartPosition();
+ int groupEnd = group.getVisibleStartPosition() + group.getVisibleSpan();
+ if ((fromColumnPosition >= groupStart && fromColumnPosition <= groupEnd)
+ && toColumnPosition == groupStart || toColumnPosition == groupEnd) {
+ // nothing to reorder as the reorder operation tries to
+ // reorder a collapsed group to basically the same
+ // position as before, either to the left or right. Need
+ // to avoid the reorder operation as otherwise further
+ // event handlers would modify the group
+ return true;
+ }
+ }
+
int toPosition = toColumnPosition;
// we need to convert and fire the command on the underlying
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 390f58e5..07fde988 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
@@ -2260,6 +2260,21 @@ public class RowGroupHeaderLayer extends AbstractLayerTransform {
if (groupModel != null) {
Group group = groupModel.getGroupByPosition(fromRowPosition);
if (group != null) {
+
+ if (group.isCollapsed()) {
+ int groupStart = group.getVisibleStartPosition();
+ int groupEnd = group.getVisibleStartPosition() + group.getVisibleSpan();
+ if ((fromRowPosition >= groupStart && fromRowPosition <= groupEnd)
+ && toRowPosition == groupStart || toRowPosition == groupEnd) {
+ // nothing to reorder as the reorder operation tries to
+ // reorder a collapsed group to basically the same
+ // position as before, either to the left or right. Need
+ // to avoid the reorder operation as otherwise further
+ // event handlers would modify the group
+ return true;
+ }
+ }
+
int toPosition = toRowPosition;
// we need to convert and fire the command on the underlying

Back to the top