mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-11-02 20:36:44 +00:00
refactor and rename launch and application classes
This commit is contained in:
parent
1e4c8c3837
commit
778564a954
18 changed files with 94 additions and 83 deletions
|
@ -110,7 +110,7 @@ dependencies {
|
||||||
|
|
||||||
application {
|
application {
|
||||||
mainModule = 'com.sparrowwallet.sparrow'
|
mainModule = 'com.sparrowwallet.sparrow'
|
||||||
mainClass = 'com.sparrowwallet.sparrow.MainApp'
|
mainClass = 'com.sparrowwallet.sparrow.SparrowWallet'
|
||||||
}
|
}
|
||||||
|
|
||||||
compileJava {
|
compileJava {
|
||||||
|
|
|
@ -12,7 +12,7 @@ public class AboutController {
|
||||||
private Label title;
|
private Label title;
|
||||||
|
|
||||||
public void initializeView() {
|
public void initializeView() {
|
||||||
title.setText(MainApp.APP_NAME + " " + MainApp.APP_VERSION + MainApp.APP_VERSION_SUFFIX);
|
title.setText(SparrowWallet.APP_NAME + " " + SparrowWallet.APP_VERSION + SparrowWallet.APP_VERSION_SUFFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStage(Stage stage) {
|
public void setStage(Stage stage) {
|
||||||
|
|
|
@ -35,7 +35,6 @@ import com.sparrowwallet.sparrow.transaction.TransactionView;
|
||||||
import com.sparrowwallet.sparrow.wallet.Entry;
|
import com.sparrowwallet.sparrow.wallet.Entry;
|
||||||
import com.sparrowwallet.sparrow.wallet.WalletController;
|
import com.sparrowwallet.sparrow.wallet.WalletController;
|
||||||
import com.sparrowwallet.sparrow.wallet.WalletForm;
|
import com.sparrowwallet.sparrow.wallet.WalletForm;
|
||||||
import com.sparrowwallet.sparrow.whirlpool.Whirlpool;
|
|
||||||
import de.codecentric.centerdevice.MenuToolkit;
|
import de.codecentric.centerdevice.MenuToolkit;
|
||||||
import javafx.animation.*;
|
import javafx.animation.*;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
|
@ -402,10 +401,10 @@ public class AppController implements Initializable {
|
||||||
MenuItem preferences = new MenuItem("Preferences...");
|
MenuItem preferences = new MenuItem("Preferences...");
|
||||||
preferences.setOnAction(this::openPreferences);
|
preferences.setOnAction(this::openPreferences);
|
||||||
preferences.setAccelerator(new KeyCodeCombination(KeyCode.COMMA, KeyCombination.META_DOWN));
|
preferences.setAccelerator(new KeyCodeCombination(KeyCode.COMMA, KeyCombination.META_DOWN));
|
||||||
Menu defaultApplicationMenu = new Menu("Apple", null, tk.createAboutMenuItem(MainApp.APP_NAME, getAboutStage()), new SeparatorMenuItem(),
|
Menu defaultApplicationMenu = new Menu("Apple", null, tk.createAboutMenuItem(SparrowWallet.APP_NAME, getAboutStage()), new SeparatorMenuItem(),
|
||||||
preferences, new SeparatorMenuItem(),
|
preferences, new SeparatorMenuItem(),
|
||||||
tk.createHideMenuItem(MainApp.APP_NAME), tk.createHideOthersMenuItem(), tk.createUnhideAllMenuItem(), new SeparatorMenuItem(),
|
tk.createHideMenuItem(SparrowWallet.APP_NAME), tk.createHideOthersMenuItem(), tk.createUnhideAllMenuItem(), new SeparatorMenuItem(),
|
||||||
tk.createQuitMenuItem(MainApp.APP_NAME));
|
tk.createQuitMenuItem(SparrowWallet.APP_NAME));
|
||||||
tk.setApplicationMenu(defaultApplicationMenu);
|
tk.setApplicationMenu(defaultApplicationMenu);
|
||||||
|
|
||||||
fileMenu.getItems().removeIf(item -> item.getStyleClass().contains("osxHide"));
|
fileMenu.getItems().removeIf(item -> item.getStyleClass().contains("osxHide"));
|
||||||
|
@ -465,7 +464,7 @@ public class AppController implements Initializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
Stage stage = new Stage(StageStyle.UNDECORATED);
|
Stage stage = new Stage(StageStyle.UNDECORATED);
|
||||||
stage.setTitle("About " + MainApp.APP_NAME);
|
stage.setTitle("About " + SparrowWallet.APP_NAME);
|
||||||
stage.initOwner(tabs.getScene().getWindow());
|
stage.initOwner(tabs.getScene().getWindow());
|
||||||
stage.initModality(Modality.WINDOW_MODAL);
|
stage.initModality(Modality.WINDOW_MODAL);
|
||||||
stage.setResizable(false);
|
stage.setResizable(false);
|
||||||
|
@ -1018,7 +1017,7 @@ public class AppController implements Initializable {
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
if(e instanceof IOException && e.getMessage().startsWith("The process cannot access the file because another process has locked")) {
|
if(e instanceof IOException && e.getMessage().startsWith("The process cannot access the file because another process has locked")) {
|
||||||
log.error("Error opening wallet", e);
|
log.error("Error opening wallet", e);
|
||||||
showErrorDialog("Error Opening Wallet", "The wallet file is locked. Is another instance of " + MainApp.APP_NAME + " already running?");
|
showErrorDialog("Error Opening Wallet", "The wallet file is locked. Is another instance of " + SparrowWallet.APP_NAME + " already running?");
|
||||||
} else if(!attemptImportWallet(file, null)) {
|
} else if(!attemptImportWallet(file, null)) {
|
||||||
log.error("Error opening wallet", e);
|
log.error("Error opening wallet", e);
|
||||||
showErrorDialog("Error Opening Wallet", e.getMessage() == null ? "Unsupported file format" : e.getMessage());
|
showErrorDialog("Error Opening Wallet", e.getMessage() == null ? "Unsupported file format" : e.getMessage());
|
||||||
|
|
|
@ -20,7 +20,6 @@ import com.sparrowwallet.drongo.protocol.ScriptType;
|
||||||
import com.sparrowwallet.drongo.protocol.Transaction;
|
import com.sparrowwallet.drongo.protocol.Transaction;
|
||||||
import com.sparrowwallet.drongo.psbt.PSBT;
|
import com.sparrowwallet.drongo.psbt.PSBT;
|
||||||
import com.sparrowwallet.drongo.uri.BitcoinURI;
|
import com.sparrowwallet.drongo.uri.BitcoinURI;
|
||||||
import com.sparrowwallet.sparrow.control.TextUtils;
|
|
||||||
import com.sparrowwallet.sparrow.control.TrayManager;
|
import com.sparrowwallet.sparrow.control.TrayManager;
|
||||||
import com.sparrowwallet.sparrow.event.*;
|
import com.sparrowwallet.sparrow.event.*;
|
||||||
import com.sparrowwallet.sparrow.io.*;
|
import com.sparrowwallet.sparrow.io.*;
|
||||||
|
@ -43,7 +42,6 @@ import javafx.scene.Parent;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.control.*;
|
import javafx.scene.control.*;
|
||||||
import javafx.scene.control.Dialog;
|
import javafx.scene.control.Dialog;
|
||||||
import javafx.scene.control.Label;
|
|
||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
import javafx.scene.image.ImageView;
|
import javafx.scene.image.ImageView;
|
||||||
import javafx.scene.input.KeyCode;
|
import javafx.scene.input.KeyCode;
|
||||||
|
@ -53,7 +51,6 @@ import javafx.stage.Stage;
|
||||||
import javafx.stage.Window;
|
import javafx.stage.Window;
|
||||||
import javafx.util.Duration;
|
import javafx.util.Duration;
|
||||||
import org.berndpruenster.netlayer.tor.Tor;
|
import org.berndpruenster.netlayer.tor.Tor;
|
||||||
import org.controlsfx.control.HyperlinkLabel;
|
|
||||||
import org.controlsfx.glyphfont.Glyph;
|
import org.controlsfx.glyphfont.Glyph;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -70,8 +67,6 @@ import java.time.ZoneId;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class AppServices {
|
public class AppServices {
|
||||||
|
@ -573,7 +568,7 @@ public class AppServices {
|
||||||
|
|
||||||
private static Image getWindowIcon() {
|
private static Image getWindowIcon() {
|
||||||
if(windowIcon == null) {
|
if(windowIcon == null) {
|
||||||
windowIcon = new Image(MainApp.class.getResourceAsStream("/image/sparrow-icon.png"));
|
windowIcon = new Image(SparrowWallet.class.getResourceAsStream("/image/sparrow-icon.png"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return windowIcon;
|
return windowIcon;
|
||||||
|
|
|
@ -21,16 +21,16 @@ import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class Sparrow extends Application {
|
public class SparrowDesktop extends Application {
|
||||||
private Stage mainStage;
|
private Stage mainStage;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() throws Exception {
|
public void init() throws Exception {
|
||||||
Thread.setDefaultUncaughtExceptionHandler((t, e) -> {
|
Thread.setDefaultUncaughtExceptionHandler((t, e) -> {
|
||||||
if(e instanceof IndexOutOfBoundsException && Arrays.stream(e.getStackTrace()).anyMatch(element -> element.getClassName().equals("javafx.scene.chart.BarChart"))) {
|
if(e instanceof IndexOutOfBoundsException && Arrays.stream(e.getStackTrace()).anyMatch(element -> element.getClassName().equals("javafx.scene.chart.BarChart"))) {
|
||||||
LoggerFactory.getLogger(MainApp.class).debug("Exception in thread \"" + t.getName() + "\"", e);;
|
LoggerFactory.getLogger(SparrowWallet.class).debug("Exception in thread \"" + t.getName() + "\"", e);;
|
||||||
} else {
|
} else {
|
||||||
LoggerFactory.getLogger(MainApp.class).error("Exception in thread \"" + t.getName() + "\"", e);
|
LoggerFactory.getLogger(SparrowWallet.class).error("Exception in thread \"" + t.getName() + "\"", e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
super.init();
|
super.init();
|
||||||
|
@ -114,9 +114,9 @@ public class Sparrow extends Application {
|
||||||
Config.get().setAppWidth(mainStage.getWidth());
|
Config.get().setAppWidth(mainStage.getWidth());
|
||||||
Config.get().setAppHeight(mainStage.getHeight());
|
Config.get().setAppHeight(mainStage.getHeight());
|
||||||
mainStage.close();
|
mainStage.close();
|
||||||
MainApp.SparrowInstance sparrowInstance = MainApp.getSparrowInstance();
|
SparrowWallet.Instance instance = SparrowWallet.getSparrowInstance();
|
||||||
if(sparrowInstance != null) {
|
if(instance != null) {
|
||||||
sparrowInstance.freeLock();
|
instance.freeLock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,9 +7,7 @@ import com.sparrowwallet.sparrow.io.Storage;
|
||||||
import com.sparrowwallet.sparrow.instance.InstanceException;
|
import com.sparrowwallet.sparrow.instance.InstanceException;
|
||||||
import com.sparrowwallet.sparrow.instance.InstanceList;
|
import com.sparrowwallet.sparrow.instance.InstanceList;
|
||||||
import com.sparrowwallet.sparrow.terminal.SparrowTerminal;
|
import com.sparrowwallet.sparrow.terminal.SparrowTerminal;
|
||||||
import com.sparrowwallet.sparrow.terminal.TerminalInteractionServices;
|
|
||||||
import com.sun.javafx.application.PlatformImpl;
|
import com.sun.javafx.application.PlatformImpl;
|
||||||
import javafx.application.Application;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.slf4j.bridge.SLF4JBridgeHandler;
|
import org.slf4j.bridge.SLF4JBridgeHandler;
|
||||||
|
@ -17,7 +15,7 @@ import org.slf4j.bridge.SLF4JBridgeHandler;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class MainApp {
|
public class SparrowWallet {
|
||||||
public static final String APP_ID = "com.sparrowwallet.sparrow";
|
public static final String APP_ID = "com.sparrowwallet.sparrow";
|
||||||
public static final String APP_NAME = "Sparrow";
|
public static final String APP_NAME = "Sparrow";
|
||||||
public static final String APP_VERSION = "1.6.6";
|
public static final String APP_VERSION = "1.6.6";
|
||||||
|
@ -25,7 +23,7 @@ public class MainApp {
|
||||||
public static final String APP_HOME_PROPERTY = "sparrow.home";
|
public static final String APP_HOME_PROPERTY = "sparrow.home";
|
||||||
public static final String NETWORK_ENV_PROPERTY = "SPARROW_NETWORK";
|
public static final String NETWORK_ENV_PROPERTY = "SPARROW_NETWORK";
|
||||||
|
|
||||||
private static SparrowInstance sparrowInstance;
|
private static Instance instance;
|
||||||
|
|
||||||
public static void main(String[] argv) {
|
public static void main(String[] argv) {
|
||||||
Args args = new Args();
|
Args args = new Args();
|
||||||
|
@ -72,17 +70,11 @@ public class MainApp {
|
||||||
getLogger().info("Using " + Network.get() + " configuration");
|
getLogger().info("Using " + Network.get() + " configuration");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(args.terminal) {
|
|
||||||
PlatformImpl.setTaskbarApplication(false);
|
|
||||||
Application.launch(SparrowTerminal.class, argv);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> fileUriArguments = jCommander.getUnknownOptions();
|
List<String> fileUriArguments = jCommander.getUnknownOptions();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
sparrowInstance = new SparrowInstance(fileUriArguments);
|
instance = new Instance(fileUriArguments);
|
||||||
sparrowInstance.acquireLock(); //If fileUriArguments is not empty, will exit app after sending fileUriArguments if lock cannot be acquired
|
instance.acquireLock(); //If fileUriArguments is not empty, will exit app after sending fileUriArguments if lock cannot be acquired
|
||||||
} catch(InstanceException e) {
|
} catch(InstanceException e) {
|
||||||
getLogger().error("Could not access application lock", e);
|
getLogger().error("Could not access application lock", e);
|
||||||
}
|
}
|
||||||
|
@ -93,22 +85,28 @@ public class MainApp {
|
||||||
|
|
||||||
SLF4JBridgeHandler.removeHandlersForRootLogger();
|
SLF4JBridgeHandler.removeHandlersForRootLogger();
|
||||||
SLF4JBridgeHandler.install();
|
SLF4JBridgeHandler.install();
|
||||||
com.sun.javafx.application.LauncherImpl.launchApplication(Sparrow.class, MainAppPreloader.class, argv);
|
|
||||||
|
if(args.terminal) {
|
||||||
|
PlatformImpl.setTaskbarApplication(false);
|
||||||
|
com.sun.javafx.application.LauncherImpl.launchApplication(SparrowTerminal.class, SparrowWalletPreloader.class, argv);
|
||||||
|
} else {
|
||||||
|
com.sun.javafx.application.LauncherImpl.launchApplication(SparrowDesktop.class, SparrowWalletPreloader.class, argv);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SparrowInstance getSparrowInstance() {
|
public static Instance getSparrowInstance() {
|
||||||
return sparrowInstance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Logger getLogger() {
|
private static Logger getLogger() {
|
||||||
return LoggerFactory.getLogger(MainApp.class);
|
return LoggerFactory.getLogger(SparrowWallet.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class SparrowInstance extends InstanceList {
|
public static class Instance extends InstanceList {
|
||||||
private final List<String> fileUriArguments;
|
private final List<String> fileUriArguments;
|
||||||
|
|
||||||
public SparrowInstance(List<String> fileUriArguments) {
|
public Instance(List<String> fileUriArguments) {
|
||||||
super(MainApp.APP_ID + "." + Network.get(), !fileUriArguments.isEmpty());
|
super(SparrowWallet.APP_ID + "." + Network.get(), !fileUriArguments.isEmpty());
|
||||||
this.fileUriArguments = fileUriArguments;
|
this.fileUriArguments = fileUriArguments;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package com.sparrowwallet.sparrow;
|
||||||
import javafx.application.Preloader;
|
import javafx.application.Preloader;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
public class MainAppPreloader extends Preloader {
|
public class SparrowWalletPreloader extends Preloader {
|
||||||
@Override
|
@Override
|
||||||
public void start(Stage stage) {
|
public void start(Stage stage) {
|
||||||
com.sun.glass.ui.Application.GetApplication().setName("Sparrow");
|
com.sun.glass.ui.Application.GetApplication().setName("Sparrow");
|
|
@ -7,7 +7,7 @@ import com.sparrowwallet.drongo.wallet.MnemonicException;
|
||||||
import com.sparrowwallet.drongo.wallet.StandardAccount;
|
import com.sparrowwallet.drongo.wallet.StandardAccount;
|
||||||
import com.sparrowwallet.drongo.wallet.Wallet;
|
import com.sparrowwallet.drongo.wallet.Wallet;
|
||||||
import com.sparrowwallet.sparrow.AppServices;
|
import com.sparrowwallet.sparrow.AppServices;
|
||||||
import com.sparrowwallet.sparrow.MainApp;
|
import com.sparrowwallet.sparrow.SparrowWallet;
|
||||||
import com.sparrowwallet.sparrow.soroban.Soroban;
|
import com.sparrowwallet.sparrow.soroban.Soroban;
|
||||||
import com.sparrowwallet.sparrow.whirlpool.Whirlpool;
|
import com.sparrowwallet.sparrow.whirlpool.Whirlpool;
|
||||||
import javafx.concurrent.Service;
|
import javafx.concurrent.Service;
|
||||||
|
@ -547,8 +547,8 @@ public class Storage {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static File getSparrowHome() {
|
public static File getSparrowHome() {
|
||||||
if(System.getProperty(MainApp.APP_HOME_PROPERTY) != null) {
|
if(System.getProperty(SparrowWallet.APP_HOME_PROPERTY) != null) {
|
||||||
return new File(System.getProperty(MainApp.APP_HOME_PROPERTY));
|
return new File(System.getProperty(SparrowWallet.APP_HOME_PROPERTY));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Platform.getCurrent() == Platform.WINDOWS) {
|
if(Platform.getCurrent() == Platform.WINDOWS) {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import com.sparrowwallet.drongo.address.InvalidAddressException;
|
||||||
import com.sparrowwallet.drongo.crypto.ECKey;
|
import com.sparrowwallet.drongo.crypto.ECKey;
|
||||||
import com.sparrowwallet.drongo.protocol.ScriptType;
|
import com.sparrowwallet.drongo.protocol.ScriptType;
|
||||||
import com.sparrowwallet.sparrow.AppServices;
|
import com.sparrowwallet.sparrow.AppServices;
|
||||||
import com.sparrowwallet.sparrow.MainApp;
|
import com.sparrowwallet.sparrow.SparrowWallet;
|
||||||
import com.sparrowwallet.sparrow.event.VersionUpdatedEvent;
|
import com.sparrowwallet.sparrow.event.VersionUpdatedEvent;
|
||||||
import javafx.concurrent.ScheduledService;
|
import javafx.concurrent.ScheduledService;
|
||||||
import javafx.concurrent.Task;
|
import javafx.concurrent.Task;
|
||||||
|
@ -91,10 +91,10 @@ public class VersionCheckService extends ScheduledService<VersionUpdatedEvent> {
|
||||||
private boolean isNewer(VersionCheck versionCheck) {
|
private boolean isNewer(VersionCheck versionCheck) {
|
||||||
try {
|
try {
|
||||||
Version versionCheckVersion = new Version(versionCheck.version);
|
Version versionCheckVersion = new Version(versionCheck.version);
|
||||||
Version currentVersion = new Version(MainApp.APP_VERSION);
|
Version currentVersion = new Version(SparrowWallet.APP_VERSION);
|
||||||
return versionCheckVersion.compareTo(currentVersion) > 0;
|
return versionCheckVersion.compareTo(currentVersion) > 0;
|
||||||
} catch(IllegalArgumentException e) {
|
} catch(IllegalArgumentException e) {
|
||||||
log.error("Invalid versions to compare: " + versionCheck.version + " to " + MainApp.APP_VERSION, e);
|
log.error("Invalid versions to compare: " + versionCheck.version + " to " + SparrowWallet.APP_VERSION, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -12,6 +12,7 @@ import com.sparrowwallet.sparrow.terminal.preferences.GeneralDialog;
|
||||||
import com.sparrowwallet.sparrow.terminal.preferences.ServerStatusDialog;
|
import com.sparrowwallet.sparrow.terminal.preferences.ServerStatusDialog;
|
||||||
import com.sparrowwallet.sparrow.terminal.preferences.ServerTypeDialog;
|
import com.sparrowwallet.sparrow.terminal.preferences.ServerTypeDialog;
|
||||||
import com.sparrowwallet.sparrow.terminal.wallet.LoadWallet;
|
import com.sparrowwallet.sparrow.terminal.wallet.LoadWallet;
|
||||||
|
import javafx.application.Platform;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -46,7 +47,7 @@ public class MasterActionListBox extends ActionListBox {
|
||||||
File file = openBuilder.build().showDialog(SparrowTerminal.get().getGui());
|
File file = openBuilder.build().showDialog(SparrowTerminal.get().getGui());
|
||||||
if(file != null) {
|
if(file != null) {
|
||||||
LoadWallet loadWallet = new LoadWallet(new Storage(file));
|
LoadWallet loadWallet = new LoadWallet(new Storage(file));
|
||||||
SparrowTerminal.get().getGui().getGUIThread().invokeLater(loadWallet);
|
SparrowTerminal.get().getGuiThread().invokeLater(loadWallet);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
builder.build().showDialog(SparrowTerminal.get().getGui());
|
builder.build().showDialog(SparrowTerminal.get().getGui());
|
||||||
|
@ -72,6 +73,6 @@ public class MasterActionListBox extends ActionListBox {
|
||||||
.showDialog(sparrowTerminal.getGui());
|
.showDialog(sparrowTerminal.getGui());
|
||||||
});
|
});
|
||||||
|
|
||||||
addItem("Quit", sparrowTerminal::stop);
|
addItem("Quit", () -> sparrowTerminal.getGui().getMainWindow().close());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.sparrowwallet.sparrow.terminal;
|
||||||
import com.googlecode.lanterna.TextColor;
|
import com.googlecode.lanterna.TextColor;
|
||||||
import com.googlecode.lanterna.gui2.DefaultWindowManager;
|
import com.googlecode.lanterna.gui2.DefaultWindowManager;
|
||||||
import com.googlecode.lanterna.gui2.EmptySpace;
|
import com.googlecode.lanterna.gui2.EmptySpace;
|
||||||
|
import com.googlecode.lanterna.gui2.TextGUIThread;
|
||||||
import com.googlecode.lanterna.screen.Screen;
|
import com.googlecode.lanterna.screen.Screen;
|
||||||
import com.googlecode.lanterna.screen.TerminalScreen;
|
import com.googlecode.lanterna.screen.TerminalScreen;
|
||||||
import com.googlecode.lanterna.terminal.DefaultTerminalFactory;
|
import com.googlecode.lanterna.terminal.DefaultTerminalFactory;
|
||||||
|
@ -10,6 +11,7 @@ import com.googlecode.lanterna.terminal.Terminal;
|
||||||
import com.sparrowwallet.drongo.wallet.Wallet;
|
import com.sparrowwallet.drongo.wallet.Wallet;
|
||||||
import com.sparrowwallet.sparrow.AppServices;
|
import com.sparrowwallet.sparrow.AppServices;
|
||||||
import com.sparrowwallet.sparrow.EventManager;
|
import com.sparrowwallet.sparrow.EventManager;
|
||||||
|
import com.sparrowwallet.sparrow.SparrowWallet;
|
||||||
import com.sparrowwallet.sparrow.terminal.wallet.WalletData;
|
import com.sparrowwallet.sparrow.terminal.wallet.WalletData;
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
|
@ -17,7 +19,6 @@ import javafx.stage.Stage;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -43,8 +44,12 @@ public class SparrowTerminal extends Application {
|
||||||
|
|
||||||
sparrowTerminal = this;
|
sparrowTerminal = this;
|
||||||
|
|
||||||
getScreen().startScreen();
|
try {
|
||||||
getGui().getMainWindow().waitUntilClosed();
|
getScreen().startScreen();
|
||||||
|
getGui().getMainWindow().waitUntilClosed();
|
||||||
|
} finally {
|
||||||
|
exit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -52,6 +57,19 @@ public class SparrowTerminal extends Application {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stop() throws Exception {
|
||||||
|
try {
|
||||||
|
AppServices.get().stop();
|
||||||
|
SparrowWallet.Instance instance = SparrowWallet.getSparrowInstance();
|
||||||
|
if(instance != null) {
|
||||||
|
instance.freeLock();
|
||||||
|
}
|
||||||
|
} catch(Exception e) {
|
||||||
|
log.error("Could not stop application", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Screen getScreen() {
|
public Screen getScreen() {
|
||||||
return screen;
|
return screen;
|
||||||
}
|
}
|
||||||
|
@ -60,20 +78,20 @@ public class SparrowTerminal extends Application {
|
||||||
return gui;
|
return gui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TextGUIThread getGuiThread() {
|
||||||
|
return gui.getGUIThread();
|
||||||
|
}
|
||||||
|
|
||||||
public Map<Wallet, WalletData> getWalletData() {
|
public Map<Wallet, WalletData> getWalletData() {
|
||||||
return walletData;
|
return walletData;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stop() {
|
public void exit() {
|
||||||
try {
|
try {
|
||||||
screen.stopScreen();
|
screen.stopScreen();
|
||||||
terminal.exitPrivateMode();
|
Platform.runLater(Platform::exit);
|
||||||
Platform.runLater(() -> {
|
|
||||||
AppServices.get().stop();
|
|
||||||
Platform.exit();
|
|
||||||
});
|
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
log.error("Could not stop terminal", e);
|
log.error("Could not stop terminal screen", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ public class TerminalInteractionServices implements InteractionServices {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public Optional<ButtonType> showAlert(String title, String content, Alert.AlertType alertType, Node graphic, ButtonType... buttons) {
|
public Optional<ButtonType> showAlert(String title, String content, Alert.AlertType alertType, Node graphic, ButtonType... buttons) {
|
||||||
if(Platform.isFxApplicationThread()) {
|
if(Platform.isFxApplicationThread()) {
|
||||||
SparrowTerminal.get().getGui().getGUIThread().invokeLater(() -> {
|
SparrowTerminal.get().getGuiThread().invokeLater(() -> {
|
||||||
Optional<ButtonType> optButtonType = showMessageDialog(title, content, buttons);
|
Optional<ButtonType> optButtonType = showMessageDialog(title, content, buttons);
|
||||||
Platform.runLater(() -> Platform.exitNestedEventLoop(alertShowing, optButtonType));
|
Platform.runLater(() -> Platform.exitNestedEventLoop(alertShowing, optButtonType));
|
||||||
});
|
});
|
||||||
|
@ -92,7 +92,7 @@ public class TerminalInteractionServices implements InteractionServices {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public Optional<String> requestPassphrase(String walletName, Keystore keystore) {
|
public Optional<String> requestPassphrase(String walletName, Keystore keystore) {
|
||||||
if(Platform.isFxApplicationThread()) {
|
if(Platform.isFxApplicationThread()) {
|
||||||
SparrowTerminal.get().getGui().getGUIThread().invokeLater(() -> {
|
SparrowTerminal.get().getGuiThread().invokeLater(() -> {
|
||||||
Optional<String> optPassphrase = showPassphraseDialog(walletName, keystore);
|
Optional<String> optPassphrase = showPassphraseDialog(walletName, keystore);
|
||||||
Platform.runLater(() -> Platform.exitNestedEventLoop(passphraseShowing, optPassphrase));
|
Platform.runLater(() -> Platform.exitNestedEventLoop(passphraseShowing, optPassphrase));
|
||||||
});
|
});
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class AddressesDialog extends WalletDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateAddressesLater() {
|
private void updateAddressesLater() {
|
||||||
SparrowTerminal.get().getGui().getGUIThread().invokeLater(this::updateAddresses);
|
SparrowTerminal.get().getGuiThread().invokeLater(this::updateAddresses);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateAddresses() {
|
private void updateAddresses() {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import com.sparrowwallet.drongo.SecureString;
|
||||||
import com.sparrowwallet.drongo.crypto.InvalidPasswordException;
|
import com.sparrowwallet.drongo.crypto.InvalidPasswordException;
|
||||||
import com.sparrowwallet.drongo.wallet.Wallet;
|
import com.sparrowwallet.drongo.wallet.Wallet;
|
||||||
import com.sparrowwallet.sparrow.EventManager;
|
import com.sparrowwallet.sparrow.EventManager;
|
||||||
import com.sparrowwallet.sparrow.MainApp;
|
import com.sparrowwallet.sparrow.SparrowWallet;
|
||||||
import com.sparrowwallet.sparrow.TabData;
|
import com.sparrowwallet.sparrow.TabData;
|
||||||
import com.sparrowwallet.sparrow.WalletTabData;
|
import com.sparrowwallet.sparrow.WalletTabData;
|
||||||
import com.sparrowwallet.sparrow.event.*;
|
import com.sparrowwallet.sparrow.event.*;
|
||||||
|
@ -52,7 +52,7 @@ public class LoadWallet implements Runnable {
|
||||||
loadWalletService.setExecutor(Storage.LoadWalletService.getSingleThreadedExecutor());
|
loadWalletService.setExecutor(Storage.LoadWalletService.getSingleThreadedExecutor());
|
||||||
loadWalletService.setOnSucceeded(workerStateEvent -> {
|
loadWalletService.setOnSucceeded(workerStateEvent -> {
|
||||||
WalletAndKey walletAndKey = loadWalletService.getValue();
|
WalletAndKey walletAndKey = loadWalletService.getValue();
|
||||||
SparrowTerminal.get().getGui().getGUIThread().invokeLater(() -> openWallet(storage, walletAndKey));
|
SparrowTerminal.get().getGuiThread().invokeLater(() -> openWallet(storage, walletAndKey));
|
||||||
});
|
});
|
||||||
loadWalletService.setOnFailed(workerStateEvent -> {
|
loadWalletService.setOnFailed(workerStateEvent -> {
|
||||||
Throwable exception = workerStateEvent.getSource().getException();
|
Throwable exception = workerStateEvent.getSource().getException();
|
||||||
|
@ -77,7 +77,7 @@ public class LoadWallet implements Runnable {
|
||||||
loadWalletService.setOnSucceeded(workerStateEvent -> {
|
loadWalletService.setOnSucceeded(workerStateEvent -> {
|
||||||
EventManager.get().post(new StorageEvent(storage.getWalletId(null), TimedEvent.Action.END, "Done"));
|
EventManager.get().post(new StorageEvent(storage.getWalletId(null), TimedEvent.Action.END, "Done"));
|
||||||
WalletAndKey walletAndKey = loadWalletService.getValue();
|
WalletAndKey walletAndKey = loadWalletService.getValue();
|
||||||
SparrowTerminal.get().getGui().getGUIThread().invokeLater(() -> openWallet(storage, walletAndKey));
|
SparrowTerminal.get().getGuiThread().invokeLater(() -> openWallet(storage, walletAndKey));
|
||||||
});
|
});
|
||||||
loadWalletService.setOnFailed(workerStateEvent -> {
|
loadWalletService.setOnFailed(workerStateEvent -> {
|
||||||
EventManager.get().post(new StorageEvent(storage.getWalletId(null), TimedEvent.Action.END, "Failed"));
|
EventManager.get().post(new StorageEvent(storage.getWalletId(null), TimedEvent.Action.END, "Failed"));
|
||||||
|
@ -99,7 +99,7 @@ public class LoadWallet implements Runnable {
|
||||||
}
|
}
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
if(e instanceof IOException && e.getMessage().startsWith("The process cannot access the file because another process has locked")) {
|
if(e instanceof IOException && e.getMessage().startsWith("The process cannot access the file because another process has locked")) {
|
||||||
showErrorDialog("Error Opening Wallet", "The wallet file is locked. Is another instance of " + MainApp.APP_NAME + " already running?");
|
showErrorDialog("Error Opening Wallet", "The wallet file is locked. Is another instance of " + SparrowWallet.APP_NAME + " already running?");
|
||||||
} else {
|
} else {
|
||||||
log.error("Error opening wallet", e);
|
log.error("Error opening wallet", e);
|
||||||
showErrorDialog("Error Opening Wallet", e.getMessage() == null ? "Unsupported file format" : e.getMessage());
|
showErrorDialog("Error Opening Wallet", e.getMessage() == null ? "Unsupported file format" : e.getMessage());
|
||||||
|
|
|
@ -59,7 +59,7 @@ public class ReceiveDialog extends WalletDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refreshAddress() {
|
public void refreshAddress() {
|
||||||
SparrowTerminal.get().getGui().getGUIThread().invokeLater(() -> {
|
SparrowTerminal.get().getGuiThread().invokeLater(() -> {
|
||||||
NodeEntry freshEntry = getWalletForm().getFreshNodeEntry(KeyPurpose.RECEIVE, currentEntry);
|
NodeEntry freshEntry = getWalletForm().getFreshNodeEntry(KeyPurpose.RECEIVE, currentEntry);
|
||||||
setNodeEntry(freshEntry);
|
setNodeEntry(freshEntry);
|
||||||
});
|
});
|
||||||
|
@ -93,7 +93,7 @@ public class ReceiveDialog extends WalletDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateLastUsed() {
|
private void updateLastUsed() {
|
||||||
SparrowTerminal.get().getGui().getGUIThread().invokeLater(() -> {
|
SparrowTerminal.get().getGuiThread().invokeLater(() -> {
|
||||||
Set<BlockTransactionHashIndex> currentOutputs = currentEntry.getNode().getTransactionOutputs();
|
Set<BlockTransactionHashIndex> currentOutputs = currentEntry.getNode().getTransactionOutputs();
|
||||||
if(AppServices.onlineProperty().get() && currentOutputs.isEmpty()) {
|
if(AppServices.onlineProperty().get() && currentOutputs.isEmpty()) {
|
||||||
lastUsed.setText("Never");
|
lastUsed.setText("Never");
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class TransactionsDialog extends WalletDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateHistory(WalletTransactionsEntry walletTransactionsEntry) {
|
private void updateHistory(WalletTransactionsEntry walletTransactionsEntry) {
|
||||||
SparrowTerminal.get().getGui().getGUIThread().invokeLater(() -> {
|
SparrowTerminal.get().getGuiThread().invokeLater(() -> {
|
||||||
TableModel<TableCell> tableModel = getTableModel(walletTransactionsEntry);
|
TableModel<TableCell> tableModel = getTableModel(walletTransactionsEntry);
|
||||||
transactions.setTableModel(tableModel);
|
transactions.setTableModel(tableModel);
|
||||||
});
|
});
|
||||||
|
@ -89,7 +89,7 @@ public class TransactionsDialog extends WalletDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateLabels(WalletTransactionsEntry walletTransactionsEntry) {
|
private void updateLabels(WalletTransactionsEntry walletTransactionsEntry) {
|
||||||
SparrowTerminal.get().getGui().getGUIThread().invokeLater(() -> {
|
SparrowTerminal.get().getGuiThread().invokeLater(() -> {
|
||||||
balance.setText(formatBitcoinValue(walletTransactionsEntry.getBalance(), true));
|
balance.setText(formatBitcoinValue(walletTransactionsEntry.getBalance(), true));
|
||||||
mempoolBalance.setText(formatBitcoinValue(walletTransactionsEntry.getMempoolBalance(), true));
|
mempoolBalance.setText(formatBitcoinValue(walletTransactionsEntry.getMempoolBalance(), true));
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ public class TransactionsDialog extends WalletDialog {
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void fiatCurrencySelected(FiatCurrencySelectedEvent event) {
|
public void fiatCurrencySelected(FiatCurrencySelectedEvent event) {
|
||||||
if(event.getExchangeSource() == ExchangeSource.NONE) {
|
if(event.getExchangeSource() == ExchangeSource.NONE) {
|
||||||
SparrowTerminal.get().getGui().getGUIThread().invokeLater(() -> {
|
SparrowTerminal.get().getGuiThread().invokeLater(() -> {
|
||||||
fiatBalance.setText("");
|
fiatBalance.setText("");
|
||||||
fiatMempoolBalance.setText("");
|
fiatMempoolBalance.setText("");
|
||||||
});
|
});
|
||||||
|
@ -146,7 +146,7 @@ public class TransactionsDialog extends WalletDialog {
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void exchangeRatesUpdated(ExchangeRatesUpdatedEvent event) {
|
public void exchangeRatesUpdated(ExchangeRatesUpdatedEvent event) {
|
||||||
SparrowTerminal.get().getGui().getGUIThread().invokeLater(() -> {
|
SparrowTerminal.get().getGuiThread().invokeLater(() -> {
|
||||||
WalletTransactionsEntry walletTransactionsEntry = getWalletForm().getWalletTransactionsEntry();
|
WalletTransactionsEntry walletTransactionsEntry = getWalletForm().getWalletTransactionsEntry();
|
||||||
fiatBalance.setText(formatFiatValue(getFiatValue(walletTransactionsEntry.getBalance(), event.getBtcRate())));
|
fiatBalance.setText(formatFiatValue(getFiatValue(walletTransactionsEntry.getBalance(), event.getBtcRate())));
|
||||||
fiatMempoolBalance.setText(formatFiatValue(getFiatValue(walletTransactionsEntry.getMempoolBalance(), event.getBtcRate())));
|
fiatMempoolBalance.setText(formatFiatValue(getFiatValue(walletTransactionsEntry.getMempoolBalance(), event.getBtcRate())));
|
||||||
|
|
|
@ -36,12 +36,12 @@ public class UtxosDialog extends WalletDialog {
|
||||||
private Button mixTo;
|
private Button mixTo;
|
||||||
|
|
||||||
private final ChangeListener<Boolean> mixingOnlineListener = (observable, oldValue, newValue) -> {
|
private final ChangeListener<Boolean> mixingOnlineListener = (observable, oldValue, newValue) -> {
|
||||||
SparrowTerminal.get().getGui().getGUIThread().invokeLater(() -> startMix.setEnabled(newValue));
|
SparrowTerminal.get().getGuiThread().invokeLater(() -> startMix.setEnabled(newValue));
|
||||||
};
|
};
|
||||||
|
|
||||||
private final ChangeListener<Boolean> mixingStartingListener = (observable, oldValue, newValue) -> {
|
private final ChangeListener<Boolean> mixingStartingListener = (observable, oldValue, newValue) -> {
|
||||||
try {
|
try {
|
||||||
SparrowTerminal.get().getGui().getGUIThread().invokeAndWait(() -> {
|
SparrowTerminal.get().getGuiThread().invokeAndWait(() -> {
|
||||||
startMix.setEnabled(!newValue && AppServices.onlineProperty().get());
|
startMix.setEnabled(!newValue && AppServices.onlineProperty().get());
|
||||||
startMix.setLabel(newValue && AppServices.onlineProperty().get() ? "Starting Mixing..." : isMixing() ? "Stop Mixing" : "Start Mixing");
|
startMix.setLabel(newValue && AppServices.onlineProperty().get() ? "Starting Mixing..." : isMixing() ? "Stop Mixing" : "Start Mixing");
|
||||||
mixTo.setEnabled(!newValue);
|
mixTo.setEnabled(!newValue);
|
||||||
|
@ -53,7 +53,7 @@ public class UtxosDialog extends WalletDialog {
|
||||||
|
|
||||||
private final ChangeListener<Boolean> mixingStoppingListener = (observable, oldValue, newValue) -> {
|
private final ChangeListener<Boolean> mixingStoppingListener = (observable, oldValue, newValue) -> {
|
||||||
try {
|
try {
|
||||||
SparrowTerminal.get().getGui().getGUIThread().invokeAndWait(() -> {
|
SparrowTerminal.get().getGuiThread().invokeAndWait(() -> {
|
||||||
startMix.setEnabled(!newValue && AppServices.onlineProperty().get());
|
startMix.setEnabled(!newValue && AppServices.onlineProperty().get());
|
||||||
startMix.setLabel(newValue ? "Stopping Mixing..." : isMixing() ? "Stop Mixing" : "Start Mixing");
|
startMix.setLabel(newValue ? "Stopping Mixing..." : isMixing() ? "Stop Mixing" : "Start Mixing");
|
||||||
mixTo.setEnabled(!newValue);
|
mixTo.setEnabled(!newValue);
|
||||||
|
@ -161,7 +161,7 @@ public class UtxosDialog extends WalletDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateHistory(WalletUtxosEntry walletUtxosEntry) {
|
private void updateHistory(WalletUtxosEntry walletUtxosEntry) {
|
||||||
SparrowTerminal.get().getGui().getGUIThread().invokeLater(() -> {
|
SparrowTerminal.get().getGuiThread().invokeLater(() -> {
|
||||||
TableModel<TableCell> tableModel = getTableModel(walletUtxosEntry);
|
TableModel<TableCell> tableModel = getTableModel(walletUtxosEntry);
|
||||||
utxos.setTableModel(tableModel);
|
utxos.setTableModel(tableModel);
|
||||||
});
|
});
|
||||||
|
@ -184,7 +184,7 @@ public class UtxosDialog extends WalletDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateLabels(WalletUtxosEntry walletUtxosEntry) {
|
private void updateLabels(WalletUtxosEntry walletUtxosEntry) {
|
||||||
SparrowTerminal.get().getGui().getGUIThread().invokeLater(() -> {
|
SparrowTerminal.get().getGuiThread().invokeLater(() -> {
|
||||||
balance.setText(formatBitcoinValue(walletUtxosEntry.getBalance(), true));
|
balance.setText(formatBitcoinValue(walletUtxosEntry.getBalance(), true));
|
||||||
mempoolBalance.setText(formatBitcoinValue(walletUtxosEntry.getMempoolBalance(), true));
|
mempoolBalance.setText(formatBitcoinValue(walletUtxosEntry.getMempoolBalance(), true));
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ public class UtxosDialog extends WalletDialog {
|
||||||
whirlpool.setMixToWallet(null, null);
|
whirlpool.setMixToWallet(null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
SparrowTerminal.get().getGui().getGUIThread().invokeLater(this::updateMixToButton);
|
SparrowTerminal.get().getGuiThread().invokeLater(this::updateMixToButton);
|
||||||
if(whirlpool.isStarted()) {
|
if(whirlpool.isStarted()) {
|
||||||
//Will automatically restart
|
//Will automatically restart
|
||||||
AppServices.getWhirlpoolServices().stopWhirlpool(whirlpool, false);
|
AppServices.getWhirlpoolServices().stopWhirlpool(whirlpool, false);
|
||||||
|
@ -343,7 +343,7 @@ public class UtxosDialog extends WalletDialog {
|
||||||
UtxoEntry tableEntry = (UtxoEntry)tableModel.getRow(row).get(0).getEntry();
|
UtxoEntry tableEntry = (UtxoEntry)tableModel.getRow(row).get(0).getEntry();
|
||||||
if(tableEntry.getHashIndex().equals(event.getUtxo())) {
|
if(tableEntry.getHashIndex().equals(event.getUtxo())) {
|
||||||
final int utxoRow = row;
|
final int utxoRow = row;
|
||||||
SparrowTerminal.get().getGui().getGUIThread().invokeLater(() -> {
|
SparrowTerminal.get().getGuiThread().invokeLater(() -> {
|
||||||
tableModel.setCell(2, utxoRow, new MixTableCell(utxoEntry));
|
tableModel.setCell(2, utxoRow, new MixTableCell(utxoEntry));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -369,12 +369,12 @@ public class UtxosDialog extends WalletDialog {
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void openWallets(OpenWalletsEvent event) {
|
public void openWallets(OpenWalletsEvent event) {
|
||||||
SparrowTerminal.get().getGui().getGUIThread().invokeLater(this::updateMixToButton);
|
SparrowTerminal.get().getGuiThread().invokeLater(this::updateMixToButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void walletLabelChanged(WalletLabelChangedEvent event) {
|
public void walletLabelChanged(WalletLabelChangedEvent event) {
|
||||||
SparrowTerminal.get().getGui().getGUIThread().invokeLater(this::updateMixToButton);
|
SparrowTerminal.get().getGuiThread().invokeLater(this::updateMixToButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
|
@ -392,7 +392,7 @@ public class UtxosDialog extends WalletDialog {
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void fiatCurrencySelected(FiatCurrencySelectedEvent event) {
|
public void fiatCurrencySelected(FiatCurrencySelectedEvent event) {
|
||||||
if(event.getExchangeSource() == ExchangeSource.NONE) {
|
if(event.getExchangeSource() == ExchangeSource.NONE) {
|
||||||
SparrowTerminal.get().getGui().getGUIThread().invokeLater(() -> {
|
SparrowTerminal.get().getGuiThread().invokeLater(() -> {
|
||||||
fiatBalance.setText("");
|
fiatBalance.setText("");
|
||||||
fiatMempoolBalance.setText("");
|
fiatMempoolBalance.setText("");
|
||||||
});
|
});
|
||||||
|
@ -401,7 +401,7 @@ public class UtxosDialog extends WalletDialog {
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void exchangeRatesUpdated(ExchangeRatesUpdatedEvent event) {
|
public void exchangeRatesUpdated(ExchangeRatesUpdatedEvent event) {
|
||||||
SparrowTerminal.get().getGui().getGUIThread().invokeLater(() -> {
|
SparrowTerminal.get().getGuiThread().invokeLater(() -> {
|
||||||
WalletUtxosEntry walletUtxosEntry = getWalletForm().getWalletUtxosEntry();
|
WalletUtxosEntry walletUtxosEntry = getWalletForm().getWalletUtxosEntry();
|
||||||
fiatBalance.setText(formatFiatValue(getFiatValue(walletUtxosEntry.getBalance(), event.getBtcRate())));
|
fiatBalance.setText(formatFiatValue(getFiatValue(walletUtxosEntry.getBalance(), event.getBtcRate())));
|
||||||
fiatMempoolBalance.setText(formatFiatValue(getFiatValue(walletUtxosEntry.getMempoolBalance(), event.getBtcRate())));
|
fiatMempoolBalance.setText(formatFiatValue(getFiatValue(walletUtxosEntry.getMempoolBalance(), event.getBtcRate())));
|
||||||
|
|
|
@ -24,7 +24,7 @@ public class WalletAccountsDialog extends DialogWindow {
|
||||||
for(Wallet wallet : masterWallet.getAllWallets()) {
|
for(Wallet wallet : masterWallet.getAllWallets()) {
|
||||||
actions.addItem(wallet.getDisplayName(), () -> {
|
actions.addItem(wallet.getDisplayName(), () -> {
|
||||||
close();
|
close();
|
||||||
SparrowTerminal.get().getGui().getGUIThread().invokeLater(() -> {
|
SparrowTerminal.get().getGuiThread().invokeLater(() -> {
|
||||||
WalletActionsDialog walletActionsDialog = new WalletActionsDialog(wallet);
|
WalletActionsDialog walletActionsDialog = new WalletActionsDialog(wallet);
|
||||||
walletActionsDialog.showDialog(SparrowTerminal.get().getGui());
|
walletActionsDialog.showDialog(SparrowTerminal.get().getGui());
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue