mirror of
https://github.com/sparrowwallet/drongo.git
synced 2025-11-05 11:56:38 +00:00
store treetable column sort on adjustment, and restore on wallet load
This commit is contained in:
parent
1805aeb374
commit
b2c362d5a7
2 changed files with 31 additions and 1 deletions
|
|
@ -0,0 +1,5 @@
|
|||
package com.sparrowwallet.drongo.wallet;
|
||||
|
||||
public enum SortDirection {
|
||||
ASCENDING, DESCENDING
|
||||
}
|
||||
|
|
@ -3,10 +3,21 @@ package com.sparrowwallet.drongo.wallet;
|
|||
public class WalletTable extends Persistable {
|
||||
private final TableType tableType;
|
||||
private final Double[] widths;
|
||||
private final int sortColumn;
|
||||
private final SortDirection sortDirection;
|
||||
|
||||
public WalletTable(TableType tableType, Double[] widths) {
|
||||
public WalletTable(TableType tableType, Double[] widths, int sortColumn, SortDirection sortDirection) {
|
||||
this.tableType = tableType;
|
||||
this.widths = widths;
|
||||
this.sortColumn = sortColumn;
|
||||
this.sortDirection = sortDirection;
|
||||
}
|
||||
|
||||
public WalletTable(TableType tableType, Double[] widths, Sort sort) {
|
||||
this.tableType = tableType;
|
||||
this.widths = widths;
|
||||
this.sortColumn = sort.sortColumn;
|
||||
this.sortDirection = sort.sortDirection;
|
||||
}
|
||||
|
||||
public TableType getTableType() {
|
||||
|
|
@ -17,6 +28,18 @@ public class WalletTable extends Persistable {
|
|||
return widths;
|
||||
}
|
||||
|
||||
public int getSortColumn() {
|
||||
return sortColumn;
|
||||
}
|
||||
|
||||
public SortDirection getSortDirection() {
|
||||
return sortDirection;
|
||||
}
|
||||
|
||||
public Sort getSort() {
|
||||
return new Sort(sortColumn, sortDirection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean equals(Object o) {
|
||||
if(this == o) {
|
||||
|
|
@ -33,4 +56,6 @@ public class WalletTable extends Persistable {
|
|||
public int hashCode() {
|
||||
return tableType.hashCode();
|
||||
}
|
||||
|
||||
public record Sort(int sortColumn, SortDirection sortDirection) {}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue