add wallet table to store layout settings

This commit is contained in:
Craig Raw 2025-01-28 10:32:57 +02:00
parent 378ab611f5
commit 1805aeb374
3 changed files with 50 additions and 0 deletions

View file

@ -0,0 +1,5 @@
package com.sparrowwallet.drongo.wallet;
public enum TableType {
TRANSACTIONS, UTXOS, RECEIVE_ADDRESSES, CHANGE_ADDRESSES, SEARCH_WALLET, WALLET_SUMMARY
}

View file

@ -41,6 +41,7 @@ public class Wallet extends Persistable implements Comparable<Wallet> {
private final Map<Sha256Hash, BlockTransaction> transactions = new HashMap<>();
private final Map<String, String> detachedLabels = new HashMap<>();
private WalletConfig walletConfig;
private final Map<TableType, WalletTable> walletTables = new HashMap<>();
private MixConfig mixConfig;
private final Map<Sha256Hash, UtxoMixData> utxoMixes = new HashMap<>();
private Integer storedBlockHeight;
@ -466,6 +467,14 @@ public class Wallet extends Persistable implements Comparable<Wallet> {
this.walletConfig = walletConfig;
}
public Map<TableType, WalletTable> getWalletTables() {
return walletTables;
}
public WalletTable getWalletTable(TableType tableType) {
return walletTables.get(tableType);
}
public MixConfig getMixConfig() {
return mixConfig;
}

View file

@ -0,0 +1,36 @@
package com.sparrowwallet.drongo.wallet;
public class WalletTable extends Persistable {
private final TableType tableType;
private final Double[] widths;
public WalletTable(TableType tableType, Double[] widths) {
this.tableType = tableType;
this.widths = widths;
}
public TableType getTableType() {
return tableType;
}
public Double[] getWidths() {
return widths;
}
@Override
public final boolean equals(Object o) {
if(this == o) {
return true;
}
if(!(o instanceof WalletTable that)) {
return false;
}
return tableType == that.tableType;
}
@Override
public int hashCode() {
return tableType.hashCode();
}
}