public class TabPanel extends Component implements IndexedPanel.ForIsWidget, HasOneWidget, HasBeforeSelectionHandlers<Widget>, HasSelectionHandlers<Widget>, BeforeCloseEvent.HasBeforeCloseHandlers<Widget>, CloseEvent.HasCloseHandlers<Widget>, HasLayout, HasWidgets
TabPanel panel = new TabPanel(); panel.setResizeTabs(true); panel.setEnableTabScroll(true); panel.setAnimScroll(true); TabItem item = new TabItem(); item.setClosable(true); item.setText("Tab Item"); item.setLayout(new FitLayout()); item.add(new Label("Test Content")); panel.add(item);
Modifier and Type | Class and Description |
---|---|
static interface |
TabPanel.TabPanelAppearance |
static interface |
TabPanel.TabPanelMessages |
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
IndexedPanel.ForIsWidget
HasWidgets.ForIsWidget
DEBUG_ID_PREFIX
Constructor and Description |
---|
TabPanel()
Creates a new tab panel.
|
TabPanel(TabPanel.TabPanelAppearance appearance) |
Modifier and Type | Method and Description |
---|---|
void |
add(Widget w) |
void |
add(Widget widget,
String text) |
void |
add(Widget widget,
TabItemConfig config) |
HandlerRegistration |
addBeforeCloseHandler(BeforeCloseEvent.BeforeCloseHandler<Widget> handler)
Adds a
BeforeCloseEvent.BeforeCloseHandler handler for BeforeCloseEvent
events. |
HandlerRegistration |
addBeforeSelectionHandler(BeforeSelectionHandler<Widget> handler) |
HandlerRegistration |
addCloseHandler(CloseEvent.CloseHandler<Widget> handler)
Adds a
CloseEvent.CloseHandler handler for CloseEvent events. |
HandlerRegistration |
addSelectionHandler(SelectionHandler<Widget> handler) |
void |
clear() |
Widget |
findItem(String id,
boolean checkText)
Searches for an item based on its id and optionally the item's text.
|
void |
forceLayout() |
boolean |
getAnimScroll()
Returns true if scrolling is animated.
|
boolean |
getBodyBorder()
Returns true if the body border is enabled.
|
TabItemConfig |
getConfig(Widget widget)
Returns the tab item config for the given widget.
|
CardLayoutContainer |
getContainer()
Returns the internal card layout container.
|
TabPanel.TabPanelMessages |
getMessages()
Returns the tab panel messages.
|
boolean |
getResizeTabs()
Returns true if tab resizing is enabled.
|
int |
getScrollDuration()
Returns the scroll duration in milliseconds.
|
boolean |
getTabScroll()
Returns true if tab scrolling is enabled.
|
Widget |
getWidget()
Returns the current selection tab item.
|
Widget |
getWidget(int index) |
int |
getWidgetCount() |
int |
getWidgetIndex(IsWidget child) |
int |
getWidgetIndex(Widget widget) |
void |
insert(Widget widget,
int index,
TabItemConfig config) |
boolean |
isAutoSelect()
Returns true if auto select is enabled.
|
boolean |
isCloseContextMenu()
Returns true if close context menu is enabled.
|
boolean |
isLayoutRunning() |
boolean |
isOrWasLayoutRunning() |
Iterator<Widget> |
iterator() |
void |
onBrowserEvent(Event event) |
boolean |
remove(int index) |
boolean |
remove(Widget child) |
void |
scrollToTab(Widget item,
boolean animate)
Scrolls to a particular tab if tab scrolling is enabled.
|
void |
setAnimScroll(boolean animScroll)
True to animate tab scrolling so that hidden tabs slide smoothly into view
(defaults to true).
|
void |
setAutoSelect(boolean autoSelect)
True to have the first item selected when the panel is displayed for the
first time if there is not selection (defaults to true).
|
void |
setBodyBorder(boolean bodyBorder)
True to display an interior border on the body element of the panel, false
to hide it (defaults to true, pre-render).
|
void |
setCloseContextMenu(boolean closeMenu)
True to show the close context menu (defaults to false).
|
void |
setMessages(TabPanel.TabPanelMessages messages)
Sets the tab panel messages.
|
void |
setResizeTabs(boolean resizeTabs)
True to automatically resize each tab so that the tabs will completely fill
the tab strip (defaults to false).
|
void |
setScrollDuration(int scrollDuration)
Sets the number of milliseconds that each scroll animation should last
(defaults to 150).
|
void |
setScrollIncrement(int scrollIncrement)
Sets the number of pixels to scroll each time a tab scroll button is
pressed (defaults to 100, or if
setResizeTabs(boolean) = true, the
calculated tab width). |
void |
setTabScroll(boolean tabScroll)
True to enable scrolling to tabs that may be invisible due to overflowing
the overall TabPanel width.
|
void |
setWidget(IsWidget item)
Sets the selected tab item.
|
void |
setWidget(Widget item) |
void |
update(Widget widget,
TabItemConfig config) |
addBeforeHideHandler, addBeforeShowContextMenuHandler, addBeforeShowHandler, addBlurHandler, addDisableHandler, addEnableHandler, addFocusHandler, addHideHandler, addMoveHandler, addResizeHandler, addShowContextMenuHandler, addShowHandler, addStyleOnOver, clearSizeCache, disable, disableEvents, enable, enableEvents, fireEvent, focus, getData, getElement, getFocusSupport, getHideMode, getId, getItemId, getOffsetHeight, getOffsetWidth, getShadow, getStateId, getToolTip, hide, hideToolTip, isAllowTextSelection, isAutoHeight, isAutoWidth, isDeferHeight, isEnabled, isRendered, isStateful, isVisible, isVisible, mask, mask, removeHandler, removeToolTip, setAllowTextSelection, setBorders, setBounds, setBounds, setContextMenu, setData, setDeferHeight, setEnabled, setHeight, setHeight, setHideMode, setId, setItemId, setPagePosition, setPixelSize, setPosition, setShadow, setSize, setStateful, setStateId, setTabIndex, setToolTip, setToolTipConfig, setVisible, setWidth, setWidth, show, sync, syncSize, unmask
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, getLayoutData, getParent, isAttached, removeFromParent, setLayoutData, sinkEvents
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleName, getStylePrimaryName, getTitle, isVisible, removeStyleDependentName, removeStyleName, setStyleDependentName, setStyleName, setStyleName, setStylePrimaryName, setTitle, setVisible, sinkBitlessEvent, toString, unsinkEvents
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
fireEvent
public TabPanel()
public TabPanel(TabPanel.TabPanelAppearance appearance)
public void add(Widget w)
add
in interface HasWidgets
@UiChild(tagname="child") public void add(Widget widget, TabItemConfig config)
public HandlerRegistration addBeforeCloseHandler(BeforeCloseEvent.BeforeCloseHandler<Widget> handler)
BeforeCloseEvent.HasBeforeCloseHandlers
BeforeCloseEvent.BeforeCloseHandler
handler for BeforeCloseEvent
events.addBeforeCloseHandler
in interface BeforeCloseEvent.HasBeforeCloseHandlers<Widget>
handler
- the handlerpublic HandlerRegistration addBeforeSelectionHandler(BeforeSelectionHandler<Widget> handler)
addBeforeSelectionHandler
in interface HasBeforeSelectionHandlers<Widget>
public HandlerRegistration addCloseHandler(CloseEvent.CloseHandler<Widget> handler)
CloseEvent.HasCloseHandlers
CloseEvent.CloseHandler
handler for CloseEvent
events.addCloseHandler
in interface CloseEvent.HasCloseHandlers<Widget>
handler
- the handlerpublic HandlerRegistration addSelectionHandler(SelectionHandler<Widget> handler)
addSelectionHandler
in interface HasSelectionHandlers<Widget>
public void clear()
clear
in interface HasWidgets
public Widget findItem(String id, boolean checkText)
id
- the item idcheckText
- true to match the items id and textpublic void forceLayout()
forceLayout
in interface HasLayout
public boolean getAnimScroll()
public boolean getBodyBorder()
public TabItemConfig getConfig(Widget widget)
widget
- the widgetpublic CardLayoutContainer getContainer()
public TabPanel.TabPanelMessages getMessages()
public boolean getResizeTabs()
public int getScrollDuration()
public boolean getTabScroll()
public Widget getWidget()
getWidget
in interface HasOneWidget
public Widget getWidget(int index)
getWidget
in interface IndexedPanel
public int getWidgetCount()
getWidgetCount
in interface IndexedPanel
public int getWidgetIndex(IsWidget child)
getWidgetIndex
in interface IndexedPanel.ForIsWidget
public int getWidgetIndex(Widget widget)
getWidgetIndex
in interface IndexedPanel
public void insert(Widget widget, int index, TabItemConfig config)
public boolean isAutoSelect()
public boolean isCloseContextMenu()
public boolean isLayoutRunning()
isLayoutRunning
in interface HasLayout
public boolean isOrWasLayoutRunning()
isOrWasLayoutRunning
in interface HasLayout
public Iterator<Widget> iterator()
iterator
in interface HasWidgets
iterator
in interface Iterable<Widget>
public void onBrowserEvent(Event event)
onBrowserEvent
in interface EventListener
onBrowserEvent
in class Component
public boolean remove(int index)
remove
in interface IndexedPanel
public boolean remove(Widget child)
remove
in interface HasWidgets
public void scrollToTab(Widget item, boolean animate)
item
- the item to scroll toanimate
- true to animate the scrollpublic void setAnimScroll(boolean animScroll)
tabScroll
= true.animScroll
- the animation scroll statepublic void setAutoSelect(boolean autoSelect)
autoSelect
- the auto select statepublic void setBodyBorder(boolean bodyBorder)
bodyBorder
- the body border stylepublic void setCloseContextMenu(boolean closeMenu)
closeMenu
- true to show itpublic void setMessages(TabPanel.TabPanelMessages messages)
messages
- the messagespublic void setResizeTabs(boolean resizeTabs)
resizeTabs
- true to enable tab resizingpublic void setScrollDuration(int scrollDuration)
scrollDuration
- the scroll durationpublic void setScrollIncrement(int scrollIncrement)
setResizeTabs(boolean)
= true, the
calculated tab width). Only applies when setTabScroll(boolean)
=
true.scrollIncrement
- the scroll incrementpublic void setTabScroll(boolean tabScroll)
tabScroll
- true to enable tab scrollingpublic void setWidget(IsWidget item)
setWidget
in interface AcceptsOneWidget
item
- the item to be selectedpublic void setWidget(Widget item)
setWidget
in interface HasOneWidget
public void update(Widget widget, TabItemConfig config)
Copyright © 2012. All Rights Reserved.