GWT 2.0.3

com.google.gwt.user.client.ui
Class ScrollPanel

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Panel
              extended by com.google.gwt.user.client.ui.SimplePanel
                  extended by com.google.gwt.user.client.ui.ScrollPanel
All Implemented Interfaces:
HasScrollHandlers, HasHandlers, EventListener, HasWidgets, ProvidesResize, RequiresResize, SourcesScrollEvents, java.lang.Iterable<Widget>

public class ScrollPanel
extends SimplePanel
implements SourcesScrollEvents, HasScrollHandlers, RequiresResize, ProvidesResize

A simple panel that wraps its contents in a scrollable area.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
ScrollPanel()
          Creates an empty scroll panel.
ScrollPanel(Widget child)
          Creates a new scroll panel with the given child widget.
 
Method Summary
 HandlerRegistration addScrollHandler(ScrollHandler handler)
          Adds a ScrollEvent handler.
 void addScrollListener(ScrollListener listener)
          Deprecated. Use addScrollHandler(com.google.gwt.event.dom.client.ScrollHandler) instead
 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 getScrollPosition()
          Gets the vertical scroll position.
 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)
          Sets the vertical scroll position.
 void setSize(java.lang.String width, java.lang.String height)
          Sets the object's size.
 void setWidth(java.lang.String width)
          Sets the object's width.
 
Methods inherited from class com.google.gwt.user.client.ui.SimplePanel
add, getWidget, iterator, remove, setWidget
 
Methods inherited from class com.google.gwt.user.client.ui.Panel
adopt, adopt, clear, disown, doAttachChildren, doDetachChildren, onLoad, onUnload, orphan
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addDomHandler, addHandler, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setPixelSize, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ScrollPanel

public ScrollPanel()
Creates an empty scroll panel.


ScrollPanel

public ScrollPanel(Widget child)
Creates a new scroll panel with the given child widget.

Parameters:
child - the widget to be wrapped by the scroll panel
Method Detail

addScrollHandler

public HandlerRegistration addScrollHandler(ScrollHandler handler)
Description copied from interface: HasScrollHandlers
Adds a ScrollEvent handler.

Specified by:
addScrollHandler in interface HasScrollHandlers
Parameters:
handler - the scroll handler
Returns:
HandlerRegistration used to remove this handler

addScrollListener

@Deprecated
public void addScrollListener(ScrollListener listener)
Deprecated. Use addScrollHandler(com.google.gwt.event.dom.client.ScrollHandler) instead

Description copied from interface: SourcesScrollEvents
Adds a listener interface to receive scroll events.

Specified by:
addScrollListener in interface SourcesScrollEvents
Parameters:
listener - the listener interface to add

ensureVisible

public void ensureVisible(UIObject item)
Ensures that the specified item is visible, by adjusting the panel's scroll position.

Parameters:
item - the item whose visibility is to be ensured

getHorizontalScrollPosition

public int getHorizontalScrollPosition()
Gets the horizontal scroll position.

Returns:
the horizontal scroll position, in pixels

getScrollPosition

public int getScrollPosition()
Gets the vertical scroll position.

Returns:
the vertical scroll position, in pixels

onResize

public void onResize()
Description copied from interface: RequiresResize
This method must be called whenever the implementor's size has been modified.

Specified by:
onResize in interface RequiresResize

removeScrollListener

@Deprecated
public void removeScrollListener(ScrollListener listener)
Deprecated. Use the HandlerRegistration.removeHandler() method on the object returned by addScrollHandler(com.google.gwt.event.dom.client.ScrollHandler) instead

Description copied from interface: SourcesScrollEvents
Removes a previously added scroll listener.

Specified by:
removeScrollListener in interface SourcesScrollEvents
Parameters:
listener - the listener interface to remove

scrollToBottom

public void scrollToBottom()
Scroll to the bottom of this panel.


scrollToLeft

public void scrollToLeft()
Scroll to the far left of this panel.


scrollToRight

public void scrollToRight()
Scroll to the far right of this panel.


scrollToTop

public void scrollToTop()
Scroll to the top of this panel.


setAlwaysShowScrollBars

public void setAlwaysShowScrollBars(boolean alwaysShow)
Sets whether this panel always shows its scroll bars, or only when necessary.

Parameters:
alwaysShow - true to show scroll bars at all times

setHeight

public void setHeight(java.lang.String height)
Sets the object's height. This height does not include decorations such as border, margin, and padding.

Overrides:
setHeight in class UIObject
Parameters:
height - the object's new height, in absolute CSS units (e.g. "10px", "1em" but not "50%")

setHorizontalScrollPosition

public void setHorizontalScrollPosition(int position)
Sets the horizontal scroll position.

Parameters:
position - the new horizontal scroll position, in pixels

setScrollPosition

public void setScrollPosition(int position)
Sets the vertical scroll position.

Parameters:
position - the new vertical scroll position, in pixels

setSize

public void setSize(java.lang.String width,
                    java.lang.String height)
Sets the object's size. This size does not include decorations such as border, margin, and padding.

Overrides:
setSize in class UIObject
Parameters:
width - the object's new width, in absolute CSS units (e.g. "10px", "1em", but not "50%")
height - the object's new height, in absolute CSS units (e.g. "10px", "1em", but not "50%")

setWidth

public void setWidth(java.lang.String width)
Sets the object's width. This width does not include decorations such as border, margin, and padding.

Overrides:
setWidth in class UIObject
Parameters:
width - the object's new width, in absolute CSS units (e.g. "10px", "1em", but not "50%")

getContainerElement

protected Element getContainerElement()
Description copied from class: SimplePanel
Override this method to specify that an element other than the root element be the container for the panel's child widget. This can be useful when you want to create a simple panel that decorates its contents. Note that this method continues to return the Element class defined in the User module to maintain backwards compatibility.

Overrides:
getContainerElement in class SimplePanel
Returns:
the element to be used as the panel's container

GWT 2.0.3