com.openpcl.viewer.tree
Class PosTree

java.lang.Object
  extended by com.openpcl.viewer.tree.PosTree
All Implemented Interfaces:
IPluginHooksPosTree

public class PosTree
extends Object
implements IPluginHooksPosTree


Nested Class Summary
 class PosTree.PosTreeCellRenderer
          Tree cell renderer class specifies the icons to use for the different node types: 1.
 class PosTree.PosTreeSelectionListener
          Tree selection listener
protected  class PosTree.RightclickTreeMouseListener
          MouseAdapter class for when the user right clicks on a node in the tree.
This checks for mouse event for popup menu in both mouseReleased() and mousePressed() because:

As stated at http://java.sun.com/docs/books/tutorial/uiswing/components/menu.html "The exact gesture that should bring up a popup menu varies by look and feel.
 
Field Summary
protected static String TREE_PAGE_ICON
           
protected static String TREE_ROOT_ICON
           
 
Constructor Summary
PosTree(PosView pPosView, String pShortName)
           
 
Method Summary
 DefaultMutableTreeNode addChildNodeToTree(DefaultMutableTreeNode child, DefaultMutableTreeNode parent, boolean shouldBeVisible)
          Add the node to the tree under the passed in parent node
 void addTreeSelectionListener()
          Add the tree selection listener
 void buildTreePopupMenu(JPopupMenu pJPopupMenu)
          Build the JPopupMenu to show when the user right clicks on tree nodes.
The items on this popup menu are in the String array sTreePopupMenuItems.
Subclass plugins override this method so do not delete or rename this method.
 void clearRightClickedNode()
          Clear the right clicked PosTreeNode.
Subclass plugins override this method so do not delete or rename this method.
 void clearRightClickedTreePath()
          Clear the right clicked TreePath.
Subclass plugins override this method so do not delete or rename this method.
 void collapseNodeOrSelectParent()
          If the node is expanded then collapse it.
protected  void expandEntireTree(TreeNode pNode)
          Method that expands all the nodes from the given node down
 void expandNodeOrSelectNext()
          If the node is collapsed then expand it.
 void freeUpMemory()
          When the user is done with this rendering session, then free up memory
 PosTreeNode getClickedNode()
          Get the left clicked PosTreeNode.
Subclass plugins override this method so do not delete or rename this method.
 PosTreeNode getCurrentClickedPageTreeNodeUsrObj()
           
 boolean getIsRootNodeLeaf()
           
 TreePath getLastSelectedTreePath()
           
 JTree getPagesJTree()
          Get the JTree that is on the screen
 String getPclPageNodeDetailName(PosTreeNode pPosTreeNode)
          Get the String text out of the tree node user object that is the detail name.
 PosView getPosView()
          Get the PosView panel that holds the JTree and the BufferedImage bitmap of the PCL image
 PosTreeNode getRightClickedNode()
          Get the right clicked PosTreeNode.
Subclass plugins override this method so do not delete or rename this method.
 TreePath getRightClickedTreePath()
          Get the right clicked TreePath.
Subclass plugins override this method so do not delete or rename this method.
 boolean getShowHideExtraInfoOnTree()
          Get Show/Hide Index Numbers on Tree
 TreeModel getTreeModel()
           
 DefaultMutableTreeNode getTreeNodeRoot()
           
 PosTreeNode makePclPageTreeNode(int pPageNumber)
          Make a Pcl page node in the tree under the root node.
 void selectNextDocument()
          Select next node in the tree without auto expanding.
 void selectPage1()
           
 void selectPreviousDocument()
          Select previous node in the tree without auto expanding.
 void setCellRenderer()
          Set the tree cell renderer
 void setClickedNode(PosTreeNode pClickedNode)
           
 void setLastSelectedTreePath(TreePath pLastSelectedTreePath)
           
 void setToInitialValues()
          Set to initial values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TREE_ROOT_ICON

protected static final String TREE_ROOT_ICON
See Also:
Constant Field Values

TREE_PAGE_ICON

protected static final String TREE_PAGE_ICON
See Also:
Constant Field Values
Constructor Detail

PosTree

public PosTree(PosView pPosView,
               String pShortName)
Method Detail

getPagesJTree

public JTree getPagesJTree()
Get the JTree that is on the screen


getPosView

public PosView getPosView()
Get the PosView panel that holds the JTree and the BufferedImage bitmap of the PCL image


getShowHideExtraInfoOnTree

public boolean getShowHideExtraInfoOnTree()
Get Show/Hide Index Numbers on Tree


addTreeSelectionListener

public void addTreeSelectionListener()
Add the tree selection listener


setCellRenderer

public void setCellRenderer()
Set the tree cell renderer


setToInitialValues

public void setToInitialValues()
Set to initial values


getLastSelectedTreePath

public TreePath getLastSelectedTreePath()

getClickedNode

public PosTreeNode getClickedNode()
Get the left clicked PosTreeNode.
Subclass plugins override this method so do not delete or rename this method.

Specified by:
getClickedNode in interface IPluginHooksPosTree

getRightClickedNode

public PosTreeNode getRightClickedNode()
Get the right clicked PosTreeNode.
Subclass plugins override this method so do not delete or rename this method.

Specified by:
getRightClickedNode in interface IPluginHooksPosTree

getRightClickedTreePath

public TreePath getRightClickedTreePath()
Get the right clicked TreePath.
Subclass plugins override this method so do not delete or rename this method.

Specified by:
getRightClickedTreePath in interface IPluginHooksPosTree

clearRightClickedNode

public void clearRightClickedNode()
Clear the right clicked PosTreeNode.
Subclass plugins override this method so do not delete or rename this method.

Specified by:
clearRightClickedNode in interface IPluginHooksPosTree

clearRightClickedTreePath

public void clearRightClickedTreePath()
Clear the right clicked TreePath.
Subclass plugins override this method so do not delete or rename this method.

Specified by:
clearRightClickedTreePath in interface IPluginHooksPosTree

setLastSelectedTreePath

public void setLastSelectedTreePath(TreePath pLastSelectedTreePath)

setClickedNode

public void setClickedNode(PosTreeNode pClickedNode)

freeUpMemory

public void freeUpMemory()
When the user is done with this rendering session, then free up memory


getTreeModel

public TreeModel getTreeModel()

getTreeNodeRoot

public DefaultMutableTreeNode getTreeNodeRoot()

getIsRootNodeLeaf

public boolean getIsRootNodeLeaf()

getCurrentClickedPageTreeNodeUsrObj

public PosTreeNode getCurrentClickedPageTreeNodeUsrObj()

selectPage1

public void selectPage1()

makePclPageTreeNode

public PosTreeNode makePclPageTreeNode(int pPageNumber)
Make a Pcl page node in the tree under the root node. If a 1 page PCL file, then there will end up 1 node saying "Page 1". else, if a multi page PCL file, then there will be several nodes saying "Page 1", then "Page 2", "Page 3"


addChildNodeToTree

public DefaultMutableTreeNode addChildNodeToTree(DefaultMutableTreeNode child,
                                                 DefaultMutableTreeNode parent,
                                                 boolean shouldBeVisible)
Add the node to the tree under the passed in parent node

Parameters:
child -
parent -
shouldBeVisible -

expandNodeOrSelectNext

public void expandNodeOrSelectNext()
If the node is collapsed then expand it. If already expanded or is a leaf, then select next. This is the arrow right in the tree.


selectNextDocument

public void selectNextDocument()
Select next node in the tree without auto expanding. This is the arrow down or the Ctrl-L in the tree.


collapseNodeOrSelectParent

public void collapseNodeOrSelectParent()
If the node is expanded then collapse it. If already collpased or is a leaf, then select previous. This is the arrow left in the tree.


selectPreviousDocument

public void selectPreviousDocument()
Select previous node in the tree without auto expanding. This is the arrow up or the Ctrl-K in the tree.


getPclPageNodeDetailName

public String getPclPageNodeDetailName(PosTreeNode pPosTreeNode)
Get the String text out of the tree node user object that is the detail name.


expandEntireTree

protected void expandEntireTree(TreeNode pNode)
Method that expands all the nodes from the given node down

Parameters:
pNode - - the node to start at

buildTreePopupMenu

public void buildTreePopupMenu(JPopupMenu pJPopupMenu)
Build the JPopupMenu to show when the user right clicks on tree nodes.
The items on this popup menu are in the String array sTreePopupMenuItems.
Subclass plugins override this method so do not delete or rename this method.

Specified by:
buildTreePopupMenu in interface IPluginHooksPosTree


OpenPCL http://www.openpcl.com