Search in sources :

Example 26 with ComboBox

use of javafx.scene.control.ComboBox in project Smartcity-Smarthouse by TechnionYP5777.

the class MessageViewController method buildMessage.

@SuppressWarnings("unchecked")
void buildMessage() {
    String message = "";
    for (final SensorField field : singleFieldMap.keySet()) {
        message += " " + field.getName() + " ";
        if (field.getType() == Types.BOOLEAN)
            message += ((ComboBox<BooleanValues>) singleFieldMap.get(field)).getValue();
        else {
            final String Input = ((TextField) singleFieldMap.get(field)).getText();
            if (!validateInput(Input, field.getType()))
                return;
            message += Input;
        }
    }
    message += "\n";
    showMessage(message);
}
Also used : SensorField(il.ac.technion.cs.smarthouse.simulator.model.SensorField) ComboBox(javafx.scene.control.ComboBox) TextField(javafx.scene.control.TextField)

Example 27 with ComboBox

use of javafx.scene.control.ComboBox in project Smartcity-Smarthouse by TechnionYP5777.

the class MessageViewController method buildSingleModePane.

void buildSingleModePane() {
    singleFieldMap = new HashMap<>();
    int currentRow = 0;
    singleMode.add(new Label("Name"), 0, currentRow);
    singleMode.add(new Label("Value"), 1, currentRow++);
    for (final SensorField ¢ : currentSensor.getFields()) {
        singleMode.add(new Label(¢.getName()), 0, currentRow);
        if (¢.getType() != Types.BOOLEAN) {
            final TextField t = new TextField();
            singleMode.add(t, 1, currentRow);
            singleFieldMap.put(¢, t);
        } else {
            final ComboBox<BooleanValues> b = new ComboBox<>();
            b.getItems().addAll(BooleanValues.values());
            singleMode.add(b, 1, currentRow);
            singleFieldMap.put(¢, b);
        }
        ++currentRow;
    }
}
Also used : SensorField(il.ac.technion.cs.smarthouse.simulator.model.SensorField) ComboBox(javafx.scene.control.ComboBox) Label(javafx.scene.control.Label) TextField(javafx.scene.control.TextField)

Example 28 with ComboBox

use of javafx.scene.control.ComboBox in project bitsquare by bitsquare.

the class BankForm method addFormForAddAccount.

@Override
public void addFormForAddAccount() {
    gridRowFrom = gridRow + 1;
    Tuple3<Label, ComboBox, ComboBox> tuple3 = addLabelComboBoxComboBox(gridPane, ++gridRow, "Country:");
    ComboBox<Region> regionComboBox = tuple3.second;
    regionComboBox.setPromptText("Select region");
    regionComboBox.setConverter(new StringConverter<Region>() {

        @Override
        public String toString(Region region) {
            return region.name;
        }

        @Override
        public Region fromString(String s) {
            return null;
        }
    });
    regionComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllRegions()));
    ComboBox<Country> countryComboBox = tuple3.third;
    countryComboBox.setVisibleRowCount(15);
    countryComboBox.setDisable(true);
    countryComboBox.setPromptText("Select country");
    countryComboBox.setConverter(new StringConverter<Country>() {

        @Override
        public String toString(Country country) {
            return country.name + " (" + country.code + ")";
        }

        @Override
        public Country fromString(String s) {
            return null;
        }
    });
    countryComboBox.setOnAction(e -> {
        Country selectedItem = countryComboBox.getSelectionModel().getSelectedItem();
        if (selectedItem != null) {
            if (selectedItem.code.equals("US")) {
                new Popup<>().information("Bank transfer with WIRE or ACH is not supported for the US because WIRE is too expensive and ACH has a high chargeback risk.\n\n" + "Please use payment methods \"ClearXchange\", \"US Postal Money Order\" or \"Cash/ATM Deposit\" instead.").onClose(() -> closeHandler.run()).show();
            } else {
                getCountryBasedPaymentAccount().setCountry(selectedItem);
                String countryCode = selectedItem.code;
                TradeCurrency currency = CurrencyUtil.getCurrencyByCountryCode(countryCode);
                paymentAccount.setSingleTradeCurrency(currency);
                currencyComboBox.setDisable(false);
                currencyComboBox.getSelectionModel().select(currency);
                bankIdLabel.setText(BankUtil.getBankIdLabel(countryCode));
                branchIdLabel.setText(BankUtil.getBranchIdLabel(countryCode));
                accountNrLabel.setText(BankUtil.getAccountNrLabel(countryCode));
                accountTypeLabel.setText(BankUtil.getAccountTypeLabel(countryCode));
                bankNameInputTextField.setText("");
                bankIdInputTextField.setText("");
                branchIdInputTextField.setText("");
                accountNrInputTextField.setText("");
                accountTypeComboBox.getSelectionModel().clearSelection();
                accountTypeComboBox.setItems(FXCollections.observableArrayList(BankUtil.getAccountTypeValues(countryCode)));
                if (BankUtil.useValidation(countryCode) && !validatorsApplied) {
                    validatorsApplied = true;
                    if (useHolderID)
                        holderIdInputTextField.setValidator(inputValidator);
                    bankNameInputTextField.setValidator(inputValidator);
                    bankIdInputTextField.setValidator(new BankIdValidator(countryCode));
                    branchIdInputTextField.setValidator(new BranchIdValidator(countryCode));
                    accountNrInputTextField.setValidator(new AccountNrValidator(countryCode));
                } else {
                    validatorsApplied = false;
                    if (useHolderID)
                        holderIdInputTextField.setValidator(null);
                    bankNameInputTextField.setValidator(null);
                    bankIdInputTextField.setValidator(null);
                    branchIdInputTextField.setValidator(null);
                    accountNrInputTextField.setValidator(null);
                }
                holderNameInputTextField.resetValidation();
                bankNameInputTextField.resetValidation();
                bankIdInputTextField.resetValidation();
                branchIdInputTextField.resetValidation();
                accountNrInputTextField.resetValidation();
                boolean requiresHolderId = BankUtil.isHolderIdRequired(countryCode);
                if (requiresHolderId) {
                    holderNameInputTextField.minWidthProperty().unbind();
                    holderNameInputTextField.setMinWidth(300);
                } else {
                    holderNameInputTextField.minWidthProperty().bind(currencyComboBox.widthProperty());
                }
                if (useHolderID) {
                    if (!requiresHolderId)
                        holderIdInputTextField.setText("");
                    holderIdInputTextField.resetValidation();
                    holderIdInputTextField.setVisible(requiresHolderId);
                    holderIdInputTextField.setManaged(requiresHolderId);
                    holderIdLabel.setText(BankUtil.getHolderIdLabel(countryCode));
                    holderIdLabel.setVisible(requiresHolderId);
                    holderIdLabel.setManaged(requiresHolderId);
                }
                boolean bankNameRequired = BankUtil.isBankNameRequired(countryCode);
                bankNameTuple.first.setVisible(bankNameRequired);
                bankNameTuple.first.setManaged(bankNameRequired);
                bankNameInputTextField.setVisible(bankNameRequired);
                bankNameInputTextField.setManaged(bankNameRequired);
                boolean bankIdRequired = BankUtil.isBankIdRequired(countryCode);
                bankIdTuple.first.setVisible(bankIdRequired);
                bankIdTuple.first.setManaged(bankIdRequired);
                bankIdInputTextField.setVisible(bankIdRequired);
                bankIdInputTextField.setManaged(bankIdRequired);
                boolean branchIdRequired = BankUtil.isBranchIdRequired(countryCode);
                branchIdTuple.first.setVisible(branchIdRequired);
                branchIdTuple.first.setManaged(branchIdRequired);
                branchIdInputTextField.setVisible(branchIdRequired);
                branchIdInputTextField.setManaged(branchIdRequired);
                boolean accountNrRequired = BankUtil.isAccountNrRequired(countryCode);
                accountNrTuple.first.setVisible(accountNrRequired);
                accountNrTuple.first.setManaged(accountNrRequired);
                accountNrInputTextField.setVisible(accountNrRequired);
                accountNrInputTextField.setManaged(accountNrRequired);
                boolean accountTypeRequired = BankUtil.isAccountTypeRequired(countryCode);
                accountTypeTuple.first.setVisible(accountTypeRequired);
                accountTypeTuple.first.setManaged(accountTypeRequired);
                accountTypeTuple.second.setVisible(accountTypeRequired);
                accountTypeTuple.second.setManaged(accountTypeRequired);
                updateFromInputs();
                onCountryChanged();
            }
        }
    });
    regionComboBox.setOnAction(e -> {
        Region selectedItem = regionComboBox.getSelectionModel().getSelectedItem();
        if (selectedItem != null) {
            countryComboBox.setDisable(false);
            countryComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllCountriesForRegion(selectedItem)));
        }
    });
    currencyComboBox = addLabelComboBox(gridPane, ++gridRow, "Currency:").second;
    currencyComboBox.setPromptText("Select currency");
    currencyComboBox.setItems(FXCollections.observableArrayList(CurrencyUtil.getAllSortedFiatCurrencies()));
    currencyComboBox.setOnAction(e -> {
        TradeCurrency selectedItem = currencyComboBox.getSelectionModel().getSelectedItem();
        FiatCurrency defaultCurrency = CurrencyUtil.getCurrencyByCountryCode(countryComboBox.getSelectionModel().getSelectedItem().code);
        if (!defaultCurrency.equals(selectedItem)) {
            new Popup<>().warning("Are you sure you want to choose a currency other than the country's default currency?").actionButtonText("Yes").onAction(() -> {
                paymentAccount.setSingleTradeCurrency(selectedItem);
                autoFillNameTextField();
            }).closeButtonText("No, restore default currency").onClose(() -> currencyComboBox.getSelectionModel().select(defaultCurrency)).show();
        } else {
            paymentAccount.setSingleTradeCurrency(selectedItem);
            autoFillNameTextField();
        }
    });
    currencyComboBox.setConverter(new StringConverter<TradeCurrency>() {

        @Override
        public String toString(TradeCurrency currency) {
            return currency.getNameAndCode();
        }

        @Override
        public TradeCurrency fromString(String string) {
            return null;
        }
    });
    currencyComboBox.setDisable(true);
    addAcceptedBanksForAddAccount();
    addHolderNameAndId();
    bankNameTuple = addLabelInputTextField(gridPane, ++gridRow, "Bank name:");
    bankNameInputTextField = bankNameTuple.second;
    bankNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        bankAccountContractData.setBankName(newValue);
        updateFromInputs();
    });
    bankIdTuple = addLabelInputTextField(gridPane, ++gridRow, BankUtil.getBankIdLabel(""));
    bankIdLabel = bankIdTuple.first;
    bankIdInputTextField = bankIdTuple.second;
    bankIdInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        bankAccountContractData.setBankId(newValue);
        updateFromInputs();
    });
    branchIdTuple = addLabelInputTextField(gridPane, ++gridRow, BankUtil.getBranchIdLabel(""));
    branchIdLabel = branchIdTuple.first;
    branchIdInputTextField = branchIdTuple.second;
    branchIdInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        bankAccountContractData.setBranchId(newValue);
        updateFromInputs();
    });
    accountNrTuple = addLabelInputTextField(gridPane, ++gridRow, BankUtil.getAccountNrLabel(""));
    accountNrLabel = accountNrTuple.first;
    accountNrInputTextField = accountNrTuple.second;
    accountNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> {
        bankAccountContractData.setAccountNr(newValue);
        updateFromInputs();
    });
    accountTypeTuple = addLabelComboBox(gridPane, ++gridRow, "");
    accountTypeLabel = accountTypeTuple.first;
    accountTypeComboBox = accountTypeTuple.second;
    accountTypeComboBox.setPromptText("Select account type");
    accountTypeComboBox.setOnAction(e -> {
        if (BankUtil.isAccountTypeRequired(bankAccountContractData.getCountryCode())) {
            bankAccountContractData.setAccountType(accountTypeComboBox.getSelectionModel().getSelectedItem());
            updateFromInputs();
        }
    });
    addAllowedPeriod();
    addAccountNameTextFieldWithAutoFillCheckBox();
    updateFromInputs();
}
Also used : BankIdValidator(io.bitsquare.gui.util.validation.BankIdValidator) ComboBox(javafx.scene.control.ComboBox) Label(javafx.scene.control.Label) BranchIdValidator(io.bitsquare.gui.util.validation.BranchIdValidator) Popup(io.bitsquare.gui.main.overlays.popups.Popup) AccountNrValidator(io.bitsquare.gui.util.validation.AccountNrValidator)

Example 29 with ComboBox

use of javafx.scene.control.ComboBox in project bitsquare by bitsquare.

the class SelectDepositTxWindow method addContent.

///////////////////////////////////////////////////////////////////////////////////////////
// Protected
///////////////////////////////////////////////////////////////////////////////////////////
private void addContent() {
    Label label = addMultilineLabel(gridPane, ++rowIndex, "The deposit transaction was not stored in the trade.\n" + "Please select one of the existing MultiSig transactions from your wallet which was the " + "deposit transaction used in the failed trade.\n\n" + "You can find the correct transaction by opening the trade details window (click on the trade ID in the list)" + " and following the offer fee payment transaction output to the next transaction where you see " + "the Multisig deposit transaction (the address starts with 3). That transaction ID should be " + "visible in the list presented here. Once you found the correct transaction select that transaction here and continue.\n\n" + "Sorry for the inconvenience but that error case should be happen very rare and in future we will try " + "to find better ways to resolve it.", 10);
    GridPane.setMargin(label, new Insets(0, 0, 10, 0));
    Tuple2<Label, ComboBox> tuple = addLabelComboBox(gridPane, ++rowIndex, "Select deposit transaction");
    transactionsComboBox = tuple.second;
    transactionsComboBox.setPromptText("Select");
    transactionsComboBox.setConverter(new StringConverter<Transaction>() {

        @Override
        public String toString(Transaction transaction) {
            return transaction.getHashAsString();
        }

        @Override
        public Transaction fromString(String string) {
            return null;
        }
    });
    transactionsComboBox.setItems(FXCollections.observableArrayList(transactions));
    transactionsComboBox.setOnAction(event -> {
        selectHandlerOptional.get().accept(transactionsComboBox.getSelectionModel().getSelectedItem());
        hide();
    });
}
Also used : Insets(javafx.geometry.Insets) Transaction(org.bitcoinj.core.Transaction) FormBuilder.addLabelComboBox(io.bitsquare.gui.util.FormBuilder.addLabelComboBox) ComboBox(javafx.scene.control.ComboBox) Label(javafx.scene.control.Label) FormBuilder.addMultilineLabel(io.bitsquare.gui.util.FormBuilder.addMultilineLabel)

Example 30 with ComboBox

use of javafx.scene.control.ComboBox in project blue by kunstmusik.

the class BlueJFXControlsApplication method start.

@Override
public void start(Stage stage) throws Exception {
    TabPane root = new TabPane();
    root.getTabs().add(new Tab("Knob", new Knob()));
    root.getTabs().add(new Tab("ValuePanel", new ValuePanel()));
    setupKnobs(root);
    setupTextFieldsTest(root);
    setupButtonsTest(root);
    setTablesTest(root);
    setTreeViewTest(root);
    ComboBox cb = new ComboBox(FXCollections.observableArrayList("Test 1", "Test 2", "Test 3"));
    root.getTabs().add(new Tab("ComboBox", cb));
    Scene scene = new Scene(new BorderPane(root));
    BlueFX.style(scene);
    stage.setScene(scene);
    stage.show();
    stage.onHiddenProperty().addListener(a -> LifecycleManager.getDefault().exit());
// SimpleCSSEditor.editCSS(root);
}
Also used : TabPane(javafx.scene.control.TabPane) BorderPane(javafx.scene.layout.BorderPane) ValuePanel(blue.jfx.controls.ValuePanel) Tab(javafx.scene.control.Tab) Knob(blue.jfx.controls.Knob) ComboBox(javafx.scene.control.ComboBox) Scene(javafx.scene.Scene)

Aggregations

ComboBox (javafx.scene.control.ComboBox)48 Label (javafx.scene.control.Label)30 Insets (javafx.geometry.Insets)15 HBox (javafx.scene.layout.HBox)15 Button (javafx.scene.control.Button)14 TextField (javafx.scene.control.TextField)14 GridPane (javafx.scene.layout.GridPane)14 VBox (javafx.scene.layout.VBox)12 AutoTooltipLabel (bisq.desktop.components.AutoTooltipLabel)10 BorderPane (javafx.scene.layout.BorderPane)9 Text (javafx.scene.text.Text)9 TradeCurrency (bisq.core.locale.TradeCurrency)8 List (java.util.List)8 FXCollections (javafx.collections.FXCollections)8 Tooltip (javafx.scene.control.Tooltip)8 Priority (javafx.scene.layout.Priority)8 Popup (bisq.desktop.main.overlays.popups.Popup)7 Node (javafx.scene.Node)7 ImageView (javafx.scene.image.ImageView)7 TextWithStyle (org.phoenicis.javafx.views.common.TextWithStyle)7