net.sourceforge.stripes.tag.layout
Class LayoutRenderTagPath

java.lang.Object
  extended by net.sourceforge.stripes.tag.layout.LayoutRenderTagPath

public class LayoutRenderTagPath
extends Object

Uniquely identifies a LayoutRenderTag within a page. Within a single page, any number of render tags can be accessible via the same "path," where a path consists of zero or more component tags that are parents of the render tag. This class helps to distinguish between multiple render tags with the same component path by assigning sequential indexes to them.

Since:
Stripes 1.5.7
Author:
Ben Gunter

Constructor Summary
LayoutRenderTagPath(LayoutRenderTag tag)
          Construct a new instance to identify the specified tag.
 
Method Summary
protected  List<String> calculateComponentPath(LayoutRenderTag tag)
          Calculate the path to a render tag.
 boolean equals(Object obj)
           
 List<String> getComponentPath()
          Get the names of the LayoutComponentTags that are parent tags of the render tag.
 int getIndex()
          Get the index (zero-based) of the combined render page and component path within the page.
 int hashCode()
           
protected  int incrementIndex(PageContext pageContext)
          Get the next index for this path from the specified page context.
 boolean isPathComponent(LayoutComponentTag tag)
          True if the specified tag is a component that must execute so that the current component tag can execute.
protected  boolean isPathComponent(LayoutComponentTag tag, Iterator<String> path)
          Recursive method called from isPathComponent(LayoutComponentTag) that returns true if the specified tag's name is present in the component path iterator at the same position where this tag occurs in the render/component tag tree.
 String toString()
           
 String toStringWithoutIndex()
          Get a string representation of this instance without including the index.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LayoutRenderTagPath

public LayoutRenderTagPath(LayoutRenderTag tag)
Construct a new instance to identify the specified tag.

Method Detail

calculateComponentPath

protected List<String> calculateComponentPath(LayoutRenderTag tag)
Calculate the path to a render tag. The path is a list of names of components that must execute, in order, so that the specified render tag can execute.

Parameters:
tag - The render tag.
Returns:
A list of component names or null if the render tag is not a child of a component.

incrementIndex

protected int incrementIndex(PageContext pageContext)
Get the next index for this path from the specified page context.


getComponentPath

public List<String> getComponentPath()
Get the names of the LayoutComponentTags that are parent tags of the render tag.


getIndex

public int getIndex()
Get the index (zero-based) of the combined render page and component path within the page.


isPathComponent

public boolean isPathComponent(LayoutComponentTag tag)
                        throws StripesJspException
True if the specified tag is a component that must execute so that the current component tag can execute. That is, this tag is a parent of the current component.

Parameters:
tag - The tag to check to see if it is part of this path.
Throws:
StripesJspException

isPathComponent

protected boolean isPathComponent(LayoutComponentTag tag,
                                  Iterator<String> path)
Recursive method called from isPathComponent(LayoutComponentTag) that returns true if the specified tag's name is present in the component path iterator at the same position where this tag occurs in the render/component tag tree. For example, if the path iterator contains the component names ["foo", "bar"] then this method will return true if the tag's name is "bar" and it is a child of a render tag that is a child of a component tag whose name is "foo".

Parameters:
tag - The tag to check
path - The path to the check the tag against

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

toStringWithoutIndex

public String toStringWithoutIndex()
Get a string representation of this instance without including the index.



© Copyright 2005-2006, Stripes Development Team.