Search in sources :

Example 11 with EventType

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);
    }
}
Also used : EventType(javafx.event.EventType)

Example 12 with EventType

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();
            }
        }
    };
}
Also used : EventType(javafx.event.EventType) Point2D(javafx.geometry.Point2D) Node(javafx.scene.Node)

Example 13 with EventType

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);
}
Also used : EventType(javafx.event.EventType)

Example 14 with EventType

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);
}
Also used : EventType(javafx.event.EventType)

Example 15 with EventType

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);
}
Also used : EventType(javafx.event.EventType) BorderWidths(javafx.scene.layout.BorderWidths) Label(javafx.scene.control.Label) BorderStroke(javafx.scene.layout.BorderStroke) Text(javafx.scene.text.Text) TextFlow(javafx.scene.text.TextFlow) CornerRadii(javafx.scene.layout.CornerRadii) Border(javafx.scene.layout.Border)

Aggregations

EventType (javafx.event.EventType)26 Point2D (javafx.geometry.Point2D)7 Marker (eu.hansolo.enzo.common.Marker)4 Label (javafx.scene.control.Label)4 Text (javafx.scene.text.Text)4 EventHandler (javafx.event.EventHandler)3 Circle (javafx.scene.shape.Circle)3 Rectangle (javafx.scene.shape.Rectangle)3 TextFlow (javafx.scene.text.TextFlow)3 Timeline (javafx.animation.Timeline)2 Node (javafx.scene.Node)2 UnmodifiableListSet (com.sun.javafx.collections.UnmodifiableListSet)1 Direction (com.sun.javafx.scene.traversal.Direction)1 ArrayDeque (java.util.ArrayDeque)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Locale (java.util.Locale)1 Queue (java.util.Queue)1 Set (java.util.Set)1 BiConsumer (java.util.function.BiConsumer)1