org.apache.lenya.cms.publication
Class SiteTreeNodeImpl

java.lang.Object
  extended by org.apache.lenya.cms.publication.SiteTreeNodeImpl
All Implemented Interfaces:
SiteTreeNode

public class SiteTreeNodeImpl
extends java.lang.Object
implements SiteTreeNode

Concrete implementation of the SiteTreeNode interface.

See Also:
SiteTreeNode

Field Summary
static java.lang.String HREF_ATTRIBUTE_NAME
           
static java.lang.String ID_ATTRIBUTE_NAME
           
static java.lang.String LABEL_NAME
           
static java.lang.String LANGUAGE_ATTRIBUTE_NAME
           
static java.lang.String LINK_ATTRIBUTE_NAME
           
static java.lang.String NODE_NAME
           
static java.lang.String SUFFIX_ATTRIBUTE_NAME
           
static java.lang.String VISIBLEINNAV_ATTRIBUTE_NAME
           
 
Constructor Summary
SiteTreeNodeImpl(org.w3c.dom.Node node, DefaultSiteTree sitetree)
          Creates a new SiteTreeNodeImpl object.
 
Method Summary
 void accept(SiteTreeNodeVisitor visitor)
          Call the visit method of the visitor, that mean the operation that shall be perfoemed on this node (Visitor pattern)
 void acceptReverseSubtree(SiteTreeNodeVisitor visitor)
          Traverse in a reverse way the node ant its children and call the accept method.
 void acceptSubtree(SiteTreeNodeVisitor visitor)
          (non-Javadoc)
 void addLabel(Label label)
          Add a label to this node iff the node does not have this label already.
 void deleteChildren()
          Remove the children of this node.
 java.lang.String getAbsoluteId()
          Get the absolute id of this node.
 java.lang.String getAbsoluteParentId()
          Deprecated. use getParent().getAbsoluteId() instead
 SiteTreeNode[] getChildren()
          Get the sitetreenodes, which are children of this node
 SiteTreeNode[] getChildren(java.lang.String language)
          Get the sitetreenodes, which are children of this node and contain a label for the given language.
protected  DefaultSiteTree getDefaultSiteTree()
           
 java.lang.String getHref()
          Get the href of this node.
 java.lang.String getId()
          Get the id of this node.
 Label getLabel(java.lang.String xmlLanguage)
          Get the label for a specific language.
 Label[] getLabels()
          Get all labels for this node (independent of their language attribute).
protected  NamespaceHelper getNamespaceHelper()
          Returns the namespace helper of the sitetree XML document.
 java.lang.String getNextSiblingDocumentId()
           
 SiteTreeNode[] getNextSiblings()
          Get the sitetreenodes, which are the siblings following this node
 SiteTreeNode getParent()
          Returns the parent node of this node.
 SiteTreeNode getParent(java.lang.String language)
          Returns the parent node of this node or null if the parent has no label for the given language.
 java.lang.String getParentId()
          Deprecated. use getParent().getId() instead
 java.lang.String getSuffix()
          Get the suffix of this node.
 boolean hasLink()
          Check whether this node has a link.
 java.util.List postOrder()
          Give a list of the children and this node in a post order way
 java.util.List preOrder()
          Give a list of the children and this node in a pre order way
 SiteTreeNode[] removeChildren()
          Remove the children of the node
 void removeLabel(Label label)
          Remove a label from this node.
 void setLabel(Label label)
          Sets a label of an this node.
 void setNodeAttribute(java.lang.String attributeName, java.lang.String attributeValue)
          Sets an attribute of this node.
 boolean visibleInNav()
          Check whether this node is visible in the navigation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID_ATTRIBUTE_NAME

public static final java.lang.String ID_ATTRIBUTE_NAME
See Also:
Constant Field Values

VISIBLEINNAV_ATTRIBUTE_NAME

public static final java.lang.String VISIBLEINNAV_ATTRIBUTE_NAME
See Also:
Constant Field Values

HREF_ATTRIBUTE_NAME

public static final java.lang.String HREF_ATTRIBUTE_NAME
See Also:
Constant Field Values

SUFFIX_ATTRIBUTE_NAME

public static final java.lang.String SUFFIX_ATTRIBUTE_NAME
See Also:
Constant Field Values

LINK_ATTRIBUTE_NAME

public static final java.lang.String LINK_ATTRIBUTE_NAME
See Also:
Constant Field Values

LANGUAGE_ATTRIBUTE_NAME

public static final java.lang.String LANGUAGE_ATTRIBUTE_NAME
See Also:
Constant Field Values

NODE_NAME

public static final java.lang.String NODE_NAME
See Also:
Constant Field Values

LABEL_NAME

public static final java.lang.String LABEL_NAME
See Also:
Constant Field Values
Constructor Detail

SiteTreeNodeImpl

public SiteTreeNodeImpl(org.w3c.dom.Node node,
                        DefaultSiteTree sitetree)
Creates a new SiteTreeNodeImpl object.

Parameters:
node - the node which is to be wrapped by this SiteTreeNode
Method Detail

getParentId

public java.lang.String getParentId()
Deprecated. use getParent().getId() instead

Description copied from interface: SiteTreeNode
Get the parent-id of this node.

Specified by:
getParentId in interface SiteTreeNode
Returns:
the parent-id.
See Also:
SiteTreeNode.getParentId()

getId

public java.lang.String getId()
Description copied from interface: SiteTreeNode
Get the id of this node.

Specified by:
getId in interface SiteTreeNode
Returns:
the node id.
See Also:
SiteTreeNode.getId()

getAbsoluteParentId

public java.lang.String getAbsoluteParentId()
Deprecated. use getParent().getAbsoluteId() instead

Description copied from interface: SiteTreeNode
Get the absolute parent-id of this node.

Specified by:
getAbsoluteParentId in interface SiteTreeNode
Returns:
the absolute parent-id.
See Also:
SiteTreeNode.getAbsoluteParentId()

getAbsoluteId

public java.lang.String getAbsoluteId()
Description copied from interface: SiteTreeNode
Get the absolute id of this node.

Specified by:
getAbsoluteId in interface SiteTreeNode
Returns:
the absolute id.
See Also:
SiteTreeNode.getAbsoluteId()

getLabels

public Label[] getLabels()
Description copied from interface: SiteTreeNode
Get all labels for this node (independent of their language attribute).

Specified by:
getLabels in interface SiteTreeNode
Returns:
an Array of labels.
See Also:
SiteTreeNode.getLabels()

getLabel

public Label getLabel(java.lang.String xmlLanguage)
Description copied from interface: SiteTreeNode
Get the label for a specific language.

Specified by:
getLabel in interface SiteTreeNode
Parameters:
xmlLanguage - the language for which the label is requested.
Returns:
a Label if there is one for the given language, null otherwise.
See Also:
SiteTreeNode.getLabel(java.lang.String)

addLabel

public void addLabel(Label label)
Description copied from interface: SiteTreeNode
Add a label to this node iff the node does not have this label already.

Specified by:
addLabel in interface SiteTreeNode
Parameters:
label - the label to be added.
See Also:
SiteTreeNode.addLabel(org.apache.lenya.cms.publication.Label)

removeLabel

public void removeLabel(Label label)
Description copied from interface: SiteTreeNode
Remove a label from this node.

Specified by:
removeLabel in interface SiteTreeNode
Parameters:
label - the label to be removed.
See Also:
SiteTreeNode.removeLabel(org.apache.lenya.cms.publication.Label)

visibleInNav

public boolean visibleInNav()
Description copied from interface: SiteTreeNode
Check whether this node is visible in the navigation

Specified by:
visibleInNav in interface SiteTreeNode
Returns:
true if this node is visible. The method should also return true if the attribute is not set. That means a node missing this attribute becomes visible by default.
See Also:
SiteTreeNode.hasLink()

getHref

public java.lang.String getHref()
Description copied from interface: SiteTreeNode
Get the href of this node.

Specified by:
getHref in interface SiteTreeNode
Returns:
the href.
See Also:
SiteTreeNode.getHref()

getSuffix

public java.lang.String getSuffix()
Description copied from interface: SiteTreeNode
Get the suffix of this node.

Specified by:
getSuffix in interface SiteTreeNode
Returns:
the suffix.
See Also:
SiteTreeNode.getSuffix()

hasLink

public boolean hasLink()
Description copied from interface: SiteTreeNode
Check whether this node has a link.

Specified by:
hasLink in interface SiteTreeNode
Returns:
true if this node has a link.
See Also:
SiteTreeNode.hasLink()

getChildren

public SiteTreeNode[] getChildren()
Description copied from interface: SiteTreeNode
Get the sitetreenodes, which are children of this node

Specified by:
getChildren in interface SiteTreeNode
Returns:
the children.
See Also:
SiteTreeNode.getChildren()

removeChildren

public SiteTreeNode[] removeChildren()
Description copied from interface: SiteTreeNode
Remove the children of the node

Specified by:
removeChildren in interface SiteTreeNode
Returns:
the removed node
See Also:
SiteTreeNode.removeChildren()

deleteChildren

public void deleteChildren()
Description copied from interface: SiteTreeNode
Remove the children of this node.

Specified by:
deleteChildren in interface SiteTreeNode

getNextSiblings

public SiteTreeNode[] getNextSiblings()
Description copied from interface: SiteTreeNode
Get the sitetreenodes, which are the siblings following this node

Specified by:
getNextSiblings in interface SiteTreeNode
Returns:
the children.
See Also:
SiteTreeNode.getChildren()

getNextSiblingDocumentId

public java.lang.String getNextSiblingDocumentId()
Specified by:
getNextSiblingDocumentId in interface SiteTreeNode
Returns:
string. The document-id corresponding to the next sibling node.
See Also:
SiteTreeNode.getNextSiblingDocumentId()

accept

public void accept(SiteTreeNodeVisitor visitor)
            throws DocumentException
Description copied from interface: SiteTreeNode
Call the visit method of the visitor, that mean the operation that shall be perfoemed on this node (Visitor pattern)

Specified by:
accept in interface SiteTreeNode
Parameters:
visitor - The visitor.
Throws:
DocumentException - if an error occurs
See Also:
SiteTreeNode.accept(org.apache.lenya.cms.publication.SiteTreeNodeVisitor)

acceptSubtree

public void acceptSubtree(SiteTreeNodeVisitor visitor)
                   throws DocumentException
(non-Javadoc)

Specified by:
acceptSubtree in interface SiteTreeNode
Parameters:
visitor - The visitor.
Throws:
DocumentException - if an error occurs
See Also:
SiteTreeNode.acceptSubtree(org.apache.lenya.cms.publication.SiteTreeNodeVisitor)

acceptReverseSubtree

public void acceptReverseSubtree(SiteTreeNodeVisitor visitor)
                          throws DocumentException
Description copied from interface: SiteTreeNode
Traverse in a reverse way the node ant its children and call the accept method.

Specified by:
acceptReverseSubtree in interface SiteTreeNode
Parameters:
visitor - The visitor.
Throws:
DocumentException - if an error occurs
See Also:
SiteTreeNode.acceptSubtree(org.apache.lenya.cms.publication.SiteTreeNodeVisitor)

postOrder

public java.util.List postOrder()
Description copied from interface: SiteTreeNode
Give a list of the children and this node in a post order way

Specified by:
postOrder in interface SiteTreeNode
Returns:
The list
See Also:
SiteTreeNode.postOrder()

setLabel

public void setLabel(Label label)
Description copied from interface: SiteTreeNode
Sets a label of an this node. If the label does not exist, it is added. Otherwise, the existing label is replaced.

Specified by:
setLabel in interface SiteTreeNode
Parameters:
label - the label to add
See Also:
SiteTreeNode.setLabel(org.apache.lenya.cms.publication.Label)

setNodeAttribute

public void setNodeAttribute(java.lang.String attributeName,
                             java.lang.String attributeValue)
Description copied from interface: SiteTreeNode
Sets an attribute of this node. If the attribute already exists its value will be overwritten

Specified by:
setNodeAttribute in interface SiteTreeNode
Parameters:
attributeName - name of the attribute
attributeValue - the value of the respective attribute
See Also:
SiteTreeNode.setLabel(org.apache.lenya.cms.publication.Label)

getChildren

public SiteTreeNode[] getChildren(java.lang.String language)
Description copied from interface: SiteTreeNode
Get the sitetreenodes, which are children of this node and contain a label for the given language.

Specified by:
getChildren in interface SiteTreeNode
Parameters:
language - A language string.
Returns:
the children.
See Also:
SiteTreeNode.getChildren(java.lang.String)

getParent

public SiteTreeNode getParent()
Description copied from interface: SiteTreeNode
Returns the parent node of this node.

Specified by:
getParent in interface SiteTreeNode
Returns:
A sitetree node.
See Also:
SiteTreeNode.getParent()

getNamespaceHelper

protected NamespaceHelper getNamespaceHelper()
Returns the namespace helper of the sitetree XML document.

Returns:
A namespace helper.

getParent

public SiteTreeNode getParent(java.lang.String language)
Description copied from interface: SiteTreeNode
Returns the parent node of this node or null if the parent has no label for the given language.

Specified by:
getParent in interface SiteTreeNode
Parameters:
language - A language string.
Returns:
A sitetree node.
See Also:
SiteTreeNode.getParent(java.lang.String)

preOrder

public java.util.List preOrder()
Description copied from interface: SiteTreeNode
Give a list of the children and this node in a pre order way

Specified by:
preOrder in interface SiteTreeNode
Returns:
The list
See Also:
SiteTreeNode.preOrder()

getDefaultSiteTree

protected DefaultSiteTree getDefaultSiteTree()


Copyright © 1999-2005 Apache Software Foundation. All Rights Reserved.