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

java.lang.Object
  extended bycom.google.gwt.user.client.ui.UIObject
      extended bycom.google.gwt.user.client.ui.Widget
          extended bycom.google.gwt.user.client.ui.Panel
              extended bycom.google.gwt.user.client.ui.ComplexPanel
                  extended bycom.google.gwt.user.client.ui.DeckPanel
All Implemented Interfaces:
EventListener, HasWidgets, IndexedPanel

public class DeckPanel
extends ComplexPanel

A panel that displays all of its child widgets in a 'deck', where only one can be visible at a time. It is used by TabPanel.

Once a widget has been added to a DeckPanel, its visibility, width, and height attributes will be manipulated. When the widget is removed from the DeckPanel, it will be visible, and its width and height attributes will be cleared.


Constructor Summary
DeckPanel()
          Creates an empty deck panel.
 
Method Summary
 void add(Widget w)
          Adds the specified widget to the deck.
protected  void disown(Widget w)
          Calls the superclass' disown(Widget) method, makes the widget visible, and clears the widget's width and height attributes.
 int getVisibleWidget()
          Gets the index of the currently-visible widget.
 void insert(Widget w, int beforeIndex)
          Inserts a widget before the specified index.
 boolean remove(Widget w)
          Removes a child widget.
 void showWidget(int index)
          Shows the widget at the specified index.
 
Methods inherited from class com.google.gwt.user.client.ui.ComplexPanel
add, getChildren, getWidget, getWidgetCount, getWidgetIndex, insert, iterator, remove
 
Methods inherited from class com.google.gwt.user.client.ui.Panel
adopt, clear, onAttach, onDetach
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
getParent, isAttached, onBrowserEvent, onLoad, onUnload, removeFromParent, setElement
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleName, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getTitle, isVisible, isVisible, removeStyleName, resetStyleName, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setTitle, setVisible, setVisible, setWidth, sinkEvents, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DeckPanel

public DeckPanel()
Creates an empty deck panel.

Method Detail

add

public void add(Widget w)
Adds the specified widget to the deck.

Specified by:
add in interface HasWidgets
Overrides:
add in class Panel
Parameters:
w - the widget to be added

getVisibleWidget

public int getVisibleWidget()
Gets the index of the currently-visible widget.

Returns:
the visible widget's index

insert

public void insert(Widget w,
                   int beforeIndex)
Inserts a widget before the specified index.

Parameters:
w - the widget to be inserted
beforeIndex - the index before which it will be inserted
Throws:
java.lang.IndexOutOfBoundsException - if beforeIndex is out of range

remove

public boolean remove(Widget w)
Description copied from interface: HasWidgets
Removes a child widget.

Specified by:
remove in interface HasWidgets
Overrides:
remove in class ComplexPanel

showWidget

public void showWidget(int index)
Shows the widget at the specified index. This causes the currently- visible widget to be hidden.

Parameters:
index - the index of the widget to be shown

disown

protected void disown(Widget w)
Calls the superclass' disown(Widget) method, makes the widget visible, and clears the widget's width and height attributes. This is done so that any changes to the visibility, height, or width of the widget that were done by the panel are undone when the widget is disowned from the panel.

Overrides:
disown in class Panel
Parameters:
w - the widget to be disowned