use of javafx.event.EventType in project Board-Instrumentation-Framework by intel.
the class ValidationPane method fireValidationEvent.
public void fireValidationEvent(final ValidationEvent EVENT) {
fireEvent(EVENT);
final EventType TYPE = EVENT.getEventType();
final EventHandler<ValidationEvent> HANDLER;
if (ValidationEvent.VALID == TYPE) {
HANDLER = getOnValid();
} else if (ValidationEvent.INVALID == TYPE) {
HANDLER = getOnInvalid();
} else if (ValidationEvent.INFO == TYPE) {
HANDLER = getOnInfo();
} else if (ValidationEvent.OPTIONAL == TYPE) {
HANDLER = getOnOptional();
} else if (ValidationEvent.CLEAR == TYPE) {
HANDLER = getOnClear();
} else {
HANDLER = null;
}
if (HANDLER != null) {
HANDLER.handle(EVENT);
}
}
use of javafx.event.EventType in project Board-Instrumentation-Framework by intel.
the class ValidationPane method init.
private void init() {
validatorMap = FXCollections.observableHashMap();
faderMap = FXCollections.observableHashMap();
popupMap = FXCollections.observableHashMap();
visibilityListener = observable -> draw();
mouseHandler = mouseEvent -> {
final EventType TYPE = mouseEvent.getEventType();
final Object SRC = mouseEvent.getSource();
if (MouseEvent.MOUSE_ENTERED == TYPE) {
if (popupMap.containsKey(SRC)) {
if (!validatorMap.get(SRC).getInfoText().isEmpty()) {
Point2D pos = ((Node) SRC).localToScreen(((Node) SRC).getLayoutBounds().getMinX(), ((Node) SRC).getLayoutBounds().getMinY());
popupMap.get(SRC).setX(pos.getX());
// popupMap.get(SRC).setY(pos.getY() - popupMap.get(SRC).getHeight());
popupMap.get(SRC).setY(pos.getY() + ((Node) SRC).getLayoutBounds().getHeight() + 5);
popupMap.get(SRC).show(((Node) SRC).getScene().getWindow());
}
}
} else if (MouseEvent.MOUSE_EXITED == TYPE) {
if (popupMap.containsKey(SRC)) {
popupMap.get(SRC).hide();
}
}
};
}
use of javafx.event.EventType in project tilesfx by HanSolo.
the class Section method fireSectionEvent.
public void fireSectionEvent(final SectionEvent EVENT) {
final EventHandler<SectionEvent> HANDLER;
final EventType TYPE = EVENT.getEventType();
if (SectionEvent.TILES_FX_SECTION_ENTERED == TYPE) {
HANDLER = getOnSectionEntered();
} else if (SectionEvent.TILES_FX_SECTION_LEFT == TYPE) {
HANDLER = getOnSectionLeft();
} else if (SectionEvent.TILES_FX_SECTION_UPDATE == TYPE) {
HANDLER = getOnSectionUpdate();
} else {
HANDLER = null;
}
if (null == HANDLER)
return;
HANDLER.handle(EVENT);
}
use of javafx.event.EventType in project tilesfx by HanSolo.
the class TimeSection method fireTimeSectionEvent.
public void fireTimeSectionEvent(final TimeSectionEvent EVENT) {
final EventHandler<TimeSectionEvent> HANDLER;
final EventType TYPE = EVENT.getEventType();
if (TimeSectionEvent.TIME_SECTION_ENTERED == TYPE) {
HANDLER = getOnTimeSectionEntered();
} else if (TimeSectionEvent.TIME_SECTION_LEFT == TYPE) {
HANDLER = getOnTimeSectionLeft();
} else {
HANDLER = null;
}
if (null == HANDLER)
return;
HANDLER.handle(EVENT);
}
use of javafx.event.EventType in project tilesfx by HanSolo.
the class PlusMinusTileSkin method initGraphics.
// ******************** Initialization ************************************
@Override
protected void initGraphics() {
super.initGraphics();
mouseEventHandler = e -> {
final EventType TYPE = e.getEventType();
final Label SRC = (Label) e.getSource();
if (MouseEvent.MOUSE_PRESSED == TYPE) {
if (SRC.equals(minusLabel)) {
decrement();
} else if (SRC.equals(plusLabel)) {
increment();
}
} else if (MouseEvent.MOUSE_RELEASED == TYPE) {
if (SRC.equals(minusLabel)) {
minusLabel.setTextFill(tile.getForegroundColor());
minusLabel.setBorder(new Border(new BorderStroke(tile.getForegroundColor(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(size * 0.01))));
} else if (SRC.equals(plusLabel)) {
plusLabel.setTextFill(tile.getForegroundColor());
plusLabel.setBorder(new Border(new BorderStroke(tile.getForegroundColor(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(size * 0.01))));
}
}
};
titleText = new Text();
titleText.setFill(tile.getTitleColor());
Helper.enableNode(titleText, !tile.getTitle().isEmpty());
text = new Text(tile.getText());
text.setFill(tile.getUnitColor());
Helper.enableNode(text, tile.isTextVisible());
valueText = new Text(String.format(locale, formatString, ((tile.getValue() - minValue) / range * 100)));
valueText.setFill(tile.getValueColor());
Helper.enableNode(valueText, tile.isValueVisible());
unitText = new Text(tile.getUnit());
unitText.setFill(tile.getUnitColor());
Helper.enableNode(unitText, !tile.getUnit().isEmpty());
valueUnitFlow = new TextFlow(valueText, unitText);
valueUnitFlow.setTextAlignment(TextAlignment.RIGHT);
description = new Label(tile.getDescription());
description.setAlignment(tile.getDescriptionAlignment());
description.setWrapText(true);
description.setTextFill(tile.getTextColor());
Helper.enableNode(description, !tile.getDescription().isEmpty());
plusLabel = new Label("+");
plusLabel.setAlignment(Pos.CENTER);
plusLabel.setEffect(shadow);
plusLabel.setPickOnBounds(false);
minusLabel = new Label("-");
minusLabel.setAlignment(Pos.CENTER);
minusLabel.setEffect(shadow);
minusLabel.setPickOnBounds(false);
getPane().getChildren().addAll(titleText, text, valueUnitFlow, description, minusLabel, plusLabel);
}
Aggregations