mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06:45 +00:00
force selection of a new configured server if currently configured server is deleted
This commit is contained in:
parent
3c2ef43526
commit
e23c1b3872
1 changed files with 8 additions and 0 deletions
|
@ -26,6 +26,7 @@ import java.util.stream.Collectors;
|
|||
public class ServerAliasDialog extends Dialog<Server> {
|
||||
private final ServerType serverType;
|
||||
private final TableView<ServerEntry> serverTable;
|
||||
private final Button closeButton;
|
||||
|
||||
public ServerAliasDialog(ServerType serverType) {
|
||||
this.serverType = serverType;
|
||||
|
@ -76,6 +77,7 @@ public class ServerAliasDialog extends Dialog<Server> {
|
|||
|
||||
Button selectButton = (Button)dialogPane.lookupButton(selectButtonType);
|
||||
Button deleteButton = (Button)dialogPane.lookupButton(deleteButtonType);
|
||||
closeButton = (Button)dialogPane.lookupButton(ButtonType.CLOSE);
|
||||
selectButton.setDefaultButton(true);
|
||||
selectButton.setDisable(true);
|
||||
deleteButton.setDisable(true);
|
||||
|
@ -112,8 +114,14 @@ public class ServerAliasDialog extends Dialog<Server> {
|
|||
serverTable.getItems().remove(serverEntry);
|
||||
if(serverType == ServerType.BITCOIN_CORE) {
|
||||
Config.get().removeRecentCoreServer(serverEntry.getServer());
|
||||
if(serverEntry.getServer().equals(Config.get().getCoreServer()) && !serverTable.getItems().isEmpty()) {
|
||||
closeButton.setDisable(true);
|
||||
}
|
||||
} else {
|
||||
Config.get().removeRecentElectrumServer(serverEntry.getServer());
|
||||
if(serverEntry.getServer().equals(Config.get().getElectrumServer()) && !serverTable.getItems().isEmpty()) {
|
||||
closeButton.setDisable(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue