mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 03:08:02 +00:00
Fix bug with sort priorities getting messed up
This commit is contained in:
@@ -305,7 +305,7 @@ public final class ItemListView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processMouseEvent(MouseEvent e) {
|
public void processMouseEvent(MouseEvent e) {
|
||||||
Point p = e.getPoint();
|
Point p = e.getPoint();
|
||||||
int row = rowAtPoint(p);
|
int row = rowAtPoint(p);
|
||||||
@@ -618,26 +618,18 @@ public final class ItemListView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
this.colsToSort.add(0, (TableColumnInfo<InventoryItem>) col0);
|
this.colsToSort.add(0, (TableColumnInfo<InventoryItem>) col0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Found at top level, should invert
|
if (colsToSort.size() > 0 && colsToSort.get(0).equals(col0)) { //if column already at top level, just invert
|
||||||
if (colsToSort.size() > 0 && colsToSort.get(0).equals(col0)) {
|
|
||||||
col0.setSortPriority(1);
|
col0.setSortPriority(1);
|
||||||
col0.setSortState(col0.getSortState() == SortState.ASC
|
col0.setSortState(col0.getSortState() == SortState.ASC ? SortState.DESC : SortState.ASC);
|
||||||
? SortState.DESC : SortState.ASC);
|
|
||||||
}
|
}
|
||||||
// Found somewhere: move down others, this one to top.
|
else { //otherwise move column to top level and move others down
|
||||||
else if (colsToSort.contains(col0)) {
|
|
||||||
col0.setSortState(col0.getDefaultSortState());
|
|
||||||
this.colsToSort.remove(col0);
|
this.colsToSort.remove(col0);
|
||||||
this.colsToSort.add(0, (TableColumnInfo<InventoryItem>) col0);
|
|
||||||
}
|
|
||||||
// No column in list; add directly.
|
|
||||||
else {
|
|
||||||
col0.setSortPriority(1);
|
col0.setSortPriority(1);
|
||||||
col0.setSortState(col0.getDefaultSortState());
|
col0.setSortState(col0.getDefaultSortState());
|
||||||
this.colsToSort.add(0, (TableColumnInfo<InventoryItem>) col0);
|
this.colsToSort.add(0, (TableColumnInfo<InventoryItem>) col0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decrement sort priority on remaining columns
|
//decrement sort priority on remaining columns
|
||||||
for (int i = 1; i < maxSortDepth; i++) {
|
for (int i = 1; i < maxSortDepth; i++) {
|
||||||
if (colsToSort.size() == i) { break; }
|
if (colsToSort.size() == i) { break; }
|
||||||
|
|
||||||
@@ -647,7 +639,7 @@ public final class ItemListView<T extends InventoryItem> extends ItemView<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unset and remove boundary columns.
|
//unset and remove boundary columns.
|
||||||
if (this.colsToSort.size() > maxSortDepth) {
|
if (this.colsToSort.size() > maxSortDepth) {
|
||||||
this.colsToSort.get(maxSortDepth).setSortState(SortState.NONE);
|
this.colsToSort.get(maxSortDepth).setSortState(SortState.NONE);
|
||||||
this.colsToSort.get(maxSortDepth).setSortPriority(0);
|
this.colsToSort.get(maxSortDepth).setSortPriority(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user