use of bisq.desktop.components.BusyAnimation in project bisq-desktop by bisq-network.
the class PasswordView method initialize.
@Override
public void initialize() {
headline = FormBuilder.addTitledGroupBg(root, gridRow, 2, "");
passwordField = FormBuilder.addLabelPasswordTextField(root, gridRow, Res.get("password.enterPassword"), Layout.FIRST_ROW_DISTANCE).second;
passwordField.setValidator(passwordValidator);
passwordFieldChangeListener = (observable, oldValue, newValue) -> validatePasswords();
Tuple2<Label, PasswordTextField> tuple2 = FormBuilder.addLabelPasswordTextField(root, ++gridRow, Res.get("password.confirmPassword"));
repeatedPasswordLabel = tuple2.first;
repeatedPasswordField = tuple2.second;
repeatedPasswordField.setValidator(passwordValidator);
repeatedPasswordFieldChangeListener = (observable, oldValue, newValue) -> validatePasswords();
Tuple3<Button, BusyAnimation, Label> tuple = FormBuilder.addButtonBusyAnimationLabel(root, ++gridRow, "", 15);
pwButton = tuple.first;
BusyAnimation busyAnimation = tuple.second;
Label deriveStatusLabel = tuple.third;
pwButton.setDisable(true);
setText();
pwButton.setOnAction(e -> {
if (!walletsManager.areWalletsEncrypted()) {
new Popup<>().backgroundInfo(Res.get("password.backupReminder")).closeButtonText(Res.get("password.backupWasDone")).onClose(() -> onApplyPassword(busyAnimation, deriveStatusLabel)).actionButtonTextWithGoTo("navigation.account.walletSeed").onAction(() -> {
navigation.setReturnPath(navigation.getCurrentPath());
// noinspection unchecked
navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class, SeedWordsView.class);
}).show();
} else {
onApplyPassword(busyAnimation, deriveStatusLabel);
}
});
FormBuilder.addTitledGroupBg(root, ++gridRow, 1, Res.get("shared.information"), Layout.GROUP_DISTANCE);
FormBuilder.addMultilineLabel(root, gridRow, Res.get("account.password.info"), Layout.FIRST_ROW_AND_GROUP_DISTANCE);
}
use of bisq.desktop.components.BusyAnimation in project bisq-desktop by bisq-network.
the class OfferDetailsWindow method addConfirmAndCancelButtons.
private void addConfirmAndCancelButtons(boolean isPlaceOffer) {
boolean isBuyOffer = offer.isBuyOffer();
boolean isBuyerRole = isPlaceOffer ? isBuyOffer : !isBuyOffer;
String placeOfferButtonText = isBuyerRole ? Res.get("offerDetailsWindow.confirm.maker", Res.get("shared.buy")) : Res.get("offerDetailsWindow.confirm.maker", Res.get("shared.sell"));
String takeOfferButtonText = isBuyerRole ? Res.get("offerDetailsWindow.confirm.taker", Res.get("shared.buy")) : Res.get("offerDetailsWindow.confirm.taker", Res.get("shared.sell"));
ImageView iconView = new ImageView();
iconView.setId(isBuyerRole ? "image-buy-white" : "image-sell-white");
Tuple3<Button, BusyAnimation, Label> placeOfferTuple = addButtonBusyAnimationLabelAfterGroup(gridPane, ++rowIndex, isPlaceOffer ? placeOfferButtonText : takeOfferButtonText);
Button button = placeOfferTuple.first;
button.setMinHeight(40);
button.setPadding(new Insets(0, 20, 0, 20));
button.setGraphic(iconView);
button.setGraphicTextGap(10);
button.setId(isBuyerRole ? "buy-button-big" : "sell-button-big");
button.setText(isPlaceOffer ? placeOfferButtonText : takeOfferButtonText);
busyAnimation = placeOfferTuple.second;
Label spinnerInfoLabel = placeOfferTuple.third;
Button cancelButton = addButton(gridPane, ++rowIndex, Res.get("shared.cancel"));
cancelButton.setDefaultButton(false);
cancelButton.setId("cancel-button");
cancelButton.setOnAction(e -> {
closeHandlerOptional.ifPresent(Runnable::run);
hide();
});
button.setOnAction(e -> {
if (user.getAcceptedArbitrators().size() > 0) {
button.setDisable(true);
cancelButton.setDisable(true);
busyAnimation.play();
if (isPlaceOffer) {
spinnerInfoLabel.setText(Res.get("createOffer.fundsBox.placeOfferSpinnerInfo"));
placeOfferHandlerOptional.get().run();
} else {
spinnerInfoLabel.setText(Res.get("takeOffer.fundsBox.takeOfferSpinnerInfo"));
takeOfferHandlerOptional.get().run();
}
} else {
new Popup<>().warning(Res.get("offerDetailsWindow.warn.noArbitrator")).show();
// noinspection unchecked
navigation.navigateTo(MainView.class, AccountView.class, AccountSettingsView.class, ArbitratorSelectionView.class);
}
});
}
use of bisq.desktop.components.BusyAnimation in project bisq-desktop by bisq-network.
the class DisplayUpdateDownloadWindow method addContent.
// /////////////////////////////////////////////////////////////////////////////////////////
// Protected
// /////////////////////////////////////////////////////////////////////////////////////////
private void addContent() {
headLine = "Important update information!";
headLineLabel.getStyleClass().addAll("headline-label", "highlight");
checkNotNull(alert, "alertMessage must not be null");
addMultilineLabel(gridPane, ++rowIndex, alert.getMessage(), 10);
Separator separator = new Separator();
separator.setMouseTransparent(true);
separator.setOrientation(Orientation.HORIZONTAL);
separator.getStyleClass().add("separator");
GridPane.setHalignment(separator, HPos.CENTER);
GridPane.setRowIndex(separator, ++rowIndex);
GridPane.setColumnSpan(separator, 2);
GridPane.setMargin(separator, new Insets(20, 0, 20, 0));
gridPane.getChildren().add(separator);
Button downloadButton = new AutoTooltipButton(Res.get("displayUpdateDownloadWindow.button.label"));
downloadButton.setDefaultButton(true);
busyAnimation = new BusyAnimation(false);
Label statusLabel = new AutoTooltipLabel();
statusLabel.managedProperty().bind(statusLabel.visibleProperty());
HBox hBox = new HBox();
hBox.setSpacing(10);
hBox.setAlignment(Pos.CENTER_LEFT);
hBox.getChildren().addAll(downloadButton, busyAnimation, statusLabel);
GridPane.setRowIndex(hBox, ++rowIndex);
GridPane.setColumnIndex(hBox, 0);
GridPane.setColumnSpan(hBox, 2);
gridPane.getChildren().add(hBox);
Label downloadingFileLabel = addLabel(gridPane, ++rowIndex, Res.get("displayUpdateDownloadWindow.downloadingFile", ""));
GridPane.setColumnIndex(downloadingFileLabel, 0);
downloadingFileLabel.setOpacity(0.2);
progressBar = new ProgressBar(0L);
progressBar.setPrefWidth(200);
progressBar.setMaxHeight(4);
progressBar.managedProperty().bind(progressBar.visibleProperty());
progressBar.setVisible(false);
GridPane.setRowIndex(progressBar, rowIndex);
GridPane.setColumnIndex(progressBar, 1);
GridPane.setHalignment(progressBar, HPos.LEFT);
GridPane.setFillWidth(progressBar, true);
GridPane.setMargin(progressBar, new Insets(3, 0, 0, 10));
gridPane.getChildren().add(progressBar);
final String downloadedFilesLabelTitle = Res.get("displayUpdateDownloadWindow.downloadedFiles");
Label downloadedFilesLabel = addLabel(gridPane, ++rowIndex, downloadedFilesLabelTitle);
GridPane.setColumnIndex(downloadedFilesLabel, 0);
GridPane.setHalignment(downloadedFilesLabel, HPos.LEFT);
GridPane.setColumnSpan(downloadedFilesLabel, 2);
downloadedFilesLabel.setOpacity(0.2);
final String verifiedSigLabelTitle = Res.get("displayUpdateDownloadWindow.verifiedSigs");
Label verifiedSigLabel = addLabel(gridPane, ++rowIndex, verifiedSigLabelTitle);
GridPane.setColumnIndex(verifiedSigLabel, 0);
GridPane.setColumnSpan(verifiedSigLabel, 2);
GridPane.setHalignment(verifiedSigLabel, HPos.LEFT);
verifiedSigLabel.setOpacity(0.2);
Separator separator2 = new Separator();
separator2.setMouseTransparent(true);
separator2.setOrientation(Orientation.HORIZONTAL);
separator2.getStyleClass().add("separator");
GridPane.setHalignment(separator2, HPos.CENTER);
GridPane.setRowIndex(separator2, ++rowIndex);
GridPane.setColumnSpan(separator2, 2);
GridPane.setMargin(separator2, new Insets(20, 0, 20, 0));
gridPane.getChildren().add(separator2);
BisqInstaller installer = new BisqInstaller();
String downloadFailedString = Res.get("displayUpdateDownloadWindow.download.failed");
downloadButton.setOnAction(e -> {
if (installer.isSupportedOS()) {
List<String> downloadedFiles = new ArrayList<>();
List<String> verifiedSigs = new ArrayList<>();
downloadButton.setDisable(true);
progressBar.setVisible(true);
downloadedFilesLabel.setOpacity(1);
downloadingFileLabel.setOpacity(1);
busyAnimation.play();
statusLabel.setText(Res.get("displayUpdateDownloadWindow.status.downloading"));
// download installer
downloadTaskOptional = installer.download(alert.getVersion());
if (downloadTaskOptional.isPresent()) {
final DownloadTask downloadTask = downloadTaskOptional.get();
final ChangeListener<String> downloadedFilesListener = (observable, oldValue, newValue) -> {
if (!newValue.endsWith("-local")) {
downloadingFileLabel.setText(Res.get("displayUpdateDownloadWindow.downloadingFile", newValue));
downloadedFilesLabel.setText(downloadedFilesLabelTitle + " " + Joiner.on(", ").join(downloadedFiles));
downloadedFiles.add(newValue);
}
};
downloadTask.messageProperty().addListener(downloadedFilesListener);
progressBar.progressProperty().unbind();
progressBar.progressProperty().bind(downloadTask.progressProperty());
downloadTask.setOnSucceeded(workerStateEvent -> {
downloadedFilesLabel.setText(downloadedFilesLabelTitle + " " + Joiner.on(", ").join(downloadedFiles));
downloadTask.messageProperty().removeListener(downloadedFilesListener);
progressBar.setVisible(false);
downloadingFileLabel.setText("");
downloadingFileLabel.setOpacity(0.2);
statusLabel.setText(Res.get("displayUpdateDownloadWindow.status.verifying"));
List<BisqInstaller.FileDescriptor> downloadResults = downloadTask.getValue();
Optional<BisqInstaller.FileDescriptor> downloadFailed = downloadResults.stream().filter(fileDescriptor -> !BisqInstaller.DownloadStatusEnum.OK.equals(fileDescriptor.getDownloadStatus())).findFirst();
downloadedFilesLabel.getStyleClass().removeAll("error-text", "success-text");
if (downloadResults == null || downloadResults.isEmpty() || downloadFailed.isPresent()) {
showErrorMessage(downloadButton, statusLabel, downloadFailedString);
downloadedFilesLabel.getStyleClass().add("error-text");
} else {
log.debug("Download completed successfully.");
downloadedFilesLabel.getStyleClass().add("success-text");
verifyTask = installer.verify(downloadResults);
verifiedSigLabel.setOpacity(1);
final ChangeListener<String> verifiedSigLabelListener = (observable, oldValue, newValue) -> {
verifiedSigs.add(newValue);
verifiedSigLabel.setText(verifiedSigLabelTitle + " " + Joiner.on(", ").join(verifiedSigs));
};
verifyTask.messageProperty().addListener(verifiedSigLabelListener);
verifyTask.setOnSucceeded(event -> {
verifyTask.messageProperty().removeListener(verifiedSigLabelListener);
statusLabel.setText("");
stopAnimations();
List<BisqInstaller.VerifyDescriptor> verifyResults = verifyTask.getValue();
// check that there are no failed verifications
Optional<BisqInstaller.VerifyDescriptor> verifyFailed = verifyResults.stream().filter(verifyDescriptor -> !BisqInstaller.VerifyStatusEnum.OK.equals(verifyDescriptor.getVerifyStatusEnum())).findFirst();
if (verifyResults == null || verifyResults.isEmpty() || verifyFailed.isPresent()) {
showErrorMessage(downloadButton, statusLabel, Res.get("displayUpdateDownloadWindow.verify.failed"));
} else {
verifiedSigLabel.getStyleClass().add("success-text");
new Popup<>().feedback(Res.get("displayUpdateDownloadWindow.success")).actionButtonText(Res.get("displayUpdateDownloadWindow.download.openDir")).onAction(() -> {
try {
Utilities.openFile(new File(Utilities.getDownloadOfHomeDir()));
doClose();
} catch (IOException e2) {
log.error(e2.getMessage());
e2.printStackTrace();
}
}).onClose(this::doClose).show();
log.info("Download & verification succeeded.");
}
});
}
});
} else {
showErrorMessage(downloadButton, statusLabel, downloadFailedString);
}
} else {
showErrorMessage(downloadButton, statusLabel, (Res.get("displayUpdateDownloadWindow.installer.failed")));
}
});
}
use of bisq.desktop.components.BusyAnimation in project bisq-desktop by bisq-network.
the class BuyerStep2View method addContent.
// /////////////////////////////////////////////////////////////////////////////////////////
// Content
// /////////////////////////////////////////////////////////////////////////////////////////
@Override
protected void addContent() {
addTradeInfoBlock();
PaymentAccountPayload paymentAccountPayload = model.dataModel.getSellersPaymentAccountPayload();
String paymentMethodId = paymentAccountPayload != null ? paymentAccountPayload.getPaymentMethodId() : "";
TitledGroupBg accountTitledGroupBg = FormBuilder.addTitledGroupBg(gridPane, ++gridRow, 1, Res.get("portfolio.pending.step2_buyer.startPaymentUsing", Res.get(paymentMethodId)), Layout.GROUP_DISTANCE);
TextFieldWithCopyIcon field = FormBuilder.addLabelTextFieldWithCopyIcon(gridPane, gridRow, Res.get("portfolio.pending.step2_buyer.amountToTransfer"), model.getFiatVolume(), Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
field.setCopyWithoutCurrencyPostFix(true);
switch(paymentMethodId) {
case PaymentMethod.OK_PAY_ID:
gridRow = OKPayForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
break;
case PaymentMethod.UPHOLD_ID:
gridRow = UpholdForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
break;
case PaymentMethod.CASH_APP_ID:
gridRow = CashAppForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
break;
case PaymentMethod.MONEY_BEAM_ID:
gridRow = MoneyBeamForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
break;
case PaymentMethod.VENMO_ID:
gridRow = VenmoForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
break;
case PaymentMethod.POPMONEY_ID:
gridRow = PopmoneyForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
break;
case PaymentMethod.REVOLUT_ID:
gridRow = RevolutForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
break;
case PaymentMethod.PERFECT_MONEY_ID:
gridRow = PerfectMoneyForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
break;
case PaymentMethod.SEPA_ID:
gridRow = SepaForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
break;
case PaymentMethod.FASTER_PAYMENTS_ID:
gridRow = FasterPaymentsForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
break;
case PaymentMethod.NATIONAL_BANK_ID:
gridRow = NationalBankForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
break;
case PaymentMethod.SAME_BANK_ID:
gridRow = SameBankForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
break;
case PaymentMethod.SPECIFIC_BANKS_ID:
gridRow = SpecificBankForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
break;
case PaymentMethod.SWISH_ID:
gridRow = SwishForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
break;
case PaymentMethod.ALI_PAY_ID:
gridRow = AliPayForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
break;
case PaymentMethod.CLEAR_X_CHANGE_ID:
gridRow = ClearXchangeForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
break;
case PaymentMethod.CHASE_QUICK_PAY_ID:
gridRow = ChaseQuickPayForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
break;
case PaymentMethod.INTERAC_E_TRANSFER_ID:
gridRow = InteracETransferForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
break;
case PaymentMethod.US_POSTAL_MONEY_ORDER_ID:
gridRow = USPostalMoneyOrderForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
break;
case PaymentMethod.CASH_DEPOSIT_ID:
gridRow = CashDepositForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
break;
case PaymentMethod.WESTERN_UNION_ID:
gridRow = WesternUnionForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload);
break;
case PaymentMethod.BLOCK_CHAINS_ID:
String labelTitle = Res.get("portfolio.pending.step2_buyer.sellersAddress", CurrencyUtil.getNameByCode(trade.getOffer().getCurrencyCode()));
gridRow = CryptoCurrencyForm.addFormForBuyer(gridPane, gridRow, paymentAccountPayload, labelTitle);
break;
default:
log.error("Not supported PaymentMethod: " + paymentMethodId);
}
if (!(paymentAccountPayload instanceof CryptoCurrencyAccountPayload))
FormBuilder.addLabelTextFieldWithCopyIcon(gridPane, ++gridRow, Res.getWithCol("shared.reasonForPayment"), model.dataModel.getReference());
GridPane.setRowSpan(accountTitledGroupBg, gridRow - 3);
Tuple3<Button, BusyAnimation, Label> tuple3 = FormBuilder.addButtonBusyAnimationLabelAfterGroup(gridPane, ++gridRow, Res.get("portfolio.pending.step2_buyer.paymentStarted"));
confirmButton = tuple3.first;
confirmButton.setOnAction(e -> onPaymentStarted());
busyAnimation = tuple3.second;
statusLabel = tuple3.third;
}
Aggregations