Search in sources :

Example 1 with EventType

use of javafx.event.EventType in project gs-ui-javafx by graphstream.

the class FxDefaultView method removeListener.

public <T, U> void removeListener(T descriptor, U listener) {
    EventType eventType = (EventType) descriptor;
    EventHandler eventFilter = (EventHandler) listener;
    removeEventFilter(eventType, eventFilter);
}
Also used : EventType(javafx.event.EventType) EventHandler(javafx.event.EventHandler)

Example 2 with EventType

use of javafx.event.EventType in project Board-Instrumentation-Framework by intel.

the class GaugeSkin 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) {
            unitText.setText("Threshold");
            valueText.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(valueText.getText()));
            fadeBackToInteractive();
        }
    } else if (SRC instanceof Marker) {
        if (TouchEvent.TOUCH_PRESSED == TYPE) {
            unitText.setText(((Marker) SRC).getText());
            valueText.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(valueText.getText()));
            fadeBackToInteractive();
        }
    } else if (SRC.equals(minMeasuredValue)) {
        if (TouchEvent.TOUCH_PRESSED == TYPE) {
            unitText.setText("Min");
            valueText.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) {
            unitText.setText("Max");
            valueText.setText(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", getSkinnable().getMaxMeasuredValue()));
            resizeText();
        } else if (TouchEvent.TOUCH_RELEASED == TYPE) {
            fadeBackToInteractive();
        }
    }
}
Also used : EventType(javafx.event.EventType) Point2D(javafx.geometry.Point2D) Marker(eu.hansolo.enzo.common.Marker)

Example 3 with EventType

use of javafx.event.EventType in project Board-Instrumentation-Framework by intel.

the class RadialBargraphSkin 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) {
            unit.setText("Threshold");
            value.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(value.getText()));
            fadeBackToInteractive();
        }
    } else if (getSkinnable().isInteractive() && SRC instanceof Marker) {
        if (MouseEvent.MOUSE_PRESSED == TYPE) {
            unit.setText(((Marker) SRC).getText());
            value.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(value.getText()));
            fadeBackToInteractive();
        }
    } else if (getSkinnable().isInteractive() && SRC.equals(minMeasuredValue)) {
        if (MouseEvent.MOUSE_PRESSED == TYPE) {
            unit.setText("Min");
            value.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) {
            unit.setText("Max");
            value.setText(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", getSkinnable().getMaxMeasuredValue()));
            resizeText();
        } else if (MouseEvent.MOUSE_RELEASED == TYPE) {
            fadeBackToInteractive();
        }
    }
}
Also used : EventType(javafx.event.EventType) Point2D(javafx.geometry.Point2D) Marker(eu.hansolo.enzo.common.Marker)

Example 4 with EventType

use of javafx.event.EventType in project Board-Instrumentation-Framework by intel.

the class HeatControlSkin method handleMouseEvent.

// ******************** Private Methods ***********************************
private void handleMouseEvent(final MouseEvent MOUSE_EVENT) {
    final Object SRC = MOUSE_EVENT.getSource();
    final EventType TYPE = MOUSE_EVENT.getEventType();
    if (SRC.equals(targetIndicator)) {
        if (MouseEvent.MOUSE_PRESSED == TYPE) {
            userAction = true;
            value.setText(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", getSkinnable().getTarget()));
            resizeText();
        } else if (MouseEvent.MOUSE_DRAGGED == TYPE) {
            touchRotate(MOUSE_EVENT.getSceneX() - getSkinnable().getLayoutX(), MOUSE_EVENT.getSceneY() - getSkinnable().getLayoutY(), targetIndicatorRotate);
        } else if (MouseEvent.MOUSE_RELEASED == TYPE) {
            getSkinnable().setTarget(Double.parseDouble(newTarget));
            fadeBack();
        }
    }
}
Also used : EventType(javafx.event.EventType)

Example 5 with EventType

use of javafx.event.EventType in project Board-Instrumentation-Framework by intel.

the class HeatControlSkin method handleTouchEvent.

private void handleTouchEvent(final TouchEvent TOUCH_EVENT) {
    final Object SRC = TOUCH_EVENT.getSource();
    final EventType TYPE = TOUCH_EVENT.getEventType();
    if (SRC.equals(targetIndicator)) {
        if (TouchEvent.TOUCH_PRESSED == TYPE) {
            value.setText(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", getSkinnable().getTarget()));
            resizeText();
        } else if (TouchEvent.TOUCH_MOVED == TYPE) {
            touchRotate(TOUCH_EVENT.getTouchPoint().getSceneX() - getSkinnable().getLayoutX(), TOUCH_EVENT.getTouchPoint().getSceneY() - getSkinnable().getLayoutY(), targetIndicatorRotate);
        } else if (TouchEvent.TOUCH_RELEASED == TYPE) {
            getSkinnable().setTarget(Double.parseDouble(value.getText()));
            fadeBack();
        }
    }
}
Also used : EventType(javafx.event.EventType)

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