org.loom.tags.menu
Class MenuItemTag

java.lang.Object
  extended by javax.servlet.jsp.tagext.SimpleTagSupport
      extended by org.loom.tags.AbstractTag
          extended by org.loom.tags.menu.MenuItemTag
All Implemented Interfaces:
javax.servlet.jsp.tagext.DynamicAttributes, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.SimpleTag, LoomTag, MenuItemTagCollection, ParameterContainer

@Tag(dynamicAttributes=true,
     bodyContent=SCRIPTLESS,
     example="See menu")
public class MenuItemTag
extends AbstractTag
implements ParameterContainer, MenuItemTagCollection

Menu item. Menu items will detect if the current url is the same they point to, and set their CSS accordingly. Forbidden URLs will also get a "unauthorized" CSS class automatically added.


Field Summary
 
Fields inherited from class org.loom.tags.AbstractTag
expressionLanguageProxy, loomServletRequestFactory, out, repository, request, response
 
Constructor Summary
MenuItemTag()
           
 
Method Summary
 void addChild(MenuItemData child)
          Add a MenuItemData as child of this node
 MenuItemTag 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
 void setAction(java.lang.String action)
          The action this link points to.
 void setAliases(java.lang.String a)
          A list of events that will mark this menu item as "selected", even if the target event is different
 void setCssClass(java.lang.String cls)
          HTML attribute
 void setEvent(java.lang.String event)
          The event this link points to.
 void setHash(java.lang.String hash)
          The hash (the fragment after '#') of the url
 void setHref(java.lang.String url)
          The target url.
 void setI18n(boolean i18n)
          Deprecated. use translateLabel instead
 void setId(java.lang.String id)
          HTML attribute
 void setIf(boolean ifClause)
          Set to false to skip tag execution.
 void setLabel(java.lang.String label)
          Sets the text to be shown in this menu item
 void setMapping(java.lang.String mapping)
          The mapping as action.event.
 void setRequest(LoomServletRequest request)
           
 void setTarget(java.lang.String target)
          HTML attribute
 void setTranslateLabel(boolean translateLabel)
          Set to true to translate the item text, default true
 
Methods inherited from class org.loom.tags.AbstractTag
createWriterWrapper, doBody, doBufferedBody, doTag, endTag, evaluateExpression, getActionProperty, getAncestorWithClass, getBufferedBody, getExtendedAttributes, getMessagesRepository, getPageContext, getRequest, getResponse, getScopedAttribute, getWriter, initTag, 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
 

Constructor Detail

MenuItemTag

public MenuItemTag()
Method Detail

setRequest

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

doTagImpl

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

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

setLabel

@Attribute
public void setLabel(java.lang.String label)
Sets the text to be shown in this menu item


setTranslateLabel

@Attribute
public void setTranslateLabel(boolean translateLabel)
Set to true to translate the item text, default true


setI18n

@Attribute
public void setI18n(boolean i18n)
Deprecated. use translateLabel instead

Set to true to translate the item text, default true


setAliases

@Attribute
public void setAliases(java.lang.String a)
A list of events that will mark this menu item as "selected", even if the target event is different


addParameter

public MenuItemTag 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.

setAction

@Attribute
public void setAction(java.lang.String action)
The action this link points to. Either this or href must be specified.


setEvent

@Attribute
public void setEvent(java.lang.String event)
The event this link points to. If action is specified but event is not, the default event will be assumed. If the action does not define a default event, an exception will be thrown. Either action/event or href must be set.


setMapping

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


setHref

@Attribute
public void setHref(java.lang.String url)
The target url. Either this or the action / event pair must be set.


setHash

@Attribute
public void setHash(java.lang.String hash)
The hash (the fragment after '#') of the url


setCssClass

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


addChild

public void addChild(MenuItemData child)
Description copied from interface: MenuItemTagCollection
Add a MenuItemData as child of this node

Specified by:
addChild in interface MenuItemTagCollection

setId

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


setTarget

@Attribute
public void setTarget(java.lang.String target)
HTML attribute


setIf

@Attribute
public void setIf(boolean ifClause)
Set to false to skip tag execution.