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

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.Composite
              extended bycom.google.gwt.user.client.ui.TabPanel
All Implemented Interfaces:
EventListener, EventListener, HasWidgets, SourcesTabEvents, TabListener

public class TabPanel
extends Composite
implements TabListener, SourcesTabEvents, HasWidgets

A panel that represents a tabbed set of pages, each of which contains another widget. Its child widgets are shown as the user selects the various tabs associated with them. The tabs can contain arbitrary HTML.

Note that this widget is not a panel per se, but rather a Composite that aggregates a TabBar and a DeckPanel. It does, however, implement HasWidgets.

CSS Style Rules

Example

code


Field Summary
 
Fields inherited from class java.lang.Object
typeId, typeName
 
Constructor Summary
TabPanel()
          Creates an empty tab panel.
 
Method Summary
 void add(Widget w, String tabText)
          Adds a widget to the tab panel.
 void add(Widget w, String tabText, boolean asHTML)
          Adds a widget to the tab panel.
 void addTabListener(TabListener listener)
          Adds a listener interface to receive click events.
 DeckPanel getDeckPanel()
          Gets the deck panel within this tab panel.
 TabBar getTabBar()
          Gets the tab bar within this tab panel
 Widget getWidget(int index)
           
 int getWidgetCount()
          Gets the number of widgets in this tab panel.
 int getWidgetIndex(Widget child)
           
 void insert(Widget widget, String tabText, boolean asHTML, int beforeIndex)
          Inserts a widget into the tab panel.
 void insert(Widget widget, String tabText, int beforeIndex)
          Inserts a widget into the tab panel.
 Iterator iterator()
          Gets an iterator for the contained widgets.
 boolean onBeforeTabSelected(SourcesTabEvents sender, int tabIndex)
          Fired just before a tab is selected.
 void onTabSelected(SourcesTabEvents sender, int tabIndex)
          Fired when a tab is selected
 void remove(Widget widget)
          Removes the given widget, and its associated tab.
 void removeTabListener(TabListener listener)
          Removes a previously added listener interface.
 void selectTab(int index)
          Programmatically selects the specified tab.
 
Methods inherited from class com.google.gwt.user.client.ui.Composite
getElement, onAttach, onDetach, setWidget
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
getParent, isAttached, onBrowserEvent, onLoad
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleName, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleName, isVisible, isVisible, removeStyleName, setElement, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setVisible, setVisible, setWidth, sinkEvents, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
equals, finalize, hashCode
 

Constructor Detail

TabPanel

public TabPanel()
Creates an empty tab panel.

Method Detail

add

public void add(Widget w,
                String tabText)
Adds a widget to the tab panel.

Parameters:
w - the widget to be added
tabText - the text to be shown on its tab

add

public void add(Widget w,
                String tabText,
                boolean asHTML)
Adds a widget to the tab panel.

Parameters:
w - the widget to be added
tabText - the text to be shown on its tab
asHTML - true to treat the specified text as HTML

addTabListener

public void addTabListener(TabListener listener)
Description copied from interface: SourcesTabEvents
Adds a listener interface to receive click events.

Specified by:
addTabListener in interface SourcesTabEvents
Parameters:
listener - the listener interface to add

getDeckPanel

public DeckPanel getDeckPanel()
Gets the deck panel within this tab panel.

Returns:
the deck panel

getTabBar

public TabBar getTabBar()
Gets the tab bar within this tab panel

Returns:
the tab bar

getWidget

public Widget getWidget(int index)

getWidgetCount

public int getWidgetCount()
Gets the number of widgets in this tab panel.

Returns:
the widget count

getWidgetIndex

public int getWidgetIndex(Widget child)

insert

public void insert(Widget widget,
                   String tabText,
                   boolean asHTML,
                   int beforeIndex)
Inserts a widget into the tab panel.

Parameters:
widget - the widget to be inserted
tabText - the text to be shown on its tab
asHTML - true to treat the specified text as HTML
beforeIndex - the index before which it will be inserted

insert

public void insert(Widget widget,
                   String tabText,
                   int beforeIndex)
Inserts a widget into the tab panel.

Parameters:
widget - the widget to be inserted
tabText - the text to be shown on its tab
beforeIndex - the index before which it will be inserted

iterator

public Iterator iterator()
Description copied from interface: HasWidgets
Gets an iterator for the contained widgets.

Specified by:
iterator in interface HasWidgets
See Also:
HasWidgets.iterator()

onBeforeTabSelected

public boolean onBeforeTabSelected(SourcesTabEvents sender,
                                   int tabIndex)
Description copied from interface: TabListener
Fired just before a tab is selected.

Specified by:
onBeforeTabSelected in interface TabListener
Parameters:
sender - the TabBar or TabPanel whose tab was selected.
tabIndex - the index of the tab about to be selected
Returns:
false to disallow the selection. If any listener returns false, then the selection will be disallowed.

onTabSelected

public void onTabSelected(SourcesTabEvents sender,
                          int tabIndex)
Description copied from interface: TabListener
Fired when a tab is selected

Specified by:
onTabSelected in interface TabListener
Parameters:
sender - the TabBar or TabPanel whose tab was selected
tabIndex - the index of the tab that was selected

remove

public void remove(Widget widget)
Removes the given widget, and its associated tab.

Parameters:
widget - the widget to be removed

removeTabListener

public void removeTabListener(TabListener listener)
Description copied from interface: SourcesTabEvents
Removes a previously added listener interface.

Specified by:
removeTabListener in interface SourcesTabEvents
Parameters:
listener - the listener interface to remove

selectTab

public void selectTab(int index)
Programmatically selects the specified tab.

Parameters:
index - the index of the tab to be selected


This javadoc distribution was not produced by Google. The official documentation is here.