explicitly name functions in strings

This commit is contained in:
Craig Raw 2022-07-28 16:09:10 +02:00
parent 28722d385b
commit b4af3586dc
2 changed files with 13 additions and 3 deletions

View file

@ -1,5 +1,15 @@
package com.sparrowwallet.sparrow.wallet;
public enum Function {
TRANSACTIONS, SEND, RECEIVE, ADDRESSES, UTXOS, SETTINGS, LOCK;
TRANSACTIONS("transactions"), SEND("send"), RECEIVE("receive"), ADDRESSES("addresses"), UTXOS("utxos"), SETTINGS("settings"), LOCK("lock");
private final String name;
Function(String name) {
this.name = name;
}
public String getName() {
return name;
}
}

View file

@ -90,9 +90,9 @@ public class WalletController extends WalletFormController implements Initializa
try {
if(!existing) {
URL url = AppServices.class.getResource("wallet/" + function.toString().toLowerCase() + ".fxml");
URL url = AppServices.class.getResource("wallet/" + function.getName() + ".fxml");
if(url == null) {
url = AppServices.class.getResource("wallet" + File.separator + function.toString().toLowerCase() + ".fxml");
url = AppServices.class.getResource("wallet" + File.separator + function.getName() + ".fxml");
}
if(url == null) {
throw new IllegalStateException("Cannot find wallet/" + function.toString().toLowerCase() + ".fxml");