public class ScrollPanel extends SimplePanel implements SourcesScrollEvents, RequiresResize, ProvidesResize, HasScrolling
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
HasWidgets.ForIsWidget
widget
eventsToSink
DEBUG_ID_PREFIX, MISSING_ELEMENT_ERROR, SETELEMENT_TWICE_ERROR
Modifier | Constructor and Description |
---|---|
|
ScrollPanel()
Creates an empty scroll panel.
|
protected |
ScrollPanel(Element root,
Element scrollable,
Element container)
Creates an empty scroll panel using the specified root, scrollable, and
container elements.
|
|
ScrollPanel(Widget child)
Creates a new scroll panel with the given child widget.
|
Modifier and Type | Method and Description |
---|---|
HandlerRegistration |
addScrollHandler(ScrollHandler handler)
Adds a
ScrollEvent handler. |
void |
addScrollListener(ScrollListener listener)
Deprecated.
|
void |
ensureVisible(UIObject item)
Ensures that the specified item is visible, by adjusting the panel's scroll
position.
|
protected Element |
getContainerElement()
Override this method to specify that an element other than the root element
be the container for the panel's child widget.
|
int |
getHorizontalScrollPosition()
Gets the horizontal scroll position.
|
int |
getMaximumHorizontalScrollPosition()
Get the maximum position of horizontal scrolling.
|
int |
getMaximumVerticalScrollPosition()
Get the maximum position of vertical scrolling.
|
int |
getMinimumHorizontalScrollPosition()
Get the minimum position of horizontal scrolling.
|
int |
getMinimumVerticalScrollPosition()
Get the minimum position of vertical scrolling.
|
protected Element |
getScrollableElement()
Get the scrollable element.
|
int |
getScrollPosition()
Deprecated.
as of GWT 2.3, replaced by
getVerticalScrollPosition() |
int |
getVerticalScrollPosition()
Gets the vertical scroll position.
|
boolean |
isTouchScrollingDisabled()
Check whether or not touch based scrolling is disabled.
|
protected void |
onAttach()
This method is called when a widget is attached to the browser's document.
|
protected void |
onDetach()
This method is called when a widget is detached from the browser's
document.
|
void |
onResize()
This method must be called whenever the implementor's size has been
modified.
|
void |
removeScrollListener(ScrollListener listener)
Deprecated.
Use the
HandlerRegistration.removeHandler()
method on the object returned by addScrollHandler(com.google.gwt.event.dom.client.ScrollHandler) instead |
void |
scrollToBottom()
Scroll to the bottom of this panel.
|
void |
scrollToLeft()
Scroll to the far left of this panel.
|
void |
scrollToRight()
Scroll to the far right of this panel.
|
void |
scrollToTop()
Scroll to the top of this panel.
|
void |
setAlwaysShowScrollBars(boolean alwaysShow)
Sets whether this panel always shows its scroll bars, or only when
necessary.
|
void |
setHeight(java.lang.String height)
Sets the object's height.
|
void |
setHorizontalScrollPosition(int position)
Sets the horizontal scroll position.
|
void |
setScrollPosition(int position)
Deprecated.
as of GWT 2.3, replaced by
setVerticalScrollPosition(int) |
void |
setSize(java.lang.String width,
java.lang.String height)
Sets the object's size.
|
boolean |
setTouchScrollingDisabled(boolean isDisabled)
Set whether or not touch scrolling is disabled.
|
void |
setVerticalScrollPosition(int position)
Sets the vertical scroll position.
|
void |
setWidth(java.lang.String width)
Sets the object's width.
|
add, getWidget, iterator, remove, setWidget, setWidget
add, adopt, clear, doAttachChildren, doDetachChildren, orphan, remove
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, ensureHandlers, fireEvent, getHandlerCount, getHandlerManager, getLayoutData, getParent, isAttached, isOrWasAttached, onBrowserEvent, onLoad, onUnload, removeFromParent, replaceElement, setLayoutData, setParent, sinkEvents, unsinkEvents
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setPixelSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, sinkBitlessEvent, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
fireEvent
public ScrollPanel()
public ScrollPanel(Widget child)
child
- the widget to be wrapped by the scroll panelprotected ScrollPanel(Element root, Element scrollable, Element container)
root
- the root element of the Widgetscrollable
- the scrollable element, which can be the same as the root
elementcontainer
- the container element that holds the childpublic HandlerRegistration addScrollHandler(ScrollHandler handler)
HasScrollHandlers
ScrollEvent
handler.addScrollHandler
in interface HasScrollHandlers
handler
- the scroll handlerHandlerRegistration
used to remove this handler@Deprecated public void addScrollListener(ScrollListener listener)
addScrollHandler(com.google.gwt.event.dom.client.ScrollHandler)
insteadSourcesScrollEvents
addScrollListener
in interface SourcesScrollEvents
listener
- the listener interface to addpublic void ensureVisible(UIObject item)
item
- the item whose visibility is to be ensuredpublic int getHorizontalScrollPosition()
getHorizontalScrollPosition
in interface HasHorizontalScrolling
public int getMaximumHorizontalScrollPosition()
HasHorizontalScrolling
scrollWidth - clientWidth
.getMaximumHorizontalScrollPosition
in interface HasHorizontalScrolling
public int getMaximumVerticalScrollPosition()
HasVerticalScrolling
scrollHeight - clientHeight
.getMaximumVerticalScrollPosition
in interface HasVerticalScrolling
public int getMinimumHorizontalScrollPosition()
HasHorizontalScrolling
getMinimumHorizontalScrollPosition
in interface HasHorizontalScrolling
public int getMinimumVerticalScrollPosition()
HasVerticalScrolling
getMinimumVerticalScrollPosition
in interface HasVerticalScrolling
@Deprecated public int getScrollPosition()
getVerticalScrollPosition()
public int getVerticalScrollPosition()
HasVerticalScrolling
getVerticalScrollPosition
in interface HasVerticalScrolling
public boolean isTouchScrollingDisabled()
public void onResize()
RequiresResize
onResize
in interface RequiresResize
@Deprecated public void removeScrollListener(ScrollListener listener)
HandlerRegistration.removeHandler()
method on the object returned by addScrollHandler(com.google.gwt.event.dom.client.ScrollHandler)
insteadSourcesScrollEvents
removeScrollListener
in interface SourcesScrollEvents
listener
- the listener interface to removepublic void scrollToBottom()
public void scrollToLeft()
public void scrollToRight()
public void scrollToTop()
public void setAlwaysShowScrollBars(boolean alwaysShow)
alwaysShow
- true
to show scroll bars at all timespublic void setHeight(java.lang.String height)
public void setHorizontalScrollPosition(int position)
setHorizontalScrollPosition
in interface HasHorizontalScrolling
position
- the new horizontal scroll position, in pixels@Deprecated public void setScrollPosition(int position)
setVerticalScrollPosition(int)
position
- the new vertical scroll position, in pixelspublic void setSize(java.lang.String width, java.lang.String height)
public boolean setTouchScrollingDisabled(boolean isDisabled)
isDisabled
- true to disable, false to enablepublic void setVerticalScrollPosition(int position)
HasVerticalScrolling
setVerticalScrollPosition
in interface HasVerticalScrolling
position
- the new vertical scroll position, in pixelspublic void setWidth(java.lang.String width)
protected Element getContainerElement()
SimplePanel
Element
class defined in the
User
module to maintain backwards compatibility.getContainerElement
in class SimplePanel
protected Element getScrollableElement()
protected void onAttach()
Widget
This method is called when a widget is attached to the browser's document.
To receive notification after a Widget has been added to the document,
override the Widget.onLoad()
method or use Widget.addAttachHandler(com.google.gwt.event.logical.shared.AttachEvent.Handler)
.
It is strongly recommended that you override Widget.onLoad()
or
Widget.doAttachChildren()
instead of this method to avoid inconsistencies
between logical and physical attachment states.
Subclasses that override this method must call
super.onAttach()
to ensure that the Widget has been attached
to its underlying Element.
onAttach
in class Widget
Widget.onLoad()
,
Widget.doAttachChildren()
protected void onDetach()
Widget
This method is called when a widget is detached from the browser's
document. To receive notification before a Widget is removed from the
document, override the Widget.onUnload()
method or use Widget.addAttachHandler(com.google.gwt.event.logical.shared.AttachEvent.Handler)
.
It is strongly recommended that you override Widget.onUnload()
or
Widget.doDetachChildren()
instead of this method to avoid inconsistencies
between logical and physical attachment states.
Subclasses that override this method must call
super.onDetach()
to ensure that the Widget has been detached
from the underlying Element. Failure to do so will result in application
memory leaks due to circular references between DOM Elements and JavaScript
objects.
onDetach
in class Widget
Widget.onUnload()
,
Widget.doDetachChildren()