org.oddjob.monitor.model
Class JobTreeNode

java.lang.Object
  extended by org.oddjob.monitor.model.JobTreeNode
All Implemented Interfaces:
TreeNode

public class JobTreeNode
extends Object
implements TreeNode

This class encapsulates the model of a job to be used in the monitor.

Author:
Rob Gordon

Constructor Summary
JobTreeNode(ExplorerModel explorerModel, JobTreeModel model)
          Constructor for the root node.
JobTreeNode(ExplorerModel explorerModel, JobTreeModel model, Executor executor, ExplorerContextFactory contextFactory)
          Constructor for testing so we can change the Executor and ExplorerContextFactory.
JobTreeNode(JobTreeNode parent, Object node)
          Constructor for child nodes.
 
Method Summary
 Enumeration<JobTreeNode> children()
           
 void destroy()
          Destroy the node.
 boolean getAllowsChildren()
           
 TreeNode getChildAt(int index)
           
 int getChildCount()
           
 JobTreeNode[] getChildren()
           
 Object getComponent()
           
 ExplorerContext getExplorerContext()
           
 ImageIcon getIcon()
           
 int getIndex(TreeNode child)
           
 TreeNode getParent()
           
 boolean isLeaf()
           
 boolean isVisible()
           
 void setVisible(boolean visible)
          Called when a node is made visible.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JobTreeNode

public JobTreeNode(ExplorerModel explorerModel,
                   JobTreeModel model)
Constructor for the root node.

Parameters:
explorerModel - The ExplorerModel.
model - The JobTreeModel.

JobTreeNode

public JobTreeNode(ExplorerModel explorerModel,
                   JobTreeModel model,
                   Executor executor,
                   ExplorerContextFactory contextFactory)
Constructor for testing so we can change the Executor and ExplorerContextFactory.

Parameters:
explorerModel -
model -
executor -
contextFactory -

JobTreeNode

public JobTreeNode(JobTreeNode parent,
                   Object node)
Constructor for child nodes.

Parameters:
parent - The parent node.
node - The structure node this is modelling.
Method Detail

setVisible

public void setVisible(boolean visible)
Called when a node is made visible. This is to reduce the amount of listeners added to the job tree.

Parameters:
visible - True if visible.

isVisible

public boolean isVisible()

getComponent

public Object getComponent()

children

public Enumeration<JobTreeNode> children()
Specified by:
children in interface TreeNode

getAllowsChildren

public boolean getAllowsChildren()
Specified by:
getAllowsChildren in interface TreeNode

getChildAt

public TreeNode getChildAt(int index)
Specified by:
getChildAt in interface TreeNode

getChildCount

public int getChildCount()
Specified by:
getChildCount in interface TreeNode

isLeaf

public boolean isLeaf()
Specified by:
isLeaf in interface TreeNode

getIndex

public int getIndex(TreeNode child)
Specified by:
getIndex in interface TreeNode

getParent

public TreeNode getParent()
Specified by:
getParent in interface TreeNode

toString

public String toString()
Overrides:
toString in class Object

getIcon

public ImageIcon getIcon()

getChildren

public JobTreeNode[] getChildren()

destroy

public void destroy()
Destroy the node. Remove listeners and destroy any remaining child nodes. Child node will remain in situations where a child is removed from it's parent before being destroyed This happens with both the ForEachJob and the JMXClientJob jobs.


getExplorerContext

public ExplorerContext getExplorerContext()
Returns:
Returns the context.