net.sf.jame.core.tree
Class Node

java.lang.Object
  extended by net.sf.jame.core.tree.Node
Direct Known Subclasses:
DefaultNode, RootNode

public abstract class Node
extends java.lang.Object

Author:
Andrea Medeghini

Constructor Summary
Node(java.lang.String nodeId)
          Constructs a new node.
 
Method Summary
 void accept()
          Accepts node value.
protected  void addDescription(java.lang.StringBuilder builder)
           
protected  void addLabel(java.lang.StringBuilder builder)
           
 void appendChildNode(Node node)
          Appends a child.
protected  void appendChildNodeToParent(Node node)
          Appends a child to parent.
 void cancel()
          Cancels node value.
 void dispose()
           
protected  void doAccept()
           
protected  void doCancel()
           
 java.lang.String dump()
           
protected  void finalize()
           
protected  void fireNodeAccepted(NodePath path)
           
protected  void fireNodeAdded(NodePath path)
           
protected  void fireNodeCancelled(NodePath path)
           
protected  void fireNodeChanged()
           
protected  void fireNodeRemoved(NodePath path)
           
 Node getChildNode(int index)
          Returns a child.
 int getChildNodeCount()
          Returns the number of childs.
 ConfigContext getContext()
           
 java.lang.String getDescription()
           
 java.lang.String getLabel()
           
 Node getNodeByPath(java.lang.String path)
           
 java.lang.String getNodeClass()
          Returns the nodeClass.
 NodeEditor getNodeEditor()
          Returns the node editor.
 java.lang.String getNodeId()
          Returns the nodeId.
 java.lang.String getNodeLabel()
          Returns the nodeLabel.
 NodePath getNodePath()
          Returns the node path.
 NodeValue<?> getNodeValue()
          Returns the node value.
 java.lang.Object getObject(java.lang.String key)
           
 Node getParentNode()
          Returns the parent.
 NodeValue<?> getPreviousNodeValue()
          Returns the previous node value.
 RootNode getRootNode()
           
 NodeSession getSession()
           
 java.lang.String getValueAsString()
          Returns the node value as string.
 boolean hasPendingCommands()
          Returns true if node has pending commands.
 int indexOf(Node node)
           
 void insertChildNodeAt(int index, Node node)
           
 void insertNodeAfter(int index, Node node)
           
 void insertNodeBefore(int index, Node node)
           
 boolean isAttribute()
          Returns true if the node is an attribute.
 boolean isChildNode(Node node)
           
 boolean isEditable()
          Returns true if the node is editable.
 boolean isHighFrequency()
           
 boolean isMutable()
          Returns true if the node is mutable.
protected static boolean isValueChanged(java.lang.Object value, java.lang.Object prevValue)
           
 void moveDownChildNode(int index)
           
 void moveUpChildNode(int index)
           
protected  void nodeAdded()
           
protected  void nodeRemoved()
           
 void putObject(java.lang.String key, java.lang.Object value)
           
 void removeAllChildNodes()
          Removes all the children.
 void removeChildNode(int nodeIndex)
          Removes a child.
 void removeObject(java.lang.String key)
           
 void setChildNode(int index, Node node)
           
 void setContext(ConfigContext context)
           
protected  void setNodeClass(java.lang.String nodeClass)
          Sets the nodeClass.
protected  void setNodeEditor(NodeEditor editor)
          Sets the node editor.
protected  void setNodeLabel(java.lang.String nodeLabel)
          Sets the nodeClass.
protected  void setNodeValue(NodeValue<?> value)
          Sets the node value.
 void setSession(NodeSession session)
           
 java.lang.String toString()
           
protected  void updateChildNodes()
           
protected  void updateNode()
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Node

public Node(java.lang.String nodeId)
Constructs a new node.

Parameters:
nodeId - the nodeId.
Method Detail

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable
See Also:
Object.finalize()

isHighFrequency

public boolean isHighFrequency()
Returns:

dispose

public void dispose()

fireNodeChanged

protected void fireNodeChanged()

fireNodeAdded

protected void fireNodeAdded(NodePath path)

fireNodeRemoved

protected void fireNodeRemoved(NodePath path)

fireNodeAccepted

protected void fireNodeAccepted(NodePath path)

fireNodeCancelled

protected void fireNodeCancelled(NodePath path)

getNodePath

public NodePath getNodePath()
Returns the node path.

Returns:
the path.

setSession

public void setSession(NodeSession session)
Parameters:
session -

getSession

public NodeSession getSession()
Returns:

setContext

public void setContext(ConfigContext context)
Parameters:
context -

getContext

public ConfigContext getContext()
Returns:

getParentNode

public Node getParentNode()
Returns the parent.

Returns:
the parent.

isChildNode

public boolean isChildNode(Node node)
Parameters:
node -
Returns:

getChildNode

public Node getChildNode(int index)
Returns a child.

Parameters:
index - the child index.
Returns:
the child.

getChildNodeCount

public int getChildNodeCount()
Returns the number of childs.

Returns:
the number of childs.

getNodeValue

public NodeValue<?> getNodeValue()
Returns the node value.

Returns:
the node value.

getPreviousNodeValue

public NodeValue<?> getPreviousNodeValue()
Returns the previous node value.

Returns:
the previous node value.

setNodeValue

protected final void setNodeValue(NodeValue<?> value)
Sets the node value.

Parameters:
value - the node value to set.

isValueChanged

protected static boolean isValueChanged(java.lang.Object value,
                                        java.lang.Object prevValue)
Parameters:
value -
prevValue -
Returns:

updateNode

protected void updateNode()

updateChildNodes

protected void updateChildNodes()

getNodeEditor

public NodeEditor getNodeEditor()
Returns the node editor.

Returns:
the node editor.

setNodeEditor

protected void setNodeEditor(NodeEditor editor)
Sets the node editor.

Parameters:
editor - the node editor to set.

getNodeId

public java.lang.String getNodeId()
Returns the nodeId.

Returns:
the nodeId.

getNodeClass

public java.lang.String getNodeClass()
Returns the nodeClass.

Returns:
the nodeClass.

setNodeClass

protected void setNodeClass(java.lang.String nodeClass)
Sets the nodeClass.

Parameters:
the - nodeClass.

getNodeLabel

public java.lang.String getNodeLabel()
Returns the nodeLabel.

Returns:
the nodeLabel

setNodeLabel

protected void setNodeLabel(java.lang.String nodeLabel)
Sets the nodeClass.

Parameters:
the - nodeClass.

hasPendingCommands

public boolean hasPendingCommands()
Returns true if node has pending commands.

Returns:
true if node has pending commands.

accept

public final void accept()
Accepts node value.

Parameters:
session -

cancel

public final void cancel()
Cancels node value.


doAccept

protected final void doAccept()

doCancel

protected final void doCancel()

isMutable

public boolean isMutable()
Returns true if the node is mutable.

Returns:
true if the node is mutable.

isEditable

public boolean isEditable()
Returns true if the node is editable.

Returns:
true if the node is editable.

isAttribute

public boolean isAttribute()
Returns true if the node is an attribute.

Returns:
true if the node is an attribute.

toString

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

appendChildNodeToParent

protected void appendChildNodeToParent(Node node)
Appends a child to parent.

Parameters:
node - the child to append.

appendChildNode

public void appendChildNode(Node node)
Appends a child.

Parameters:
node - the child to append.

removeChildNode

public void removeChildNode(int nodeIndex)
Removes a child.

Parameters:
index - the child to remove.

removeAllChildNodes

public void removeAllChildNodes()
Removes all the children.


insertNodeBefore

public void insertNodeBefore(int index,
                             Node node)
Parameters:
index -
node -

insertNodeAfter

public void insertNodeAfter(int index,
                            Node node)
Parameters:
index -
node -

insertChildNodeAt

public void insertChildNodeAt(int index,
                              Node node)
Parameters:
index -
node -

moveUpChildNode

public void moveUpChildNode(int index)
Parameters:
index -

moveDownChildNode

public void moveDownChildNode(int index)
Parameters:
index -

setChildNode

public void setChildNode(int index,
                         Node node)
Parameters:
index -

getValueAsString

public java.lang.String getValueAsString()
Returns the node value as string.

Returns:
the string.

getLabel

public final java.lang.String getLabel()
Returns:
the label.

addLabel

protected void addLabel(java.lang.StringBuilder builder)
Parameters:
builder -

getDescription

public final java.lang.String getDescription()
Returns:
the description.

addDescription

protected void addDescription(java.lang.StringBuilder builder)
Parameters:
builder -

indexOf

public int indexOf(Node node)
Parameters:
node -
Returns:
the index.

nodeAdded

protected void nodeAdded()

nodeRemoved

protected void nodeRemoved()

dump

public java.lang.String dump()
Returns:

getNodeByPath

public Node getNodeByPath(java.lang.String path)
Parameters:
path -
Returns:

putObject

public void putObject(java.lang.String key,
                      java.lang.Object value)
Parameters:
key -
value -

getObject

public java.lang.Object getObject(java.lang.String key)
Parameters:
key -
Returns:

removeObject

public void removeObject(java.lang.String key)
Parameters:
key -

getRootNode

public RootNode getRootNode()
Returns: