com.maryanovsky.gwtutils.client.ui
Class ButtonScrollPanel

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.Composite
              extended by com.maryanovsky.gwtutils.client.ui.ButtonScrollPanel
All Implemented Interfaces:
HasAttachHandlers, HasHandlers, EventListener, HasVisibility, HasWidgets, IsRenderable, IsWidget, Iterable<Widget>

public class ButtonScrollPanel
extends Composite
implements HasWidgets

A scroll panel which scrolls its contents with two buttons instead of a scroll bar.

Author:
Maryanovsky Alexander

Nested Class Summary
static interface ButtonScrollPanel.Resources
          The interface for the resources required by the scroll pane.
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
 
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets
HasWidgets.ForIsWidget
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
ButtonScrollPanel(ButtonScrollPanel.Resources resources)
          Creates a new ButtonScrollPanel with the specified resources.
 
Method Summary
 void add(Widget widget)
          Adds a widget.
 void clear()
          Removes the widget.
 SimplePanel getContentPanel()
          Returns the panel where the scrollable child should be placed.
 int getScrollDelay()
          Returns the delay between scrolls, in milliseconds.
 int getScrollStep()
          Returns the number of pixels a single step scrolls.
 boolean isScrollOnMouseOver()
          Returns whether the scrolling occurs on mouse-over.
 Iterator<Widget> iterator()
          Returns an iterator listing the sole child, if any.
 boolean remove(Widget widget)
          Removes the widget.
 void setContentWidget(Widget widget)
          Sets the content widget.
 void setScrollDelay(int scrollDelay)
          Sets the delay between scrolls, in milliseconds.
 void setScrollOnMouseOver(boolean isScrollOnMouseOver)
          Sets whether the scrolling will occur on mouse-over.
 void setScrollStep(int scrollStep)
          Sets the number of pixels a single step will scroll.
 
Methods inherited from class com.google.gwt.user.client.ui.Composite
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, 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, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ButtonScrollPanel

public ButtonScrollPanel(ButtonScrollPanel.Resources resources)
Creates a new ButtonScrollPanel with the specified resources.

Method Detail

getContentPanel

public SimplePanel getContentPanel()
Returns the panel where the scrollable child should be placed.


add

public void add(Widget widget)
Adds a widget. Note that you can't add more than one widget.

Specified by:
add in interface HasWidgets

setContentWidget

public void setContentWidget(Widget widget)
Sets the content widget.


clear

public void clear()
Removes the widget.

Specified by:
clear in interface HasWidgets

iterator

public Iterator<Widget> iterator()
Returns an iterator listing the sole child, if any.

Specified by:
iterator in interface HasWidgets
Specified by:
iterator in interface Iterable<Widget>

remove

public boolean remove(Widget widget)
Removes the widget.

Specified by:
remove in interface HasWidgets

setScrollStep

public void setScrollStep(int scrollStep)
Sets the number of pixels a single step will scroll.


getScrollStep

public int getScrollStep()
Returns the number of pixels a single step scrolls.


setScrollDelay

public void setScrollDelay(int scrollDelay)
Sets the delay between scrolls, in milliseconds.


getScrollDelay

public int getScrollDelay()
Returns the delay between scrolls, in milliseconds.


isScrollOnMouseOver

public boolean isScrollOnMouseOver()
Returns whether the scrolling occurs on mouse-over. If false, the scrolling will only occur when the user actually presses the buttons.


setScrollOnMouseOver

public void setScrollOnMouseOver(boolean isScrollOnMouseOver)
Sets whether the scrolling will occur on mouse-over. If not, the user will need to press the buttons to scroll.