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

java.lang.Object
  extended by de.dv.sbu.filehandler.ftl.dataprovider.DataProviderImpl
      extended by de.dv.sbu.filehandler.ftl.dataprovider.navigation.Navigation
All Implemented Interfaces:
IDataProvider

public class Navigation
extends DataProviderImpl

This data-provider realizes a simple navigation tree structure from a list of root nodes spanning a forest.

This root node usually is a technical dummy and will be ignored when the tree structure is used for outputting.

During outputting you may call the following methods: getRootNodes(), getActiveNode(), href() andhref(NavigationNode).

Author:
Daniel Vogtland

Field Summary
 
Fields inherited from class de.dv.sbu.filehandler.ftl.dataprovider.DataProviderImpl
builderConfiguration, sourceFileInformation
 
Constructor Summary
Navigation()
           
 
Method Summary
 NavigationNode findNode(java.lang.String target)
          Scans the registered nodes for a match with the given target.
 NavigationNode getActiveNode()
          Returns the active node corresponding to the current file information.
 java.util.List<NavigationNode> getRootNodes()
          Returns the list of root nodes spanning the navigation tree forest.
 java.lang.String href()
          Builds a HREF text for the current node respecting the current file information.
 java.lang.String href(NavigationNode node)
          Builds a HREF text for the given node respecting the current file information.
 void init(BuilderConfiguration builderConfiguration)
          Initializes the data provider.
 void init(SourceFileInformation fileInfo)
          Updates the inner state depending on the given file information - if necessary.
 NavigationIterator nodeIterator()
          Builds an hierarchical node iterator.
 NavigationIterator nodeIterator(NavigationNode node)
          Builds an hierarchical node iterator for the given node.
 void setRootNodes(java.util.List<NavigationNode> rootNodes)
          Sets the root nodes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Navigation

public Navigation()
Method Detail

getRootNodes

public java.util.List<NavigationNode> getRootNodes()
Returns the list of root nodes spanning the navigation tree forest.

Returns:
The root nodes.

setRootNodes

public void setRootNodes(java.util.List<NavigationNode> rootNodes)
                  throws java.lang.NullPointerException
Sets the root nodes. Not expected to contain null values.

Parameters:
rootNodes - The root nodes to set.
Throws:
java.lang.NullPointerException - The argument is null.

init

public void init(BuilderConfiguration builderConfiguration)
Initializes the data provider.

Specified by:
init in interface IDataProvider
Overrides:
init in class DataProviderImpl
Parameters:
builderConfiguration - The builder configuration to use.
See Also:
DataProviderImpl.init(de.dv.sbu.builder.BuilderConfiguration)

init

public void init(SourceFileInformation fileInfo)
Updates the inner state depending on the given file information - if necessary.

Specified by:
init in interface IDataProvider
Overrides:
init in class DataProviderImpl
Parameters:
fileInfo - The current source file information.
See Also:
IDataProvider.init(de.dv.sbu.SourceFileInformation)

href

public java.lang.String href(NavigationNode node)
Builds a HREF text for the given node respecting the current file information. If the target starts with '/' it will be interpreted as source file reference, otherwise the original target will be returned.

Parameters:
node - The node to build a HREF for.
Returns:
The resulting HREF text.

href

public java.lang.String href()
Builds a HREF text for the current node respecting the current file information. If the target starts with '/' it will be interpreted as source file reference, otherwise the original target will be returned.

Returns:
The resulting HREF text.

nodeIterator

public NavigationIterator nodeIterator()
Builds an hierarchical node iterator.

Returns:
The new iterator.

nodeIterator

public NavigationIterator nodeIterator(NavigationNode node)
Builds an hierarchical node iterator for the given node.

Parameters:
node - The node to start from.
Returns:
The new iterator.

findNode

public NavigationNode findNode(java.lang.String target)
Scans the registered nodes for a match with the given target.

Parameters:
target - The target to look for.
Returns:
The first matching node or null if not found.

getActiveNode

public NavigationNode getActiveNode()
Returns the active node corresponding to the current file information. Might be null.

Returns:
The active node.