2.17.2: 2011-06-17

net.sf.basedb.clients.web.taglib.tab
Class TabControl

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by net.sf.basedb.clients.web.taglib.tab.TabControl
All Implemented Interfaces:
Serializable, IterationTag, JspTag, Tag, Renderer<TabAction>

public class TabControl
extends TagSupport
implements Renderer<TabAction>

This is the main tag for the tab control. It must always be present as the outermost tag. Use one or more Tab tags to define each tab inside the tabcontrol.

Syntax:

   <t:tabcontrol
      id=...
      clazz=...
      style=...
      contentstyle=...
      width=...
      active=...
      switch=...
      position=...
      autoheight=true|false
      notabs=true|false
      extensions=...
   >

Attribute Default value Required Description
id - yes The ID of the tab control. The value of this attribute goes directly into the standard id attribute. This means that if you need a reference to the tab control object in your own JavaScript code, you may for example use the following code:

tabcontrol = document.getElementById('<id>');

clazz button no The value if this attribute goes directly into the standard HTML class attribute. This allows you to apply different styles to different tables.
style - no The value if this attribute goes directly into the standard HTML style attribute. This allows you to apply different styles to different tabcontrols.
contentstyle - no The value if this attribute goes directly into the standard HTML style attribute for the content section. This allows you to apply different styles to different tabcontrols.
width - no The width of the tab control.
active - no The id of the tab that should be active to begin with. If no value is specified the first tab is automatically made active.
switch setActiveTab no The name of the javascript method to call to switch tabs. The function should take two parameters which is the ID of the tabcontrol and the ID of the tab that should become active. Note! If validation is required the javascript method should call the validateActiveTab(tabControlId) method. It is not done automatically.
position top no The position of the tabs in relation to the content. The default value is to display the tabs at the top. The only other allowed value is bottom.
autoheight true no If the tab control should try to automatically adjust the height of the tab content area when the window is resized. This functionality replaces the window.onresize event handler. If an existing event handler exists it will be saved as window.oldOnresize and invoked before the tabs are resized.
notabs false no If the tabcontrol should display tabs or not. If false the tab control will not output any HTML except the contents of the active tab.
extensions - no An ExtensionsInvoker for TabAction extensions. All actions will be rendered by this tabcontrol after all the normally defined tags have been rendered. Since BASE 2.17.

Version:
2.0
Author:
Nicklas
See Also:
Tab, Serialized Form

Field Summary
private  String active
          The ID attribute of the active tab.
private  boolean autoAdjustHeight
          If tab height should be automatically adjusted or not.
static int BOTTOM
          Tabs are at the bottom of the tab control.
private  String clazz
          Optional class attribute.
private  StringBuilder content
          The HTML for the contents of the tabs.
private  String contentStyle
          Optional style attribute for the content section
private  ExtensionsInvoker<TabAction> extensions
           
private  boolean noTabs
          If the tabs should be displayed or not.
private  int numTabs
          The number of tabs.
private  int position
          The position of the tabs.
private  boolean remember
          If it should try to remember the last active tab on the page
private  StringBuilder script
          JavaScript for initialising the tabcontrol
private static long serialVersionUID
           
private  String startActive
          The real ID of the tab that is initially active.
private  String style
          Optional style attribute
private  String switchtab
          The JavaScript method to call to change tabs.
private  StringBuilder tabs
          The HTML for the tabs.
static int TOP
          Tabs are at the top of the tab control.
private  String width
          The width of the tab control.
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
TabControl()
           
 
Method Summary
(package private)  void addTab(TabAction tab)
           
 int doEndTag()
           
 int doStartTag()
           
 String getActive()
           
 String getClazz()
           
 String getContentstyle()
           
 String getStyle()
           
 String getSwitch()
           
 String getWidth()
           
 void render(TabAction action)
          Render the action in the client application.
 void setActive(String active)
           
 void setAutoheight(boolean auto)
           
 void setClazz(String clazz)
           
 void setContentstyle(String contentStyle)
           
 void setExtensions(ExtensionsInvoker<TabAction> extensions)
           
 void setNotabs(boolean noTabs)
           
 void setPosition(String position)
           
 void setRemember(boolean remember)
           
 void setStyle(String style)
           
 void setSwitch(String s)
           
 void setWidth(String width)
           
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

clazz

private String clazz
Optional class attribute.

Since:
2.17

style

private String style
Optional style attribute


contentStyle

private String contentStyle
Optional style attribute for the content section


width

private String width
The width of the tab control.


active

private String active
The ID attribute of the active tab.


switchtab

private String switchtab
The JavaScript method to call to change tabs.


position

private int position
The position of the tabs.


remember

private boolean remember
If it should try to remember the last active tab on the page


autoAdjustHeight

private boolean autoAdjustHeight
If tab height should be automatically adjusted or not.


noTabs

private boolean noTabs
If the tabs should be displayed or not.


extensions

private ExtensionsInvoker<TabAction> extensions

startActive

private String startActive
The real ID of the tab that is initially active.


numTabs

private int numTabs
The number of tabs.


tabs

private StringBuilder tabs
The HTML for the tabs.


content

private StringBuilder content
The HTML for the contents of the tabs.


script

private StringBuilder script
JavaScript for initialising the tabcontrol


TOP

public static final int TOP
Tabs are at the top of the tab control.

See Also:
Constant Field Values

BOTTOM

public static final int BOTTOM
Tabs are at the bottom of the tab control.

See Also:
Constant Field Values
Constructor Detail

TabControl

public TabControl()
Method Detail

setClazz

public void setClazz(String clazz)
Since:
2.17

getClazz

public String getClazz()
Since:
2.17

setStyle

public void setStyle(String style)

getStyle

public String getStyle()

setContentstyle

public void setContentstyle(String contentStyle)

getContentstyle

public String getContentstyle()

setWidth

public void setWidth(String width)

getWidth

public String getWidth()

setActive

public void setActive(String active)

getActive

public String getActive()

setSwitch

public void setSwitch(String s)

getSwitch

public String getSwitch()

setPosition

public void setPosition(String position)

setAutoheight

public void setAutoheight(boolean auto)

setNotabs

public void setNotabs(boolean noTabs)

setExtensions

public void setExtensions(ExtensionsInvoker<TabAction> extensions)

setRemember

public void setRemember(boolean remember)

addTab

void addTab(TabAction tab)

doStartTag

public int doStartTag()
               throws JspException
Specified by:
doStartTag in interface Tag
Overrides:
doStartTag in class TagSupport
Throws:
JspException

doEndTag

public int doEndTag()
             throws JspException
Specified by:
doEndTag in interface Tag
Overrides:
doEndTag in class TagSupport
Throws:
JspException

render

public void render(TabAction action)
Description copied from interface: Renderer
Render the action in the client application.

Specified by:
render in interface Renderer<TabAction>
Parameters:
action - The action to render

2.17.2: 2011-06-17