use of javafx.event.EventType in project Board-Instrumentation-Framework by intel.
the class TButton method fireSelectEvent.
public void fireSelectEvent(final SelectEvent EVENT) {
final EventHandler<SelectEvent> HANDLER;
final EventType TYPE = EVENT.getEventType();
if (SelectEvent.SELECT == TYPE) {
HANDLER = getOnSelect();
} else if (SelectEvent.DESELECT == TYPE) {
HANDLER = getOnDeselect();
} else {
HANDLER = null;
}
if (HANDLER != null) {
HANDLER.handle(EVENT);
}
}
use of javafx.event.EventType in project Board-Instrumentation-Framework by intel.
the class GaugeSkin method handleMouseEvent.
private void handleMouseEvent(final MouseEvent MOUSE_EVENT) {
final Object SRC = MOUSE_EVENT.getSource();
final EventType TYPE = MOUSE_EVENT.getEventType();
if (getSkinnable().isInteractive() && SRC.equals(threshold)) {
if (MouseEvent.MOUSE_PRESSED == TYPE) {
unitText.setText("Threshold");
valueText.setText(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", getSkinnable().getThreshold()));
resizeText();
} else if (MouseEvent.MOUSE_DRAGGED == TYPE) {
Point2D point = getSkinnable().sceneToLocal(MOUSE_EVENT.getSceneX(), MOUSE_EVENT.getSceneY());
touchRotate(point.getX(), point.getY(), thresholdRotate);
} else if (MouseEvent.MOUSE_RELEASED == TYPE) {
getSkinnable().setThreshold(Double.parseDouble(valueText.getText()));
fadeBackToInteractive();
}
} else if (getSkinnable().isInteractive() && SRC instanceof Marker) {
if (MouseEvent.MOUSE_PRESSED == TYPE) {
unitText.setText(((Marker) SRC).getText());
valueText.setText(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", ((Marker) SRC).getValue()));
resizeText();
} else if (MouseEvent.MOUSE_DRAGGED == TYPE) {
Point2D point = getSkinnable().sceneToLocal(MOUSE_EVENT.getSceneX(), MOUSE_EVENT.getSceneY());
touchRotate(point.getX(), point.getY(), getSkinnable().getMarkers().get(SRC));
} else if (MouseEvent.MOUSE_RELEASED == TYPE) {
((Marker) SRC).setValue(Double.parseDouble(valueText.getText()));
fadeBackToInteractive();
}
} else if (getSkinnable().isInteractive() && SRC.equals(minMeasuredValue)) {
if (MouseEvent.MOUSE_PRESSED == TYPE) {
unitText.setText("Min");
valueText.setText(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", getSkinnable().getMinMeasuredValue()));
resizeText();
} else if (MouseEvent.MOUSE_RELEASED == TYPE) {
fadeBackToInteractive();
}
} else if (getSkinnable().isInteractive() && SRC.equals(maxMeasuredValue)) {
if (MouseEvent.MOUSE_PRESSED == TYPE) {
unitText.setText("Max");
valueText.setText(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", getSkinnable().getMaxMeasuredValue()));
resizeText();
} else if (MouseEvent.MOUSE_RELEASED == TYPE) {
fadeBackToInteractive();
}
}
}
use of javafx.event.EventType in project Board-Instrumentation-Framework by intel.
the class RadialBargraphSkin method handleTouchEvent.
private void handleTouchEvent(final TouchEvent TOUCH_EVENT) {
final Object SRC = TOUCH_EVENT.getSource();
final EventType TYPE = TOUCH_EVENT.getEventType();
if (SRC.equals(threshold)) {
if (TouchEvent.TOUCH_PRESSED == TYPE) {
unit.setText("Threshold");
value.setText(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", getSkinnable().getThreshold()));
resizeText();
} else if (TouchEvent.TOUCH_MOVED == TYPE) {
Point2D point = getSkinnable().sceneToLocal(TOUCH_EVENT.getTouchPoint().getSceneX(), TOUCH_EVENT.getTouchPoint().getSceneY());
touchRotate(point.getX(), point.getY(), thresholdRotate);
} else if (TouchEvent.TOUCH_RELEASED == TYPE) {
getSkinnable().setThreshold(Double.parseDouble(value.getText()));
fadeBackToInteractive();
}
} else if (SRC instanceof Marker) {
if (TouchEvent.TOUCH_PRESSED == TYPE) {
unit.setText(((Marker) SRC).getText());
value.setText(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", ((Marker) SRC).getValue()));
resizeText();
} else if (TouchEvent.TOUCH_MOVED == TYPE) {
Point2D point = getSkinnable().sceneToLocal(TOUCH_EVENT.getTouchPoint().getSceneX(), TOUCH_EVENT.getTouchPoint().getSceneY());
touchRotate(point.getX(), point.getY(), getSkinnable().getMarkers().get(SRC));
} else if (TouchEvent.TOUCH_RELEASED == TYPE) {
((Marker) SRC).setValue(Double.parseDouble(value.getText()));
fadeBackToInteractive();
}
} else if (SRC.equals(minMeasuredValue)) {
if (TouchEvent.TOUCH_PRESSED == TYPE) {
unit.setText("Min");
value.setText(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", getSkinnable().getMinMeasuredValue()));
resizeText();
} else if (TouchEvent.TOUCH_RELEASED == TYPE) {
fadeBackToInteractive();
}
} else if (SRC.equals(maxMeasuredValue)) {
if (TouchEvent.TOUCH_PRESSED == TYPE) {
unit.setText("Max");
value.setText(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", getSkinnable().getMaxMeasuredValue()));
resizeText();
} else if (TouchEvent.TOUCH_RELEASED == TYPE) {
fadeBackToInteractive();
}
}
}
use of javafx.event.EventType in project Board-Instrumentation-Framework by intel.
the class OnOffSwitch method fireSelectionEvent.
public void fireSelectionEvent(final SelectionEvent EVENT) {
fireEvent(EVENT);
final EventType TYPE = EVENT.getEventType();
final EventHandler<SelectionEvent> HANDLER;
if (SelectionEvent.SELECT == TYPE) {
HANDLER = getOnSelect();
} else if (SelectionEvent.DESELECT == TYPE) {
HANDLER = getOnDeselect();
} else {
HANDLER = null;
}
if (null == HANDLER)
return;
HANDLER.handle(EVENT);
}
use of javafx.event.EventType in project Board-Instrumentation-Framework by intel.
the class RadialMenu method fireItemEvent.
public void fireItemEvent(final ItemEvent EVENT) {
fireEvent(EVENT);
final EventType TYPE = EVENT.getEventType();
final EventHandler<ItemEvent> HANDLER;
if (ItemEvent.ITEM_CLICKED == TYPE) {
HANDLER = getOnItemClicked();
} else if (ItemEvent.ITEM_SELECTED == TYPE) {
HANDLER = getOnItemSelected();
} else if (ItemEvent.ITEM_DESELECTED == TYPE) {
HANDLER = getOnItemDeselected();
} else {
HANDLER = null;
}
if (HANDLER != null) {
HANDLER.handle(EVENT);
}
}
Aggregations