use of javafx.collections.MapChangeListener in project Board-Instrumentation-Framework by intel.
the class GaugeSkin method registerListeners.
private void registerListeners() {
getSkinnable().widthProperty().addListener(observable -> handleControlPropertyChanged("RESIZE"));
getSkinnable().heightProperty().addListener(observable -> handleControlPropertyChanged("RESIZE"));
getSkinnable().minMeasuredValueProperty().addListener(observable -> handleControlPropertyChanged("MIN_MEASURED_VALUE"));
getSkinnable().minMeasuredValueVisibleProperty().addListener(observable -> handleControlPropertyChanged("MIN_MEASURED_VALUE_VISIBLE"));
getSkinnable().maxMeasuredValueProperty().addListener(observable -> handleControlPropertyChanged("MAX_MEASURED_VALUE"));
getSkinnable().maxMeasuredValueVisibleProperty().addListener(observable -> handleControlPropertyChanged("MAX_MEASURED_VALUE_VISIBLE"));
getSkinnable().tickLabelOrientationProperty().addListener(observable -> handleControlPropertyChanged("RESIZE"));
getSkinnable().needleTypeProperty().addListener(observable -> handleControlPropertyChanged("NEEDLE_TYPE"));
getSkinnable().needleColorProperty().addListener(observable -> handleControlPropertyChanged("NEEDLE_COLOR"));
getSkinnable().animatedProperty().addListener(observable -> handleControlPropertyChanged("ANIMATED"));
getSkinnable().thresholdProperty().addListener(observable -> handleControlPropertyChanged("THRESHOLD"));
getSkinnable().thresholdVisibleProperty().addListener(observable -> handleControlPropertyChanged("THRESHOLD_VISIBLE"));
getSkinnable().angleRangeProperty().addListener(observable -> handleControlPropertyChanged("ANGLE_RANGE"));
getSkinnable().numberFormatProperty().addListener(observable -> handleControlPropertyChanged("RECALC"));
getSkinnable().plainValueProperty().addListener(observable -> handleControlPropertyChanged("PLAIN_VALUE"));
getSkinnable().histogramEnabledProperty().addListener(observable -> handleControlPropertyChanged("HISTOGRAM"));
getSkinnable().dropShadowEnabledProperty().addListener(observable -> handleControlPropertyChanged("DROP_SHADOW"));
getSkinnable().interactiveProperty().addListener(observable -> handleControlPropertyChanged("INTERACTIVE"));
getSkinnable().getSections().addListener((ListChangeListener<Section>) change -> handleControlPropertyChanged("CANVAS_REFRESH"));
getSkinnable().getAreas().addListener((ListChangeListener<Section>) change -> handleControlPropertyChanged("CANVAS_REFRESH"));
getSkinnable().getMarkers().addListener((MapChangeListener<Marker, Rotate>) change -> handleControlPropertyChanged("MARKER"));
getSkinnable().markersVisibleProperty().addListener(observable -> handleControlPropertyChanged("MARKER"));
getSkinnable().sectionsVisibleProperty().addListener(observable -> handleControlPropertyChanged("CANVAS_REFRESH"));
getSkinnable().areasVisibleProperty().addListener(observable -> handleControlPropertyChanged("CANVAS_REFRESH"));
getSkinnable().customKnobClickHandlerProperty().addListener(observable -> handleControlPropertyChanged("CUSTOM_KNOB_CLICK_HANDLER"));
getSkinnable().valueProperty().addListener((OV, OLD_VALUE, NEW_VALUE) -> {
withinSpeedLimit = !(Instant.now().minusMillis((long) getSkinnable().getAnimationDuration()).isBefore(lastCall));
lastCall = Instant.now();
oldValue = OLD_VALUE.doubleValue();
rotateNeedle();
});
getSkinnable().minValueProperty().addListener((OV, OLD_VALUE, NEW_VALUE) -> {
angleStep = getSkinnable().getAngleRange() / (getSkinnable().getMaxValue() - NEW_VALUE.doubleValue());
needleRotate.setAngle((180 - getSkinnable().getStartAngle()) + (getSkinnable().getValue() - NEW_VALUE.doubleValue()) * angleStep);
if (getSkinnable().getValue() < NEW_VALUE.doubleValue()) {
getSkinnable().setValue(NEW_VALUE.doubleValue());
oldValue = NEW_VALUE.doubleValue();
}
});
getSkinnable().maxValueProperty().addListener((OV, OLD_VALUE, NEW_VALUE) -> {
angleStep = getSkinnable().getAngleRange() / (NEW_VALUE.doubleValue() - getSkinnable().getMinValue());
needleRotate.setAngle((180 - getSkinnable().getStartAngle()) + (getSkinnable().getValue() - getSkinnable().getMinValue()) * angleStep);
if (getSkinnable().getValue() > NEW_VALUE.doubleValue()) {
getSkinnable().setValue(NEW_VALUE.doubleValue());
oldValue = NEW_VALUE.doubleValue();
}
});
getSkinnable().limitProperty().addListener(observable -> handleControlPropertyChanged("LIMIT"));
needleRotate.angleProperty().addListener(observable -> handleControlPropertyChanged("ANGLE"));
if (null == getSkinnable().getCustomKnobClickHandler()) {
knob.setOnMousePressed(event -> {
timeline.stop();
needleRotate.setAngle(180 - getSkinnable().getStartAngle() + (getSkinnable().getValue() - getSkinnable().getMinValue()) * angleStep);
getSkinnable().setInteractive(!getSkinnable().isInteractive());
});
} else {
knob.setOnMousePressed(getSkinnable().getCustomKnobClickHandler());
}
minMeasuredValue.setOnMousePressed(mouseEventHandler);
minMeasuredValue.setOnMouseReleased(mouseEventHandler);
maxMeasuredValue.setOnMousePressed(mouseEventHandler);
maxMeasuredValue.setOnMouseReleased(mouseEventHandler);
threshold.setOnMousePressed(mouseEventHandler);
threshold.setOnMouseDragged(mouseEventHandler);
threshold.setOnMouseReleased(mouseEventHandler);
for (Marker marker : getSkinnable().getMarkers().keySet()) {
marker.setOnMousePressed(mouseEventHandler);
marker.setOnMouseDragged(mouseEventHandler);
marker.setOnMouseReleased(mouseEventHandler);
}
}
use of javafx.collections.MapChangeListener in project Board-Instrumentation-Framework by intel.
the class RadialBargraphSkin method registerListeners.
private void registerListeners() {
getSkinnable().widthProperty().addListener(observable -> handleControlPropertyChanged("RESIZE"));
getSkinnable().heightProperty().addListener(observable -> handleControlPropertyChanged("RESIZE"));
getSkinnable().valueProperty().addListener(observable -> handleControlPropertyChanged("VALUE"));
getSkinnable().minValueProperty().addListener(observable -> handleControlPropertyChanged("RECALC"));
getSkinnable().maxValueProperty().addListener(observable -> handleControlPropertyChanged("RECALC"));
getSkinnable().minMeasuredValueProperty().addListener(observable -> handleControlPropertyChanged("MIN_MEASURED_VALUE"));
getSkinnable().minMeasuredValueVisibleProperty().addListener(observable -> handleControlPropertyChanged("MIN_MEASURED_VALUE_VISIBLE"));
getSkinnable().maxMeasuredValueProperty().addListener(observable -> handleControlPropertyChanged("MAX_MEASURED_VALUE"));
getSkinnable().maxMeasuredValueVisibleProperty().addListener(observable -> handleControlPropertyChanged("MAX_MEASURED_VALUE_VISIBLE"));
getSkinnable().barColorProperty().addListener(observable -> handleControlPropertyChanged("BAR_COLOR"));
getSkinnable().animatedProperty().addListener(observable -> handleControlPropertyChanged("ANIMATED"));
getSkinnable().thresholdProperty().addListener(observable -> handleControlPropertyChanged("THRESHOLD"));
getSkinnable().thresholdVisibleProperty().addListener(observable -> handleControlPropertyChanged("THRESHOLD_VISIBLE"));
getSkinnable().angleRangeProperty().addListener(observable -> handleControlPropertyChanged("ANGLE_RANGE"));
getSkinnable().numberFormatProperty().addListener(observable -> handleControlPropertyChanged("RECALC"));
getSkinnable().plainValueProperty().addListener(observable -> handleControlPropertyChanged("PLAIN_VALUE"));
getSkinnable().interactiveProperty().addListener(observable -> handleControlPropertyChanged("INTERACTIVE"));
getSkinnable().getSections().addListener((ListChangeListener<Section>) change -> handleControlPropertyChanged("CANVAS_REFRESH"));
getSkinnable().getMarkers().addListener((MapChangeListener<Marker, Rotate>) change -> handleControlPropertyChanged("MARKER"));
getSkinnable().barGradientProperty().addListener((ListChangeListener<Stop>) change -> handleControlPropertyChanged("BAR_GRADIENT"));
getSkinnable().barGradientEnabledProperty().addListener(observable -> handleControlPropertyChanged("BAR_COLOR"));
angle.addListener(observable -> handleControlPropertyChanged("ANGLE"));
knob.setOnMousePressed(event -> getSkinnable().setInteractive(!getSkinnable().isInteractive()));
minMeasuredValue.setOnMousePressed(mouseEventHandler);
minMeasuredValue.setOnMouseReleased(mouseEventHandler);
minMeasuredValue.setOnTouchPressed(touchEventHandler);
minMeasuredValue.setOnTouchReleased(touchEventHandler);
maxMeasuredValue.setOnMousePressed(mouseEventHandler);
maxMeasuredValue.setOnMouseReleased(mouseEventHandler);
maxMeasuredValue.setOnTouchPressed(touchEventHandler);
maxMeasuredValue.setOnTouchReleased(touchEventHandler);
threshold.setOnMousePressed(mouseEventHandler);
threshold.setOnMouseDragged(mouseEventHandler);
threshold.setOnMouseReleased(mouseEventHandler);
threshold.setOnTouchPressed(touchEventHandler);
threshold.setOnTouchMoved(touchEventHandler);
threshold.setOnTouchReleased(touchEventHandler);
for (Marker marker : getSkinnable().getMarkers().keySet()) {
marker.setOnMousePressed(mouseEventHandler);
marker.setOnMouseDragged(mouseEventHandler);
marker.setOnMouseReleased(mouseEventHandler);
marker.setOnTouchPressed(touchEventHandler);
marker.setOnTouchMoved(touchEventHandler);
marker.setOnTouchReleased(touchEventHandler);
}
}
Aggregations