org.keridwen.core.data.model.impl
Class DefaultNode<T>

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by org.keridwen.core.data.model.impl.DefaultNode<T>
All Implemented Interfaces:
Serializable, Cloneable, Iterable<Node<?>>, MutableTreeNode, TreeNode, Node<T>

public class DefaultNode<T>
extends DefaultMutableTreeNode
implements Node<T>

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
DefaultNode(String name)
          Creates an empty folder Node.
DefaultNode(String name, T contentToSet)
          Creates a Node with the given name, initial content, NodeReader and NodeWriter.
DefaultNode(String name, URI anURI, NodeReader<T> aReader, NodeWriter aWriter)
          Creates a Node with the given name, NodeReader and NodeWriter.
 
Method Summary
 void clearContent()
          Removes the content of the node.
 Node<?> getChildNodeByName(String nameToFind)
          Gets the child Node with the given name.
 T getContent()
          Gets the content of the Node.
 String getDescription()
          Gets the String description of the Node
 String getName()
          Gets the Node name.
 NodeInformation getNodeInformation()
          Gets metadata information about the Node.
 NodeReader<T> getNodeReader()
          Gets the NodeReader.
 NodeState getNodeState()
          Gets the NodeState.
 URI getNodeURI()
          Gets the URI where the Node is saved.
 nu.xom.Element getXmlElement()
          Gets the XML description of the Node.
 boolean isContentLoaded()
          Indicates whether the content of the node has been loaded in memory or not.
 boolean isContentLocal()
          Indicates whether the content of the node is stored within the model or linked from outside.
 boolean isFolder()
          Indicates if this Node is a folder Node or a leaf Node.
 Iterator<Node<?>> iterator()
           
 void load(URI anURI)
          Loads the Node content from the given URI.
 void reload()
          Reloads the Node content
 void saveNode()
          Saves the Node to its current URI
 void saveNodeAs(URI anURI)
          Saves the Node to the given URI
 void setContentLocal(boolean innerContent)
          Indicates whether the content of the node is stored within the model or linked from outside.
 void setName(String name)
          Sets the Node name.
 void setNodeReader(NodeReader<T> aReader)
          Sets the NodeReader.
 void setNodeState(NodeState stateToSet)
          Sets the Node state.
 void setNodeURI(URI uriToSet)
          Sets the Node URI.
 void setNodeWriter(NodeWriter aWriter)
          Sets the NodeWriter.
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPathToRoot, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent, setUserObject, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface javax.swing.tree.MutableTreeNode
insert, remove, remove, removeFromParent, setParent, setUserObject
 
Methods inherited from interface javax.swing.tree.TreeNode
children, getAllowsChildren, getChildAt, getChildCount, getIndex, getParent, isLeaf
 

Constructor Detail

DefaultNode

public DefaultNode(String name,
                   T contentToSet)
Creates a Node with the given name, initial content, NodeReader and NodeWriter.

Parameters:
name - the Node name
contentToSet - the initial content of the Node

DefaultNode

public DefaultNode(String name,
                   URI anURI,
                   NodeReader<T> aReader,
                   NodeWriter aWriter)
Creates a Node with the given name, NodeReader and NodeWriter.

Parameters:
name - the Node name
anURI - the Node URI
aReader - the NodeReader to set
aWriter - the NodeWriter to set

DefaultNode

public DefaultNode(String name)
Creates an empty folder Node.

Parameters:
name - the name of the Node
Method Detail

setName

public void setName(String name)
Sets the Node name.

Parameters:
name - the name to set

getName

public String getName()
Description copied from interface: Node
Gets the Node name.

Specified by:
getName in interface Node<T>
Returns:
the Node name

getNodeInformation

public NodeInformation getNodeInformation()
Description copied from interface: Node
Gets metadata information about the Node.

Specified by:
getNodeInformation in interface Node<T>
Returns:
the NodeInformation containing metadata

setNodeState

public void setNodeState(NodeState stateToSet)
Description copied from interface: Node
Sets the Node state.

Specified by:
setNodeState in interface Node<T>
Parameters:
stateToSet - the NodeState to set.

getNodeState

public NodeState getNodeState()
Description copied from interface: Node
Gets the NodeState. Its state tells if the node has been removed, is up to date, has been newly created ...

Specified by:
getNodeState in interface Node<T>
Returns:
the NodeState of the Node

iterator

public Iterator<Node<?>> iterator()
Specified by:
iterator in interface Iterable<Node<?>>
Specified by:
iterator in interface Node<T>

getContent

public T getContent()
Description copied from interface: Node
Gets the content of the Node.

Specified by:
getContent in interface Node<T>
Returns:
the node content

reload

public void reload()
Description copied from interface: Node
Reloads the Node content

Specified by:
reload in interface Node<T>

load

public void load(URI anURI)
Description copied from interface: Node
Loads the Node content from the given URI.

Specified by:
load in interface Node<T>

saveNode

public void saveNode()
Description copied from interface: Node
Saves the Node to its current URI

Specified by:
saveNode in interface Node<T>

saveNodeAs

public void saveNodeAs(URI anURI)
Description copied from interface: Node
Saves the Node to the given URI

Specified by:
saveNodeAs in interface Node<T>

getNodeReader

public NodeReader<T> getNodeReader()
Description copied from interface: Node
Gets the NodeReader.

Specified by:
getNodeReader in interface Node<T>
Returns:
the NodeReader

setNodeWriter

public void setNodeWriter(NodeWriter aWriter)
Description copied from interface: Node
Sets the NodeWriter.

Specified by:
setNodeWriter in interface Node<T>
Parameters:
aWriter - the NodeWriter to set

setNodeReader

public void setNodeReader(NodeReader<T> aReader)
Description copied from interface: Node
Sets the NodeReader.

Specified by:
setNodeReader in interface Node<T>
Parameters:
aReader - the NodeReader to set

isFolder

public boolean isFolder()
Description copied from interface: Node
Indicates if this Node is a folder Node or a leaf Node. A folder Node does not have any content associated to it. It this does not have a NodeReader nor a NodeWriter.

Specified by:
isFolder in interface Node<T>
Returns:
true if the Node is a folder.

getNodeURI

public URI getNodeURI()
Description copied from interface: Node
Gets the URI where the Node is saved.

Specified by:
getNodeURI in interface Node<T>
Returns:
the Node URI

setNodeURI

public void setNodeURI(URI uriToSet)
Description copied from interface: Node
Sets the Node URI.

Specified by:
setNodeURI in interface Node<T>
Parameters:
uriToSet - the URI to set

isContentLocal

public boolean isContentLocal()
Description copied from interface: Node
Indicates whether the content of the node is stored within the model or linked from outside.

Specified by:
isContentLocal in interface Node<T>
Returns:
true if the content of the node is stored within the model

setContentLocal

public void setContentLocal(boolean innerContent)
Description copied from interface: Node
Indicates whether the content of the node is stored within the model or linked from outside.

Specified by:
setContentLocal in interface Node<T>
Parameters:
innerContent - the boolean value to set

getXmlElement

public nu.xom.Element getXmlElement()
Description copied from interface: Node
Gets the XML description of the Node.

Specified by:
getXmlElement in interface Node<T>
Returns:
the XML description of the Node as a Xom Element

getChildNodeByName

public Node<?> getChildNodeByName(String nameToFind)
Gets the child Node with the given name.

Parameters:
nameToFind - the name of the child Node to find
Returns:
the Node found (if any, null otherwise

getDescription

public String getDescription()
Description copied from interface: Node
Gets the String description of the Node

Specified by:
getDescription in interface Node<T>
Returns:
the String description of the Node

clearContent

public void clearContent()
Description copied from interface: Node
Removes the content of the node.

Specified by:
clearContent in interface Node<T>

isContentLoaded

public boolean isContentLoaded()
Description copied from interface: Node
Indicates whether the content of the node has been loaded in memory or not.

Specified by:
isContentLoaded in interface Node<T>
Returns:
true if the content has been loaded in memory


Copyright © 2010-2013 Artenum. All Rights Reserved.