org.apache.struts2.components
Class TabbedPanel

java.lang.Object
  extended by org.apache.struts2.components.Component
      extended by org.apache.struts2.components.UIBean
          extended by org.apache.struts2.components.ClosingUIBean
              extended by org.apache.struts2.components.TabbedPanel

public class TabbedPanel
extends ClosingUIBean

The tabbedpanel widget is primarily an AJAX component, where each tab can either be local content or remote content (refreshed each time the user selects that tab).

Examples

The following is an example of a tabbedpanel and panel tag utilizing local and remote content.

 
 <s:tabbedPanel id="test2" theme="simple" >
     <s:panel id="left" tabName="left" theme="ajax">
         This is the left pane<br/>
         <s:form >
             <s:textfield name="tt" label="Test Text" />  <br/>
             <s:textfield name="tt2" label="Test Text2" />
         </s:form>
     </s:panel>
     <s:panel remote="true" href="/AjaxTest.action" id="ryh1" theme="ajax" tabName="remote one" />
     <s:panel id="middle" tabName="middle" theme="ajax">
         middle tab<br/>
         <s:form >
             <s:textfield name="tt" label="Test Text44" />  <br/>
             <s:textfield name="tt2" label="Test Text442" />
         </s:form>
     </s:panel>
     <s:panel remote="true" href="/AjaxTest.action"  id="ryh21" theme="ajax" tabName="remote right" />
 </s:tabbedPanel>
 
 

Additional Configuration If you are looking for the "nifty" rounded corner look, there is additional configuration. This assumes that the background color of the tabs is white. If you are using a different color, please modify the parameter in the Rounded() method.

 
 <link rel="stylesheet" type="text/css" href="<s:url value="/struts/tabs.css"/>">
 <link rel="stylesheet" type="text/css" href="<s:url value="/struts/niftycorners/niftyCorners.css"/>">
 <link rel="stylesheet" type="text/css" href="<s:url value="/struts/niftycorners/niftyPrint.css"/>" media="print">
 <script type="text/javascript" src="<s:url value="/struts/niftycorners/nifty.js"/>"></script>
 <script type="text/javascript">
     dojo.event.connect(window, "onload", function() {
         if (!NiftyCheck())
             return;
         Rounded("li.tab_selected", "top", "white", "transparent", "border #ffffffS");
         Rounded("li.tab_unselected", "top", "white", "transparent", "border #ffffffS");
         // "white" needs to be replaced with the background color
     });
 </script>
 
 
Important: Be sure to setup the page containing this tag to be Configured for AJAX

See Also:
Panel

Field Summary
protected  java.util.List tabs
           
static java.lang.String TEMPLATE
           
static java.lang.String TEMPLATE_CLOSE
           
 
Fields inherited from class org.apache.struts2.components.UIBean
accesskey, cssClass, cssStyle, disabled, label, labelPosition, name, onblur, onchange, onclick, ondblclick, onfocus, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onselect, request, required, requiredposition, response, tabindex, template, templateDir, templateSuffix, theme, title, tooltip, tooltipConfig, value
 
Fields inherited from class org.apache.struts2.components.Component
COMPONENT_STACK, id, parameters, stack
 
Constructor Summary
TabbedPanel(com.opensymphony.xwork2.util.OgnlValueStack stack, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
           
 
Method Summary
 void addTab(Panel pane)
          Add a new panel to be rendered.
protected  void evaluateExtraParams()
           
 java.lang.String getComponentName()
           
 java.lang.String getDefaultOpenTemplate()
           
protected  java.lang.String getDefaultTemplate()
          A contract that requires each concrete UI Tag to specify which template should be used as a default.
 java.util.List getTabs()
          Get the list of panel tabs for this tab panel.
 java.lang.String getTopicName()
           
 void setId(java.lang.String id)
          The id to assign to the component.
 
Methods inherited from class org.apache.struts2.components.ClosingUIBean
setOpenTemplate, start
 
Methods inherited from class org.apache.struts2.components.UIBean
addFormParameter, buildTemplateName, enableAncestorFormCustomOnsubmit, end, escape, evaluateNameValue, evaluateParams, getTemplate, getTemplateDir, getTheme, getTooltipConfig, getValueClassType, mergeTemplate, populateComponentHtmlId, setAccesskey, setCssClass, setCssStyle, setDisabled, setLabel, setLabelposition, setName, setOnblur, setOnchange, setOnclick, setOndblclick, setOnfocus, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnselect, setRequired, setRequiredposition, setTabindex, setTemplate, setTemplateDir, setTheme, setTitle, setTooltip, setTooltipConfig, setValue
 
Methods inherited from class org.apache.struts2.components.Component
addAllParameters, addParameter, altSyntax, copyParams, determineActionURL, determineNamespace, end, fieldError, findAncestor, findString, findString, findValue, findValue, findValue, getComponentStack, getId, getParameters, getStack, popComponentStack, toString, usesBody
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEMPLATE

public static final java.lang.String TEMPLATE
See Also:
Constant Field Values

TEMPLATE_CLOSE

public static final java.lang.String TEMPLATE_CLOSE
See Also:
Constant Field Values

tabs

protected java.util.List tabs
Constructor Detail

TabbedPanel

public TabbedPanel(com.opensymphony.xwork2.util.OgnlValueStack stack,
                   javax.servlet.http.HttpServletRequest request,
                   javax.servlet.http.HttpServletResponse response)
Method Detail

addTab

public void addTab(Panel pane)
Add a new panel to be rendered.

Parameters:
pane - a new panel to be rendered

getTabs

public java.util.List getTabs()
Get the list of panel tabs for this tab panel.

Returns:
the list of panel tabs for this tab panel

getTopicName

public java.lang.String getTopicName()

evaluateExtraParams

protected void evaluateExtraParams()
Overrides:
evaluateExtraParams in class UIBean

getDefaultOpenTemplate

public java.lang.String getDefaultOpenTemplate()
Specified by:
getDefaultOpenTemplate in class ClosingUIBean

getDefaultTemplate

protected java.lang.String getDefaultTemplate()
Description copied from class: UIBean
A contract that requires each concrete UI Tag to specify which template should be used as a default. For example, the CheckboxTab might return "checkbox.vm" while the RadioTag might return "radio.vm". This value not begin with a '/' unless you intend to make the path absolute rather than relative to the current theme.

Specified by:
getDefaultTemplate in class UIBean
Returns:
The name of the template to be used as the default.

getComponentName

public java.lang.String getComponentName()

setId

public void setId(java.lang.String id)
The id to assign to the component.

Overrides:
setId in class Component


Copyright © 2000-2006 Apache Software Foundation. All Rights Reserved.