public abstract class AbstractScrollGesture extends AbstractGesture
AbstractScrollGesture
can be used to react to mouse wheel scroll
events. The first scroll event starts the scroll gesture. Subsequent events
belong to the same gesture until no scroll events are received for the finish
duration, in which case the gesture ends. It is an abstract class that
defines three methods that have to be implemented by subclasses:
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_FINISH_DELAY_MILLIS
The default duration in milliseconds that has to pass without receiving a
ScrollEvent so that the gesture is assumed to have finished. |
Constructor and Description |
---|
AbstractScrollGesture() |
Modifier and Type | Method and Description |
---|---|
protected long |
getFinishDelayMillis()
Returns the duration in milliseconds that has to pass without receiving a
ScrollEvent so that the gesture is assumed to have finished. |
protected void |
playFinishDelayTransition()
(Re-)Starts playing the finish-delay-transition.
|
protected void |
register()
Called when a
Scene is provided. |
protected abstract void |
scroll(javafx.scene.input.ScrollEvent event)
Callback method that is invoked for all but the first
ScrollEvent
of a scroll gesture. |
protected abstract void |
scrollFinished()
Callback method that is invoked when the scroll gesture ends, i.e. no
ScrollEvent was fired for the number of milliseconds specified in
DEFAULT_FINISH_DELAY_MILLIS . |
protected abstract void |
scrollStarted(javafx.scene.input.ScrollEvent event)
Callback method that is invoked for the first
ScrollEvent of a
scroll gesture. |
protected void |
unregister()
Called when the
Scene is removed. |
getScene, setScene
public static final int DEFAULT_FINISH_DELAY_MILLIS
ScrollEvent
so that the gesture is assumed to have finished.
Value: 180 (ms)
protected long getFinishDelayMillis()
ScrollEvent
so that the gesture is assumed to have finished.ScrollEvent
so that the gesture is assumed to have
finished.protected void playFinishDelayTransition()
protected void register()
AbstractGesture
Scene
is provided. The new Scene
can be
obtained via AbstractGesture.getScene()
. Event handlers are registered here.register
in class AbstractGesture
protected abstract void scroll(javafx.scene.input.ScrollEvent event)
ScrollEvent
of a scroll gesture.event
- The corresponding ScrollEvent
.protected abstract void scrollFinished()
ScrollEvent
was fired for the number of milliseconds specified in
DEFAULT_FINISH_DELAY_MILLIS
.protected abstract void scrollStarted(javafx.scene.input.ScrollEvent event)
ScrollEvent
of a
scroll gesture.event
- The corresponding ScrollEvent
.protected void unregister()
AbstractGesture
Scene
is removed. You can obtain the old
Scene
via AbstractGesture.getScene()
so that event handlers can be
unregistered.unregister
in class AbstractGesture
Copyright (c) 2014 itemis AG and others. All rights reserved.