org.apache.tapestry.util
Class ComponentAddress

java.lang.Object
  extended by org.apache.tapestry.util.ComponentAddress
All Implemented Interfaces:
Serializable

public class ComponentAddress
extends Object
implements Serializable

The ComponentAddress class contains the path to a component, allowing it to locate an instance of that component in a different IRequestCycle.

This class needs to be used mostly when working with components accessed via the IRender interface. It allows those components to serialize and pass as a service parameter information about what component they have to talk to if control returns back to them.

This situation often occurs when the component used via IRender contains Direct or Action links.

Since:
2.2
Version:
$Id: ComponentAddress.java 243791 2004-02-19 17:38:13Z hlship $
Author:
mindbridge
See Also:
Serialized Form

Constructor Summary
ComponentAddress(IComponent component)
          Creates a new ComponentAddress object that carries the identification information of the given component (the page name and the ID path).
ComponentAddress(INamespace namespace, String pageName, String idPath)
          Creates a new ComponentAddress using the given Page Name and ID Path relative on the provided Namespace
ComponentAddress(String pageName, String idPath)
          Creates a new ComponentAddress using the given Page Name and ID Path
 
Method Summary
 boolean equals(Object obj)
           
 IComponent findComponent(IRequestCycle cycle)
          Finds a component with the current address using the given RequestCycle.
 String getIdPath()
          Returns the idPath of the component.
 String getPageName()
          Returns the Page Name of the component.
 int hashCode()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentAddress

public ComponentAddress(IComponent component)
Creates a new ComponentAddress object that carries the identification information of the given component (the page name and the ID path).

Parameters:
component - the component to get the address of

ComponentAddress

public ComponentAddress(String pageName,
                        String idPath)
Creates a new ComponentAddress using the given Page Name and ID Path

Parameters:
pageName - the name of the page that contains the component
idPath - the ID Path of the component

ComponentAddress

public ComponentAddress(INamespace namespace,
                        String pageName,
                        String idPath)
Creates a new ComponentAddress using the given Page Name and ID Path relative on the provided Namespace

Parameters:
namespace - the namespace of the page that contains the component
pageName - the name of the page that contains the component
idPath - the ID Path of the component
Method Detail

findComponent

public IComponent findComponent(IRequestCycle cycle)
Finds a component with the current address using the given RequestCycle.

Parameters:
cycle - the RequestCycle to use to locate the component
Returns:
IComponent a component that has been initialized for the given RequestCycle

getIdPath

public String getIdPath()
Returns the idPath of the component.

Returns:
String the ID path of the component

getPageName

public String getPageName()
Returns the Page Name of the component.

Returns:
String the Page Name of the component

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

equals

public boolean equals(Object obj)
Overrides:
equals in class Object
See Also:
Object.equals(Object)