Search in sources :

Example 76 with AutoTooltipLabel

use of bisq.desktop.components.AutoTooltipLabel in project bisq-desktop by bisq-network.

the class FormBuilder method addLabel.

public static Label addLabel(GridPane gridPane, int rowIndex, String title, double top) {
    Label label = new AutoTooltipLabel(title);
    GridPane.setRowIndex(label, rowIndex);
    GridPane.setMargin(label, new Insets(top, 0, 0, 0));
    gridPane.getChildren().add(label);
    return label;
}
Also used : Insets(javafx.geometry.Insets) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) Label(javafx.scene.control.Label) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel)

Example 77 with AutoTooltipLabel

use of bisq.desktop.components.AutoTooltipLabel in project bisq-desktop by bisq-network.

the class FormBuilder method addLabelTextFieldLabelTextField.

// /////////////////////////////////////////////////////////////////////////////////////////
// Label  + TextField + Label  + TextField
// /////////////////////////////////////////////////////////////////////////////////////////
public static Tuple4<Label, TextField, Label, TextField> addLabelTextFieldLabelTextField(GridPane gridPane, int rowIndex, String title1, String title2) {
    Label label1 = addLabel(gridPane, rowIndex, title1, 0);
    TextField textField1 = new TextField();
    textField1.setEditable(false);
    textField1.setMouseTransparent(true);
    textField1.setFocusTraversable(false);
    Label label2 = new AutoTooltipLabel(title2);
    HBox.setMargin(label2, new Insets(5, 0, 0, 0));
    TextField textField2 = new TextField();
    textField2.setEditable(false);
    textField2.setMouseTransparent(true);
    textField2.setFocusTraversable(false);
    HBox hBox = new HBox();
    hBox.setSpacing(10);
    hBox.getChildren().addAll(textField1, label2, textField2);
    GridPane.setRowIndex(hBox, rowIndex);
    GridPane.setColumnIndex(hBox, 1);
    gridPane.getChildren().add(hBox);
    return new Tuple4<>(label1, textField1, label2, textField2);
}
Also used : Tuple4(bisq.common.util.Tuple4) HBox(javafx.scene.layout.HBox) Insets(javafx.geometry.Insets) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) Label(javafx.scene.control.Label) BalanceTextField(bisq.desktop.components.BalanceTextField) InputTextField(bisq.desktop.components.InputTextField) InfoInputTextField(bisq.desktop.components.InfoInputTextField) PasswordTextField(bisq.desktop.components.PasswordTextField) InfoTextField(bisq.desktop.components.InfoTextField) TextField(javafx.scene.control.TextField) TxIdTextField(bisq.desktop.components.TxIdTextField) BsqAddressTextField(bisq.desktop.components.BsqAddressTextField) FundsTextField(bisq.desktop.components.FundsTextField) AddressTextField(bisq.desktop.components.AddressTextField) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel)

Example 78 with AutoTooltipLabel

use of bisq.desktop.components.AutoTooltipLabel in project bisq-desktop by bisq-network.

the class FormBuilder method getEditableValueCurrencyBox.

// /////////////////////////////////////////////////////////////////////////////////////////
// Trade: HBox, InputTextField, Label
// /////////////////////////////////////////////////////////////////////////////////////////
public static Tuple3<HBox, InputTextField, Label> getEditableValueCurrencyBox(String promptText) {
    InputTextField input = new InputTextField();
    input.setPrefWidth(170);
    input.setAlignment(Pos.CENTER_RIGHT);
    input.setId("text-input-with-currency-text-field");
    input.setPromptText(promptText);
    Label currency = new AutoTooltipLabel(Res.getBaseCurrencyCode());
    currency.setId("currency-info-label");
    HBox box = new HBox();
    box.getChildren().addAll(input, currency);
    return new Tuple3<>(box, input, currency);
}
Also used : HBox(javafx.scene.layout.HBox) InputTextField(bisq.desktop.components.InputTextField) InfoInputTextField(bisq.desktop.components.InfoInputTextField) Tuple3(bisq.common.util.Tuple3) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) Label(javafx.scene.control.Label) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel)

Example 79 with AutoTooltipLabel

use of bisq.desktop.components.AutoTooltipLabel in project bisq-desktop by bisq-network.

the class FormBuilder method addHBoxLabelComboBox.

// /////////////////////////////////////////////////////////////////////////////////////////
// HBox  + AutoTooltipLabel + ComboBox
// /////////////////////////////////////////////////////////////////////////////////////////
public static Tuple3<HBox, AutoTooltipLabel, ComboBox> addHBoxLabelComboBox(GridPane gridPane, int rowIndex, String title, double top) {
    HBox hBox = new HBox();
    hBox.setAlignment(Pos.CENTER_LEFT);
    hBox.setSpacing(4);
    final AutoTooltipLabel label = new AutoTooltipLabel(title);
    final ComboBox<Object> comboBox = new ComboBox<>();
    hBox.getChildren().addAll(label, comboBox);
    GridPane.setRowIndex(hBox, rowIndex);
    GridPane.setColumnSpan(hBox, 2);
    GridPane.setMargin(hBox, new Insets(top, 0, 0, 24));
    gridPane.getChildren().add(hBox);
    return new Tuple3<>(hBox, label, comboBox);
}
Also used : HBox(javafx.scene.layout.HBox) Insets(javafx.geometry.Insets) ComboBox(javafx.scene.control.ComboBox) SearchComboBox(bisq.desktop.components.SearchComboBox) Tuple3(bisq.common.util.Tuple3) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel)

Example 80 with AutoTooltipLabel

use of bisq.desktop.components.AutoTooltipLabel 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")));
        }
    });
}
Also used : Button(javafx.scene.control.Button) Scene(javafx.scene.Scene) HPos(javafx.geometry.HPos) Pos(javafx.geometry.Pos) FormBuilder.addLabel(bisq.desktop.util.FormBuilder.addLabel) BusyAnimation(bisq.desktop.components.BusyAnimation) Utilities(bisq.common.util.Utilities) ArrayList(java.util.ArrayList) ProgressBar(javafx.scene.control.ProgressBar) Insets(javafx.geometry.Insets) Alert(bisq.core.alert.Alert) Res(bisq.core.locale.Res) Overlay(bisq.desktop.main.overlays.Overlay) GridPane(javafx.scene.layout.GridPane) KeyCode(javafx.scene.input.KeyCode) HBox(javafx.scene.layout.HBox) Orientation(javafx.geometry.Orientation) Popup(bisq.desktop.main.overlays.popups.Popup) Label(javafx.scene.control.Label) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) Preconditions.checkNotNull(com.google.common.base.Preconditions.checkNotNull) IOException(java.io.IOException) File(java.io.File) Separator(javafx.scene.control.Separator) List(java.util.List) Slf4j(lombok.extern.slf4j.Slf4j) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) Optional(java.util.Optional) FormBuilder.addMultilineLabel(bisq.desktop.util.FormBuilder.addMultilineLabel) ChangeListener(javafx.beans.value.ChangeListener) Joiner(com.google.common.base.Joiner) HBox(javafx.scene.layout.HBox) Insets(javafx.geometry.Insets) FormBuilder.addLabel(bisq.desktop.util.FormBuilder.addLabel) Label(javafx.scene.control.Label) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) FormBuilder.addMultilineLabel(bisq.desktop.util.FormBuilder.addMultilineLabel) ArrayList(java.util.ArrayList) Button(javafx.scene.control.Button) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) ProgressBar(javafx.scene.control.ProgressBar) BusyAnimation(bisq.desktop.components.BusyAnimation) IOException(java.io.IOException) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) File(java.io.File) Separator(javafx.scene.control.Separator)

Aggregations

AutoTooltipLabel (bisq.desktop.components.AutoTooltipLabel)90 Label (javafx.scene.control.Label)55 Insets (javafx.geometry.Insets)45 HBox (javafx.scene.layout.HBox)29 TableCell (javafx.scene.control.TableCell)27 TableColumn (javafx.scene.control.TableColumn)27 VBox (javafx.scene.layout.VBox)23 AutoTooltipButton (bisq.desktop.components.AutoTooltipButton)22 Button (javafx.scene.control.Button)22 ImageView (javafx.scene.image.ImageView)19 Res (bisq.core.locale.Res)18 InputTextField (bisq.desktop.components.InputTextField)18 Popup (bisq.desktop.main.overlays.popups.Popup)17 FxmlView (bisq.desktop.common.view.FxmlView)16 Callback (javafx.util.Callback)16 Inject (javax.inject.Inject)16 Coin (org.bitcoinj.core.Coin)16 Tooltip (javafx.scene.control.Tooltip)15 TableView (javafx.scene.control.TableView)14 BSFormatter (bisq.desktop.util.BSFormatter)13