Package lighthouse.utils

Examples of lighthouse.utils.ValidationLink


        this.model.memo.bind(descriptionEdit.textProperty());
        this.model.address.bind(addressEdit.textProperty());

        coverPhotoSiteLink.setText(COVERPHOTO_SITE);

        ValidationLink goalValid = new ValidationLink(goalAmountEdit, str -> !LHUtils.didThrow(() -> valueOrThrow(str)));
        goalAmountEdit.textProperty().addListener((obj, prev, cur) -> {
            if (goalValid.isValid.get())
                this.model.goalAmount.set(valueOrThrow(cur).value);
        });
        // Figure out the smallest pledge that is allowed based on the goal divided by number of inputs we can have.
        model.minPledgeAmountProperty().addListener(o -> {
            minPledgeEdit.setPromptText(model.getMinPledgeAmount().toPlainString());
        });
        ValidationLink minPledgeValue = new ValidationLink(minPledgeEdit, str -> {
            if (str.isEmpty())
                return true// default is used
            Coin coin = valueOrNull(str);
            if (coin == null) return false;
            Coin amount = model.getMinPledgeAmount();
            // If min pledge == suggested amount it's ok, or if it's between min amount and goal.
            return coin.equals(amount) || (coin.isGreaterThan(amount) && coin.isLessThan(Coin.valueOf(this.model.goalAmount.get())));
        });

        ValidationLink.autoDisableButton(nextButton,
                goalValid,
                new ValidationLink(titleEdit, str -> !str.isEmpty()),
                minPledgeValue);

        roundCorners(coverImageView, 10);

        Label maxPledgesWarning = new Label(String.format("You can collect a maximum of %d pledges, due to limits in the Bitcoin protocol.", ProjectModel.MAX_NUM_INPUTS));
View Full Code Here


            fullyDecentralised.setSelected(true);
        }
    }

    public void initialize() {
        ValidationLink serverName = new ValidationLink(serverNameEdit, this::isServerNameValid);
        serverNameEdit.textProperty().addListener(o -> {
            // Note that the validation link is updated AFTER this runs, so we must test directly.
            final String text = serverNameEdit.getText();
            if (isServerNameValid(text)) {
                this.model.serverName.set(text);
View Full Code Here

    private Coin max, min;
    public Runnable onSuccess;

    public void initialize() {
        ValidationLink amountLink = new ValidationLink(amountEdit, str -> {
            // Can't pledge more than our balance or more than the project is trying to actually raise
            // as excess would go to miners fees.
            Coin coin = valueOrNull(str);
            boolean valid = coin != null && coin.compareTo(max) <= 0 && coin.compareTo(min) >= 0;
            minersFeeLabel.setVisible(valid && !coin.equals(Main.wallet.getBalance()));
            return valid;
        });
        ValidationLink emailLink = new ValidationLink(emailEdit, str -> str.contains("@"));
        ValidationLink.autoDisableButton(confirmButton, amountLink, emailLink);

        String savedContact = Main.instance.prefs.getContactAddress();
        if (savedContact != null)
            emailEdit.setText(savedContact);
View Full Code Here

TOP

Related Classes of lighthouse.utils.ValidationLink

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.