com.vaadin.terminal.gwt.client.ui.
Class TouchScrollDelegate.TouchScrollHandler
java.lang.Object
com.vaadin.terminal.gwt.client.ui.TouchScrollDelegate.TouchScrollHandler
All Implemented Interfaces:
com.google.gwt.event.dom.client.TouchStartHandler, com.google.gwt.event.shared.EventHandler
Enclosing class:
- extends Object
- implements com.google.gwt.event.dom.client.TouchStartHandler
public static class TouchScrollDelegate.TouchScrollHandler
A helper class for making a widget scrollable. Uses native scrolling if supported by the browser, otherwise registers a touch start handler delegating to a TouchScrollDelegate instance.
Constructor Summary | |
---|---|
TouchScrollDelegate.TouchScrollHandler()
Constructs a scroll handler. |
|
TouchScrollDelegate.TouchScrollHandler(com.google.gwt.user.client.ui.Widget widget,
com.google.gwt.dom.client.Element... scrollables)
Deprecated. Use GWT.create(Class) and
init(Widget, Element...) instead of this
constructor to enable overriding. |
Method Summary | |
---|---|
void |
addElement(com.google.gwt.dom.client.Element scrollable)
Registers the given element as scrollable. |
void |
debug(com.google.gwt.dom.client.Element e)
|
protected com.google.gwt.user.client.ui.Widget |
getWidget()
|
void |
init(com.google.gwt.user.client.ui.Widget widget,
com.google.gwt.dom.client.Element... scrollables)
Attaches the scroll handler to the widget. |
void |
onTouchStart(com.google.gwt.event.dom.client.TouchStartEvent event)
|
void |
removeElement(com.google.gwt.dom.client.Element scrollable)
Unregisters the given element as scrollable. |
protected boolean |
requiresDelegate()
Checks if a delegate for scrolling is required or if the native scrolling of the device should be used. |
void |
setElements(com.google.gwt.dom.client.Element... scrollables)
Registers the given elements as scrollable, removing previously registered scrollables from this handler. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
TouchScrollDelegate.TouchScrollHandler
public TouchScrollDelegate.TouchScrollHandler()
Constructs a scroll handler. You must call
init(Widget, Element...)
before using the scroll handler.
TouchScrollDelegate.TouchScrollHandler
@Deprecated
public TouchScrollDelegate.TouchScrollHandler(com.google.gwt.user.client.ui.Widget widget,
com.google.gwt.dom.client.Element... scrollables)
- Parameters:
widget
- The widget that contains scrollable elementsscrollables
- The elements of the widget that should be scrollable.
Deprecated. Use GWT.create(Class)
and
init(Widget, Element...)
instead of this
constructor to enable overriding.
Attaches the scroll handler to the widget. This method must be called before calling any other methods in this class.
Method Detail |
---|
init
public void init(com.google.gwt.user.client.ui.Widget widget,
com.google.gwt.dom.client.Element... scrollables)
- Parameters:
widget
- The widget that contains scrollable elementsscrollables
- The elements of the widget that should be scrollable.
Attaches the scroll handler to the widget. This method must be called once before calling any other method in this class.
onTouchStart
public void onTouchStart(com.google.gwt.event.dom.client.TouchStartEvent event)
- Specified by:
onTouchStart
in interfacecom.google.gwt.event.dom.client.TouchStartHandler
debug
public void debug(com.google.gwt.dom.client.Element e)
addElement
public void addElement(com.google.gwt.dom.client.Element scrollable)
Registers the given element as scrollable.
removeElement
public void removeElement(com.google.gwt.dom.client.Element scrollable)
Unregisters the given element as scrollable. Should be called when a previously-registered element is removed from the DOM to prevent memory leaks.
setElements
public void setElements(com.google.gwt.dom.client.Element... scrollables)
- Parameters:
scrollables
- The elements that should be scrollable
Registers the given elements as scrollable, removing previously registered scrollables from this handler.
requiresDelegate
protected boolean requiresDelegate()
- Returns:
- true if a Javascript delegate should be used for scrolling, false to use the native scrolling of the device
Checks if a delegate for scrolling is required or if the native
scrolling of the device should be used. By default, relies on
BrowserInfo.requiresTouchScrollDelegate()
, override to change
the behavior.
getWidget
protected com.google.gwt.user.client.ui.Widget getWidget()
- Returns:
- The widget this
TouchScrollDelegate.TouchScrollHandler
is connected to.