Package com.google.gwt.touch.client
Class TouchScroller
java.lang.Object
com.google.gwt.touch.client.TouchScroller
Adds touch based scrolling to a scroll panel.
Touch based scrolling is only supported on devices that support touch events and do not implement native touch based scrolling.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static classA point associated with a time. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) PointCalculate the end velocity.static TouchScrollerReturn a newTouchScroller.static TouchScrollercreateIfSupported(HasScrolling widget) Return a newTouchScrollerthat augments the specified scrollable widget if supported, and null otherwise.(package private) TouchScroller.TemporalPointVisible for testing.Get theMomentumthat controls scrolling after the user completes a gesture.(package private) TouchScroller.TemporalPointVisible for testing.Get the targetHasScrollingwidget that this scroller affects.protected TouchgetTouchFromEvent(TouchEvent<?> event) Get touch from event.(package private) booleanVisible for testing.(package private) booleanCheck if momentum is currently active.static booleanRuntime check for whether touch scrolling is supported in this browser.(package private) booleanVisible for testing.protected voidonDragEnd(TouchEvent<?> event) Called when the object's drag sequence is complete.protected voidonDragMove(TouchEvent<?> event) Called when the object has been dragged to a new position.protected voidonDragStart(TouchEvent<?> event) Called when the object has started dragging.protected voidonTouchCancel(TouchEvent<?> event) Called when the user cancels a touch.protected voidonTouchEnd(TouchEvent<?> event) Called when the user releases a touch.protected voidonTouchMove(TouchEvent<?> event) Called when the user moves a touch.protected voidonTouchStart(TouchEvent<?> event) Called when the user starts a touch.(package private) voidRemoves the attach handler.(package private) voidRemoves the bust click handler.voidsetMomentum(Momentum momentum) Set theMomentumthat controls scrolling after the user completes a gesture.voidsetTargetWidget(HasScrolling widget) Set the targetHasScrollingwidget that this scroller affects.(package private) voidSets up the bust click handler.
-
Constructor Details
-
TouchScroller
protected TouchScroller()Construct a newTouchScroller. This constructor should be called using the static methodcreateIfSupported().- See Also:
-
-
Method Details
-
createIfSupported
Return a newTouchScroller.- Returns:
- a new
TouchScrollerif supported, and null otherwise
-
createIfSupported
Return a newTouchScrollerthat augments the specified scrollable widget if supported, and null otherwise.- Parameters:
widget- the scrollable widget- Returns:
- a new
TouchScrollerif supported, and null otherwise
-
isSupported
public static boolean isSupported()Runtime check for whether touch scrolling is supported in this browser. Returns true if touch events are supported but touch based scrolling is not natively supported.- Returns:
- true if touch scrolling is supported, false if not
-
getMomentum
Get theMomentumthat controls scrolling after the user completes a gesture.- Returns:
- the scrolling
Momentum, or null if disabled
-
getTargetWidget
Get the targetHasScrollingwidget that this scroller affects.- Returns:
- the target widget
-
setMomentum
Set theMomentumthat controls scrolling after the user completes a gesture.- Parameters:
momentum- the scrollingMomentum, or null to disable
-
setTargetWidget
Set the targetHasScrollingwidget that this scroller affects.- Parameters:
widget- the target widget, or null to disbale
-
getTouchFromEvent
Get touch from event.- Parameters:
event- the event- Returns:
- the touch object
-
onDragEnd
Called when the object's drag sequence is complete.- Parameters:
event- the touch event
-
onDragMove
Called when the object has been dragged to a new position.- Parameters:
event- the touch event
-
onDragStart
Called when the object has started dragging.- Parameters:
event- the touch event
-
onTouchCancel
Called when the user cancels a touch. This can happen if the user touches the screen with too many fingers.- Parameters:
event- the touch event
-
onTouchEnd
Called when the user releases a touch.- Parameters:
event- the touch event
-
onTouchMove
Called when the user moves a touch.- Parameters:
event- the touch event
-
onTouchStart
Called when the user starts a touch.- Parameters:
event- the touch event
-
calculateEndVelocity
Calculate the end velocity. Visible for testing.- Parameters:
from- the starting pointto- the ending point- Returns:
- the end velocity, or null if it cannot be calculated
-
getLastTouchPosition
TouchScroller.TemporalPoint getLastTouchPosition()Visible for testing. -
getRecentTouchPosition
TouchScroller.TemporalPoint getRecentTouchPosition()Visible for testing. -
isDragging
boolean isDragging()Visible for testing. -
isMomentumActive
boolean isMomentumActive()Check if momentum is currently active. Visible for testing.- Returns:
- true if active, false if not
-
isTouching
boolean isTouching()Visible for testing. -
removeAttachHandler
void removeAttachHandler()Removes the attach handler. Visible for testing. -
removeBustClickHandler
void removeBustClickHandler()Removes the bust click handler. Visible for testing. -
setupBustClickHandler
void setupBustClickHandler()Sets up the bust click handler. Visible for testing.
-