public class TabPanel extends Composite implements TabListener, SourcesTabEvents, HasWidgets, HasAnimation, IndexedPanel.ForIsWidget, HasBeforeSelectionHandlers<Integer>, HasSelectionHandlers<Integer>
This widget will only work in quirks mode. If your application is in
Standards Mode, use TabLayoutPanel
instead.
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
.
TabLayoutPanel
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
HasWidgets.ForIsWidget
DEBUG_ID_PREFIX
Constructor and Description |
---|
TabPanel()
Creates an empty tab panel.
|
Modifier and Type | Method and Description |
---|---|
void |
add(IsWidget w,
IsWidget tabWidget)
Convenience overload to allow
IsWidget to be used directly. |
void |
add(IsWidget w,
String tabText)
Convenience overload to allow
IsWidget to be used directly. |
void |
add(IsWidget w,
String tabText,
boolean asHTML)
Convenience overload to allow
IsWidget to be used directly. |
void |
add(Widget w)
Adds a child widget.
|
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 |
add(Widget w,
Widget tabWidget)
Adds a widget to the tab panel.
|
HandlerRegistration |
addBeforeSelectionHandler(BeforeSelectionHandler<Integer> handler)
Adds a
BeforeSelectionEvent handler. |
HandlerRegistration |
addSelectionHandler(SelectionHandler<Integer> handler)
Adds a
SelectionEvent handler. |
void |
addTabListener(TabListener listener)
|
void |
clear()
Removes all child widgets.
|
protected SimplePanel |
createTabTextWrapper()
Create a
SimplePanel that will wrap the contents in a tab. |
DeckPanel |
getDeckPanel()
Gets the deck panel within this tab panel.
|
TabBar |
getTabBar()
Gets the tab bar within this tab panel.
|
Widget |
getWidget(int index)
Gets the child widget at the specified index.
|
int |
getWidgetCount()
Gets the number of child widgets in this panel.
|
int |
getWidgetIndex(IsWidget child)
Convenience overload to allow
IsWidget to be used directly. |
int |
getWidgetIndex(Widget widget)
Gets the index of the specified child widget.
|
void |
insert(IsWidget widget,
IsWidget tabWidget,
int beforeIndex)
Convenience overload to allow
IsWidget to be used directly. |
void |
insert(IsWidget widget,
String tabText,
boolean asHTML,
int beforeIndex)
Convenience overload to allow
IsWidget to be used directly. |
void |
insert(IsWidget widget,
String tabText,
int beforeIndex)
Convenience overload to allow
IsWidget to be used directly. |
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.
|
void |
insert(Widget widget,
Widget tabWidget,
int beforeIndex)
Inserts a widget into the tab panel.
|
boolean |
isAnimationEnabled()
Returns true if animations are enabled, false if not.
|
Iterator<Widget> |
iterator()
Gets an iterator for the contained widgets.
|
boolean |
onBeforeTabSelected(SourcesTabEvents sender,
int tabIndex)
|
protected void |
onEnsureDebugId(String baseID)
Affected Elements:
-bar = The tab bar.
-bar-tab# = The element containing the content of the tab itself.
-bar-tab-wrapper# = The cell containing the tab at the index.
-bottom = The panel beneath the tab bar.
|
void |
onTabSelected(SourcesTabEvents sender,
int tabIndex)
Deprecated.
|
boolean |
remove(int index)
Removes the widget at the specified index.
|
boolean |
remove(Widget widget)
Removes the given widget, and its associated tab.
|
void |
removeTabListener(TabListener listener)
Deprecated.
Use the
HandlerRegistration.removeHandler()
method on the object returned by and add*Handler method instead |
void |
selectTab(int index)
Programmatically selects the specified tab and fires events.
|
void |
selectTab(int index,
boolean fireEvents)
Programmatically selects the specified tab.
|
void |
setAnimationEnabled(boolean enable)
Enable or disable animations.
|
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString
fireEvent
public void add(IsWidget w, IsWidget tabWidget)
IsWidget
to be used directly.public void add(IsWidget w, String tabText)
IsWidget
to be used directly.public void add(IsWidget w, String tabText, boolean asHTML)
IsWidget
to be used directly.public void add(Widget w)
HasWidgets
add
in interface HasWidgets
w
- the widget to be addedpublic void add(Widget w, String tabText)
w
- the widget to be addedtabText
- the text to be shown on its tabpublic void add(Widget w, String tabText, boolean asHTML)
w
- the widget to be addedtabText
- the text to be shown on its tabasHTML
- true
to treat the specified text as HTMLpublic void add(Widget w, Widget tabWidget)
w
- the widget to be addedtabWidget
- the widget to be shown in the tabpublic HandlerRegistration addBeforeSelectionHandler(BeforeSelectionHandler<Integer> handler)
HasBeforeSelectionHandlers
BeforeSelectionEvent
handler.addBeforeSelectionHandler
in interface HasBeforeSelectionHandlers<Integer>
handler
- the handlerpublic HandlerRegistration addSelectionHandler(SelectionHandler<Integer> handler)
HasSelectionHandlers
SelectionEvent
handler.addSelectionHandler
in interface HasSelectionHandlers<Integer>
handler
- the handler@Deprecated public void addTabListener(TabListener listener)
addBeforeSelectionHandler(com.google.gwt.event.logical.shared.BeforeSelectionHandler<java.lang.Integer>)
and addSelectionHandler(com.google.gwt.event.logical.shared.SelectionHandler<java.lang.Integer>)
insteadSourcesTabEvents
addTabListener
in interface SourcesTabEvents
listener
- the listener interface to addpublic void clear()
HasWidgets
clear
in interface HasWidgets
public DeckPanel getDeckPanel()
public TabBar getTabBar()
public Widget getWidget(int index)
IndexedPanel
getWidget
in interface IndexedPanel
index
- the child widget's indexpublic int getWidgetCount()
IndexedPanel
getWidgetCount
in interface IndexedPanel
public int getWidgetIndex(IsWidget child)
IsWidget
to be used directly.getWidgetIndex
in interface IndexedPanel.ForIsWidget
public int getWidgetIndex(Widget widget)
IndexedPanel
getWidgetIndex
in interface IndexedPanel
widget
- the widget to be found-1
if it is not a child of this
panelpublic void insert(IsWidget widget, IsWidget tabWidget, int beforeIndex)
IsWidget
to be used directly.public void insert(IsWidget widget, String tabText, boolean asHTML, int beforeIndex)
IsWidget
to be used directly.public void insert(IsWidget widget, String tabText, int beforeIndex)
IsWidget
to be used directly.public void insert(Widget widget, String tabText, boolean asHTML, int beforeIndex)
widget
- the widget to be insertedtabText
- the text to be shown on its tabasHTML
- true
to treat the specified text as HTMLbeforeIndex
- the index before which it will be insertedpublic void insert(Widget widget, String tabText, int beforeIndex)
widget
- the widget to be insertedtabText
- the text to be shown on its tabbeforeIndex
- the index before which it will be insertedpublic void insert(Widget widget, Widget tabWidget, int beforeIndex)
widget
- the widget to be inserted.tabWidget
- the widget to be shown on its tab.beforeIndex
- the index before which it will be inserted.public boolean isAnimationEnabled()
HasAnimation
isAnimationEnabled
in interface HasAnimation
public Iterator<Widget> iterator()
HasWidgets
Iterator.remove()
.iterator
in interface HasWidgets
iterator
in interface Iterable<Widget>
@Deprecated public boolean onBeforeTabSelected(SourcesTabEvents sender, int tabIndex)
BeforeSelectionHandler.onBeforeSelection(com.google.gwt.event.logical.shared.BeforeSelectionEvent<T>)
insteadTabListener
onBeforeTabSelected
in interface TabListener
sender
- the TabBar
or TabPanel
whose tab was
selected.tabIndex
- the index of the tab about to be selectedfalse
to disallow the selection. If any listener
returns false, then the selection will be disallowed.@Deprecated public void onTabSelected(SourcesTabEvents sender, int tabIndex)
SelectionHandler.onSelection(com.google.gwt.event.logical.shared.SelectionEvent<T>)
insteadTabListener
onTabSelected
in interface TabListener
sender
- the TabBar
or TabPanel
whose tab was selectedtabIndex
- the index of the tab that was selectedpublic boolean remove(int index)
IndexedPanel
remove
in interface IndexedPanel
index
- the index of the widget to be removedfalse
if the widget is not presentpublic boolean remove(Widget widget)
remove
in interface HasWidgets
widget
- the widget to be removedtrue
if the widget was present@Deprecated public void removeTabListener(TabListener listener)
HandlerRegistration.removeHandler()
method on the object returned by and add*Handler method insteadSourcesTabEvents
removeTabListener
in interface SourcesTabEvents
listener
- the listener interface to removepublic void selectTab(int index)
index
- the index of the tab to be selectedpublic void selectTab(int index, boolean fireEvents)
index
- the index of the tab to be selectedfireEvents
- true to fire events, false not topublic void setAnimationEnabled(boolean enable)
HasAnimation
setAnimationEnabled
in interface HasAnimation
enable
- true to enable, false to disableprotected SimplePanel createTabTextWrapper()
SimplePanel
that will wrap the contents in a tab.
Subclasses can use this method to wrap tabs in decorator panels.SimplePanel
to wrap the tab contents, or null to leave
tabs unwrappedprotected void onEnsureDebugId(String baseID)
onEnsureDebugId
in class UIObject
baseID
- the base ID used by the main elementUIObject.onEnsureDebugId(String)
Copyright © 2018. All rights reserved.