org.loom.tags.tabs
Class TabTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.SimpleTagSupport
      extended by org.loom.tags.AbstractTag
          extended by org.loom.tags.AbstractDecoratedTag
              extended by org.loom.tags.tabs.TabTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.DynamicAttributes, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.SimpleTag, HtmlTag, Link, LoomTag, ParameterContainer

@Tag(dynamicAttributes=true,
     bodyContent=SCRIPTLESS,
     example="<l:tabContainer>\n    <l:tab id=\"tab1\">\n            Tab1 contents\n    </l:tab>\n    <l:tab id=\"tab2\" action=\"Dummy\" event=\"bar\" param-parameter1=\"baz\">\n            Tab2 contents\n    </l:tab>\n</l:tabContainer>")
public class TabTag
extends AbstractDecoratedTag
implements ParameterContainer, Link

Tabs are rendered as a group of <div> tags to be handled using javascript. When the browser displays the page the currently selected tab is extracted from the URL hash. Browsers with javascript disabled will see all the tabs at once.

For cases where a tab is too heavy to be included on each request (or pages with just too many tabs) the tabs can include an action/event pair. These tabs will only get rendered when the current request is the same pointed by the tab.


Field Summary
 
Fields inherited from class org.loom.tags.AbstractDecoratedTag
decorator
 
Fields inherited from class org.loom.tags.AbstractTag
expressionLanguageProxy, loomServletRequestFactory, out, repository, request, response
 
Constructor Summary
TabTag()
           
 
Method Summary
 void addCssClass(java.lang.String css)
          Add a CSS class to this tag
 TabTag addParameter(java.lang.String name, java.lang.Object value)
          Adds a parameter to the resulting url
 void doTagImpl()
          The method that must be implemented by the child class
 TabContainerTag getContainer()
           
 CssBuilder getCssBuilder()
           
 java.lang.String getId()
           
 HttpMethod getMethod()
           
 java.lang.String getTarget()
           
 UrlBuilder getUrl()
           
protected  void initTag()
          Initializes the tag attributes
 boolean isIf()
           
protected  boolean renderTag()
          This is an method intended for component extension.
 void setAction(java.lang.String action)
          If not null, this tab will point to the specified action/event pair and clicking it will trigger a request to the server.
 void setContainer(TabContainerTag container)
           
 void setCssClass(java.lang.String cls)
          HTML attribute
 void setEvent(java.lang.String event)
          If not null, this tab will point to the specified action/event pair and clicking it will trigger a request to the server.
 void setId(java.lang.String id)
          HTML attribute.
 void setIf(boolean ifClause)
          If false, this tab will not be rendered.
 void setMapping(java.lang.String mapping)
          The mapping as action.event.
 void setMethod(HttpMethod method)
          Set the HttpMethod of this link.
 void setRelative(boolean relative)
          true if the url is relative (do not render schema, server or port), false to render a full URL.
 void setRequest(LoomServletRequest request)
           
 void setTarget(java.lang.String target)
           
 
Methods inherited from class org.loom.tags.AbstractDecoratedTag
doTag, getDecorator, getDecoratorInstance, setDecorator
 
Methods inherited from class org.loom.tags.AbstractTag
createWriterWrapper, doBody, doBufferedBody, endTag, evaluateExpression, getActionProperty, getAncestorWithClass, getBufferedBody, getExtendedAttributes, getMessagesRepository, getPageContext, getRequest, getResponse, getScopedAttribute, getWriter, printParentAttributes, removeScopedAttribute, setDynamicAttribute, setExtendedAttribute, setJspContext, setResponse, setScopedAttribute, setWriter
 
Methods inherited from class javax.servlet.jsp.tagext.SimpleTagSupport
findAncestorWithClass, getJspBody, getJspContext, getParent, setJspBody, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.loom.tags.LoomTag
getExtendedAttributes, getRequest, getScopedAttribute, setExtendedAttribute, setScopedAttribute
 

Constructor Detail

TabTag

public TabTag()
Method Detail

setRequest

public void setRequest(LoomServletRequest request)
Overrides:
setRequest in class AbstractTag

renderTag

protected boolean renderTag()
Description copied from class: AbstractDecoratedTag
This is an method intended for component extension. If false, the entire tag execution will be skipped, including decorator invocation

Overrides:
renderTag in class AbstractDecoratedTag
Returns:
true to execute the tag, default false.

initTag

protected void initTag()
Description copied from class: AbstractTag
Initializes the tag attributes

Overrides:
initTag in class AbstractTag

doTagImpl

public void doTagImpl()
               throws javax.servlet.jsp.JspException,
                      java.io.IOException
Description copied from class: AbstractTag
The method that must be implemented by the child class

Specified by:
doTagImpl in class AbstractTag
Throws:
javax.servlet.jsp.JspException
java.io.IOException

setId

@Attribute(required=true)
public void setId(java.lang.String id)
HTML attribute.


getId

public java.lang.String getId()

setAction

@Attribute
public void setAction(java.lang.String action)
If not null, this tab will point to the specified action/event pair and clicking it will trigger a request to the server.


setEvent

@Attribute
public void setEvent(java.lang.String event)
If not null, this tab will point to the specified action/event pair and clicking it will trigger a request to the server.


setMapping

@Attribute
public void setMapping(java.lang.String mapping)
The mapping as action.event. This method is equivalent to setting action and event separately.


setRelative

@Attribute
public void setRelative(boolean relative)
true if the url is relative (do not render schema, server or port), false to render a full URL. Default is true


addParameter

public TabTag addParameter(java.lang.String name,
                           java.lang.Object value)
Description copied from interface: ParameterContainer
Adds a parameter to the resulting url

Specified by:
addParameter in interface ParameterContainer
Parameters:
name - the name of the parameter
value - the value of the parameter
Returns:
the same instance of ParameterContainer, to allow nested calls.

getUrl

public UrlBuilder getUrl()
Specified by:
getUrl in interface Link
Returns:
the target url of this link

setTarget

public void setTarget(java.lang.String target)

getTarget

public java.lang.String getTarget()

setCssClass

@Attribute(name="class")
public void setCssClass(java.lang.String cls)
HTML attribute


addCssClass

public void addCssClass(java.lang.String css)
Description copied from interface: HtmlTag
Add a CSS class to this tag

Specified by:
addCssClass in interface HtmlTag
Parameters:
css - the CSS class to be added

getCssBuilder

public CssBuilder getCssBuilder()
Specified by:
getCssBuilder in interface HtmlTag
Returns:
the CssBuilder used to generate the "class" attribute of this link

getContainer

public TabContainerTag getContainer()

setContainer

public void setContainer(TabContainerTag container)

getMethod

public HttpMethod getMethod()
Specified by:
getMethod in interface Link
Returns:
the HttpMethod of this link. If null, GET will be used

setMethod

public void setMethod(HttpMethod method)
Description copied from interface: Link
Set the HttpMethod of this link. / If specified (and != GET), be aware that you should setup the javascript needed to actually perform the POST call. Browsers without javascript enabled (such as web crawlers, or normal browsers with ctrl+click) will ignore this and perform a GET call that should be accepted and i.e. get this same HTML page.

Specified by:
setMethod in interface Link

isIf

public boolean isIf()

setIf

@Attribute
public void setIf(boolean ifClause)
If false, this tab will not be rendered. Default true.