private void doEmptyWallet(KeyParameter aesKey) {
   emptyWalletButton.setDisable(true);
   try {
     walletService.emptyWallet(
         addressInputTextField.getText(),
         aesKey,
         () -> {
           closeButton.setText("Close");
           addressTextField.setText(
               formatter.formatCoinWithCode(walletService.getAvailableBalance()));
           emptyWalletButton.setDisable(true);
           log.debug("wallet empty successful");
           FxTimer.runLater(
               Duration.ofMillis(Transitions.DEFAULT_DURATION),
               () ->
                   new Popup()
                       .information("The balance of your wallet was successfully transferred.")
                       .onClose(() -> blurAgain())
                       .show());
         },
         (errorMessage) -> {
           emptyWalletButton.setDisable(false);
           log.debug("wallet empty failed " + errorMessage);
         });
   } catch (InsufficientMoneyException | AddressFormatException e1) {
     e1.printStackTrace();
     log.error(e1.getMessage());
     emptyWalletButton.setDisable(false);
   }
 }
Esempio n. 2
0
  private void hideSendMsgInfo(Timer timer) {
    timer.stop();
    inputTextArea.setDisable(false);

    FxTimer.runLater(
        Duration.ofMillis(5000),
        () -> {
          sendMsgInfoLabel.setVisible(false);
          sendMsgInfoLabel.setManaged(false);
        });
    sendMsgProgressIndicator.setProgress(0);
    sendMsgProgressIndicator.setVisible(false);
    sendMsgProgressIndicator.setManaged(false);
  }
Esempio n. 3
0
  private void onSendMessage(String inputText, Dispute dispute) {
    DisputeDirectMessage disputeDirectMessage =
        disputeManager.sendDisputeDirectMessage(
            dispute, inputText, new ArrayList<>(tempAttachments));
    tempAttachments.clear();
    scrollToBottom();

    inputTextArea.setDisable(true);
    inputTextArea.clear();

    final Timer timer =
        FxTimer.runLater(
            Duration.ofMillis(500),
            () -> {
              sendMsgInfoLabel.setVisible(true);
              sendMsgInfoLabel.setManaged(true);
              sendMsgInfoLabel.setText("Sending Message...");

              sendMsgProgressIndicator.setProgress(-1);
              sendMsgProgressIndicator.setVisible(true);
              sendMsgProgressIndicator.setManaged(true);
            });

    disputeDirectMessage
        .arrivedProperty()
        .addListener(
            (observable, oldValue, newValue) -> {
              if (newValue) {
                hideSendMsgInfo(timer);
              }
            });
    disputeDirectMessage
        .storedInMailboxProperty()
        .addListener(
            (observable, oldValue, newValue) -> {
              if (newValue) {
                sendMsgInfoLabel.setVisible(true);
                sendMsgInfoLabel.setManaged(true);
                sendMsgInfoLabel.setText(
                    "Receiver is not online. Message is saved to his mailbox.");
                hideSendMsgInfo(timer);
              }
            });
  }