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;
}
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;
}
}));
}
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;
}
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;
}
}));
}
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;
}
}
};
}
Aggregations