Search in sources :

Example 51 with AnchorPane

use of javafx.scene.layout.AnchorPane in project bisq-desktop by bisq-network.

the class AltCoinAccountsView method buildForm.

// /////////////////////////////////////////////////////////////////////////////////////////
// Base form
// /////////////////////////////////////////////////////////////////////////////////////////
private void buildForm() {
    addTitledGroupBg(root, gridRow, 1, Res.get("shared.manageAccounts"));
    Tuple2<Label, ListView> tuple = addLabelListView(root, gridRow, Res.get("account.altcoin.yourAltcoinAccounts"), Layout.FIRST_ROW_DISTANCE);
    GridPane.setValignment(tuple.first, VPos.TOP);
    // noinspection unchecked
    paymentAccountsListView = tuple.second;
    paymentAccountsListView.setPrefHeight(2 * Layout.LIST_ROW_HEIGHT + 14);
    paymentAccountsListView.setCellFactory(new Callback<ListView<PaymentAccount>, ListCell<PaymentAccount>>() {

        @Override
        public ListCell<PaymentAccount> call(ListView<PaymentAccount> list) {
            return new ListCell<PaymentAccount>() {

                final Label label = new AutoTooltipLabel();

                final ImageView icon = ImageUtil.getImageViewById(ImageUtil.REMOVE_ICON);

                final Button removeButton = new AutoTooltipButton("", icon);

                final AnchorPane pane = new AnchorPane(label, removeButton);

                {
                    label.setLayoutY(5);
                    removeButton.setId("icon-button");
                    AnchorPane.setRightAnchor(removeButton, 0d);
                }

                @Override
                public void updateItem(final PaymentAccount item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item != null && !empty) {
                        label.setText(item.getAccountName());
                        removeButton.setOnAction(e -> onDeleteAccount(item));
                        setGraphic(pane);
                    } else {
                        setGraphic(null);
                    }
                }
            };
        }
    });
    Tuple3<Button, Button, Button> tuple3 = add3ButtonsAfterGroup(root, ++gridRow, Res.get("shared.addNewAccount"), Res.get("shared.ExportAccounts"), Res.get("shared.importAccounts"));
    addAccountButton = tuple3.first;
    exportButton = tuple3.second;
    importButton = tuple3.third;
}
Also used : Button(javafx.scene.control.Button) TradeCurrency(bisq.core.locale.TradeCurrency) ListView(javafx.scene.control.ListView) ListCell(javafx.scene.control.ListCell) Layout(bisq.desktop.util.Layout) FxmlView(bisq.desktop.common.view.FxmlView) BSFormatter(bisq.desktop.util.BSFormatter) AltCoinAddressValidator(bisq.core.payment.validation.AltCoinAddressValidator) Inject(javax.inject.Inject) PaymentAccountFactory(bisq.core.payment.PaymentAccountFactory) Tuple2(bisq.common.util.Tuple2) CryptoCurrencyForm(bisq.desktop.components.paymentmethods.CryptoCurrencyForm) Tuple3(bisq.common.util.Tuple3) VPos(javafx.geometry.VPos) Res(bisq.core.locale.Res) Callback(javafx.util.Callback) TitledGroupBg(bisq.desktop.components.TitledGroupBg) GridPane(javafx.scene.layout.GridPane) FormBuilder.addLabelListView(bisq.desktop.util.FormBuilder.addLabelListView) FormBuilder.add3ButtonsAfterGroup(bisq.desktop.util.FormBuilder.add3ButtonsAfterGroup) Popup(bisq.desktop.main.overlays.popups.Popup) Label(javafx.scene.control.Label) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) FormBuilder.addTitledGroupBg(bisq.desktop.util.FormBuilder.addTitledGroupBg) FormBuilder(bisq.desktop.util.FormBuilder) PaymentMethod(bisq.core.payment.payload.PaymentMethod) AccountAgeWitnessService(bisq.core.payment.AccountAgeWitnessService) TimeUnit(java.util.concurrent.TimeUnit) PaymentMethodForm(bisq.desktop.components.paymentmethods.PaymentMethodForm) PaymentAccount(bisq.core.payment.PaymentAccount) InputValidator(bisq.core.util.validation.InputValidator) FormBuilder.add2ButtonsAfterGroup(bisq.desktop.util.FormBuilder.add2ButtonsAfterGroup) CryptoCurrency(bisq.core.locale.CryptoCurrency) ImageUtil(bisq.desktop.util.ImageUtil) AnchorPane(javafx.scene.layout.AnchorPane) ImageView(javafx.scene.image.ImageView) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) UserThread(bisq.common.UserThread) ActivatableViewAndModel(bisq.desktop.common.view.ActivatableViewAndModel) ChangeListener(javafx.beans.value.ChangeListener) PaymentAccount(bisq.core.payment.PaymentAccount) ListCell(javafx.scene.control.ListCell) Label(javafx.scene.control.Label) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) ListView(javafx.scene.control.ListView) FormBuilder.addLabelListView(bisq.desktop.util.FormBuilder.addLabelListView) Button(javafx.scene.control.Button) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) ImageView(javafx.scene.image.ImageView) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) AnchorPane(javafx.scene.layout.AnchorPane)

Example 52 with AnchorPane

use of javafx.scene.layout.AnchorPane in project bisq-desktop by bisq-network.

the class SeparatedPhaseBars method addLabels.

private void addLabels() {
    Label titleLabel = new Label(Res.get("dao.proposal.active.phase"));
    Label startLabel = new Label(Res.get("dao.proposal.active.startBlock"));
    AnchorPane startLabelPane = new AnchorPane();
    AnchorPane.setLeftAnchor(startLabel, 0d);
    startLabelPane.getChildren().add(startLabel);
    Label endLabel = new Label(Res.get("dao.proposal.active.endBlock"));
    AnchorPane endLabelPane = new AnchorPane();
    AnchorPane.setRightAnchor(endLabel, 0d);
    endLabelPane.getChildren().add(endLabel);
    ProgressBar progressBar = new ProgressBar();
    progressBar.setMinHeight(9);
    progressBar.setMaxHeight(9);
    progressBar.setVisible(false);
    vBoxLabels = new VBox();
    vBoxLabels.setSpacing(5);
    vBoxLabels.getChildren().addAll(titleLabel, progressBar, startLabelPane, endLabelPane);
    vBoxLabels.setAlignment(Pos.CENTER);
    vBoxLabels.setPadding(new Insets(0, 10, 0, 0));
    getChildren().add(vBoxLabels);
}
Also used : Insets(javafx.geometry.Insets) Label(javafx.scene.control.Label) AnchorPane(javafx.scene.layout.AnchorPane) ProgressBar(javafx.scene.control.ProgressBar) VBox(javafx.scene.layout.VBox)

Example 53 with AnchorPane

use of javafx.scene.layout.AnchorPane in project bisq-desktop by bisq-network.

the class PreferencesView method initializeDisplayCurrencies.

private void initializeDisplayCurrencies() {
    TitledGroupBg titledGroupBg = addTitledGroupBg(root, ++gridRow, 3, Res.get("setting.preferences.currenciesInList"), Layout.GROUP_DISTANCE);
    GridPane.setColumnSpan(titledGroupBg, 4);
    // noinspection unchecked
    preferredTradeCurrencyComboBox = addLabelComboBox(root, gridRow, Res.get("setting.preferences.prefCurrency"), Layout.FIRST_ROW_AND_GROUP_DISTANCE).second;
    preferredTradeCurrencyComboBox.setConverter(new StringConverter<TradeCurrency>() {

        @Override
        public String toString(TradeCurrency tradeCurrency) {
            // http://boschista.deviantart.com/journal/Cool-ASCII-Symbols-214218618
            return tradeCurrency.getDisplayPrefix() + tradeCurrency.getNameAndCode();
        }

        @Override
        public TradeCurrency fromString(String s) {
            return null;
        }
    });
    Tuple2<Label, ListView> fiatTuple = addLabelListView(root, ++gridRow, Res.get("setting.preferences.displayFiat"));
    GridPane.setValignment(fiatTuple.first, VPos.TOP);
    // noinspection unchecked
    fiatCurrenciesListView = fiatTuple.second;
    fiatCurrenciesListView.setMinHeight(2 * Layout.LIST_ROW_HEIGHT + 2);
    fiatCurrenciesListView.setPrefHeight(3 * Layout.LIST_ROW_HEIGHT + 2);
    Label placeholder = new AutoTooltipLabel(Res.get("setting.preferences.noFiat"));
    placeholder.setWrapText(true);
    fiatCurrenciesListView.setPlaceholder(placeholder);
    fiatCurrenciesListView.setCellFactory(new Callback<ListView<FiatCurrency>, ListCell<FiatCurrency>>() {

        @Override
        public ListCell<FiatCurrency> call(ListView<FiatCurrency> list) {
            return new ListCell<FiatCurrency>() {

                final Label label = new AutoTooltipLabel();

                final ImageView icon = ImageUtil.getImageViewById(ImageUtil.REMOVE_ICON);

                final Button removeButton = new AutoTooltipButton("", icon);

                final AnchorPane pane = new AnchorPane(label, removeButton);

                {
                    label.setLayoutY(5);
                    removeButton.setId("icon-button");
                    AnchorPane.setRightAnchor(removeButton, 0d);
                }

                @Override
                public void updateItem(final FiatCurrency item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item != null && !empty) {
                        label.setText(item.getNameAndCode());
                        removeButton.setOnAction(e -> {
                            if (item.equals(preferences.getPreferredTradeCurrency())) {
                                new Popup<>().warning(Res.get("setting.preferences.cannotRemovePrefCurrency")).show();
                            } else {
                                preferences.removeFiatCurrency(item);
                                if (!allFiatCurrencies.contains(item))
                                    allFiatCurrencies.add(item);
                            }
                        });
                        setGraphic(pane);
                    } else {
                        setGraphic(null);
                        removeButton.setOnAction(null);
                    }
                }
            };
        }
    });
    Tuple2<Label, ListView> cryptoCurrenciesTuple = addLabelListView(root, gridRow, Res.get("setting.preferences.displayAltcoins"));
    GridPane.setValignment(cryptoCurrenciesTuple.first, VPos.TOP);
    GridPane.setMargin(cryptoCurrenciesTuple.first, new Insets(0, 0, 0, 20));
    // noinspection unchecked
    cryptoCurrenciesListView = cryptoCurrenciesTuple.second;
    GridPane.setColumnIndex(cryptoCurrenciesTuple.first, 2);
    GridPane.setColumnIndex(cryptoCurrenciesListView, 3);
    cryptoCurrenciesListView.setMinHeight(2 * Layout.LIST_ROW_HEIGHT + 2);
    cryptoCurrenciesListView.setPrefHeight(3 * Layout.LIST_ROW_HEIGHT + 2);
    placeholder = new AutoTooltipLabel(Res.get("setting.preferences.noAltcoins"));
    placeholder.setWrapText(true);
    cryptoCurrenciesListView.setPlaceholder(placeholder);
    cryptoCurrenciesListView.setCellFactory(new Callback<ListView<CryptoCurrency>, ListCell<CryptoCurrency>>() {

        @Override
        public ListCell<CryptoCurrency> call(ListView<CryptoCurrency> list) {
            return new ListCell<CryptoCurrency>() {

                final Label label = new AutoTooltipLabel();

                final ImageView icon = ImageUtil.getImageViewById(ImageUtil.REMOVE_ICON);

                final Button removeButton = new AutoTooltipButton("", icon);

                final AnchorPane pane = new AnchorPane(label, removeButton);

                {
                    label.setLayoutY(5);
                    removeButton.setId("icon-button");
                    AnchorPane.setRightAnchor(removeButton, 0d);
                }

                @Override
                public void updateItem(final CryptoCurrency item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item != null && !empty) {
                        label.setText(item.getNameAndCode());
                        removeButton.setOnAction(e -> {
                            if (item.equals(preferences.getPreferredTradeCurrency())) {
                                new Popup<>().warning(Res.get("setting.preferences.cannotRemovePrefCurrency")).show();
                            } else {
                                preferences.removeCryptoCurrency(item);
                                if (!allCryptoCurrencies.contains(item))
                                    allCryptoCurrencies.add(item);
                            }
                        });
                        setGraphic(pane);
                    } else {
                        setGraphic(null);
                        removeButton.setOnAction(null);
                    }
                }
            };
        }
    });
    // noinspection unchecked
    fiatCurrenciesComboBox = addLabelComboBox(root, ++gridRow).second;
    fiatCurrenciesComboBox.setPromptText(Res.get("setting.preferences.addFiat"));
    fiatCurrenciesComboBox.setConverter(new StringConverter<FiatCurrency>() {

        @Override
        public String toString(FiatCurrency tradeCurrency) {
            return tradeCurrency.getNameAndCode();
        }

        @Override
        public FiatCurrency fromString(String s) {
            return null;
        }
    });
    Tuple2<Label, ComboBox> labelComboBoxTuple2 = addLabelComboBox(root, gridRow);
    // noinspection unchecked
    cryptoCurrenciesComboBox = labelComboBoxTuple2.second;
    GridPane.setColumnIndex(cryptoCurrenciesComboBox, 3);
    cryptoCurrenciesComboBox.setPromptText(Res.get("setting.preferences.addAltcoin"));
    cryptoCurrenciesComboBox.setConverter(new StringConverter<CryptoCurrency>() {

        @Override
        public String toString(CryptoCurrency tradeCurrency) {
            return tradeCurrency.getNameAndCode();
        }

        @Override
        public CryptoCurrency fromString(String s) {
            return null;
        }
    });
}
Also used : Button(javafx.scene.control.Button) Arrays(java.util.Arrays) Coin(org.bitcoinj.core.Coin) ListCell(javafx.scene.control.ListCell) Layout(bisq.desktop.util.Layout) StringUtils(org.apache.commons.lang3.StringUtils) BSFormatter(bisq.desktop.util.BSFormatter) InputTextField(bisq.desktop.components.InputTextField) ComboBox(javafx.scene.control.ComboBox) Res(bisq.core.locale.Res) BisqApp(bisq.desktop.app.BisqApp) Popup(bisq.desktop.main.overlays.popups.Popup) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) FormBuilder(bisq.desktop.util.FormBuilder) BlockChainExplorer(bisq.core.user.BlockChainExplorer) BaseCurrencyNetwork(bisq.core.btc.BaseCurrencyNetwork) Collectors(java.util.stream.Collectors) List(java.util.List) CryptoCurrency(bisq.core.locale.CryptoCurrency) DevEnv(bisq.common.app.DevEnv) AnchorPane(javafx.scene.layout.AnchorPane) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) Preferences(bisq.core.user.Preferences) UserThread(bisq.common.UserThread) CountryUtil(bisq.core.locale.CountryUtil) Activatable(bisq.desktop.common.model.Activatable) FeeService(bisq.core.provider.fee.FeeService) ObservableList(javafx.collections.ObservableList) TradeCurrency(bisq.core.locale.TradeCurrency) ListView(javafx.scene.control.ListView) FXCollections(javafx.collections.FXCollections) FiatCurrency(bisq.core.locale.FiatCurrency) FxmlView(bisq.desktop.common.view.FxmlView) Inject(javax.inject.Inject) Tuple2(bisq.common.util.Tuple2) Tuple3(bisq.common.util.Tuple3) Insets(javafx.geometry.Insets) Country(bisq.core.locale.Country) VPos(javafx.geometry.VPos) CurrencyUtil(bisq.core.locale.CurrencyUtil) Callback(javafx.util.Callback) TitledGroupBg(bisq.desktop.components.TitledGroupBg) GridPane(javafx.scene.layout.GridPane) Label(javafx.scene.control.Label) CheckBox(javafx.scene.control.CheckBox) BisqEnvironment(bisq.core.app.BisqEnvironment) StringConverter(javafx.util.StringConverter) TimeUnit(java.util.concurrent.TimeUnit) ImageUtil(bisq.desktop.util.ImageUtil) ImageView(javafx.scene.image.ImageView) LanguageUtil(bisq.core.locale.LanguageUtil) ActivatableViewAndModel(bisq.desktop.common.view.ActivatableViewAndModel) ChangeListener(javafx.beans.value.ChangeListener) Insets(javafx.geometry.Insets) ListCell(javafx.scene.control.ListCell) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) Label(javafx.scene.control.Label) CryptoCurrency(bisq.core.locale.CryptoCurrency) ListView(javafx.scene.control.ListView) Button(javafx.scene.control.Button) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) FiatCurrency(bisq.core.locale.FiatCurrency) ImageView(javafx.scene.image.ImageView) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) AnchorPane(javafx.scene.layout.AnchorPane) TradeCurrency(bisq.core.locale.TradeCurrency) ComboBox(javafx.scene.control.ComboBox) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) TitledGroupBg(bisq.desktop.components.TitledGroupBg)

Example 54 with AnchorPane

use of javafx.scene.layout.AnchorPane in project RIS-PACS by KyleRemil.

the class LoginController method changeView.

private void changeView() {
    System.out.println("Login succeeded!");
    try {
        AnchorPane root = FXMLLoader.load(getClass().getResource("../view/FrameView.fxml"));
        Stage stage = (Stage) button_login.getScene().getWindow();
        Scene scene = new Scene(root);
        stage.setScene(scene);
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
Also used : Stage(javafx.stage.Stage) IOException(java.io.IOException) Scene(javafx.scene.Scene) AnchorPane(javafx.scene.layout.AnchorPane)

Example 55 with AnchorPane

use of javafx.scene.layout.AnchorPane in project RIS-PACS by KyleRemil.

the class TechnicianController method openProcedureView.

public void openProcedureView() {
    try {
        AnchorPane root = (AnchorPane) FXMLLoader.load(getClass().getResource("/com/rispacs/view/ProcedureView.fxml"));
        Stage stage = new Stage();
        stage.setTitle("Procedure");
        stage.setScene(new Scene(root));
        stage.show();
    } catch (IOException e) {
        e.printStackTrace();
    }
}
Also used : Stage(javafx.stage.Stage) IOException(java.io.IOException) Scene(javafx.scene.Scene) AnchorPane(javafx.scene.layout.AnchorPane)

Aggregations

AnchorPane (javafx.scene.layout.AnchorPane)64 IOException (java.io.IOException)26 FXMLLoader (javafx.fxml.FXMLLoader)22 Scene (javafx.scene.Scene)22 ChangeListener (javafx.beans.value.ChangeListener)18 Label (javafx.scene.control.Label)16 ImageView (javafx.scene.image.ImageView)16 FXML (javafx.fxml.FXML)15 Insets (javafx.geometry.Insets)15 URL (java.net.URL)13 Pane (javafx.scene.layout.Pane)13 GridPane (javafx.scene.layout.GridPane)12 Inject (javax.inject.Inject)12 JFXButton (com.jfoenix.controls.JFXButton)11 ResourceBundle (java.util.ResourceBundle)11 KeyFrame (javafx.animation.KeyFrame)11 Timeline (javafx.animation.Timeline)11 Initializable (javafx.fxml.Initializable)11 Duration (javafx.util.Duration)11 Button (javafx.scene.control.Button)10