Java Code Examples for javafx.animation.PauseTransition#playFromStart()
The following examples show how to use
javafx.animation.PauseTransition#playFromStart() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ScrollGesture.java From gef with Eclipse Public License 2.0 | 5 votes |
/** * (Re-)Starts playing the finish-delay-transition. * * @param viewer * The {@link IViewer} */ protected void playFinishDelayTransition(IViewer viewer) { if (!finishDelayTransitions.containsKey(viewer)) { finishDelayTransitions.put(viewer, createFinishDelayTransition(viewer)); } PauseTransition pauseTransition = finishDelayTransitions.get(viewer); pauseTransition.stop(); pauseTransition.setDuration(Duration.millis(getFinishDelayMillis())); pauseTransition.playFromStart(); }
Example 2
Source File: JFXNodeUtils.java From JFoenix with Apache License 2.0 | 5 votes |
public static <T> InvalidationListener addDelayedPropertyInvalidationListener(ObservableValue<T> property, Duration delayTime, Consumer<T> consumer) { Wrapper<T> eventWrapper = new Wrapper<>(); PauseTransition holdTimer = new PauseTransition(delayTime); holdTimer.setOnFinished(event -> consumer.accept(eventWrapper.content)); final InvalidationListener invalidationListener = observable -> { eventWrapper.content = property.getValue(); holdTimer.playFromStart(); }; property.addListener(invalidationListener); return invalidationListener; }
Example 3
Source File: JFXNodeUtils.java From JFoenix with Apache License 2.0 | 5 votes |
public static <T> InvalidationListener addDelayedPropertyInvalidationListener(ObservableValue<T> property, Duration delayTime, BiConsumer<T, InvalidationListener> consumer) { Wrapper<T> eventWrapper = new Wrapper<>(); PauseTransition holdTimer = new PauseTransition(delayTime); final InvalidationListener invalidationListener = observable -> { eventWrapper.content = property.getValue(); holdTimer.playFromStart(); }; holdTimer.setOnFinished(event -> consumer.accept(eventWrapper.content, invalidationListener)); property.addListener(invalidationListener); return invalidationListener; }
Example 4
Source File: JFXNodeUtils.java From JFoenix with Apache License 2.0 | 5 votes |
public static <T> InvalidationListener addDelayedPropertyInvalidationListener(ObservableValue<T> property, Duration delayTime, Consumer<T> justInTimeConsumer, Consumer<T> delayedConsumer) { Wrapper<T> eventWrapper = new Wrapper<>(); PauseTransition holdTimer = new PauseTransition(delayTime); holdTimer.setOnFinished(event -> delayedConsumer.accept(eventWrapper.content)); final InvalidationListener invalidationListener = observable -> { eventWrapper.content = property.getValue(); justInTimeConsumer.accept(eventWrapper.content); holdTimer.playFromStart(); }; property.addListener(invalidationListener); return invalidationListener; }
Example 5
Source File: JFXNodeUtils.java From JFoenix with Apache License 2.0 | 5 votes |
public static <T extends Event> EventHandler<? super T> addDelayedEventHandler(Node control, Duration delayTime, final EventType<T> eventType, final EventHandler<? super T> eventHandler) { Wrapper<T> eventWrapper = new Wrapper<>(); PauseTransition holdTimer = new PauseTransition(delayTime); holdTimer.setOnFinished(finish -> eventHandler.handle(eventWrapper.content)); final EventHandler<? super T> eventEventHandler = event -> { eventWrapper.content = event; holdTimer.playFromStart(); }; control.addEventHandler(eventType, eventEventHandler); return eventEventHandler; }