|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.click.control.AbstractControl net.sf.click.control.AbstractContainer net.sf.click.control.Panel net.sf.click.extras.panel.TabbedPanel
Provides a tabbed panel with multiple sub-panels in 'tabs'.
This panel comes with a default template that will render the panels in CSS customizable table tags. A listenersetTabListener(ActionListener)
may be attached
(similar to the control listeners) that will be called on tab switch.
This could be useful to load (or reload) model related information for which
ever panel is selected by the user.
The classpath TabbedPanel.htm template is illustrated below:
<div id='$this.id'> <table class="tp_tab"> <tr class="tp_tab"> #foreach ($panel in $this.panels) #if ($panel.id == $this.activePanel.id) <td class="tp_tab_on"> $panel.label </td> <td class="tp_tab_space"></td> #else <td class="tp_tab_off"> <a href="$this.tabLink.getHref($panel.name)" id="$panel.id" class="tp_tab_link">$panel.label</a> </td> <td class="tp_tab_space"></td> #end #end </tr> </table> <table class="tp_content"> <tr class="tp_content"> <td class="tp_content"> $this.activePanel </td> </tr> </table> </div>Also, as show above, there are a number of CSS attributes that allow some customization of the output. These CSS attributes are defined in the auto deployed TabbedPanel.css. The TabbedPanel CSS attributes are:
table.tp_tab { border-collapse: collapse; } tr.tp_tab { } td.tp_tab_on { background: #336699; color: #ffffff; border-left: 1px solid #336699; border-top: 1px solid #336699; border-right: 1px solid #336699; padding: 5px; } td.tp_tab_off { background: #cccccc; color: #000000; border-left: 1px solid #336699; border-top: 1px solid #336699; border-right: 1px solid #336699; padding: 5px; } table.tp_content { border: 1px solid #336699; } tr.tp_content { } td.tp_content { background: #efefef; }
Field Summary | |
protected Panel |
activePanel
The currently active panel. |
static String |
HTML_IMPORTS
The TabbedPanel.css style sheet import link. |
protected ActionLink |
tabLink
The tab switch action link. |
Fields inherited from class net.sf.click.control.Panel |
disabled, id, label, model, panels, template |
Fields inherited from class net.sf.click.control.AbstractContainer |
controlMap, controls |
Fields inherited from class net.sf.click.control.AbstractControl |
actionListener, attributes, listener, listenerMethod, messages, name, parent, styles |
Fields inherited from interface net.sf.click.Control |
CONTROL_MESSAGES |
Constructor Summary | |
TabbedPanel()
Create a TabbedPanel with no name or template defined. |
|
TabbedPanel(String name)
Create a TabbedPanel with the given name. |
|
TabbedPanel(String name,
String template)
Create a Panel with the given name and template path. |
|
TabbedPanel(String name,
String template,
String id)
Create a TabbedPanel with the given name, id attribute and template path. |
Method Summary | |
Control |
add(Control control)
Add the control to the panel. |
Control |
addControl(Control control)
|
Panel |
getActivePanel()
Return the currently active panel. |
String |
getHtmlImports()
Return the HTML head import statements for the CSS stylesheet file: click/TabbedPanel.css. |
ActionLink |
getTabLink()
Return the tab switching action link. |
String |
getWidth()
Return the tabbed panel content table HTML width attribute if defined. |
protected void |
initActivePanel()
Sets the active panel based on one of the following: If tabPanelIndex request parameter is present, this value will be used to specify the active panel. |
void |
onDeploy(ServletContext servletContext)
Deploy the TabbedPanel.css file to the click web directory when the application is initialized. |
void |
onInit()
Initialize the child controls contained in the panel. |
boolean |
onProcess()
Process the request and invoke the onProcess() method of any child controls. |
void |
onRender()
Perform any pre rendering logic and invoke the onRender() method of any child controls. |
void |
setActionListener(ActionListener actionListener)
This method will delegate to setTabListener(net.sf.click.ActionListener) . |
void |
setActivePanel(Panel panel)
Set the currently active panel to the given panel. |
void |
setListener(Object listener,
String listenerMethod)
This method will delegate to setTabListener(java.lang.Object, java.lang.String) . |
void |
setTabListener(ActionListener actionListener)
Set the tab switch listener. |
void |
setTabListener(Object listener,
String listenerMethod)
|
void |
setWidth(String width)
Set the tabbed panel content table HTML width attribute if defined. |
Methods inherited from class net.sf.click.control.Panel |
addModel, createTemplateModel, getId, getLabel, getModel, getPanels, getTemplate, isDisabled, remove, removeControl, render, setDisabled, setId, setLabel, setTemplate |
Methods inherited from class net.sf.click.control.AbstractContainer |
contains, getControl, getControlMap, getControls, getControlSizeEst, hasControls, insert, onDestroy, renderChildren, renderContent, renderTagEnd, toString |
Methods inherited from class net.sf.click.control.AbstractControl |
addStyleClass, appendAttributes, getActionListener, getAttribute, getAttributes, getContext, getMessage, getMessage, getMessage, getMessages, getName, getPage, getParent, getStyle, getStyles, getTag, hasAttribute, hasAttributes, hasStyles, registerActionEvent, removeStyleClass, renderTagBegin, setAttribute, setName, setParent, setStyle |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface net.sf.click.Control |
getContext, getMessages, getName, getParent, setName, setParent |
Field Detail |
public static final String HTML_IMPORTS
protected Panel activePanel
protected ActionLink tabLink
Constructor Detail |
public TabbedPanel(String name)
name
- the name of the panelpublic TabbedPanel(String name, String template)
name
- the name of the paneltemplate
- the Velocity templatepublic TabbedPanel(String name, String template, String id)
name
- the name of the paneltemplate
- the Velocity template pathid
- the id HTML attribute valuepublic TabbedPanel()
Method Detail |
public Control addControl(Control control)
control
- the control to add to the container
IllegalArgumentException
- if the control is null, if the name
of the control is not defined or the container already contains a
control with the same nameadd(net.sf.click.Control)
public Control add(Control control)
control
- the control to add to the container
IllegalArgumentException
- if the control is null, if the name
of the control is not defined or the container already contains a
control with the same namePanel.add(net.sf.click.Control)
public Panel getActivePanel()
public void setActivePanel(Panel panel)
panel
- the panel to set as the current active panelpublic String getHtmlImports()
public void setListener(Object listener, String listenerMethod)
setTabListener(java.lang.Object, java.lang.String)
.
listener
- the listener object with the named method to invokelistenerMethod
- the name of the method to invokepublic void setTabListener(Object listener, String listenerMethod)
listener
- the listener object with the named method to invokelistenerMethod
- the name of the method to invokesetTabListener(ActionListener)
public void setActionListener(ActionListener actionListener)
setTabListener(net.sf.click.ActionListener)
.
actionListener
- the control's action listenerpublic void setTabListener(ActionListener actionListener)
public boolean onClick() { System.out.println("onClick called"); return true; }
actionListener
- the control's action listenerpublic ActionLink getTabLink()
public String getWidth()
public void setWidth(String width)
width
- the tabbed panel content table HTML width attributepublic void onDeploy(ServletContext servletContext)
servletContext
- the servlet contextControl.onDeploy(ServletContext)
public void onInit()
Control.onInit()
public boolean onProcess()
Control.onProcess()
public void onRender()
Control.onRender()
protected void initActivePanel()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |