UndoRedo V1.2
by Matthew Ford
2005/06/27

au.com.forward.undoRedo
Class BranchDefaultMutableTreeNode

java.lang.Object
  extended by javax.swing.tree.DefaultMutableTreeNode
      extended by au.com.forward.undoRedo.UndoRedoTreeNode
          extended by au.com.forward.undoRedo.BranchDefaultMutableTreeNode
All Implemented Interfaces:
IHaveDescription, java.io.Serializable, java.lang.Cloneable, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode

public class BranchDefaultMutableTreeNode
extends UndoRedoTreeNode
implements IHaveDescription

A mutable tree node to hold Redo branches.
Overrides toString() to indicate if any node in this branch have been redone.
Added updateDisplayMessage() to update the node display string to show the deepest redo in this branch.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
allowsChildren, children, EMPTY_ENUMERATION, parent, userObject
 
Constructor Summary
BranchDefaultMutableTreeNode(BranchUndoRedo userObject)
          BranchDefaultMutableTreeNode constructor
 
Method Summary
 void cancelGetDescription()
          Cancels getDescription Forwards request to the deepest node
 UndoRedoTreeNode getDeepestNode()
           
 void getDescription(IDisplayText textDisplay, UndoRedoTreeNode undoRedoTreeNode)
          Gets the Description of the UndoableEdit.
 int getMaxDepth()
          Get the maximum depth of this branch.
protected static int isFirstChildReDone(BranchDefaultMutableTreeNode node)
          Checks the first child of this branch to see if it has been redone.
 void setDeepestNode(UndoRedoTreeNode deepestNode)
           
 void setMaxDepth(int maxDepth)
          Set the maximum depth of this branch
 java.lang.String toString()
          Override toString() to indicate if any nodes in this branch have been redone
 void updateDisplayMessage()
          Find the deepest presentation name and set it as this nodes presentation name
 
Methods inherited from class au.com.forward.undoRedo.UndoRedoTreeNode
clone, getUndoableEdit, toFullString
 
Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
add, breadthFirstEnumeration, children, 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
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BranchDefaultMutableTreeNode

public BranchDefaultMutableTreeNode(BranchUndoRedo userObject)
BranchDefaultMutableTreeNode constructor

Parameters:
userObject - the BranchUndoRedo
Method Detail

isFirstChildReDone

protected static int isFirstChildReDone(BranchDefaultMutableTreeNode node)
Checks the first child of this branch to see if it has been redone.
All UndoRedo objects in a branch are Redo objects, that is isUndo()==FALSE but this checks the underlying UndoableEdit to see if it has been redone or is dead

Parameters:
node - the branch node to check
Returns:
0 if first child of this branch is dead
1 if first child of this branch is a Redo that has been redone
-1 if first child of this branch is a Redo that has not been redone

toString

public java.lang.String toString()
Override toString() to indicate if any nodes in this branch have been redone

Overrides:
toString in class javax.swing.tree.DefaultMutableTreeNode
Returns:
super.toString with prefix if child has been redone.

getDeepestNode

public UndoRedoTreeNode getDeepestNode()

setDeepestNode

public void setDeepestNode(UndoRedoTreeNode deepestNode)

getMaxDepth

public int getMaxDepth()
Get the maximum depth of this branch.

Returns:
the maximum depth.

setMaxDepth

public void setMaxDepth(int maxDepth)
Set the maximum depth of this branch

Parameters:
maxDepth - the maximum depth

getDescription

public void getDescription(IDisplayText textDisplay,
                           UndoRedoTreeNode undoRedoTreeNode)
Gets the Description of the UndoableEdit. Forwards request to the deepest node

Specified by:
getDescription in interface IHaveDescription
Parameters:
textDisplay - - the callback component used to display the extended description

cancelGetDescription

public void cancelGetDescription()
Cancels getDescription Forwards request to the deepest node

Specified by:
cancelGetDescription in interface IHaveDescription

updateDisplayMessage

public void updateDisplayMessage()
Find the deepest presentation name and set it as this nodes presentation name


©2005, Forward Computing and Control Pty. Ltd
ACN 003 669 994   NSW Australia
All Rights Reserved.