public class TouchScroller extends Object
Touch based scrolling is only supported on devices that support touch events and do not implement native touch based scrolling.
Modifier | Constructor and Description |
---|---|
protected |
TouchScroller()
Construct a new
TouchScroller . |
Modifier and Type | Method and Description |
---|---|
static TouchScroller |
createIfSupported()
Return a new
TouchScroller . |
static TouchScroller |
createIfSupported(HasScrolling widget)
Return a new
TouchScroller that augments the specified scrollable
widget if supported, and null otherwise. |
Momentum |
getMomentum()
Get the
Momentum that controls scrolling after the user completes a
gesture. |
HasScrolling |
getTargetWidget()
Get the target
HasScrolling widget that this scroller affects. |
protected Touch |
getTouchFromEvent(TouchEvent<?> event)
Get touch from event.
|
static boolean |
isSupported()
Runtime check for whether touch scrolling is supported in this browser.
|
protected void |
onDragEnd(TouchEvent<?> event)
Called when the object's drag sequence is complete.
|
protected void |
onDragMove(TouchEvent<?> event)
Called when the object has been dragged to a new position.
|
protected void |
onDragStart(TouchEvent<?> event)
Called when the object has started dragging.
|
protected void |
onTouchCancel(TouchEvent<?> event)
Called when the user cancels a touch.
|
protected void |
onTouchEnd(TouchEvent<?> event)
Called when the user releases a touch.
|
protected void |
onTouchMove(TouchEvent<?> event)
Called when the user moves a touch.
|
protected void |
onTouchStart(TouchEvent<?> event)
Called when the user starts a touch.
|
void |
setMomentum(Momentum momentum)
Set the
Momentum that controls scrolling after the user completes a
gesture. |
void |
setTargetWidget(HasScrolling widget)
Set the target
HasScrolling widget that this scroller affects. |
protected TouchScroller()
TouchScroller
. This constructor should be called
using the static method createIfSupported()
.createIfSupported()
public static TouchScroller createIfSupported()
TouchScroller
.TouchScroller
if supported, and null otherwisepublic static TouchScroller createIfSupported(HasScrolling widget)
TouchScroller
that augments the specified scrollable
widget if supported, and null otherwise.widget
- the scrollable widgetTouchScroller
if supported, and null otherwisepublic static boolean isSupported()
public Momentum getMomentum()
Momentum
that controls scrolling after the user completes a
gesture.Momentum
, or null if disabledpublic HasScrolling getTargetWidget()
HasScrolling
widget that this scroller affects.public void setMomentum(Momentum momentum)
Momentum
that controls scrolling after the user completes a
gesture.momentum
- the scrolling Momentum
, or null to disablepublic void setTargetWidget(HasScrolling widget)
HasScrolling
widget that this scroller affects.widget
- the target widget, or null to disbaleprotected Touch getTouchFromEvent(TouchEvent<?> event)
event
- the eventprotected void onDragEnd(TouchEvent<?> event)
event
- the touch eventprotected void onDragMove(TouchEvent<?> event)
event
- the touch eventprotected void onDragStart(TouchEvent<?> event)
event
- the touch eventprotected void onTouchCancel(TouchEvent<?> event)
event
- the touch eventprotected void onTouchEnd(TouchEvent<?> event)
event
- the touch eventprotected void onTouchMove(TouchEvent<?> event)
event
- the touch eventprotected void onTouchStart(TouchEvent<?> event)
event
- the touch eventCopyright © 2018. All rights reserved.