public interface Node extends LocalizedDisplayable, Iterable<Node>, Serializable
Navigation.saveNode(Node)
is called.Modifier and Type | Method and Description |
---|---|
Node |
addChild(int index,
String childName)
Inserts a child to this navigation node at the specified index.
|
Node |
addChild(String childName)
Adds a child to this navigation node.
|
FilteredNode |
filter()
Will return a filtered view of this navigation node.
|
Node |
getChild(int index)
Returns the child node of the given index.
|
Node |
getChild(String childName)
Returns the child node.
|
int |
getChildCount()
Returns the number of child nodes.
|
String |
getIconName()
Name of the icon for this navigation node.
|
String |
getName()
The name of the node.
|
Node |
getNode(NodePath nodePath)
Returns the node specified by the node path, relative to this node.
|
Node |
getNode(String... nodePath)
Returns the node specified by the node path, relative to this node.
|
NodePath |
getNodePath()
The path of the node.
|
PageId |
getPageId()
The
PageId of the page this node points to. |
Node |
getParent()
Returns the parent of the node, or null if the node is the root node.
|
String |
getURI()
Resolves the URI given the current context.
|
Visibility |
getVisibility()
Returns the visibility object of this navigation node.
|
boolean |
hasChild(String childName)
If this node has a child of the specified childName
|
int |
indexOf(String childName)
The index of the child with the specified name.
|
boolean |
isChildrenLoaded()
If this node's children has been loaded.
|
boolean |
isRoot()
If this node is the root node of the navigation.
|
boolean |
isVisible()
If the node is visible.
|
void |
moveTo(int index)
Moves the node to the specified index.
|
void |
moveTo(int index,
Node parent)
Moves this node to another parent inserting it at the specified index.
|
void |
moveTo(Node parent)
Moves this node to another parent.
|
boolean |
removeChild(String childName)
Removes the child from this navigation node.
|
void |
setIconName(String iconName)
Sets the name of the icon name for this navigation node.
|
void |
setName(String name)
Sets the name of the node.
|
void |
setPageId(PageId pageId)
Sets the
PageId of the page this node should point to. |
void |
setVisibility(boolean visible)
Sets the visibility of this navigation node either
Visibility.Status.VISIBLE or Visibility.Status.HIDDEN . |
void |
setVisibility(PublicationDate publicationDate)
Sets the visibility of this navigation node to be
Visibility.Status.PUBLICATION , in which the dates of the
PublicationDate are used to calculate the visibility. |
void |
setVisibility(Visibility visibility)
Sets the visibility for this navigation node.
|
void |
sort(Comparator<Node> comparator)
Will sort the children of this node per the comparator.
|
getDisplayNames, setDisplayNames
getDisplayName, setDisplayName
String getName()
void setName(String name)
name
- the name of the node.IllegalArgumentException
- if the name is null.Node getParent()
NodePath getNodePath()
String getURI()
boolean isVisible()
Node.getVisibility().isVisible()
Visibility getVisibility()
void setVisibility(Visibility visibility)
visibility
- the visibility to setIllegalArgumentException
- if the publication date is nullvoid setVisibility(boolean visible)
Visibility.Status.VISIBLE
or Visibility.Status.HIDDEN
.
This does not remove any publication information, just sets the flag.visible
- if this node should be visible or notvoid setVisibility(PublicationDate publicationDate)
Visibility.Status.PUBLICATION
, in which the dates of the
PublicationDate
are used to calculate the visibility.publicationDate
- the publication dateIllegalArgumentException
- if the publication date is nullString getIconName()
void setIconName(String iconName)
iconName
- the name of the icon, or null.PageId getPageId()
PageId
of the page this node points to.void setPageId(PageId pageId)
PageId
of the page this node should point to. Can be null.pageId
- the page id or nullboolean isRoot()
Node addChild(String childName)
childName
- the name of the childIllegalArgumentException
- if childName is nullIllegalStateException
- if this node's children have not been loaded.EntityAlreadyExistsException
- if a child of the same name already exists.Node addChild(int index, String childName)
index
- the index at which the child is to be insertedchildName
- the name of the childIllegalArgumentException
- if childName is nullIllegalStateException
- if this node's children have not been loaded.IndexOutOfBoundsException
- if the index is out of rangeEntityAlreadyExistsException
- if a child of the same name already exists.Node getChild(String childName)
childName
- the name of the child nodeIllegalArgumentException
- the childName is nullIllegalStateException
- if this node's children have not been loadedNode getChild(int index)
index
- the index of the childIndexOutOfBoundsException
- if the index is out of rangeIllegalStateException
- if this node's children have not been loadedint getChildCount() throws IllegalStateException
IllegalStateException
- if this node's children have not been loadedboolean hasChild(String childName)
childName
- the name of the childIllegalArgumentException
- if childName is nullIllegalStateException
- if this node's children have not been loadedboolean isChildrenLoaded()
Node getNode(String... nodePath)
For example: if the current tree is /foo/bar/baz and the current node is foo, then calling
foo.getNode("bar", "baz")
would return the baz node.
nodePath
- the node path relative to this node.IllegalArgumentException
- if nodePath is nullIllegalStateException
- if any of the nodes represented by the path do not have their children loadedNode getNode(NodePath nodePath)
For example: if the current tree is /foo/bar/baz and the current node is foo, then calling
foo.getNode(NodePath.path("bar", "baz"))
would return the baz node.
nodePath
- the node path relative to this nodeIllegalArgumentException
- if nodePath is nullIllegalStateException
- if any of the nodes represented by the path do not have their children loadedint indexOf(String childName)
childName
- the name of the childIllegalArgumentException
- if childName is nullIllegalStateException
- if this node's children have not been loadedboolean removeChild(String childName)
childName
- the name of the childIllegalArgumentException
- if childName was nullIllegalStateException
- if this node's children have not been loadedFilteredNode filter()
For example if a node has 3 visible and one hidden children nodes and a filter is applied to only accept visible nodes, getChildrenCount would only return 2, iterating over the filtered node would not include the hidden node, etc.
IllegalArgumentException
- if filter is nullvoid sort(Comparator<Node> comparator)
comparator
- the comparator responsible for comparing nodes for sorting.IllegalArgumentException
- if comparator is nullvoid moveTo(int index)
IndexOutOfBoundsException
- if the index is out of rangevoid moveTo(Node parent)
parent
- the parent to move this node to.IllegalArgumentException
- if parent is on a different branch, is a child of the current node, or if it is nullEntityAlreadyExistsException
- if a node with the same name already exists at the parent locationIllegalStateException
- if the children of the parent to move to have not been loadedvoid moveTo(int index, Node parent)
index
- the index to be inserted atparent
- the parent to move this node toIndexOutOfBoundsException
- if the index is out of rangeIllegalArgumentException
- if parent is nullEntityAlreadyExistsException
- if a node with the same name already exists at the parent locationIllegalStateException
- if the children of the parent to move to have not been loadedCopyright © 2013 JBoss by Red Hat. All Rights Reserved.