Search in sources :

Example 31 with StringProperty

use of javafx.beans.property.StringProperty in project Board-Instrumentation-Framework by intel.

the class RadialBuilder method build.

public final Radial build() {
    final Radial CONTROL = new Radial();
    // Make sure that sections and markers will be added first
    if (properties.keySet().contains("sectionsArray")) {
        CONTROL.setSections(((ObjectProperty<Section[]>) properties.get("sectionsArray")).get());
    }
    if (properties.keySet().contains("sectionsList")) {
        CONTROL.setSections(((ObjectProperty<List<Section>>) properties.get("sectionsList")).get());
    }
    if (properties.keySet().contains("areasArray")) {
        CONTROL.setAreas(((ObjectProperty<Section[]>) properties.get("areasArray")).get());
    }
    if (properties.keySet().contains("areasList")) {
        CONTROL.setAreas(((ObjectProperty<List<Section>>) properties.get("areasList")).get());
    }
    properties.forEach((key, property) -> {
        if ("prefSize".equals(key)) {
            Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get();
            CONTROL.setPrefSize(dim.getWidth(), dim.getHeight());
        } else if ("minSize".equals(key)) {
            Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get();
            CONTROL.setPrefSize(dim.getWidth(), dim.getHeight());
        } else if ("maxSize".equals(key)) {
            Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get();
            CONTROL.setPrefSize(dim.getWidth(), dim.getHeight());
        } else if ("prefWidth".equals(key)) {
            CONTROL.setPrefWidth(((DoubleProperty) properties.get(key)).get());
        } else if ("prefHeight".equals(key)) {
            CONTROL.setPrefHeight(((DoubleProperty) properties.get(key)).get());
        } else if ("minWidth".equals(key)) {
            CONTROL.setMinWidth(((DoubleProperty) properties.get(key)).get());
        } else if ("minHeight".equals(key)) {
            CONTROL.setMinHeight(((DoubleProperty) properties.get(key)).get());
        } else if ("maxWidth".equals(key)) {
            CONTROL.setMaxWidth(((DoubleProperty) properties.get(key)).get());
        } else if ("maxHeight".equals(key)) {
            CONTROL.setMaxHeight(((DoubleProperty) properties.get(key)).get());
        } else if ("scaleX".equals(key)) {
            CONTROL.setScaleX(((DoubleProperty) properties.get(key)).get());
        } else if ("scaleY".equals(key)) {
            CONTROL.setScaleY(((DoubleProperty) properties.get(key)).get());
        } else if ("layoutX".equals(key)) {
            CONTROL.setLayoutX(((DoubleProperty) properties.get(key)).get());
        } else if ("layoutY".equals(key)) {
            CONTROL.setLayoutY(((DoubleProperty) properties.get(key)).get());
        } else if ("translateX".equals(key)) {
            CONTROL.setTranslateX(((DoubleProperty) properties.get(key)).get());
        } else if ("translateY".equals(key)) {
            CONTROL.setTranslateY(((DoubleProperty) properties.get(key)).get());
        } else if ("styleClass".equals(key)) {
            CONTROL.getStyleClass().setAll("gauge");
            CONTROL.getStyleClass().addAll(((ObjectProperty<String[]>) properties.get(key)).get());
        } else if ("minValue".equals(key)) {
            CONTROL.setMinValue(((DoubleProperty) properties.get(key)).get());
        } else if ("maxValue".equals(key)) {
            CONTROL.setMaxValue(((DoubleProperty) properties.get(key)).get());
        } else if ("value".equals(key)) {
            CONTROL.setValue(((DoubleProperty) properties.get(key)).get());
        } else if ("decimals".equals(key)) {
            CONTROL.setDecimals(((IntegerProperty) properties.get(key)).get());
        } else if ("title".equals(key)) {
            CONTROL.setTitle(((StringProperty) properties.get(key)).get());
        } else if ("unit".equals(key)) {
            CONTROL.setUnit(((StringProperty) properties.get(key)).get());
        } else if ("animated".equals(key)) {
            CONTROL.setAnimated(((BooleanProperty) properties.get(key)).get());
        } else if ("animationDuration".equals(key)) {
            CONTROL.setAnimationDuration(((DoubleProperty) properties.get(key)).get());
        } else if ("startAngle".equals(key)) {
            CONTROL.setStartAngle(((DoubleProperty) properties.get(key)).get());
        } else if ("angleRange".equals(key)) {
            CONTROL.setAngleRange(((DoubleProperty) properties.get(key)).get());
        } else if ("autoScale".equals(key)) {
            CONTROL.setAutoScale(((BooleanProperty) properties.get(key)).get());
        } else if ("ledColor".equals(key)) {
            CONTROL.setLedColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("ledVisible".equals(key)) {
            CONTROL.setLedVisible(((BooleanProperty) properties.get(key)).get());
        } else if ("lcdVisible".equals(key)) {
            CONTROL.setLcdVisible(((BooleanProperty) properties.get(key)).get());
        } else if ("needleColor".equals(key)) {
            CONTROL.setNeedleColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("tickLabelOrientation".equals(key)) {
            CONTROL.setTickLabelOrientation(((ObjectProperty<Radial.TickLabelOrientation>) properties.get(key)).get());
        } else if ("numberFormat".equals(key)) {
            CONTROL.setNumberFormat(((ObjectProperty<Radial.NumberFormat>) properties.get(key)).get());
        } else if ("majorTickSpace".equals(key)) {
            CONTROL.setMajorTickSpace(((DoubleProperty) properties.get(key)).get());
        } else if ("minorTickSpace".equals(key)) {
            CONTROL.setMinorTickSpace(((DoubleProperty) properties.get(key)).get());
        } else if ("tickLabelFill".equals(key)) {
            CONTROL.setTickLabelFill(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("tickMarkFill".equals(key)) {
            CONTROL.setTickMarkFill(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("style".equals(key)) {
            CONTROL.setStyle(((StringProperty) properties.get(key)).get());
        } else if ("frameSizeFactor".equals(key)) {
            CONTROL.setFrameSizeFactor(((DoubleProperty) properties.get(key)).get());
        } else if ("sectionFill0".equals(key)) {
            CONTROL.setSectionFill0(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("sectionFill1".equals(key)) {
            CONTROL.setSectionFill1(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("sectionFill2".equals(key)) {
            CONTROL.setSectionFill2(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("sectionFill3".equals(key)) {
            CONTROL.setSectionFill3(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("sectionFill4".equals(key)) {
            CONTROL.setSectionFill4(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("sectionFill5".equals(key)) {
            CONTROL.setSectionFill5(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("sectionFill6".equals(key)) {
            CONTROL.setSectionFill6(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("sectionFill7".equals(key)) {
            CONTROL.setSectionFill7(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("sectionFill8".equals(key)) {
            CONTROL.setSectionFill8(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("sectionFill9".equals(key)) {
            CONTROL.setSectionFill9(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("areaFill0".equals(key)) {
            CONTROL.setAreaFill0(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("areaFill1".equals(key)) {
            CONTROL.setAreaFill1(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("areaFill2".equals(key)) {
            CONTROL.setAreaFill2(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("areaFill3".equals(key)) {
            CONTROL.setAreaFill3(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("areaFill4".equals(key)) {
            CONTROL.setAreaFill4(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("areaFill5".equals(key)) {
            CONTROL.setAreaFill5(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("areaFill6".equals(key)) {
            CONTROL.setAreaFill6(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("areaFill7".equals(key)) {
            CONTROL.setAreaFill7(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("areaFill8".equals(key)) {
            CONTROL.setAreaFill8(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("areaFill9".equals(key)) {
            CONTROL.setAreaFill9(((ObjectProperty<Color>) properties.get(key)).get());
        }
    });
    return CONTROL;
}
Also used : ObjectProperty(javafx.beans.property.ObjectProperty) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) IntegerProperty(javafx.beans.property.IntegerProperty) SimpleIntegerProperty(javafx.beans.property.SimpleIntegerProperty) BooleanProperty(javafx.beans.property.BooleanProperty) SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty) Dimension2D(javafx.geometry.Dimension2D) Color(javafx.scene.paint.Color) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) StringProperty(javafx.beans.property.StringProperty) List(java.util.List) DoubleProperty(javafx.beans.property.DoubleProperty) SimpleDoubleProperty(javafx.beans.property.SimpleDoubleProperty)

Example 32 with StringProperty

use of javafx.beans.property.StringProperty in project Board-Instrumentation-Framework by intel.

the class SimpleGaugeBuilder method build.

public final SimpleGauge build() {
    final SimpleGauge CONTROL = new SimpleGauge();
    // Make sure that sections will be added first
    if (properties.keySet().contains("sectionsArray")) {
        CONTROL.setSections(((ObjectProperty<Section[]>) properties.get("sectionsArray")).get());
    } else if (properties.keySet().contains("sectionsList")) {
        CONTROL.setSections(((ObjectProperty<List<Section>>) properties.get("sectionsList")).get());
    }
    for (String key : properties.keySet()) {
        if ("prefSize".equals(key)) {
            Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get();
            CONTROL.setPrefSize(dim.getWidth(), dim.getHeight());
        } else if ("minSize".equals(key)) {
            Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get();
            CONTROL.setPrefSize(dim.getWidth(), dim.getHeight());
        } else if ("maxSize".equals(key)) {
            Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get();
            CONTROL.setPrefSize(dim.getWidth(), dim.getHeight());
        } else if ("prefWidth".equals(key)) {
            CONTROL.setPrefWidth(((DoubleProperty) properties.get(key)).get());
        } else if ("prefHeight".equals(key)) {
            CONTROL.setPrefHeight(((DoubleProperty) properties.get(key)).get());
        } else if ("minWidth".equals(key)) {
            CONTROL.setMinWidth(((DoubleProperty) properties.get(key)).get());
        } else if ("minHeight".equals(key)) {
            CONTROL.setMinHeight(((DoubleProperty) properties.get(key)).get());
        } else if ("maxWidth".equals(key)) {
            CONTROL.setMaxWidth(((DoubleProperty) properties.get(key)).get());
        } else if ("maxHeight".equals(key)) {
            CONTROL.setMaxHeight(((DoubleProperty) properties.get(key)).get());
        } else if ("scaleX".equals(key)) {
            CONTROL.setScaleX(((DoubleProperty) properties.get(key)).get());
        } else if ("scaleY".equals(key)) {
            CONTROL.setScaleY(((DoubleProperty) properties.get(key)).get());
        } else if ("layoutX".equals(key)) {
            CONTROL.setLayoutX(((DoubleProperty) properties.get(key)).get());
        } else if ("layoutY".equals(key)) {
            CONTROL.setLayoutY(((DoubleProperty) properties.get(key)).get());
        } else if ("translateX".equals(key)) {
            CONTROL.setTranslateX(((DoubleProperty) properties.get(key)).get());
        } else if ("translateY".equals(key)) {
            CONTROL.setTranslateY(((DoubleProperty) properties.get(key)).get());
        } else if ("styleClass".equals(key)) {
            CONTROL.getStyleClass().setAll("simple-gauge");
            CONTROL.getStyleClass().addAll(((ObjectProperty<String[]>) properties.get(key)).get());
        } else if ("maxValue".equals(key)) {
            CONTROL.setMaxValue(((DoubleProperty) properties.get(key)).get());
        } else if ("minValue".equals(key)) {
            CONTROL.setMinValue(((DoubleProperty) properties.get(key)).get());
        } else if ("value".equals(key)) {
            CONTROL.setValue(((DoubleProperty) properties.get(key)).get());
        } else if ("decimals".equals(key)) {
            CONTROL.setDecimals(((IntegerProperty) properties.get(key)).get());
        } else if ("title".equals(key)) {
            CONTROL.setTitle(((StringProperty) properties.get(key)).get());
        } else if ("unit".equals(key)) {
            CONTROL.setUnit(((StringProperty) properties.get(key)).get());
        } else if ("sectionTextVisible".equals(key)) {
            CONTROL.setSectionTextVisible(((BooleanProperty) properties.get(key)).get());
        } else if ("sectionIconVisible".equals(key)) {
            CONTROL.setSectionIconVisible(((BooleanProperty) properties.get(key)).get());
        } else if ("animated".equals(key)) {
            CONTROL.setAnimated(((BooleanProperty) properties.get(key)).get());
        } else if ("animationDuration".equals(key)) {
            CONTROL.setAnimationDuration(((DoubleProperty) properties.get(key)).get());
        } else if ("startAngle".equals(key)) {
            CONTROL.setStartAngle(((DoubleProperty) properties.get(key)).get());
        } else if ("angleRange".equals(key)) {
            CONTROL.setAngleRange(((DoubleProperty) properties.get(key)).get());
        } else if ("autoScale".equals(key)) {
            CONTROL.setAutoScale(((BooleanProperty) properties.get(key)).get());
        } else if ("needleColor".equals(key)) {
            CONTROL.setNeedleColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("borderColor".equals(key)) {
            CONTROL.setBorderColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("majorTickSpace".equals(key)) {
            CONTROL.setMajorTickSpace(((DoubleProperty) properties.get(key)).get());
        } else if ("minorTickSpace".equals(key)) {
            CONTROL.setMinorTickSpace(((DoubleProperty) properties.get(key)).get());
        } else if ("sectionFill0".equals(key)) {
            CONTROL.setSectionFill0(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("sectionFill1".equals(key)) {
            CONTROL.setSectionFill1(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("sectionFill2".equals(key)) {
            CONTROL.setSectionFill2(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("sectionFill3".equals(key)) {
            CONTROL.setSectionFill3(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("sectionFill4".equals(key)) {
            CONTROL.setSectionFill4(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("sectionFill5".equals(key)) {
            CONTROL.setSectionFill5(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("sectionFill6".equals(key)) {
            CONTROL.setSectionFill6(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("sectionFill7".equals(key)) {
            CONTROL.setSectionFill7(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("sectionFill8".equals(key)) {
            CONTROL.setSectionFill8(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("sectionFill9".equals(key)) {
            CONTROL.setSectionFill9(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("valueTextColor".equals(key)) {
            CONTROL.setValueTextColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("titleTextColor".equals(key)) {
            CONTROL.setTitleTextColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("sectionTextColor".equals(key)) {
            CONTROL.setSectionTextColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("measuredRangeVisible".equals(key)) {
            CONTROL.setMeasuredRangeVisible(((BooleanProperty) properties.get(key)).get());
        } else if ("rangeFill".equals(key)) {
            CONTROL.setRangeFill(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("valueVisible".equals(key)) {
            CONTROL.setValueVisible(((BooleanProperty) properties.get(key)).get());
        } else if ("titleVisible".equals(key)) {
            CONTROL.setTitleVisible(((BooleanProperty) properties.get(key)).get());
        } else if ("customFontEnabled".equals(key)) {
            CONTROL.setCustomFontEnabled(((BooleanProperty) properties.get(key)).get());
        } else if ("customFont".equals(key)) {
            CONTROL.setCustomFont(((ObjectProperty<Font>) properties.get(key)).get());
        }
    }
    return CONTROL;
}
Also used : ObjectProperty(javafx.beans.property.ObjectProperty) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) IntegerProperty(javafx.beans.property.IntegerProperty) SimpleIntegerProperty(javafx.beans.property.SimpleIntegerProperty) BooleanProperty(javafx.beans.property.BooleanProperty) SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty) Dimension2D(javafx.geometry.Dimension2D) Color(javafx.scene.paint.Color) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) StringProperty(javafx.beans.property.StringProperty) DoubleProperty(javafx.beans.property.DoubleProperty) SimpleDoubleProperty(javafx.beans.property.SimpleDoubleProperty) Section(eu.hansolo.enzo.common.Section)

Example 33 with StringProperty

use of javafx.beans.property.StringProperty in project Board-Instrumentation-Framework by intel.

the class OneEightyGaugeBuilder method build.

public final OneEightyGauge build() {
    final OneEightyGauge CONTROL = new OneEightyGauge();
    for (String key : properties.keySet()) {
        if ("prefSize".equals(key)) {
            Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get();
            CONTROL.setPrefSize(dim.getWidth(), dim.getHeight());
        } else if ("minSize".equals(key)) {
            Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get();
            CONTROL.setPrefSize(dim.getWidth(), dim.getHeight());
        } else if ("maxSize".equals(key)) {
            Dimension2D dim = ((ObjectProperty<Dimension2D>) properties.get(key)).get();
            CONTROL.setPrefSize(dim.getWidth(), dim.getHeight());
        } else if ("prefWidth".equals(key)) {
            CONTROL.setPrefWidth(((DoubleProperty) properties.get(key)).get());
        } else if ("prefHeight".equals(key)) {
            CONTROL.setPrefHeight(((DoubleProperty) properties.get(key)).get());
        } else if ("minWidth".equals(key)) {
            CONTROL.setMinWidth(((DoubleProperty) properties.get(key)).get());
        } else if ("minHeight".equals(key)) {
            CONTROL.setMinHeight(((DoubleProperty) properties.get(key)).get());
        } else if ("maxWidth".equals(key)) {
            CONTROL.setMaxWidth(((DoubleProperty) properties.get(key)).get());
        } else if ("maxHeight".equals(key)) {
            CONTROL.setMaxHeight(((DoubleProperty) properties.get(key)).get());
        } else if ("scaleX".equals(key)) {
            CONTROL.setScaleX(((DoubleProperty) properties.get(key)).get());
        } else if ("scaleY".equals(key)) {
            CONTROL.setScaleY(((DoubleProperty) properties.get(key)).get());
        } else if ("layoutX".equals(key)) {
            CONTROL.setLayoutX(((DoubleProperty) properties.get(key)).get());
        } else if ("layoutY".equals(key)) {
            CONTROL.setLayoutY(((DoubleProperty) properties.get(key)).get());
        } else if ("translateX".equals(key)) {
            CONTROL.setTranslateX(((DoubleProperty) properties.get(key)).get());
        } else if ("translateY".equals(key)) {
            CONTROL.setTranslateY(((DoubleProperty) properties.get(key)).get());
        } else if ("styleClass".equals(key)) {
            CONTROL.getStyleClass().setAll("one-eighty-gauge");
            CONTROL.getStyleClass().addAll(((ObjectProperty<String[]>) properties.get(key)).get());
        } else if ("maxValue".equals(key)) {
            CONTROL.setMaxValue(((DoubleProperty) properties.get(key)).get());
        } else if ("minValue".equals(key)) {
            CONTROL.setMinValue(((DoubleProperty) properties.get(key)).get());
        } else if ("value".equals(key)) {
            CONTROL.setValue(((DoubleProperty) properties.get(key)).get());
        } else if ("decimals".equals(key)) {
            CONTROL.setDecimals(((IntegerProperty) properties.get(key)).get());
        } else if ("title".equals(key)) {
            CONTROL.setTitle(((StringProperty) properties.get(key)).get());
        } else if ("unit".equals(key)) {
            CONTROL.setUnit(((StringProperty) properties.get(key)).get());
        } else if ("shadowsEnabled".equals(key)) {
            CONTROL.setShadowsEnabled(((BooleanProperty) properties.get(key)).get());
        } else if ("animated".equals(key)) {
            CONTROL.setAnimated(((BooleanProperty) properties.get(key)).get());
        } else if ("animationDuration".equals(key)) {
            CONTROL.setAnimationDuration(((DoubleProperty) properties.get(key)).get());
        } else if ("barBackgroundColor".equals(key)) {
            CONTROL.setBarBackgroundColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("barColor".equals(key)) {
            CONTROL.setBarColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("titleColor".equals(key)) {
            CONTROL.setTitleColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("valueColor".equals(key)) {
            CONTROL.setValueColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("unitColor".equals(key)) {
            CONTROL.setUnitColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("minTextColor".equals(key)) {
            CONTROL.setMinTextColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("maxTextColor".equals(key)) {
            CONTROL.setMaxTextColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("dynamicBarColor".equals(key)) {
            CONTROL.setDynamicBarColor(((BooleanProperty) properties.get(key)).get());
        } else if ("stopsArray".equals(key)) {
            CONTROL.setStops(((ObjectProperty<Stop[]>) properties.get(key)).get());
        } else if ("stopsList".equals(key)) {
            CONTROL.setStops(((ObjectProperty<List<Stop>>) properties.get(key)).get());
        } else if ("gradientLookup".equals(key)) {
            CONTROL.setGradientLookup(((ObjectProperty<GradientLookup>) properties.get(key)).get());
        }
    }
    return CONTROL;
}
Also used : ObjectProperty(javafx.beans.property.ObjectProperty) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) IntegerProperty(javafx.beans.property.IntegerProperty) SimpleIntegerProperty(javafx.beans.property.SimpleIntegerProperty) Stop(javafx.scene.paint.Stop) BooleanProperty(javafx.beans.property.BooleanProperty) SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty) Dimension2D(javafx.geometry.Dimension2D) Color(javafx.scene.paint.Color) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) StringProperty(javafx.beans.property.StringProperty) List(java.util.List) DoubleProperty(javafx.beans.property.DoubleProperty) SimpleDoubleProperty(javafx.beans.property.SimpleDoubleProperty)

Example 34 with StringProperty

use of javafx.beans.property.StringProperty in project bisq-desktop by bisq-network.

the class BindingTest method start.

@Override
public void start(Stage primaryStage) {
    VBox root = new VBox();
    root.setSpacing(20);
    Label label = new AutoTooltipLabel();
    StringProperty txt = new SimpleStringProperty();
    txt.set("-");
    label.textProperty().bind(txt);
    Button button = new AutoTooltipButton("count up");
    button.setOnAction(e -> txt.set("counter " + counter++));
    root.getChildren().addAll(label, button);
    primaryStage.setScene(new Scene(root, 400, 400));
    primaryStage.show();
}
Also used : Button(javafx.scene.control.Button) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton) Label(javafx.scene.control.Label) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) StringProperty(javafx.beans.property.StringProperty) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) AutoTooltipLabel(bisq.desktop.components.AutoTooltipLabel) Scene(javafx.scene.Scene) VBox(javafx.scene.layout.VBox) AutoTooltipButton(bisq.desktop.components.AutoTooltipButton)

Example 35 with StringProperty

use of javafx.beans.property.StringProperty in project bisq-desktop by bisq-network.

the class MainViewModel method initP2PNetwork.

// /////////////////////////////////////////////////////////////////////////////////////////
// Initialisation
// /////////////////////////////////////////////////////////////////////////////////////////
private BooleanProperty initP2PNetwork() {
    log.info("initP2PNetwork");
    StringProperty bootstrapState = new SimpleStringProperty();
    StringProperty bootstrapWarning = new SimpleStringProperty();
    BooleanProperty hiddenServicePublished = new SimpleBooleanProperty();
    BooleanProperty initialP2PNetworkDataReceived = new SimpleBooleanProperty();
    p2PNetworkInfoBinding = EasyBind.combine(bootstrapState, bootstrapWarning, p2PService.getNumConnectedPeers(), hiddenServicePublished, initialP2PNetworkDataReceived, (state, warning, numPeers, hiddenService, dataReceived) -> {
        String result = "";
        int peers = (int) numPeers;
        if (warning != null && peers == 0) {
            result = warning;
        } else {
            String p2pInfo = Res.get("mainView.footer.p2pInfo", numPeers);
            if (dataReceived && hiddenService) {
                result = p2pInfo;
            } else if (peers == 0)
                result = state;
            else
                result = state + " / " + p2pInfo;
        }
        return result;
    });
    p2PNetworkInfoBinding.subscribe((observable, oldValue, newValue) -> {
        p2PNetworkInfo.set(newValue);
    });
    bootstrapState.set(Res.get("mainView.bootstrapState.connectionToTorNetwork"));
    p2PService.getNetworkNode().addConnectionListener(new ConnectionListener() {

        @Override
        public void onConnection(Connection connection) {
        }

        @Override
        public void onDisconnect(CloseConnectionReason closeConnectionReason, Connection connection) {
            // Other disconnects might be caused by peers running an older version
            if (connection.getPeerType() == Connection.PeerType.SEED_NODE && closeConnectionReason == CloseConnectionReason.RULE_VIOLATION) {
                log.warn("RULE_VIOLATION onDisconnect closeConnectionReason=" + closeConnectionReason);
                log.warn("RULE_VIOLATION onDisconnect connection=" + connection);
            }
        }

        @Override
        public void onError(Throwable throwable) {
        }
    });
    final BooleanProperty p2pNetworkInitialized = new SimpleBooleanProperty();
    p2PService.start(new P2PServiceListener() {

        @Override
        public void onTorNodeReady() {
            log.debug("onTorNodeReady");
            bootstrapState.set(Res.get("mainView.bootstrapState.torNodeCreated"));
            p2PNetworkIconId.set("image-connection-tor");
            if (preferences.getUseTorForBitcoinJ())
                initWalletService();
            // We want to get early connected to the price relay so we call it already now
            priceFeedService.setCurrencyCodeOnInit();
            priceFeedService.initialRequestPriceFeed();
        }

        @Override
        public void onHiddenServicePublished() {
            log.debug("onHiddenServicePublished");
            hiddenServicePublished.set(true);
            bootstrapState.set(Res.get("mainView.bootstrapState.hiddenServicePublished"));
        }

        @Override
        public void onDataReceived() {
            log.debug("onRequestingDataCompleted");
            initialP2PNetworkDataReceived.set(true);
            bootstrapState.set(Res.get("mainView.bootstrapState.initialDataReceived"));
            splashP2PNetworkAnimationVisible.set(false);
            p2pNetworkInitialized.set(true);
        }

        @Override
        public void onNoSeedNodeAvailable() {
            log.warn("onNoSeedNodeAvailable");
            if (p2PService.getNumConnectedPeers().get() == 0)
                bootstrapWarning.set(Res.get("mainView.bootstrapWarning.noSeedNodesAvailable"));
            else
                bootstrapWarning.set(null);
            splashP2PNetworkAnimationVisible.set(false);
            p2pNetworkInitialized.set(true);
        }

        @Override
        public void onNoPeersAvailable() {
            log.warn("onNoPeersAvailable");
            if (p2PService.getNumConnectedPeers().get() == 0) {
                p2pNetworkWarnMsg.set(Res.get("mainView.p2pNetworkWarnMsg.noNodesAvailable"));
                bootstrapWarning.set(Res.get("mainView.bootstrapWarning.noNodesAvailable"));
                p2pNetworkLabelId.set("splash-error-state-msg");
            } else {
                bootstrapWarning.set(null);
                p2pNetworkLabelId.set("footer-pane");
            }
            splashP2PNetworkAnimationVisible.set(false);
            p2pNetworkInitialized.set(true);
        }

        @Override
        public void onUpdatedDataReceived() {
            log.debug("onBootstrapComplete");
            splashP2PNetworkAnimationVisible.set(false);
            bootstrapComplete.set(true);
        }

        @Override
        public void onSetupFailed(Throwable throwable) {
            log.warn("onSetupFailed");
            p2pNetworkWarnMsg.set(Res.get("mainView.p2pNetworkWarnMsg.connectionToP2PFailed", throwable.getMessage()));
            splashP2PNetworkAnimationVisible.set(false);
            bootstrapWarning.set(Res.get("mainView.bootstrapWarning.bootstrappingToP2PFailed"));
            p2pNetworkLabelId.set("splash-error-state-msg");
        }

        @Override
        public void onRequestCustomBridges() {
            showTorNetworkSettingsWindow();
        }
    });
    return p2pNetworkInitialized;
}
Also used : OpenOffer(bisq.core.offer.OpenOffer) User(bisq.core.user.User) ChainFileLockedException(org.bitcoinj.store.ChainFileLockedException) ListChangeListener(javafx.collections.ListChangeListener) BootstrapListener(bisq.network.p2p.BootstrapListener) SimpleIntegerProperty(javafx.beans.property.SimpleIntegerProperty) Map(java.util.Map) BlockStoreException(org.bitcoinj.store.BlockStoreException) MonadicBinding(org.fxmisc.easybind.monadic.MonadicBinding) P2PServiceListener(bisq.network.p2p.P2PServiceListener) ClosedTradableManager(bisq.core.trade.closed.ClosedTradableManager) FilterManager(bisq.core.filter.FilterManager) Set(java.util.Set) PaymentMethod(bisq.core.payment.payload.PaymentMethod) BooleanProperty(javafx.beans.property.BooleanProperty) Slf4j(lombok.extern.slf4j.Slf4j) TxIdTextField(bisq.desktop.components.TxIdTextField) Stream(java.util.stream.Stream) TorNetworkSettingsWindow(bisq.desktop.main.overlays.windows.TorNetworkSettingsWindow) AddressEntry(bisq.core.btc.AddressEntry) WalletsSetup(bisq.core.btc.wallet.WalletsSetup) TradeManager(bisq.core.trade.TradeManager) UserThread(bisq.common.UserThread) SimpleDoubleProperty(javafx.beans.property.SimpleDoubleProperty) FeeService(bisq.core.provider.fee.FeeService) ObservableList(javafx.collections.ObservableList) StringProperty(javafx.beans.property.StringProperty) CryptoException(bisq.common.crypto.CryptoException) AlertManager(bisq.core.alert.AlertManager) SetupUtils(bisq.core.app.SetupUtils) FXCollections(javafx.collections.FXCollections) Dispute(bisq.core.arbitration.Dispute) NotificationCenter(bisq.desktop.main.overlays.notifications.NotificationCenter) IntegerProperty(javafx.beans.property.IntegerProperty) ConnectionListener(bisq.network.p2p.network.ConnectionListener) Nullable(javax.annotation.Nullable) EncryptionService(bisq.network.crypto.EncryptionService) DontShowAgainLookup(bisq.core.user.DontShowAgainLookup) GlobalSettings(bisq.core.locale.GlobalSettings) IOException(java.io.IOException) BisqEnvironment(bisq.core.app.BisqEnvironment) OpenOfferManager(bisq.core.offer.OpenOfferManager) PriceFeedService(bisq.core.provider.price.PriceFeedService) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) CloseConnectionReason(bisq.network.p2p.network.CloseConnectionReason) KeyRing(bisq.common.crypto.KeyRing) InetAddresses(com.google.common.net.InetAddresses) SealedAndSigned(bisq.common.crypto.SealedAndSigned) Transaction(org.bitcoinj.core.Transaction) DisplayAlertMessageWindow(bisq.desktop.main.overlays.windows.DisplayAlertMessageWindow) Coin(org.bitcoinj.core.Coin) Date(java.util.Date) DaoManager(bisq.core.dao.DaoManager) Clock(bisq.common.Clock) Inject(com.google.inject.Inject) PerfectMoneyAccount(bisq.core.payment.PerfectMoneyAccount) Security(java.security.Security) TimeoutException(java.util.concurrent.TimeoutException) Random(java.util.Random) DisputeManager(bisq.core.arbitration.DisputeManager) BSFormatter(bisq.desktop.util.BSFormatter) Alert(bisq.core.alert.Alert) Res(bisq.core.locale.Res) Popup(bisq.desktop.main.overlays.popups.Popup) WalletPasswordWindow(bisq.desktop.main.overlays.windows.WalletPasswordWindow) P2PService(bisq.network.p2p.P2PService) ArbitratorManager(bisq.core.arbitration.ArbitratorManager) Subscription(org.fxmisc.easybind.Subscription) InetSocketAddress(java.net.InetSocketAddress) Collectors(java.util.stream.Collectors) AccountAgeWitnessService(bisq.core.payment.AccountAgeWitnessService) PaymentAccount(bisq.core.payment.PaymentAccount) List(java.util.List) TacWindow(bisq.desktop.main.overlays.windows.TacWindow) DevEnv(bisq.common.app.DevEnv) AppOptionKeys(bisq.core.app.AppOptionKeys) Preferences(bisq.core.user.Preferences) Optional(java.util.Optional) Address(org.bitcoinj.core.Address) BalanceWithConfirmationTextField(bisq.desktop.components.BalanceWithConfirmationTextField) Ping(bisq.network.p2p.peers.keepalive.messages.Ping) MarketPrice(bisq.core.provider.price.MarketPrice) DisplayUpdateDownloadWindow(bisq.desktop.main.overlays.windows.downloadupdate.DisplayUpdateDownloadWindow) GUIUtil(bisq.desktop.util.GUIUtil) BtcWalletService(bisq.core.btc.wallet.BtcWalletService) Socket(java.net.Socket) TradeCurrency(bisq.core.locale.TradeCurrency) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) SetChangeListener(javafx.collections.SetChangeListener) Timer(bisq.common.Timer) DoubleProperty(javafx.beans.property.DoubleProperty) HashMap(java.util.HashMap) TradeStatisticsManager(bisq.core.trade.statistics.TradeStatisticsManager) BalanceListener(bisq.core.btc.listeners.BalanceListener) WalletsManager(bisq.core.btc.wallet.WalletsManager) CurrencyUtil(bisq.core.locale.CurrencyUtil) Connection(bisq.network.p2p.network.Connection) PrivateNotificationManager(bisq.core.alert.PrivateNotificationManager) Version(bisq.common.app.Version) ObjectProperty(javafx.beans.property.ObjectProperty) CryptoCurrencyAccount(bisq.core.payment.CryptoCurrencyAccount) PrivateNotificationPayload(bisq.core.alert.PrivateNotificationPayload) Trade(bisq.core.trade.Trade) FailedTradesManager(bisq.core.trade.failed.FailedTradesManager) ViewModel(bisq.desktop.common.model.ViewModel) TimeUnit(java.util.concurrent.TimeUnit) SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty) EasyBind(org.fxmisc.easybind.EasyBind) DecryptedDataTuple(bisq.network.crypto.DecryptedDataTuple) ChangeListener(javafx.beans.value.ChangeListener) SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty) BooleanProperty(javafx.beans.property.BooleanProperty) SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty) Connection(bisq.network.p2p.network.Connection) P2PServiceListener(bisq.network.p2p.P2PServiceListener) StringProperty(javafx.beans.property.StringProperty) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) CloseConnectionReason(bisq.network.p2p.network.CloseConnectionReason) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) ConnectionListener(bisq.network.p2p.network.ConnectionListener)

Aggregations

StringProperty (javafx.beans.property.StringProperty)40 SimpleStringProperty (javafx.beans.property.SimpleStringProperty)37 DoubleProperty (javafx.beans.property.DoubleProperty)26 SimpleDoubleProperty (javafx.beans.property.SimpleDoubleProperty)25 ObjectProperty (javafx.beans.property.ObjectProperty)24 SimpleObjectProperty (javafx.beans.property.SimpleObjectProperty)24 Dimension2D (javafx.geometry.Dimension2D)23 BooleanProperty (javafx.beans.property.BooleanProperty)20 SimpleBooleanProperty (javafx.beans.property.SimpleBooleanProperty)20 SimpleIntegerProperty (javafx.beans.property.SimpleIntegerProperty)14 Color (javafx.scene.paint.Color)14 IntegerProperty (javafx.beans.property.IntegerProperty)11 List (java.util.List)8 MockedProperty (com.canoo.dp.impl.remoting.MockedProperty)4 Binding (com.canoo.platform.core.functional.Binding)4 Section (eu.hansolo.enzo.common.Section)4 IOException (java.io.IOException)4 Test (org.testng.annotations.Test)4 ChunkWrapper (com.kyj.fx.voeditor.visual.diff.ChunkWrapper)3 CompareResult (com.kyj.fx.voeditor.visual.diff.CompareResult)3