SUI.TabPanel
SUI.TabPanel is a component that helps you to save space by stacking a number of panels/boxes and let the user swap them by clicking on the tabs. A SUI.TapPanel can host a number of SUI boxes, each of them has a tab with a title for the user to identify and select them. TODO: create a separate Tab class
Extends
SUI.Box
Defined in:
TabPanel.js
Attr. | Name / Description |
---|---|
public |
SUI.TabPanel(see, items, items[], selected) Construct a SUI.TabPanel object. The titles of the tabs and (optional) the client boxes are given as argument to this constructor. It is also possible to select the initial tab. |
Attr. | Type | Name | Description |
---|---|---|---|
private | SUI.Border |
The box's border. |
|
private | int |
The bottom position of the box. |
|
private | HTMLElementNode |
The box's element node. |
|
private | int |
The height of the box. |
|
private | int |
The left position of the box. |
|
private | int |
The listeners array. |
|
private | int |
The maximum height of the box. |
|
private | int |
The maximum width of the box. |
|
private | int |
The minimum height of the box. |
|
private | int |
The minimum width of the box. |
|
private | SUI.Padding |
The box's padding. |
|
private | SUI.Box |
The box's parent element. |
|
private | int |
The right position of the box. |
|
private | int |
The top position of the box. |
|
private | int |
The width of the box. |
|
public |
Padding of the content on the tab. |
||
public |
Left position of the image in a scroller button. |
||
public |
Top position of the image in a scroller button. |
||
public |
Width of a the scroller button. |
||
public |
Margin top of the selected tab. |
||
public |
Border width of the line under the tab strip. |
||
public |
Border width of the lines of the tab. |
||
public |
Height of the highlight strip on top of a selected tab. |
||
public |
Top margin of unselected tabs. |
||
public |
Height of the tab bar (including bottom border). |
||
public |
Left padding of the text in the tabs. |
||
public |
Top padding of the text in the tabs. |
Attr. | Type | Name / Description |
---|---|---|
public |
absPos() Get the absolute position (top/left) of this box on the page. Note: You can only use this function if the HTML content of the page is fully rendered. |
|
public |
add(child, i) Add a box to one of the client areas of the control. |
|
public |
addClass(cls) Add a CSS class name to the class list of the HTML element associated with the box. |
|
public |
addListener(type, listener) Add/register a listener function. This way it is possible to register more than one listener function on one target. |
|
public | SUI.Border |
border(b) Get or set the border definition of the box. |
public | int |
bottom(b) Get or set the bottom of the box. |
public |
callListener(type) Call a listener function. Execute the default and additional listener functions. Note: the framework should not execute the default listeners directly but always through this method to ensure the execution of additional listener functions. |
|
public |
Get the top, left, right and bottom offset of the client area relative to the outer dimensions of the tab panel. |
|
public | int |
Get the client height of the box. The client height is the height of the box minus the top and bottom border and padding width. |
public | int |
Get the client width of the box. The client width is the width of the box minus the left and right border and padding width. |
public |
display() Display the tab panel control. Set the CSS size and position of the tabs and the currently displayed content panel. |
|
public |
draw() Draw the box on the screen. It executes a two phase process: a layout phase in which the size and positions of the box (and of it's contents, for more complex derivatives) is calculated and a display phase in which the CSS size and position of the box's (and possible it's child elements) is set. |
|
public | HTMLElementNode |
el() Get the HTML element node of the box. |
public | int |
height(h) Get or set the height of the box. |
public |
layOut() Lay out the tab panel control. Calculate the size and position of the tabs and client area. |
|
public | int |
left(l) Get or set the left of the box. |
public | int |
maxHeight(mh) Get or set the maximum height of the box. |
public | int |
maxWidth(mw) Get or set the maximum width of the box. |
public | int |
minHeight(mh) Get or set the minimum height of the box. |
public | int |
minWidth(mw) Get or set the minimum width of the box. |
public |
onSelectTab event handler: is executed when the user clicks on a tab. |
|
public | SUI.Padding |
padding(p) Get or set the padding definition of the box. |
public | SUI.Box |
parent(p) Get or set the parent box of the box. When setting the parent the box's element node will be appended to the parent box's HTML element node. |
public |
Remove a box from the DOM tree. |
|
public |
removeClass(cls) Remove a CSS class name from the class list of the HTML element associated with the box. |
|
public | int |
right(r) Get or set the right of the box. |
public | Object |
selectedTab(tab) Set or get the selected tab. |
public | int |
Set or get the index of the selected tab. |
public |
selectTab(tab) Select a tab. Set the selected tab call the onSelectTab listener and draw it. Note: this method is probably most usefull when overriding, not to call it on a tab object directly. |
|
public |
setDim() Set the CSS dimensions of this box and it's borders and padding. This is typically used in display functions to display boxes at the size and position that was calculated during layout. |
|
public |
setPos() Set the CSS postion of this box. This is typically used in display functions to display boxes at position that was calculated during layout. Note: use setDim if you want to set the position and size of the box. |
|
public |
setRect(t, l, w, h) Set the top, left, width and height of a box in one go. |
|
public | int |
top(t) Get or set the top of the box. |
public | int |
width(w) Get or set the width of the box. |
Constructor
- public SUI.TabPanel(see, object[] items, object items[], int selected)
-
Construct a SUI.TabPanel object. The titles of the tabs and (optional) the client boxes are given as argument to this constructor. It is also possible to select the initial tab.
Parameters:
Name Type Description see base class object[] items An object array containing objects with the following members: String items[].title Tab title SUI.Box items[].box A client box (optional) int selected Index of tab that should be selected initially (optional) View source: TabPanel.js, line 64
Members
- private SUI.Border _border
-
The box's border.
Inherited From: SUI.Box#_border
- private int _bottom
-
The bottom position of the box.
Inherited From: SUI.Box#_bottom
- private HTMLElementNode _el
-
The box's element node.
Inherited From: SUI.Box#_el
- private int _height
-
The height of the box.
Inherited From: SUI.Box#_height
- private int _left
-
The left position of the box.
Inherited From: SUI.Box#_left
- private int _listeners
-
The listeners array.
Inherited From: SUI.Box#_listeners
- private int _maxHeight
-
The maximum height of the box.
Inherited From: SUI.Box#_maxHeight
- private int _maxWidth
-
The maximum width of the box.
Inherited From: SUI.Box#_maxWidth
- private int _minHeight
-
The minimum height of the box.
Inherited From: SUI.Box#_minHeight
- private int _minWidth
-
The minimum width of the box.
Inherited From: SUI.Box#_minWidth
- private SUI.Padding _padding
-
The box's padding.
Inherited From: SUI.Box#_padding
- private SUI.Box _parent
-
The box's parent element.
Inherited From: SUI.Box#_parent
- private int _right
-
The right position of the box.
Inherited From: SUI.Box#_right
- private int _top
-
The top position of the box.
Inherited From: SUI.Box#_top
- private int _width
-
The width of the box.
Inherited From: SUI.Box#_width
- public PANEL_PADDING
-
Padding of the content on the tab.
View source: TabPanel.js, line 84
- public SCROLL_IMG_PADDING_LEFT
-
Left position of the image in a scroller button.
View source: TabPanel.js, line 124
- public SCROLL_IMG_PADDING_TOP
-
Top position of the image in a scroller button.
View source: TabPanel.js, line 129
- public SCROLLER_WIDTH
-
Width of a the scroller button.
View source: TabPanel.js, line 134
- public SELTAB_MARGIN_TOP
-
Margin top of the selected tab.
View source: TabPanel.js, line 139
- public TAB_BORDER_BOTTOM_WIDTH
-
Border width of the line under the tab strip.
View source: TabPanel.js, line 89
- public TAB_BORDER_WIDTH
-
Border width of the lines of the tab.
View source: TabPanel.js, line 94
- public TAB_HILIGHT_HEIGHT
-
Height of the highlight strip on top of a selected tab.
View source: TabPanel.js, line 99
- public TAB_MARGIN_TOP
-
Top margin of unselected tabs.
View source: TabPanel.js, line 104
- public TABBAR_HEIGHT
-
Height of the tab bar (including bottom border).
View source: TabPanel.js, line 109
- public TABTEXT_PADDING_LEFT
-
Left padding of the text in the tabs.
View source: TabPanel.js, line 119
- public TABTEXT_PADDING_TOP
-
Top padding of the text in the tabs.
View source: TabPanel.js, line 114
Methods
- public absPos()
-
Get the absolute position (top/left) of this box on the page. Note: You can only use this function if the HTML content of the page is fully rendered.
Inherited From: SUI.Box#absPos
- public add( SUI.Box child, int i)
-
Add a box to one of the client areas of the control.
Parameters:
Name Type Description SUI.Box child The box to add to the control int i Index position of the client container to at the box to View source: TabPanel.js, line 146
- public addClass( String cls)
-
Add a CSS class name to the class list of the HTML element associated with the box.
Parameters:
Name Type Description String cls the CSS class name to add Inherited From: SUI.Box#addClass
- public addListener( String type, Function listener)
-
Add/register a listener function. This way it is possible to register more than one listener function on one target.
Parameters:
Name Type Description String type The listener type (i.e. "onClick", "onOK", etc). Function listener The listener function. Inherited From: SUI.Box#addListener
- public SUI.Border border( SUI.Border b)
-
Get or set the border definition of the box.
Parameters:
Name Type Argument Description SUI.Border b <optional>
The new border definition (or none to use this method as a getter). Returns:
SUI.Border the border definition of the box (or null if this method was used as a setter).
Inherited From: SUI.Box#border
- public int bottom( int b)
-
Get or set the bottom of the box.
Parameters:
Name Type Argument Description int b <optional>
The new bottom of the box (or none to use this method as a getter). Returns:
int The bottom of the box (or null if this method was used as a setter).
Inherited From: SUI.Box#bottom
- public callListener( String type)
-
Call a listener function. Execute the default and additional listener functions. Note: the framework should not execute the default listeners directly but always through this method to ensure the execution of additional listener functions.
Parameters:
Name Type Description String type The listener type (i.e. "onClick", "onOK", etc). Inherited From: SUI.Box#callListener
- public clientAreaPosition()
-
Get the top, left, right and bottom offset of the client area relative to the outer dimensions of the tab panel.
View source: TabPanel.js, line 272
- public int clientHeight()
-
Get the client height of the box. The client height is the height of the box minus the top and bottom border and padding width.
Returns:
int The client height of the box.
Inherited From: SUI.Box#clientHeight
- public int clientWidth()
-
Get the client width of the box. The client width is the width of the box minus the left and right border and padding width.
Returns:
int The client width of the box.
Inherited From: SUI.Box#clientWidth
- public display()
-
Display the tab panel control. Set the CSS size and position of the tabs and the currently displayed content panel.
View source: TabPanel.js, line 154
- public draw()
-
Draw the box on the screen. It executes a two phase process: a layout phase in which the size and positions of the box (and of it's contents, for more complex derivatives) is calculated and a display phase in which the CSS size and position of the box's (and possible it's child elements) is set.
Inherited From: SUI.Box#draw
- public HTMLElementNode el()
-
Get the HTML element node of the box.
Returns:
HTMLElementNode the HTML element node of the box.
Inherited From: SUI.Box#el
- public int height( int h)
-
Get or set the height of the box.
Parameters:
Name Type Argument Description int h <optional>
The new height of the box (or none to use this method as a getter). Returns:
int The height of the box (or null if this method was used as a setter).
Inherited From: SUI.Box#height
- public layOut()
-
Lay out the tab panel control. Calculate the size and position of the tabs and client area.
View source: TabPanel.js, line 186
- public int left( int l)
-
Get or set the left of the box.
Parameters:
Name Type Argument Description int l <optional>
The new left of the box (or none to use this method as a getter). Returns:
int The left of the box (or null if this method was used as a setter).
Inherited From: SUI.Box#left
- public int maxHeight( int mh)
-
Get or set the maximum height of the box.
Parameters:
Name Type Argument Description int mh <optional>
The new maximum height of the box (or none to use this method as a getter). Returns:
int The maximum height of the box (or null if this method was used as a setter).
Inherited From: SUI.Box#maxHeight
- public int maxWidth( int mw)
-
Get or set the maximum width of the box.
Parameters:
Name Type Argument Description int mw <optional>
The new maximum width of the box (or none to use this method as a getter). Returns:
int The maximum width of the box (or null if this method was used as a setter).
Inherited From: SUI.Box#maxWidth
- public int minHeight( int mh)
-
Get or set the minimum height of the box.
Parameters:
Name Type Argument Description int mh <optional>
The new minimum height of the box (or none to use this method as a getter). Returns:
int The minimum height of the box (or null if this method was used as a setter).
Inherited From: SUI.Box#minHeight
- public int minWidth( int mw)
-
Get or set the minimum width of the box.
Parameters:
Name Type Argument Description int mw <optional>
The new minimum width of the box (or none to use this method as a getter). Returns:
int The minimum width of the box (or null if this method was used as a setter).
Inherited From: SUI.Box#minWidth
- public onSelectTab()
-
onSelectTab event handler: is executed when the user clicks on a tab.
View source: TabPanel.js, line 265
- public SUI.Padding padding( SUI.Padding p)
-
Get or set the padding definition of the box.
Parameters:
Name Type Argument Description SUI.Padding p <optional>
The new padding definition (or none to use this method as a getter). Returns:
SUI.Padding The padding definition of the box (or null if this method was used as a setter).
Inherited From: SUI.Box#padding
- public SUI.Box parent( SUI.Box p)
-
Get or set the parent box of the box. When setting the parent the box's element node will be appended to the parent box's HTML element node.
Parameters:
Name Type Description SUI.Box p The parent box for this box (or none to use this method as a getter). Returns:
SUI.Box The parent box of the box (or null if this method was used as a setter).
Inherited From: SUI.Box#parent
- public removeBox()
-
Remove a box from the DOM tree.
Inherited From: SUI.Box#removeBox
- public removeClass( String cls)
-
Remove a CSS class name from the class list of the HTML element associated with the box.
Parameters:
Name Type Description String cls The CSS class name to remove. Inherited From: SUI.Box#removeClass
- public int right( int r)
-
Get or set the right of the box.
Parameters:
Name Type Description int r The new right of the box (or none to use this method as a getter). Returns:
int The right of the box (or null if this method was used as a setter).
Inherited From: SUI.Box#right
- public Object selectedTab( Object tab)
-
Set or get the selected tab.
Parameters:
Name Type Description Object tab (optional) the tab to set the selected tab to. Returns:
Object the selected tab (null if method was used as setter)
View source: TabPanel.js, line 290
- public int selectedTabIndex( int i)
-
Set or get the index of the selected tab.
Parameters:
Name Type Description int i (optional) the index to set the index of the selected tab to. Returns:
int the index of the selected tab (null if method was used as setter)
View source: TabPanel.js, line 302
- public selectTab( Object tab)
-
Select a tab. Set the selected tab call the onSelectTab listener and draw it. Note: this method is probably most usefull when overriding, not to call it on a tab object directly.
Parameters:
Name Type Description Object tab Tab to select View source: TabPanel.js, line 314
- public setDim()
-
Set the CSS dimensions of this box and it's borders and padding. This is typically used in display functions to display boxes at the size and position that was calculated during layout.
Inherited From: SUI.Box#setDim
- public setPos()
-
Set the CSS postion of this box. This is typically used in display functions to display boxes at position that was calculated during layout. Note: use setDim if you want to set the position and size of the box.
Inherited From: SUI.Box#setPos
- public setRect( int | SUI.Box t, int l, int w, int h)
-
Set the top, left, width and height of a box in one go.
Parameters:
Name Type Argument Description int | SUI.Box t The new top of the box or another reference box to copy the values from. int l <optional>
The new left of the box (if the t parameter wasn't a reference Box). int w <optional>
The new width of the box (if the t parameter wasn't a reference Box). int h <optional>
The new length of the box (if the t parameter wasn't a reference Box). Inherited From: SUI.Box#setRect
- public int top( int t)
-
Get or set the top of the box.
Parameters:
Name Type Argument Description int t <optional>
The new top of the box (or none to use this method as a getter). Returns:
int The top of the box (or null if this method was used as a setter).
Inherited From: SUI.Box#top
- public int width( int w)
-
Get or set the width of the box.
Parameters:
Name Type Argument Description int w <optional>
The new width of the box (or none to use this method as a getter). Returns:
int The width of the box (or null if this method was used as a setter).
Inherited From: SUI.Box#width