Class RapidContext.Widget.TabContainer

Extends: RapidContext.Widget

The tab container widget class. Used to provide a set of tabbed pages, where the user can switch page freely. Internally it uses a <div> HTML element containing Pane widgets that are hidden and shown according to the page transitions. If a child Pane widget is pageCloseable, a close button will be available on the tab label.

Source code: RapidContext_Widget_TabContainer.js

Class Summary
 
Creates a new tab container widget.
Method Summary
 
addChildNode(child)
Adds a single child page widget to this widget.
 
Returns an array with all child pane widgets.
 
Removes a single child DOM node from this widget.
 
selectChild(indexOrChild)
Selects a specified child in the tab container.
 
Returns the child widget currently selected in the tab container.
 
Returns the index of the currently selected child in the tab container.
Methods borrowed from class RapidContext.Widget:
addAll, addClass, animate, blurAll, destroy, disable, enable, hasClass, hide, isDisabled, isHidden, removeAll, removeClass, setAttrs, setStyle, show, toggleClass, uid
Class Detail
RapidContext.Widget.TabContainer(attrs)
Creates a new tab container widget.
JavaScript:
var page1 = RapidContext.Widget.Pane({ pageTitle: "One" });
...
var page2 = RapidContext.Widget.Pane({ pageTitle: "Two", pageCloseable: true });
...
var attrs = { style: { width: "100%", height: "100%" } };
var tabs = RapidContext.Widget.TabContainer(attrs, page1, page2);
User Interface XML:
<TabContainer style="width: 100%; height: 100%;">
  <Pane pageTitle="One">
    ...
  </Pane>
  <Pane pageTitle="Two" pageCloseable="true">
    ...
  </Pane>
<TabContainer>
Parameters:
{Object} attrs
the widget and node attributes
{Boolean} attrs.hidden Optional
the hidden widget flag, defaults to false
{Widget} ... Optional
the child widgets or DOM nodes (should be Pane widgets)
Returns:
{Widget} the widget DOM node
Method Detail
{Array} getChildNodes()
Returns an array with all child pane widgets. Note that the array is a real JavaScript array, not a dynamic NodeList.
Returns:
{Array} the array of child DOM nodes

addChildNode(child)
Adds a single child page widget to this widget. The child widget should be a RapidContext.Widget.Pane widget, or it will be added to a new one.
Parameters:
{Widget} child
the page widget to add

removeChildNode(child)
Removes a single child DOM node from this widget. This method is sometimes overridden by child widgets in order to hide or control intermediate DOM nodes required by the widget.

Note that this method will NOT destroy the removed child widget, so care must be taken to ensure proper child widget destruction.
Parameters:
{Widget/Node} child
the DOM node to remove

{Number} selectedIndex()
Returns the index of the currently selected child in the tab container.
Returns:
{Number} the index of the selected child, or -1 if no child is selected

{Node} selectedChild()
Returns the child widget currently selected in the tab container.
Returns:
{Node} the child widget selected, or null if no child is selected

selectChild(indexOrChild)
Selects a specified child in the tab container. This method can be called without arguments to re-select the currently selected tab.
Parameters:
{Number/Node} indexOrChild Optional
the child index or node