Search in sources :

Example 1 with AnchorPane

use of javafx.scene.layout.AnchorPane in project jphp by jphp-compiler.

the class UXWindow method makeVirtualLayout.

@Signature
public void makeVirtualLayout(Environment env) {
    Parent layout = getLayout(env);
    data(env, "~~virtual-layout", Memory.wrap(env, layout));
    getWrappedObject().getScene().setRoot(new AnchorPane());
}
Also used : Parent(javafx.scene.Parent) AnchorPane(javafx.scene.layout.AnchorPane)

Example 2 with AnchorPane

use of javafx.scene.layout.AnchorPane in project bitsquare by bitsquare.

the class MainView method createFooter.

private AnchorPane createFooter() {
    // line
    Separator separator = new Separator();
    separator.setId("footer-pane-line");
    separator.setPrefHeight(1);
    setLeftAnchor(separator, 0d);
    setRightAnchor(separator, 0d);
    setTopAnchor(separator, 0d);
    // BTC
    Label btcInfoLabel = new Label();
    btcInfoLabel.setId("footer-pane");
    btcInfoLabel.textProperty().bind(model.btcInfo);
    ProgressBar blockchainSyncIndicator = new ProgressBar(-1);
    blockchainSyncIndicator.setPrefWidth(120);
    blockchainSyncIndicator.setMaxHeight(10);
    blockchainSyncIndicator.progressProperty().bind(model.btcSyncProgress);
    model.walletServiceErrorMsg.addListener((ov, oldValue, newValue) -> {
        if (newValue != null) {
            btcInfoLabel.setId("splash-error-state-msg");
            if (btcNetworkWarnMsgPopup == null) {
                btcNetworkWarnMsgPopup = new Popup<>().warning(newValue);
                btcNetworkWarnMsgPopup.show();
            }
        } else {
            btcInfoLabel.setId("footer-pane");
            if (btcNetworkWarnMsgPopup != null)
                btcNetworkWarnMsgPopup.hide();
        }
    });
    model.btcSyncProgress.addListener((ov, oldValue, newValue) -> {
        if ((double) newValue >= 1) {
            blockchainSyncIndicator.setVisible(false);
            blockchainSyncIndicator.setManaged(false);
        }
    });
    HBox blockchainSyncBox = new HBox();
    blockchainSyncBox.setSpacing(10);
    blockchainSyncBox.setAlignment(Pos.CENTER);
    blockchainSyncBox.getChildren().addAll(btcInfoLabel, blockchainSyncIndicator);
    setLeftAnchor(blockchainSyncBox, 10d);
    setBottomAnchor(blockchainSyncBox, 7d);
    // version
    Label versionLabel = new Label();
    versionLabel.setId("footer-pane");
    versionLabel.setTextAlignment(TextAlignment.CENTER);
    versionLabel.setAlignment(Pos.BASELINE_CENTER);
    versionLabel.setText(model.version);
    root.widthProperty().addListener((ov, oldValue, newValue) -> {
        versionLabel.setLayoutX(((double) newValue - versionLabel.getWidth()) / 2);
    });
    setBottomAnchor(versionLabel, 7d);
    // P2P Network
    Label p2PNetworkLabel = new Label();
    p2PNetworkLabel.setId("footer-pane");
    setRightAnchor(p2PNetworkLabel, 33d);
    setBottomAnchor(p2PNetworkLabel, 7d);
    p2PNetworkLabel.textProperty().bind(model.p2PNetworkInfo);
    ImageView p2PNetworkIcon = new ImageView();
    setRightAnchor(p2PNetworkIcon, 10d);
    setBottomAnchor(p2PNetworkIcon, 7d);
    p2PNetworkIcon.setOpacity(0.4);
    p2PNetworkIcon.idProperty().bind(model.p2PNetworkIconId);
    p2PNetworkLabel.idProperty().bind(model.p2pNetworkLabelId);
    model.p2pNetworkWarnMsg.addListener((ov, oldValue, newValue) -> {
        if (newValue != null) {
            p2PNetworkWarnMsgPopup = new Popup<>().warning(newValue);
            p2PNetworkWarnMsgPopup.show();
        } else if (p2PNetworkWarnMsgPopup != null) {
            p2PNetworkWarnMsgPopup.hide();
        }
    });
    model.bootstrapComplete.addListener((observable, oldValue, newValue) -> {
        p2PNetworkIcon.setOpacity(1);
    });
    return new AnchorPane(separator, blockchainSyncBox, versionLabel, p2PNetworkLabel, p2PNetworkIcon) {

        {
            setId("footer-pane");
            setMinHeight(30);
            setMaxHeight(30);
        }
    };
}
Also used : Popup(io.bitsquare.gui.main.overlays.popups.Popup) ImageView(javafx.scene.image.ImageView) AnchorPane(javafx.scene.layout.AnchorPane)

Example 3 with AnchorPane

use of javafx.scene.layout.AnchorPane in project bitsquare by bitsquare.

the class AltCoinAccountsView method buildForm.

///////////////////////////////////////////////////////////////////////////////////////////
// Base form
///////////////////////////////////////////////////////////////////////////////////////////
private void buildForm() {
    addTitledGroupBg(root, gridRow, 1, "Manage accounts");
    Tuple2<Label, ListView> tuple = addLabelListView(root, gridRow, "Your altcoin accounts:", Layout.FIRST_ROW_DISTANCE);
    GridPane.setValignment(tuple.first, VPos.TOP);
    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 Label();

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

                final Button removeButton = new Button("", 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, "Add new account", "Export Accounts", "Import Accounts");
    addAccountButton = tuple3.first;
    exportButton = tuple3.second;
    importButton = tuple3.third;
}
Also used : Button(javafx.scene.control.Button) PaymentAccountFactory(io.bitsquare.payment.PaymentAccountFactory) PaymentMethod(io.bitsquare.payment.PaymentMethod) Popup(io.bitsquare.gui.main.overlays.popups.Popup) ListView(javafx.scene.control.ListView) ListCell(javafx.scene.control.ListCell) TradeCurrency(io.bitsquare.locale.TradeCurrency) Tuple2(io.bitsquare.common.util.Tuple2) PaymentMethodForm(io.bitsquare.gui.components.paymentmethods.PaymentMethodForm) Inject(javax.inject.Inject) PaymentAccount(io.bitsquare.payment.PaymentAccount) Layout(io.bitsquare.gui.util.Layout) VPos(javafx.geometry.VPos) Callback(javafx.util.Callback) GridPane(javafx.scene.layout.GridPane) BSFormatter(io.bitsquare.gui.util.BSFormatter) Label(javafx.scene.control.Label) CryptoCurrency(io.bitsquare.locale.CryptoCurrency) UserThread(io.bitsquare.common.UserThread) ImageUtil(io.bitsquare.gui.util.ImageUtil) io.bitsquare.gui.util.validation(io.bitsquare.gui.util.validation) ActivatableViewAndModel(io.bitsquare.gui.common.view.ActivatableViewAndModel) TimeUnit(java.util.concurrent.TimeUnit) FormBuilder(io.bitsquare.gui.util.FormBuilder) Tuple3(io.bitsquare.common.util.Tuple3) AnchorPane(javafx.scene.layout.AnchorPane) ImageView(javafx.scene.image.ImageView) CryptoCurrencyForm(io.bitsquare.gui.components.paymentmethods.CryptoCurrencyForm) FxmlView(io.bitsquare.gui.common.view.FxmlView) ChangeListener(javafx.beans.value.ChangeListener) TitledGroupBg(io.bitsquare.gui.components.TitledGroupBg) PaymentAccount(io.bitsquare.payment.PaymentAccount) ListCell(javafx.scene.control.ListCell) Label(javafx.scene.control.Label) ListView(javafx.scene.control.ListView) Button(javafx.scene.control.Button) ImageView(javafx.scene.image.ImageView) AnchorPane(javafx.scene.layout.AnchorPane)

Example 4 with AnchorPane

use of javafx.scene.layout.AnchorPane in project bitsquare by bitsquare.

the class ArbitratorSelectionView method addLanguageGroup.

///////////////////////////////////////////////////////////////////////////////////////////
// UI builder
///////////////////////////////////////////////////////////////////////////////////////////
private void addLanguageGroup() {
    addTitledGroupBg(root, gridRow, 1, "Which languages do you speak?");
    Tuple2<Label, ListView> tuple = addLabelListView(root, gridRow, "Your languages:", Layout.FIRST_ROW_DISTANCE);
    GridPane.setValignment(tuple.first, VPos.TOP);
    languagesListView = tuple.second;
    languagesListView.setMinHeight(3 * Layout.LIST_ROW_HEIGHT + 2);
    languagesListView.setMaxHeight(6 * Layout.LIST_ROW_HEIGHT + 2);
    languagesListView.setCellFactory(new Callback<ListView<String>, ListCell<String>>() {

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

                final Label label = new Label();

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

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

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

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

                @Override
                public void updateItem(final String item, boolean empty) {
                    super.updateItem(item, empty);
                    if (item != null && !empty) {
                        label.setText(LanguageUtil.getDisplayName(item));
                        removeButton.setOnAction(e -> onRemoveLanguage(item));
                        setGraphic(pane);
                    } else {
                        setGraphic(null);
                    }
                }
            };
        }
    });
    languageComboBox = addLabelComboBox(root, ++gridRow, "", 15).second;
    languageComboBox.setPromptText("Add language");
    languageComboBox.setConverter(new StringConverter<String>() {

        @Override
        public String toString(String code) {
            return LanguageUtil.getDisplayName(code);
        }

        @Override
        public String fromString(String s) {
            return null;
        }
    });
    languageComboBox.setOnAction(e -> onAddLanguage());
}
Also used : HPos(javafx.geometry.HPos) Popup(io.bitsquare.gui.main.overlays.popups.Popup) javafx.scene.control(javafx.scene.control) TableGroupHeadline(io.bitsquare.gui.components.TableGroupHeadline) UserThread(io.bitsquare.common.UserThread) ImageUtil(io.bitsquare.gui.util.ImageUtil) Tuple2(io.bitsquare.common.util.Tuple2) StringConverter(javafx.util.StringConverter) ActivatableViewAndModel(io.bitsquare.gui.common.view.ActivatableViewAndModel) LanguageUtil(io.bitsquare.locale.LanguageUtil) Inject(javax.inject.Inject) BooleanProperty(javafx.beans.property.BooleanProperty) FormBuilder(io.bitsquare.gui.util.FormBuilder) Insets(javafx.geometry.Insets) ReadOnlyObjectWrapper(javafx.beans.property.ReadOnlyObjectWrapper) ListChangeListener(javafx.collections.ListChangeListener) Layout(io.bitsquare.gui.util.Layout) VPos(javafx.geometry.VPos) AnchorPane(javafx.scene.layout.AnchorPane) ImageView(javafx.scene.image.ImageView) FxmlView(io.bitsquare.gui.common.view.FxmlView) ChangeListener(javafx.beans.value.ChangeListener) Callback(javafx.util.Callback) GridPane(javafx.scene.layout.GridPane) ImageView(javafx.scene.image.ImageView) AnchorPane(javafx.scene.layout.AnchorPane)

Example 5 with AnchorPane

use of javafx.scene.layout.AnchorPane in project bitsquare by bitsquare.

the class FiatAccountsView method buildForm.

///////////////////////////////////////////////////////////////////////////////////////////
// Base form
///////////////////////////////////////////////////////////////////////////////////////////
private void buildForm() {
    addTitledGroupBg(root, gridRow, 1, "Manage accounts");
    Tuple2<Label, ListView> tuple = addLabelListView(root, gridRow, "Your national currency\naccounts:", Layout.FIRST_ROW_DISTANCE);
    GridPane.setValignment(tuple.first, VPos.TOP);
    tuple.first.setTextAlignment(TextAlignment.RIGHT);
    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 Label();

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

                final Button removeButton = new Button("", 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, "Add new account", "Export Accounts", "Import Accounts");
    addAccountButton = tuple3.first;
    exportButton = tuple3.second;
    importButton = tuple3.third;
}
Also used : PaymentAccountFactory(io.bitsquare.payment.PaymentAccountFactory) PaymentMethod(io.bitsquare.payment.PaymentMethod) Popup(io.bitsquare.gui.main.overlays.popups.Popup) javafx.scene.control(javafx.scene.control) ClearXchangeAccount(io.bitsquare.payment.ClearXchangeAccount) FXCollections(javafx.collections.FXCollections) Tuple2(io.bitsquare.common.util.Tuple2) Inject(javax.inject.Inject) PaymentAccount(io.bitsquare.payment.PaymentAccount) Layout(io.bitsquare.gui.util.Layout) VPos(javafx.geometry.VPos) TextAlignment(javafx.scene.text.TextAlignment) Callback(javafx.util.Callback) io.bitsquare.gui.components.paymentmethods(io.bitsquare.gui.components.paymentmethods) GridPane(javafx.scene.layout.GridPane) BSFormatter(io.bitsquare.gui.util.BSFormatter) UserThread(io.bitsquare.common.UserThread) ImageUtil(io.bitsquare.gui.util.ImageUtil) io.bitsquare.gui.util.validation(io.bitsquare.gui.util.validation) StringConverter(javafx.util.StringConverter) ActivatableViewAndModel(io.bitsquare.gui.common.view.ActivatableViewAndModel) Collectors(java.util.stream.Collectors) TimeUnit(java.util.concurrent.TimeUnit) FormBuilder(io.bitsquare.gui.util.FormBuilder) List(java.util.List) Tuple3(io.bitsquare.common.util.Tuple3) AnchorPane(javafx.scene.layout.AnchorPane) ImageView(javafx.scene.image.ImageView) FxmlView(io.bitsquare.gui.common.view.FxmlView) ChangeListener(javafx.beans.value.ChangeListener) BSResources(io.bitsquare.locale.BSResources) TitledGroupBg(io.bitsquare.gui.components.TitledGroupBg) PaymentAccount(io.bitsquare.payment.PaymentAccount) ImageView(javafx.scene.image.ImageView) AnchorPane(javafx.scene.layout.AnchorPane)

Aggregations

AnchorPane (javafx.scene.layout.AnchorPane)65 IOException (java.io.IOException)26 Scene (javafx.scene.Scene)23 FXMLLoader (javafx.fxml.FXMLLoader)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 Pane (javafx.scene.layout.Pane)14 URL (java.net.URL)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