Search in sources :

Example 26 with Section

use of eu.hansolo.enzo.common.Section in project Board-Instrumentation-Framework by intel.

the class RadialBargraphBuilder method build.

public final RadialBargraph build() {
    final RadialBargraph CONTROL = new RadialBargraph();
    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("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 ("threshold".equals(key)) {
            CONTROL.setThreshold(((DoubleProperty) properties.get(key)).get());
        } else if ("sectionsArray".equals(key)) {
            CONTROL.setSections(((ObjectProperty<Section[]>) properties.get(key)).get());
        } else if ("sectionsList".equals(key)) {
            CONTROL.setSections(((ObjectProperty<List<Section>>) properties.get(key)).get());
        } else if ("markersArray".equals(key)) {
            CONTROL.setMarkers(((ObjectProperty<Marker[]>) properties.get(key)).get());
        } else if ("markersList".equals(key)) {
            CONTROL.setMarkers(((ObjectProperty<List<Marker>>) 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 ("minMeasuredValueVisible".equals(key)) {
            CONTROL.setMinMeasuredValueVisible(((BooleanProperty) properties.get(key)).get());
        } else if ("maxMeasuredValueVisible".equals(key)) {
            CONTROL.setMaxMeasuredValueVisible(((BooleanProperty) properties.get(key)).get());
        } else if ("thresholdVisible".equals(key)) {
            CONTROL.setThresholdVisible(((BooleanProperty) 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 ("barColor".equals(key)) {
            CONTROL.setBarColor(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("numberFormat".equals(key)) {
            CONTROL.setNumberFormat(((ObjectProperty<RadialBargraph.NumberFormat>) properties.get(key)).get());
        } else if ("minorTickSpace".equals(key)) {
            CONTROL.setMinorTickSpace(((DoubleProperty) properties.get(key)).get());
        } else if ("plainValue".equals(key)) {
            CONTROL.setPlainValue(((BooleanProperty) 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 ("markerFill0".equals(key)) {
            CONTROL.setMarkerFill0(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("markerFill1".equals(key)) {
            CONTROL.setMarkerFill1(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("markerFill2".equals(key)) {
            CONTROL.setMarkerFill2(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("markerFill3".equals(key)) {
            CONTROL.setMarkerFill3(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("markerFill4".equals(key)) {
            CONTROL.setMarkerFill4(((ObjectProperty<Color>) properties.get(key)).get());
        } else if ("sectionsVisible".equals(key)) {
            CONTROL.setSectionsVisible(((BooleanProperty) properties.get(key)).get());
        } else if ("markersVisible".equals(key)) {
            CONTROL.setMarkersVisible(((BooleanProperty) properties.get(key)).get());
        }
    }
    return CONTROL;
}
Also used : ObjectProperty(javafx.beans.property.ObjectProperty) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) 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) Marker(eu.hansolo.enzo.common.Marker) DoubleProperty(javafx.beans.property.DoubleProperty) SimpleDoubleProperty(javafx.beans.property.SimpleDoubleProperty) Section(eu.hansolo.enzo.common.Section)

Example 27 with Section

use of eu.hansolo.enzo.common.Section in project Board-Instrumentation-Framework by intel.

the class RadialGauge method registerListeners.

private void registerListeners() {
    sections.addListener((ListChangeListener<Section>) c -> IntStream.range(0, sections.size()).parallel().forEachOrdered(i -> {
        Section section = sections.get(i);
        switch(i) {
            case 0:
                setSectionFill0(section.getColor());
                break;
            case 1:
                setSectionFill1(section.getColor());
                break;
            case 2:
                setSectionFill2(section.getColor());
                break;
            case 3:
                setSectionFill3(section.getColor());
                break;
            case 4:
                setSectionFill4(section.getColor());
                break;
            case 5:
                setSectionFill5(section.getColor());
                break;
            case 6:
                setSectionFill6(section.getColor());
                break;
            case 7:
                setSectionFill7(section.getColor());
                break;
            case 8:
                setSectionFill8(section.getColor());
                break;
            case 9:
                setSectionFill9(section.getColor());
                break;
        }
    }));
    areas.addListener((ListChangeListener<Section>) c -> IntStream.range(0, areas.size()).parallel().forEachOrdered(i -> {
        Section area = areas.get(i);
        switch(i) {
            case 0:
                setAreaFill0(area.getColor());
                break;
            case 1:
                setAreaFill1(area.getColor());
                break;
            case 2:
                setAreaFill2(area.getColor());
                break;
            case 3:
                setAreaFill3(area.getColor());
                break;
            case 4:
                setAreaFill4(area.getColor());
                break;
            case 5:
                setAreaFill4(area.getColor());
                break;
            case 6:
                setAreaFill4(area.getColor());
                break;
            case 7:
                setAreaFill4(area.getColor());
                break;
            case 8:
                setAreaFill4(area.getColor());
                break;
            case 9:
                setAreaFill4(area.getColor());
                break;
        }
    }));
}
Also used : IntStream(java.util.stream.IntStream) Color(javafx.scene.paint.Color) javafx.beans.property(javafx.beans.property) java.util(java.util) Section(eu.hansolo.enzo.common.Section) Control(javafx.scene.control.Control) DecimalFormat(java.text.DecimalFormat) FXCollections(javafx.collections.FXCollections) RadialGaugeSkin(eu.hansolo.enzo.gauge.skin.RadialGaugeSkin) Skin(javafx.scene.control.Skin) AnimationTimer(javafx.animation.AnimationTimer) Duration(javafx.util.Duration) ListChangeListener(javafx.collections.ListChangeListener) javafx.css(javafx.css) Paint(javafx.scene.paint.Paint) ObservableList(javafx.collections.ObservableList) Section(eu.hansolo.enzo.common.Section)

Example 28 with Section

use of eu.hansolo.enzo.common.Section 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 29 with Section

use of eu.hansolo.enzo.common.Section in project Board-Instrumentation-Framework by intel.

the class Gauge method registerListeners.

private void registerListeners() {
    sections.addListener((ListChangeListener<Section>) c -> IntStream.range(0, sections.size()).parallel().forEachOrdered(i -> {
        Section section = sections.get(i);
        switch(i) {
            case 0:
                setSectionFill0(section.getColor());
                break;
            case 1:
                setSectionFill1(section.getColor());
                break;
            case 2:
                setSectionFill2(section.getColor());
                break;
            case 3:
                setSectionFill3(section.getColor());
                break;
            case 4:
                setSectionFill4(section.getColor());
                break;
            case 5:
                setSectionFill5(section.getColor());
                break;
            case 6:
                setSectionFill6(section.getColor());
                break;
            case 7:
                setSectionFill7(section.getColor());
                break;
            case 8:
                setSectionFill8(section.getColor());
                break;
            case 9:
                setSectionFill9(section.getColor());
                break;
        }
    }));
    areas.addListener((ListChangeListener<Section>) c -> IntStream.range(0, areas.size()).parallel().forEachOrdered(i -> {
        Section area = areas.get(i);
        switch(i) {
            case 0:
                setAreaFill0(area.getColor());
                break;
            case 1:
                setAreaFill1(area.getColor());
                break;
            case 2:
                setAreaFill2(area.getColor());
                break;
            case 3:
                setAreaFill3(area.getColor());
                break;
            case 4:
                setAreaFill4(area.getColor());
                break;
            case 5:
                setAreaFill4(area.getColor());
                break;
            case 6:
                setAreaFill4(area.getColor());
                break;
            case 7:
                setAreaFill4(area.getColor());
                break;
            case 8:
                setAreaFill4(area.getColor());
                break;
            case 9:
                setAreaFill4(area.getColor());
                break;
        }
    }));
}
Also used : EventHandler(javafx.event.EventHandler) IntStream(java.util.stream.IntStream) Arrays(java.util.Arrays) ReadOnlyObjectProperty(javafx.beans.property.ReadOnlyObjectProperty) PseudoClass(javafx.css.PseudoClass) SimpleStringProperty(javafx.beans.property.SimpleStringProperty) Rotate(javafx.scene.transform.Rotate) Control(javafx.scene.control.Control) MouseEvent(javafx.scene.input.MouseEvent) FXCollections(javafx.collections.FXCollections) GaugeSkin(eu.hansolo.enzo.gauge.skin.GaugeSkin) DoubleProperty(javafx.beans.property.DoubleProperty) Skin(javafx.scene.control.Skin) IntegerProperty(javafx.beans.property.IntegerProperty) ArrayList(java.util.ArrayList) StyleConverter(javafx.css.StyleConverter) ListChangeListener(javafx.collections.ListChangeListener) Locale(java.util.Locale) SimpleIntegerProperty(javafx.beans.property.SimpleIntegerProperty) StyleableProperty(javafx.css.StyleableProperty) Color(javafx.scene.paint.Color) ObjectProperty(javafx.beans.property.ObjectProperty) Section(eu.hansolo.enzo.common.Section) MapChangeListener(javafx.collections.MapChangeListener) ReadOnlyDoubleProperty(javafx.beans.property.ReadOnlyDoubleProperty) CssMetaData(javafx.css.CssMetaData) DecimalFormat(java.text.DecimalFormat) ObservableMap(javafx.collections.ObservableMap) BooleanPropertyBase(javafx.beans.property.BooleanPropertyBase) Marker(eu.hansolo.enzo.common.Marker) BooleanProperty(javafx.beans.property.BooleanProperty) Duration(javafx.util.Duration) List(java.util.List) SimpleBooleanProperty(javafx.beans.property.SimpleBooleanProperty) StyleableObjectProperty(javafx.css.StyleableObjectProperty) SimpleObjectProperty(javafx.beans.property.SimpleObjectProperty) Paint(javafx.scene.paint.Paint) DoublePropertyBase(javafx.beans.property.DoublePropertyBase) SimpleDoubleProperty(javafx.beans.property.SimpleDoubleProperty) ObservableList(javafx.collections.ObservableList) StringProperty(javafx.beans.property.StringProperty) Collections(java.util.Collections) Styleable(javafx.css.Styleable) Section(eu.hansolo.enzo.common.Section)

Example 30 with Section

use of eu.hansolo.enzo.common.Section in project Board-Instrumentation-Framework by intel.

the class DemoDoubleRadialGauge method init.

@Override
public void init() {
    control = DoubleRadialGaugeBuilder.create().titleOne("Title One").unitOne("°C").minValueOne(0).maxValueOne(100).ledVisibleOne(true).ledColorOne(Color.RED).needleColorOne(Color.DARKBLUE).sectionsVisibleOne(true).sectionsOne(new Section(0, 20, Color.rgb(200, 0, 0, 0.2)), new Section(20, 40, Color.rgb(200, 0, 0, 0.4)), new Section(40, 60, Color.rgb(200, 0, 0, 0.6)), new Section(60, 80, Color.rgb(200, 0, 0, 0.8)), new Section(80, 100, Color.rgb(200, 0, 0, 1.0))).areasVisibleOne(true).areasOne(new Section(80, 100, Color.rgb(200, 0, 0, 1.0))).titleTwo("Title Two").unitTwo("°F").minValueTwo(0).maxValueTwo(100).ledVisibleTwo(true).ledColorTwo(Color.BLUE).needleColorTwo(Color.DARKRED).sectionsVisibleTwo(true).sectionsTwo(new Section(0, 20, Color.rgb(0, 0, 200, 0.2)), new Section(20, 40, Color.rgb(0, 0, 200, 0.4)), new Section(40, 60, Color.rgb(0, 0, 200, 0.6)), new Section(60, 80, Color.rgb(0, 0, 200, 0.8)), new Section(80, 100, Color.rgb(0, 0, 200, 1.0))).areasVisibleTwo(true).areasTwo(new Section(80, 100, Color.rgb(0, 0, 200, 1.0))).build();
    lastTimerCallOne = System.nanoTime() + 50_000_000l;
    timerOne = new AnimationTimer() {

        @Override
        public void handle(long now) {
            if (now > lastTimerCallOne + 4_200_000_000l) {
                control.setValueOne(RND.nextDouble() * 100);
                control.setBlinkingOne(control.getValueOne() > 50);
                lastTimerCallOne = now;
            }
        }
    };
    lastTimerCallTwo = System.nanoTime() + 400_000_000l;
    timerTwo = new AnimationTimer() {

        @Override
        public void handle(long now) {
            if (now > lastTimerCallTwo + 3_500_000_000l) {
                double value = RND.nextDouble() * 100;
                control.setValueTwo(value);
                control.setBlinkingTwo(control.getValueTwo() > 70);
                lastTimerCallTwo = now;
            }
        }
    };
}
Also used : AnimationTimer(javafx.animation.AnimationTimer) Section(eu.hansolo.enzo.common.Section)

Aggregations

Section (eu.hansolo.enzo.common.Section)31 AnimationTimer (javafx.animation.AnimationTimer)10 DoubleProperty (javafx.beans.property.DoubleProperty)8 SimpleDoubleProperty (javafx.beans.property.SimpleDoubleProperty)8 Marker (eu.hansolo.enzo.common.Marker)6 IntStream (java.util.stream.IntStream)6 BooleanProperty (javafx.beans.property.BooleanProperty)6 ObjectProperty (javafx.beans.property.ObjectProperty)6 SimpleBooleanProperty (javafx.beans.property.SimpleBooleanProperty)6 SimpleObjectProperty (javafx.beans.property.SimpleObjectProperty)6 SimpleStringProperty (javafx.beans.property.SimpleStringProperty)6 StringProperty (javafx.beans.property.StringProperty)6 ListChangeListener (javafx.collections.ListChangeListener)6 Skin (javafx.scene.control.Skin)6 Color (javafx.scene.paint.Color)6 ArrayList (java.util.ArrayList)5 FXCollections (javafx.collections.FXCollections)5 ObservableList (javafx.collections.ObservableList)5 List (java.util.List)4 Locale (java.util.Locale)4