com.gwtext.client.widgets
Class TabPanel

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.gwtext.client.widgets.Component
              extended by com.gwtext.client.widgets.BoxComponent
                  extended by com.gwtext.client.widgets.Container
                      extended by com.gwtext.client.widgets.Panel
                          extended by com.gwtext.client.widgets.TabPanel
All Implemented Interfaces:
com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.HasWidgets, Observable

public class TabPanel
extends Panel

A lightweight tab container.


Field Summary
 
Fields inherited from class com.gwtext.client.widgets.Component
config, id
 
Constructor Summary
TabPanel()
           
TabPanel(com.google.gwt.core.client.JavaScriptObject jsObj)
           
 
Method Summary
 void activate(int tabIndex)
          Activates a tab panel.
 void activate(java.lang.String tabID)
          Activates a tab panel.
 void addListener(TabPanelListener listener)
          Add a TabPanel listner.
 void beginUpdate()
          Disables tab resizing while tabs are being added (if resizeTabs is false this does nothing).
protected  com.google.gwt.core.client.JavaScriptObject create(com.google.gwt.core.client.JavaScriptObject config)
           
 void endUpdate()
          Stops an update and resizes the tabs (if resizeTabs is false this does nothing).
 Panel getActiveTab()
          Gets the currently active tab.
protected  com.google.gwt.core.client.JavaScriptObject getConfigPrototype()
           
 Panel getItem(java.lang.String id)
          Gets the specified tab by id.
 int getMinTabWidth()
          Return the min tab width.
 int getScrollDuration()
          The number of milliseconds that each scroll animation should last (defaults to .35).
 int getScrollIncrement()
          The number of pixels to scroll each time a tab scroll button is pressed (defaults to 100, or if resizeTabs = true, the calculated tab width).
 int getScrollRepeatInterval()
          Number of milliseconds between each scroll while a tab scroll button is continuously pressed (defaults to 400).
 com.google.gwt.user.client.Element getTabEl(Panel panel)
          Gets the DOM element for tab strip item which activates the child panel with the specified ID.
 int getTabMargin()
          The number of pixels of space to calculate into the sizing and scrolling of tabs.
 java.lang.String getTabPosition()
           
 int getTabWidth()
          The initial width in pixels of each new tab (defaults to 120).
 int getWheelIncrement()
          For scrolling tabs, the number of pixels to increment on mouse wheel scrolling (defaults to 20).
 java.lang.String getXType()
          Gets the xtype for this component as registered with ComponentMgr.
 boolean hasItem(java.lang.String id)
          Check if the TabPanel has the specified tab.
 void hideTabStripItem(int index)
          Hides the tab strip item for the passed tab.
 void hideTabStripItem(Panel panel)
          Hides the tab strip item for the passed tab.
 void hideTabStripItem(java.lang.String id)
          Hides the tab strip item for the passed tab.
 boolean isAnimScroll()
          True to animate tab scrolling so that hidden tabs slide smoothly into view (defaults to true).
 boolean isDeferredRender()
          Internally, the TabPanel uses a CardLayout to manage its tabs.
 boolean isEnableTabScroll()
          True to enable scrolling to tabs that may be invisible due to overflowing the overall TabPanel width.
 boolean isLayoutOnTabChange()
          True to do a layout of tab items as tabs are changed.
 boolean isPlain()
          True to render the tab strip without a background container image (defaults to false).
 boolean isResizeTabs()
           
 void scrollToTab(Panel panel, boolean animate)
          Scrolls to a particular tab if tab scrolling is enabled.
 void setActiveItem(int activeItem)
          A string component id or the numeric index of the component that should be initially activated within the container's layout on render.
 void setActiveItemID(java.lang.String activeItem)
          A string component id or the numeric index of the component that should be initially activated within the container's layout on render.
 void setActiveTab(int activeTab)
          The numeric index of the tab that should be initially activated on render (defaults to none).
 void setActiveTab(java.lang.String activeTab)
          The id of the tab that should be initially activated on render (defaults to none).
 void setAnimScroll(boolean animScroll)
          True to animate tab scrolling so that hidden tabs slide smoothly into view (defaults to true).
 void setDeferredRender(boolean deferredRender)
          Internally, the TabPanel uses a CardLayout to manage its tabs.
 void setEnableTabScroll(boolean enableTabScroll)
          True to enable scrolling to tabs that may be invisible due to overflowing the overall TabPanel width.
 void setLayout(ContainerLayout layout)
          The layout type to be used in this container.
 void setLayoutOnTabChange(boolean layoutOnTabChange)
          Set to true to do a layout of tab items as tabs are changed.
 void setMinTabWidth(int minTabWidth)
          The minimum width in pixels for each tab when resizeTabs = true (defaults to 30).
 void setPlain(boolean plain)
          True to render the tab strip without a background container image (defaults to false).
 void setResizeTabs(boolean resizeTabs)
          True to automatically resize each tab so that the tabs will completely fill the tab strip (defaults to false).
 void setResizeTabsRendered(boolean resizeTabs)
           
 void setScrollDuration(int scrollDuration)
          The number of milliseconds that each scroll animation should last (defaults to .35).
 void setScrollIncrement(int scrollIncrement)
          The number of pixels to scroll each time a tab scroll button is pressed (defaults to 100, or if resizeTabs = true, the calculated tab width).
 void setScrollRepeatInterval(int scrollRepeatInterval)
          Number of milliseconds between each scroll while a tab scroll button is continuously pressed (defaults to 400).
 void setTabMargin(int tabMargin)
          The number of pixels of space to calculate into the sizing and scrolling of tabs.
 void setTabPosition(Position tabPosition)
          The position where the tab strip should be rendered (defaults to 'top').
 void setTabWidth(int tabWidth)
          The initial width in pixels of each new tab (defaults to 120).
 void setWheelIncrement(int wheelIncrement)
          For scrolling tabs, the number of pixels to increment on mouse wheel scrolling (defaults to 20).
 void unhideTabStripItem(int index)
          Unhides the tab strip item for the passed tab.
 void unhideTabStripItem(Panel panel)
          Unhides the tab strip item for the passed tab.
 void unhideTabStripItem(java.lang.String id)
          Unhides the tab strip item for the passed tab.
 
Methods inherited from class com.gwtext.client.widgets.Panel
addButton, addListener, addTool, collapse, collapse, expand, expand, getBaseCls, getBody, getBodyStyle, getBodyWrap, getBottomToolbar, getCollapsedCls, getCollapseFirst, getFloating, getFooter, getFrameHeight, getFrameWidth, getHeader, getHtml, getIconCls, getInnerHeight, getInnerWidth, getMinButtonWidth, getShadowOffset, getTabCls, getTitle, getTopToolbar, getUpdateManager, isAnimCollapse, isAutoScroll, isBodyBorder, isBorder, isClosable, isCollapsed, isCollapsible, isFrame, isHeader, isHeaderAsText, isHideCollapseTool, isMaskDisabled, isShadow, isShim, isTitleCollapse, load, load, setAnimCollapse, setAutoLoad, setAutoLoad, setAutoScroll, setBaseCls, setBodyBorder, setBodyStyle, setBorder, setBottomToolbar, setBottomToolbar, setBottomToolbar, setButtonAlign, setButtons, setClosable, setCollapsed, setCollapsedCls, setCollapseFirst, setCollapsible, setContentEl, setDraggable, setFloating, setFooter, setFrame, setHeader, setHeaderAsText, setHideCollapseTool, setHtml, setIconCls, setMargins, setMargins, setMaskDisabled, setMinButtonWidth, setPaddings, setPaddings, setShadow, setShadow, setShadowOffset, setShim, setTabCls, setTitle, setTitle, setTitleCollapse, setTools, setTopToolbar, setTopToolbar, setTopToolbar, toggleCollapse, toggleCollapse
 
Methods inherited from class com.gwtext.client.widgets.Container
add, add, add, add, addListener, bubble, cascade, clear, doLayout, doLayout, findBy, findByID, findByType, getActiveItem, getActiveItemID, getAutoDestroy, getBufferResize, getComponent, getComponent, getComponents, getHideBorders, getItems, getLayout, getMonitorResize, insert, iterator, remove, remove, remove, remove, removeAll, removeAll, setAutoDestroy, setBufferResize, setDefaults, setHideBorders, setMonitorResize
 
Methods inherited from class com.gwtext.client.widgets.BoxComponent
addListener, doOnRender, doOnRender, getAutoHeight, getAutoWidth, getBox, getBox, getHeight, getPosition, getPosition, getSize, getWidth, setAutoHeight, setAutoWidth, setHeight, setHeight, setPagePosition, setPosition, setSize, setSize, setWidth, setWidth, syncSize, updateBox
 
Methods inherited from class com.gwtext.client.widgets.Component
addClass, addClassCreated, addEvent, addEvents, addListener, addListener, addListener, addPlugin, addStyleDependentName, addStyleName, afterRender, beforeDestroy, check, checkExtVer, cloneComponent, cloneComponent, cloneConfig, destroy, disable, enable, equals, error, findParentBy, findParentByType, fireEvent, focus, focus, focus, getApplyTo, getAttribute, getAttributeAsBoolean, getAttributeAsFloat, getAttributeAsInt, getAttributeAsJavaScriptObject, getAutoShow, getCls, getComponentJS, getConfig, getConfigAsString, getCtCls, getDisabledClass, getEl, getElement, getElement, getElement, getHideMode, getHideParent, getId, getItemId, getJsObj, getOffsetHeight, getOffsetWidth, getOrCreateJsObj, getOwnerContainer, getRenderTo, getStateEvents, getStateId, getXTypes, hashCode, hide, initComponent, isCreated, isDisabled, isHidden, isRendered, isVisible, isXType, isXType, onDestroy, purgeListeners, removeClass, removeStyleDependentName, removeStyleName, render, render, render, render, render, render, resumeEvents, setApplyTo, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAutoEl, setAutoEl, setAutoShow, setCls, setCtCls, setDisabled, setDisabledClass, setEl, setEl, setElement, setHideMode, setHideParent, setId, setRenderTo, setRenderToID, setStateEvents, setStateId, setStyle, setStyle, setStyleName, setStylePrimaryName, setVisible, show, suspendEvents, toString
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
doAttachChildren, doDetachChildren, getParent, isAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
getAbsoluteLeft, getAbsoluteTop, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, setPixelSize, setStyleName, setStyleName, setStylePrimaryName, setVisible, sinkEvents, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TabPanel

public TabPanel()

TabPanel

public TabPanel(com.google.gwt.core.client.JavaScriptObject jsObj)
Method Detail

getConfigPrototype

protected com.google.gwt.core.client.JavaScriptObject getConfigPrototype()
Overrides:
getConfigPrototype in class Panel

getXType

public java.lang.String getXType()
Description copied from class: Component
Gets the xtype for this component as registered with ComponentMgr. For a list of all available xtypes, see the Component javadocs.

 
 

TextField field = new TextField(); field.getXType() returns "textfield"

Overrides:
getXType in class Panel
Returns:
the xtype

create

protected com.google.gwt.core.client.JavaScriptObject create(com.google.gwt.core.client.JavaScriptObject config)
Overrides:
create in class Panel

getMinTabWidth

public int getMinTabWidth()
Return the min tab width.

Returns:
the min tab width

isResizeTabs

public boolean isResizeTabs()

setResizeTabsRendered

public void setResizeTabsRendered(boolean resizeTabs)

getTabPosition

public java.lang.String getTabPosition()

setActiveItemID

public void setActiveItemID(java.lang.String activeItem)
Description copied from class: Container
A string component id or the numeric index of the component that should be initially activated within the container's layout on render. For example, activeItem: 'item-1' or activeItem: 0 (index 0 = the first item in the container's collection). activeItem only applies to layout styles that can display items one at a time (like AccordionLayout , CardLayout and FitLayout ).

Overrides:
setActiveItemID in class Container
Parameters:
activeItem - the active Item ID

setActiveItem

public void setActiveItem(int activeItem)
Description copied from class: Container
A string component id or the numeric index of the component that should be initially activated within the container's layout on render. For example, activeItem: 'item-1' or activeItem: 0 (index 0 = the first item in the container's collection). activeItem only applies to layout styles that can display items one at a time (like AccordionLayout , CardLayout and FitLayout ).

Overrides:
setActiveItem in class Container
Parameters:
activeItem - the active Item ID

setLayout

public void setLayout(ContainerLayout layout)
Description copied from class: Container
The layout type to be used in this container. If not specified, a default ContainerLayout will be created and used.

Overrides:
setLayout in class Container
Parameters:
layout - the layout to use

activate

public void activate(java.lang.String tabID)
Activates a tab panel. The currently active one will be deactivated.

Parameters:
tabID - the tab id

activate

public void activate(int tabIndex)
Activates a tab panel. The currently active one will be deactivated.

Parameters:
tabIndex - the tab index

beginUpdate

public void beginUpdate()
Disables tab resizing while tabs are being added (if resizeTabs is false this does nothing).


endUpdate

public void endUpdate()
Stops an update and resizes the tabs (if resizeTabs is false this does nothing).


getActiveTab

public Panel getActiveTab()
Gets the currently active tab.

Returns:
the active tab

getItem

public Panel getItem(java.lang.String id)
Gets the specified tab by id.

Parameters:
id - the tab id
Returns:
the specified tab

getTabEl

public com.google.gwt.user.client.Element getTabEl(Panel panel)
Gets the DOM element for tab strip item which activates the child panel with the specified ID. Access this to change the visual treatment of the item, for example by changing the CSS class name.

Parameters:
panel - the panel
Returns:
the DOM node

hideTabStripItem

public void hideTabStripItem(java.lang.String id)
Hides the tab strip item for the passed tab.

Parameters:
id - the tab id

hideTabStripItem

public void hideTabStripItem(int index)
Hides the tab strip item for the passed tab.

Parameters:
index - the tab index

hideTabStripItem

public void hideTabStripItem(Panel panel)
Hides the tab strip item for the passed tab.

Parameters:
panel - the tab panel

scrollToTab

public void scrollToTab(Panel panel,
                        boolean animate)
Scrolls to a particular tab if tab scrolling is enabled.

Parameters:
panel - the panel to scroll to
animate - true to animate

unhideTabStripItem

public void unhideTabStripItem(java.lang.String id)
Unhides the tab strip item for the passed tab.

Parameters:
id - the tab id

unhideTabStripItem

public void unhideTabStripItem(int index)
Unhides the tab strip item for the passed tab.

Parameters:
index - the tab index

unhideTabStripItem

public void unhideTabStripItem(Panel panel)
Unhides the tab strip item for the passed tab.

Parameters:
panel - the tab panel

hasItem

public boolean hasItem(java.lang.String id)
Check if the TabPanel has the specified tab.

Parameters:
id - the tab id
Returns:
true if tab present

addListener

public void addListener(TabPanelListener listener)
Add a TabPanel listner.

Parameters:
listener - the listener

setActiveTab

public void setActiveTab(int activeTab)
The numeric index of the tab that should be initially activated on render (defaults to none).

Parameters:
activeTab - the active tab index

setActiveTab

public void setActiveTab(java.lang.String activeTab)
The id of the tab that should be initially activated on render (defaults to none).

Parameters:
activeTab - the active tab ID

setAnimScroll

public void setAnimScroll(boolean animScroll)
                   throws java.lang.IllegalStateException
True to animate tab scrolling so that hidden tabs slide smoothly into view (defaults to true). Only applies when enableTabScroll = true.

Parameters:
animScroll - true to animate tab scrolling
Throws:
java.lang.IllegalStateException - this property cannot be changed after the Component has been rendered
See Also:
setEnableTabScroll(boolean)

isAnimScroll

public boolean isAnimScroll()
True to animate tab scrolling so that hidden tabs slide smoothly into view (defaults to true). Only applies when enableTabScroll = true.

Returns:
true if animate scroll

setDeferredRender

public void setDeferredRender(boolean deferredRender)
                       throws java.lang.IllegalStateException
Internally, the TabPanel uses a CardLayout to manage its tabs. This property will be passed on to the layout as its CardLayout.deferredRender config value, determining whether or not each tab is rendered only when first accessed (defaults to true).

Parameters:
deferredRender - true to defer rendering
Throws:
java.lang.IllegalStateException - this property cannot be changed after the Component has been rendered

isDeferredRender

public boolean isDeferredRender()
Internally, the TabPanel uses a CardLayout to manage its tabs. This property will be passed on to the layout as its CardLayout.deferredRender config value, determining whether or not each tab is rendered only when first accessed (defaults to true).

Returns:
true if deferred render

setEnableTabScroll

public void setEnableTabScroll(boolean enableTabScroll)
                        throws java.lang.IllegalStateException
True to enable scrolling to tabs that may be invisible due to overflowing the overall TabPanel width. Only available with tabs on top. (defaults to false).

Parameters:
enableTabScroll - true to enable tab scroll
Throws:
java.lang.IllegalStateException - this property cannot be changed after the Component has been rendered

isEnableTabScroll

public boolean isEnableTabScroll()
True to enable scrolling to tabs that may be invisible due to overflowing the overall TabPanel width. Only available with tabs on top. (defaults to false).

Returns:
true if tab scrolling enabled

setLayoutOnTabChange

public void setLayoutOnTabChange(boolean layoutOnTabChange)
                          throws java.lang.IllegalStateException
Set to true to do a layout of tab items as tabs are changed.

Parameters:
layoutOnTabChange - true to do a layout of tab items as tabs are changed (default true)
Throws:
java.lang.IllegalStateException - this property cannot be changed after the Component has been rendered

isLayoutOnTabChange

public boolean isLayoutOnTabChange()
True to do a layout of tab items as tabs are changed.

Returns:
true to do a layout of tab items as tabs are changed

setMinTabWidth

public void setMinTabWidth(int minTabWidth)
The minimum width in pixels for each tab when resizeTabs = true (defaults to 30).

Parameters:
minTabWidth - the min tab width

setPlain

public void setPlain(boolean plain)
              throws java.lang.IllegalStateException
True to render the tab strip without a background container image (defaults to false).

Parameters:
plain - true for plain tabs
Throws:
java.lang.IllegalStateException - this property cannot be changed after the Component has been rendered

isPlain

public boolean isPlain()
True to render the tab strip without a background container image (defaults to false).

Returns:
true to render the tab strip without a background container image (defaults to false).

setResizeTabs

public void setResizeTabs(boolean resizeTabs)
True to automatically resize each tab so that the tabs will completely fill the tab strip (defaults to false). Setting this to true may cause specific widths that might be set per tab to be overridden in order to fit them all into view (although minTabWidth will always be honored).

Parameters:
resizeTabs - true to resize tabs

setScrollDuration

public void setScrollDuration(int scrollDuration)
                       throws java.lang.IllegalStateException
The number of milliseconds that each scroll animation should last (defaults to .35). Only applies when animScroll = true.

Parameters:
scrollDuration - scroll duration
Throws:
java.lang.IllegalStateException - this property cannot be changed after the Component has been rendered

getScrollDuration

public int getScrollDuration()
The number of milliseconds that each scroll animation should last (defaults to .35). Only applies when animScroll = true.

Returns:
the scroll duration

setScrollIncrement

public void setScrollIncrement(int scrollIncrement)
                        throws java.lang.IllegalStateException
The number of pixels to scroll each time a tab scroll button is pressed (defaults to 100, or if resizeTabs = true, the calculated tab width). Only applies when enableTabScroll = true.

Parameters:
scrollIncrement - the scroll increment
Throws:
java.lang.IllegalStateException - this property cannot be changed after the Component has been rendered

getScrollIncrement

public int getScrollIncrement()
The number of pixels to scroll each time a tab scroll button is pressed (defaults to 100, or if resizeTabs = true, the calculated tab width). Only applies when enableTabScroll = true.

Returns:
the scroll increment

setScrollRepeatInterval

public void setScrollRepeatInterval(int scrollRepeatInterval)
                             throws java.lang.IllegalStateException
Number of milliseconds between each scroll while a tab scroll button is continuously pressed (defaults to 400).

Parameters:
scrollRepeatInterval - the scroll repeat interval
Throws:
java.lang.IllegalStateException - this property cannot be changed after the Component has been rendered

getScrollRepeatInterval

public int getScrollRepeatInterval()
Number of milliseconds between each scroll while a tab scroll button is continuously pressed (defaults to 400).

Returns:
the scroll repeat interval

setTabMargin

public void setTabMargin(int tabMargin)
                  throws java.lang.IllegalStateException
The number of pixels of space to calculate into the sizing and scrolling of tabs. If you change the margin in CSS, you will need to update this value so calculations are correct with either resizeTabs or scrolling tabs. (defaults to 2).

Parameters:
tabMargin - the tab margin
Throws:
java.lang.IllegalStateException - this property cannot be changed after the Component has been rendered

getTabMargin

public int getTabMargin()
The number of pixels of space to calculate into the sizing and scrolling of tabs. If you change the margin in CSS, you will need to update this value so calculations are correct with either resizeTabs or scrolling tabs. (defaults to 2).

Returns:
the tab margin

setTabPosition

public void setTabPosition(Position tabPosition)
                    throws java.lang.IllegalStateException
The position where the tab strip should be rendered (defaults to 'top'). The only other supported value is 'bottom'. Note that tab scrolling is only supported for position 'top'.

Parameters:
tabPosition - the tab position
Throws:
java.lang.IllegalStateException - this property cannot be changed after the Component has been rendered
See Also:
Position.TOP, Position.BOTTOM

setTabWidth

public void setTabWidth(int tabWidth)
                 throws java.lang.IllegalStateException
The initial width in pixels of each new tab (defaults to 120).

Parameters:
tabWidth - the tab width
Throws:
java.lang.IllegalStateException - this property cannot be changed after the Component has been rendered

getTabWidth

public int getTabWidth()
The initial width in pixels of each new tab (defaults to 120).

Returns:
the initial tab width

setWheelIncrement

public void setWheelIncrement(int wheelIncrement)
                       throws java.lang.IllegalStateException
For scrolling tabs, the number of pixels to increment on mouse wheel scrolling (defaults to 20).

Parameters:
wheelIncrement - the wheel increment
Throws:
java.lang.IllegalStateException - this property cannot be changed after the Component has been rendered

getWheelIncrement

public int getWheelIncrement()
For scrolling tabs, the number of pixels to increment on mouse wheel scrolling (defaults to 20).

Returns:
the scroll wheel increment