org.japano
Class PageNode

java.lang.Object
  extended by org.japano.PageNode
Direct Known Subclasses:
AttributeSetterNode, Button, Catch, Choose, FieldNode, ForEach, If, Import, Javascript, JsObject, LegacyTagAdapter, MessageList, Otherwise, Out, Page, PageNode.Output, Param, Part, Preserve, Redirect, Remove, Set, TagFile, Test, Test.Match, Url, When

public class PageNode
extends java.lang.Object

Base class for all nodes in a page model.

Version:
$Id: PageNode.java,v 1.19 2005/10/04 02:21:11 fforw Exp $ SourceForge.net Logo
Author:
Sven Helmberger ( sven dot helmberger at gmx dot de )

Nested Class Summary
static class PageNode.Output
          Helper class for tag output definitions.
 
Field Summary
protected  java.lang.Object[] children
          Contains all child nodes of this node
protected  AbstractContext context
           
protected static java.lang.Object[] EMPTY
          empty Object array
protected  java.lang.String nodeId
           
protected  PageNode parent
          Parent node of this node
 
Constructor Summary
PageNode()
          Constructs a new Node with no children.
 
Method Summary
 java.util.List findChildren(java.lang.Class type)
          Returns a List of all children with a given type.
 PageNode findParent(java.lang.Class klass)
          Finds the first parent of the given type.
 PageNode findRootNode()
          Returns the root node the current node is a descendant of.
 void generate(Buffer out)
          Generates this node The base implementation just calls generateChildren(Buffer)
protected  void generateChildren(Buffer out)
          Dumps all child nodes of this node.
 java.lang.Object[] getChildren()
          Returns the children of this node
 AbstractContext getContext()
           
 java.lang.String getNodeId()
          Returns the unique identifier value for this page node.
 PageNode getParent()
          Returns the parent of this node.
 void init()
          Initializes the node.
 void recInit()
          Recursively initializes all children of the current Node.
 void release()
          Always called at the end of a page invocation.
 PageNode setChildren(java.lang.Object[] _children)
          Sets the children of this node.
 void setContext(AbstractContext context)
           
 void setNodeId(java.lang.String nodeId)
          Sets the unique identifier value for this page node.
 void setParent(PageNode parent)
          Sets the parent of this node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY

protected static final java.lang.Object[] EMPTY
empty Object array


children

protected java.lang.Object[] children
Contains all child nodes of this node


parent

protected PageNode parent
Parent node of this node


context

protected AbstractContext context

nodeId

protected java.lang.String nodeId
Constructor Detail

PageNode

public PageNode()
Constructs a new Node with no children.

Method Detail

setContext

public void setContext(AbstractContext context)

getContext

public AbstractContext getContext()

setParent

public void setParent(PageNode parent)
Sets the parent of this node.

Parameters:
parent - Parent node

getParent

public PageNode getParent()
Returns the parent of this node.


setChildren

public PageNode setChildren(java.lang.Object[] _children)
Sets the children of this node. The node children contained in the given Object array are initialized with this parent

Parameters:
_children - new children
Returns:
this node (convient for good page code readability)

getChildren

public java.lang.Object[] getChildren()
Returns the children of this node

Returns:
children

generate

public void generate(Buffer out)
Generates this node The base implementation just calls generateChildren(Buffer)


generateChildren

protected void generateChildren(Buffer out)
Dumps all child nodes of this node.


findParent

public PageNode findParent(java.lang.Class klass)
Finds the first parent of the given type.

Parameters:
klass - type to find
Returns:
first parent

findChildren

public java.util.List findChildren(java.lang.Class type)
Returns a List of all children with a given type.

Parameters:
type - type
Returns:
list with childs that may be empty.

recInit

public final void recInit()
Recursively initializes all children of the current Node. Parents are inited before their children.


init

public void init()
Initializes the node. The init method is called after all nodes of the page are constructed, linked and configured.


setNodeId

public void setNodeId(java.lang.String nodeId)
Sets the unique identifier value for this page node.


getNodeId

public java.lang.String getNodeId()
Returns the unique identifier value for this page node. The current implementation sets the variable name of the non-anonymous page node tags as id value.


findRootNode

public PageNode findRootNode()
Returns the root node the current node is a descendant of.

Returns:
root node

release

public void release()
Always called at the end of a page invocation.