com.maryanovsky.gwtutils.client.ui
Class Accordion

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.google.gwt.user.client.ui.ResizeComposite
                  extended by com.maryanovsky.gwtutils.client.ui.Accordion
All Implemented Interfaces:
HasAttachHandlers, HasHandlers, EventListener, HasVisibility, IsRenderable, IsWidget, ProvidesResize, RequiresResize
Direct Known Subclasses:
DefaultSizeAccordion

public class Accordion
extends ResizeComposite
implements RequiresResize, ProvidesResize

An "Accordion" panel. It arranges its children vertically with each child having a "header" that can be clicked to show/hide the widget. This is similar to StackLayoutPanel, only more than one widget can be visible at a time.

Author:
Maryanovsky Alexander

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
Accordion(Style.Unit unit)
          Creates a new Accordion which will have children whose sizes will be specified in the given unit.
 
Method Summary
 void add(Widget widget, double widgetHeight, Widget header, double headerHeight)
          Adds a widget with the specified header at the bottom.
 Widget getHeader(int index)
          Returns the header for the widget at the specified index.
 Widget getHeader(Widget widget)
          Returns the header for the specified widget.
 double getSpacing()
          Returns the spacing between the widgets.
 int getWidgetCount()
          Returns the number of widgets in the Accordion.
 int getWidgetIndex(Widget widget)
          Returns the index of the specified widget; -1 if the widget is not a child.
 void insert(Widget widget, double widgetHeight, Widget header, double headerHeight, int index)
          Adds a widget with the specified header at the specified index.
 boolean isWidgetVisible(int index)
          Returns whether the widget at the specified index is visible.
 boolean isWidgetVisible(Widget widget)
          Returns whether the specified widget is visible.
protected  void onLoad()
          Lays the children out when the widget is attached.
 void setSpacing(double spacing)
          Sets the spacing between the widgets.
 void setWidgetVisible(int index, boolean isVisible)
          Sets the visibility of the widget at the specified index.
 void setWidgetVisible(Widget widget, boolean isVisible)
          Sets the visibility of the specified widget.
 
Methods inherited from class com.google.gwt.user.client.ui.ResizeComposite
initWidget, onResize
 
Methods inherited from class com.google.gwt.user.client.ui.Composite
claimElement, getWidget, initializeClaimedElement, 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, 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
 
Methods inherited from interface com.google.gwt.user.client.ui.RequiresResize
onResize
 

Constructor Detail

Accordion

public Accordion(Style.Unit unit)
Creates a new Accordion which will have children whose sizes will be specified in the given unit.

Method Detail

getWidgetCount

public int getWidgetCount()
Returns the number of widgets in the Accordion.


getWidgetIndex

public int getWidgetIndex(Widget widget)
Returns the index of the specified widget; -1 if the widget is not a child.


getHeader

public Widget getHeader(int index)
Returns the header for the widget at the specified index.


getHeader

public Widget getHeader(Widget widget)
Returns the header for the specified widget.


isWidgetVisible

public boolean isWidgetVisible(int index)
Returns whether the widget at the specified index is visible.


isWidgetVisible

public boolean isWidgetVisible(Widget widget)
Returns whether the specified widget is visible.


setWidgetVisible

public void setWidgetVisible(int index,
                             boolean isVisible)
Sets the visibility of the widget at the specified index.


setWidgetVisible

public void setWidgetVisible(Widget widget,
                             boolean isVisible)
Sets the visibility of the specified widget.


add

public void add(Widget widget,
                double widgetHeight,
                Widget header,
                double headerHeight)
Adds a widget with the specified header at the bottom. The heights of the widget and header must be specified.


insert

public void insert(Widget widget,
                   double widgetHeight,
                   Widget header,
                   double headerHeight,
                   int index)
Adds a widget with the specified header at the specified index. Also specified are their heights and the location where to insert them.


getSpacing

public double getSpacing()
Returns the spacing between the widgets.


setSpacing

public void setSpacing(double spacing)
Sets the spacing between the widgets.


onLoad

protected void onLoad()
Lays the children out when the widget is attached.

Overrides:
onLoad in class Widget