This repository was archived by the owner on Apr 4, 2025. It is now read-only.
File tree 1 file changed +35
-2
lines changed
edu.rice.cs.hpctree/src/edu/rice/cs/hpctree
1 file changed +35
-2
lines changed Original file line number Diff line number Diff line change @@ -512,8 +512,41 @@ private Point getMetricColumnSize() {
512
512
513
513
@ Override
514
514
public void refresh () {
515
- if (natTable != null ) {
516
- natTable .refresh ();
515
+ if (natTable == null ) {
516
+ return ;
517
+ }
518
+ final var reorderLayer = bodyLayerStack .getColumnReorderLayer ();
519
+ final var listOrder = reorderLayer .getColumnIndexOrder ();
520
+
521
+ natTable .refresh ();
522
+
523
+ var newListOrder = reorderLayer .getColumnIndexOrder ();
524
+ int diff = newListOrder .size () - listOrder .size ();
525
+
526
+ // Fix issue #214 (metric column position is accidentally reset)
527
+ //
528
+ // Let assume the tree column (index=0) is always constant
529
+ // This means we need to move the column to the original order
530
+ // plus the difference between old list and the new list
531
+ // If the list of the original one:
532
+ // [0, 3, 1, 4, 2]
533
+ // and the new reset list:
534
+ // [0, 1, 2, 3, 4, 5]
535
+ // so the new position should be:
536
+ // [0, 1, 4, 2, 5, 3]
537
+ //
538
+ // Since the tree column is static (always 0 position)
539
+ // then the index 3 (now its index is 4) has to move to position 2, and
540
+ // index 4 moves to position 3
541
+ for (int i =1 ; i <listOrder .size (); i ++) {
542
+ int order1 = listOrder .get (i );
543
+ int order2 = newListOrder .get (i + diff );
544
+
545
+ if (order2 == order1 + diff )
546
+ continue ;
547
+
548
+ reorderLayer .reorderColumnPosition (order1 + diff , order2 );
549
+ newListOrder = reorderLayer .getColumnIndexOrder ();
517
550
}
518
551
}
519
552
You can’t perform that action at this time.
0 commit comments