Search in sources :

Example 1 with Tuple3

use of io.bitsquare.common.util.Tuple3 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 2 with Tuple3

use of io.bitsquare.common.util.Tuple3 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)

Example 3 with Tuple3

use of io.bitsquare.common.util.Tuple3 in project bitsquare by bitsquare.

the class FormBuilder method addLabelComboBoxButton.

public static Tuple3<Label, ComboBox, Button> addLabelComboBoxButton(GridPane gridPane, int rowIndex, String title, String buttonTitle, double top) {
    Label label = addLabel(gridPane, rowIndex, title, top);
    HBox hBox = new HBox();
    hBox.setSpacing(10);
    Button button = new Button(buttonTitle);
    button.setDefaultButton(true);
    ComboBox comboBox = new ComboBox();
    hBox.getChildren().addAll(comboBox, button);
    GridPane.setRowIndex(hBox, rowIndex);
    GridPane.setColumnIndex(hBox, 1);
    GridPane.setMargin(hBox, new Insets(top, 0, 0, 0));
    gridPane.getChildren().add(hBox);
    return new Tuple3<>(label, comboBox, button);
}
Also used : Insets(javafx.geometry.Insets) Tuple3(io.bitsquare.common.util.Tuple3)

Example 4 with Tuple3

use of io.bitsquare.common.util.Tuple3 in project bitsquare by bitsquare.

the class FormBuilder method addButtonBusyAnimationLabel.

public static Tuple3<Button, BusyAnimation, Label> addButtonBusyAnimationLabel(GridPane gridPane, int rowIndex, String buttonTitle, double top) {
    HBox hBox = new HBox();
    hBox.setSpacing(10);
    Button button = new Button(buttonTitle);
    button.setDefaultButton(true);
    BusyAnimation busyAnimation = new BusyAnimation(false);
    Label label = new Label();
    hBox.setAlignment(Pos.CENTER_LEFT);
    hBox.getChildren().addAll(button, busyAnimation, label);
    GridPane.setRowIndex(hBox, rowIndex);
    GridPane.setColumnIndex(hBox, 1);
    GridPane.setMargin(hBox, new Insets(top, 0, 0, 0));
    gridPane.getChildren().add(hBox);
    return new Tuple3<>(button, busyAnimation, label);
}
Also used : Insets(javafx.geometry.Insets) Tuple3(io.bitsquare.common.util.Tuple3)

Example 5 with Tuple3

use of io.bitsquare.common.util.Tuple3 in project bitsquare by bitsquare.

the class FormBuilder method addLabelInputTextFieldCheckBox.

///////////////////////////////////////////////////////////////////////////////////////////
// Label  + InputTextField + CheckBox
///////////////////////////////////////////////////////////////////////////////////////////
public static Tuple3<Label, InputTextField, CheckBox> addLabelInputTextFieldCheckBox(GridPane gridPane, int rowIndex, String title, String checkBoxTitle) {
    Label label = addLabel(gridPane, rowIndex, title, 0);
    InputTextField inputTextField = new InputTextField();
    CheckBox checkBox = new CheckBox(checkBoxTitle);
    HBox.setMargin(checkBox, new Insets(4, 0, 0, 0));
    HBox hBox = new HBox();
    hBox.setSpacing(10);
    hBox.getChildren().addAll(inputTextField, checkBox);
    GridPane.setRowIndex(hBox, rowIndex);
    GridPane.setColumnIndex(hBox, 1);
    gridPane.getChildren().add(hBox);
    return new Tuple3<>(label, inputTextField, checkBox);
}
Also used : Insets(javafx.geometry.Insets) Tuple3(io.bitsquare.common.util.Tuple3)

Aggregations

Tuple3 (io.bitsquare.common.util.Tuple3)10 Insets (javafx.geometry.Insets)8 ImageView (javafx.scene.image.ImageView)4 AnchorPane (javafx.scene.layout.AnchorPane)4 UserThread (io.bitsquare.common.UserThread)3 Tuple2 (io.bitsquare.common.util.Tuple2)3 Popup (io.bitsquare.gui.main.overlays.popups.Popup)3 BSFormatter (io.bitsquare.gui.util.BSFormatter)3 ChangeListener (javafx.beans.value.ChangeListener)3 Inject (javax.inject.Inject)3 ActivatableViewAndModel (io.bitsquare.gui.common.view.ActivatableViewAndModel)2 FxmlView (io.bitsquare.gui.common.view.FxmlView)2 TitledGroupBg (io.bitsquare.gui.components.TitledGroupBg)2 FormBuilder (io.bitsquare.gui.util.FormBuilder)2 ImageUtil (io.bitsquare.gui.util.ImageUtil)2 Layout (io.bitsquare.gui.util.Layout)2 io.bitsquare.gui.util.validation (io.bitsquare.gui.util.validation)2 PaymentAccount (io.bitsquare.payment.PaymentAccount)2 PaymentAccountFactory (io.bitsquare.payment.PaymentAccountFactory)2 PaymentMethod (io.bitsquare.payment.PaymentMethod)2