net.sourceforge.stripes.tag.layout
Class LayoutRenderTag

java.lang.Object
  extended by net.sourceforge.stripes.tag.StripesTagSupport
      extended by net.sourceforge.stripes.tag.layout.LayoutTag
          extended by net.sourceforge.stripes.tag.layout.LayoutRenderTag
All Implemented Interfaces:
BodyTag, DynamicAttributes, IterationTag, JspTag, Tag

public class LayoutRenderTag
extends LayoutTag
implements BodyTag, DynamicAttributes

Renders a named layout, optionally overriding one or more components in the layout. Any attributes provided to the class other than 'name' will be placed into page context during the evaluation of the layout, making them available to other tags, and in EL.

Since:
Stripes 1.1
Author:
Tim Fennell, Ben Gunter

Field Summary
 
Fields inherited from class net.sourceforge.stripes.tag.StripesTagSupport
pageContext, parentTag
 
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag
EVAL_BODY_BUFFERED, EVAL_BODY_TAG
 
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
LayoutRenderTag()
           
 
Method Summary
 int doAfterBody()
          Returns Tag.SKIP_BODY.
 int doEndTag()
          After the first pass (see LayoutContext.isComponentRenderPhase()): Ensure the layout rendered successfully by checking LayoutContext.isRendered(). Remove the current layout context from request scope. Restore previous page context attribute values.
 void doInitBody()
          Does nothing.
 int doStartTag()
          On the first pass (see LayoutContext.isComponentRenderPhase()): Push the values of any dynamic attributes into page context attributes for the duration of the tag. Create a new context and places it in request scope. Include the layout definition page named by the name attribute.
 String getName()
          Gets the name of the layout to be used.
 LayoutRenderTagPath getPath()
          Get the LayoutRenderTagPath that identifies this tag within the current page.
protected  void initialize()
          Initialize fields before execution begins.
 boolean isChildOfCurrentComponent()
          Returns true if this tag is a child of the current component tag.
 void setBodyContent(BodyContent bodyContent)
          Set the tag's body content.
 void setDynamicAttribute(String uri, String localName, Object value)
          Used by the JSP container to provide the tag with dynamic attributes.
 void setName(String name)
          Sets the name of the layout to be used and then calls initialize().
 
Methods inherited from class net.sourceforge.stripes.tag.layout.LayoutTag
cleanUpComponentRenderers, exportComponentRenderers, getCurrentPagePath, getLayoutParent, isChildOfComponent, isChildOfDefinition, isChildOfRender
 
Methods inherited from class net.sourceforge.stripes.tag.StripesTagSupport
getActionBeanType, getActionBeanUrl, getPageContext, getParent, getParentTag, getTagStack, popPageContextAttributes, pushPageContextAttributes, release, setPageContext, setParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.jsp.tagext.Tag
getParent, release, setPageContext, setParent
 

Constructor Detail

LayoutRenderTag

public LayoutRenderTag()
Method Detail

getName

public String getName()
Gets the name of the layout to be used.


setName

public void setName(String name)
Sets the name of the layout to be used and then calls initialize().


getPath

public LayoutRenderTagPath getPath()
Get the LayoutRenderTagPath that identifies this tag within the current page.


initialize

protected void initialize()
Initialize fields before execution begins. Typically, this would be done by overriding StripesTagSupport.setPageContext(javax.servlet.jsp.PageContext), but that isn't possible in this case because some of the logic depends on setName(String) having been called, which does not happen until after StripesTagSupport.setPageContext(javax.servlet.jsp.PageContext) has been called.


isChildOfCurrentComponent

public boolean isChildOfCurrentComponent()
Returns true if this tag is a child of the current component tag.


setDynamicAttribute

public void setDynamicAttribute(String uri,
                                String localName,
                                Object value)
                         throws JspException
Used by the JSP container to provide the tag with dynamic attributes.

Specified by:
setDynamicAttribute in interface DynamicAttributes
Throws:
JspException

doStartTag

public int doStartTag()
               throws JspException
On the first pass (see LayoutContext.isComponentRenderPhase()):

Specified by:
doStartTag in interface Tag
Specified by:
doStartTag in class StripesTagSupport
Returns:
EVAL_BODY_INCLUDE in all cases
Throws:
JspException

setBodyContent

public void setBodyContent(BodyContent bodyContent)
Set the tag's body content. Called by the JSP engine during component registration phase, when doStartTag() returns BodyTag.EVAL_BODY_BUFFERED

Specified by:
setBodyContent in interface BodyTag

doInitBody

public void doInitBody()
                throws JspException
Does nothing.

Specified by:
doInitBody in interface BodyTag
Throws:
JspException

doAfterBody

public int doAfterBody()
                throws JspException
Returns Tag.SKIP_BODY.

Specified by:
doAfterBody in interface IterationTag
Throws:
JspException

doEndTag

public int doEndTag()
             throws JspException
After the first pass (see LayoutContext.isComponentRenderPhase()):

Specified by:
doEndTag in interface Tag
Specified by:
doEndTag in class StripesTagSupport
Returns:
EVAL_PAGE in all cases.
Throws:
JspException


© Copyright 2005-2006, Stripes Development Team.