de.dv.sbu.filehandler.ftl.dataprovider.navigation
Class NavigationNode

java.lang.Object
  extended by de.dv.sbu.filehandler.ftl.dataprovider.navigation.NavigationNode

public class NavigationNode
extends java.lang.Object

A node within one navigation tree defined in a Navigation.

Author:
Daniel Vogtland

Constructor Summary
NavigationNode()
           
 
Method Summary
 java.lang.String getActivePattern()
          A JAVA regular expression pattern.
 int getChildIndex()
          Returns the child index related to its parent (or the just the index in case of a root node).
 java.util.List<NavigationNode> getChildren()
          Returns the list of navigation tree children.
 int getDepth()
          Returns the depth of this node.
 java.lang.String getName()
          Returns the node name.
 NavigationNode getNextNode()
          Returns the next node when viewed as sequence.
 java.util.Map<java.lang.String,java.lang.String> getParameters()
          Returns the specified parameters.
 NavigationNode getParent()
          Returns the parent node.
 NavigationNode getPreviousNode()
          Returns the previous node when viewed as sequence.
 java.lang.String getTarget()
          The node's target.
 boolean isActive()
          Calculated for each handled file.
 boolean isParentOfActive()
          Calculated for each handled file.
 java.util.List<NavigationNode> reverseTreePath()
          Returns the reverse tree path from this node (exclusive) to the tree root node (inclusive).
 void setActive(boolean active)
          Sets the active flag.
 void setActivePattern(java.lang.String activePattern)
          A JAVA regular expression pattern.
 void setChildIndex(int childIndex)
          Sets the The child index related to its parent (or the just the index in case of a root node).
 void setChildren(java.util.List<NavigationNode> children)
          Sets the child roots.
 void setDepth(int depth)
          Sets the depth of this node.
 void setName(java.lang.String name)
          Sets the node's name.
 void setNextNode(NavigationNode nextNode)
          Sets the next node.
 void setParameters(java.util.Map<java.lang.String,java.lang.String> parameters)
          Sets the parameters.
 void setParent(NavigationNode parent)
          Sets the node's parent.
 void setParentOfActive(boolean parentOfActive)
          Sets the parent-of-active flag.
 void setPreviousNode(NavigationNode previousNode)
          Sets the previous node.
 void setTarget(java.lang.String target)
          Sets the node's target
 java.lang.String toString()
          
 java.util.List<NavigationNode> treePath()
          Returns the tree path from the tree root node (inclusive) to this node (exclusive).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NavigationNode

public NavigationNode()
Method Detail

getName

public java.lang.String getName()
Returns the node name. Initially '?'.

Returns:
The node's name.

setName

public void setName(java.lang.String name)
             throws java.lang.NullPointerException
Sets the node's name.

Parameters:
name - The name to set. Expected to be unique.
Throws:
java.lang.NullPointerException - The given argument is null.

getTarget

public java.lang.String getTarget()
The node's target. If starting with "/" interpreted as relative source file path (from root). Initially the empty text.

Returns:
The current target.

setTarget

public void setTarget(java.lang.String target)
               throws java.lang.NullPointerException
Sets the node's target

Parameters:
target -
Throws:
java.lang.NullPointerException

getParameters

public java.util.Map<java.lang.String,java.lang.String> getParameters()
Returns the specified parameters. A mapping from parameter names to values.

Returns:
The specified parameters.

setParameters

public void setParameters(java.util.Map<java.lang.String,java.lang.String> parameters)
                   throws java.lang.NullPointerException
Sets the parameters.

Parameters:
parameters - The parameters to set.
Throws:
java.lang.NullPointerException - The given argument is null.

isActive

public boolean isActive()
Calculated for each handled file. This will be true if the currently handled file's path matches the node's path. If they differ the value will be false.

Returns:
true if the current node is linked to the current source file. Otherwise false.

setActive

public void setActive(boolean active)
Sets the active flag.

Parameters:
active - The state to set.

isParentOfActive

public boolean isParentOfActive()
Calculated for each handled file. If a child node has the active flag or the child flag true, this will return true. Otherwise false.

Returns:
The parent-of-active flag's state.

setParentOfActive

public void setParentOfActive(boolean parentOfActive)
Sets the parent-of-active flag.

Parameters:
parentOfActive -

getParent

public NavigationNode getParent()
Returns the parent node. null if this is a root node.

Returns:
The parent node.

setParent

public void setParent(NavigationNode parent)
Sets the node's parent.

Parameters:
parent - The node to set as parent.

getChildren

public java.util.List<NavigationNode> getChildren()
Returns the list of navigation tree children.

Returns:
The child nodes.

setChildren

public void setChildren(java.util.List<NavigationNode> children)
                 throws java.lang.NullPointerException
Sets the child roots. Not expected to contain back references.

Parameters:
children - The child nodes to set.
Throws:
java.lang.NullPointerException - The set is null or contains null elements.

getPreviousNode

public NavigationNode getPreviousNode()
Returns the previous node when viewed as sequence. null for the first one.

Returns:
The previous node.

setPreviousNode

public void setPreviousNode(NavigationNode previousNode)
Sets the previous node.

Parameters:
previousNode - The node to set.

getNextNode

public NavigationNode getNextNode()
Returns the next node when viewed as sequence. null if this is the last one.

Returns:
The next node.

setNextNode

public void setNextNode(NavigationNode nextNode)
Sets the next node.

Parameters:
nextNode - The node to set.

getChildIndex

public int getChildIndex()
Returns the child index related to its parent (or the just the index in case of a root node).

Returns:
the child index of this node

setChildIndex

public void setChildIndex(int childIndex)
Sets the The child index related to its parent (or the just the index in case of a root node).

Parameters:
childIndex - The child index to set.

getDepth

public int getDepth()
Returns the depth of this node. Root nodes have a depth of 0.

Returns:
the depth of this node

setDepth

public void setDepth(int depth)
Sets the depth of this node. Root nodes have a depth of 0.

Parameters:
depth - Sets the depth of this node.

getActivePattern

public java.lang.String getActivePattern()
A JAVA regular expression pattern. If it is set, it will decide if this node is active relating a source file. Initially null (not set).

Returns:
The active source name matching pattern.

setActivePattern

public void setActivePattern(java.lang.String activePattern)
A JAVA regular expression pattern. If it is set, it will decide if this node is active relating a source file. It must be a legal JAVA regular expression. Initially null (not set).

Parameters:
activePattern - The pattern to set or null to remove.
See Also:
Pattern

reverseTreePath

public java.util.List<NavigationNode> reverseTreePath()
Returns the reverse tree path from this node (exclusive) to the tree root node (inclusive). If this is a root node the path will have length 1. Will be generated on each call.

Returns:
The reverse tree path.

treePath

public java.util.List<NavigationNode> treePath()
Returns the tree path from the tree root node (inclusive) to this node (exclusive). If this is a root node the path will have length 0. Will be generated on each call.

Returns:
The reverse tree path.

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()