use of javafx.event.EventType in project tilesfx by HanSolo.
the class SliderTileSkin method initGraphics.
// ******************** Initialization ************************************
@Override
protected void initGraphics() {
super.initGraphics();
mouseEventHandler = e -> {
final EventType TYPE = e.getEventType();
if (MouseEvent.MOUSE_PRESSED == TYPE) {
dragStart = thumb.localToParent(e.getX(), e.getY());
formerThumbPos = (tile.getCurrentValue() - minValue) / range;
tile.fireTileEvent(VALUE_CHANGING);
} else if (MouseEvent.MOUSE_DRAGGED == TYPE) {
Point2D currentPos = thumb.localToParent(e.getX(), e.getY());
double dragPos = currentPos.getX() - dragStart.getX();
thumbDragged((formerThumbPos + dragPos / trackLength));
} else if (MouseEvent.MOUSE_RELEASED == TYPE) {
tile.fireTileEvent(VALUE_CHANGED);
}
};
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())));
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());
barBackground = new Rectangle(PREFERRED_WIDTH * 0.795, PREFERRED_HEIGHT * 0.0275);
bar = new Rectangle(0, PREFERRED_HEIGHT * 0.0275);
thumb = new Circle(PREFERRED_WIDTH * 0.09);
thumb.setEffect(shadow);
getPane().getChildren().addAll(titleText, text, valueUnitFlow, description, barBackground, bar, thumb);
}
use of javafx.event.EventType in project gs-ui-javafx by graphstream.
the class FxDefaultView method addListener.
public <T, U> void addListener(T descriptor, U listener) {
EventType eventType = (EventType) descriptor;
EventHandler eventFilter = (EventHandler) listener;
addEventFilter(eventType, eventFilter);
}
use of javafx.event.EventType in project Board-Instrumentation-Framework by intel.
the class Section method fireSectionEvent.
public void fireSectionEvent(final SectionEvent EVENT) {
final EventHandler<SectionEvent> HANDLER;
final EventType TYPE = EVENT.getEventType();
if (SectionEvent.ENTERING_SECTION == TYPE) {
HANDLER = getOnEnteringSection();
} else if (SectionEvent.LEAVING_SECTION == TYPE) {
HANDLER = getOnLeavingSection();
} else {
HANDLER = null;
}
if (null == HANDLER)
return;
HANDLER.handle(EVENT);
}
use of javafx.event.EventType in project Board-Instrumentation-Framework by intel.
the class Marker method fireMarkerEvent.
public void fireMarkerEvent(final MarkerEvent EVENT) {
final EventHandler<MarkerEvent> HANDLER;
final EventType TYPE = EVENT.getEventType();
if (MarkerEvent.MARKER_EXCEEDED == TYPE) {
HANDLER = getOnMarkerExceeded();
} else if (MarkerEvent.MARKER_UNDERRUN == TYPE) {
HANDLER = getOnMarkerUnderrun();
} else {
HANDLER = null;
}
if (null == HANDLER)
return;
HANDLER.handle(EVENT);
}
use of javafx.event.EventType in project Board-Instrumentation-Framework by intel.
the class PushButton method fireSelectionEvent.
public void fireSelectionEvent(final SelectionEvent EVENT) {
final EventType TYPE = EVENT.getEventType();
final EventHandler<SelectionEvent> HANDLER;
if (SelectionEvent.SELECTED == TYPE) {
HANDLER = getOnSelect();
} else if (SelectionEvent.DESELECTED == TYPE) {
HANDLER = getOnDeselect();
} else if (SelectionEvent.EMPTY == TYPE) {
HANDLER = getOnEmpty();
} else {
HANDLER = null;
}
if (HANDLER != null) {
HANDLER.handle(EVENT);
}
}
Aggregations