org.peace_tools.views
Class PropertiesTreeMaker

java.lang.Object
  extended by org.peace_tools.views.PropertiesTreeMaker

public class PropertiesTreeMaker
extends java.lang.Object

A helper (utility) class to assemble various properties about Jobs, MST file, and Cluster file in the form of a JTree.

This class is a helper class that is used by different views in this package to present the user with a consistent set of information about the file (may it be a MST file or Cluster file) being viewed.

Note: All the API methods exposed by this class are static methods and they can be directly invoked without instantiating an object.


Field Summary
private static int CLUSTER_ICON
          A static constant to refer to the Cluster icon position in the CustomIcons array.
private static javax.swing.Icon[] CustomIcons
          The static set of icons that are repeatedly used by this class as the user-defined data for selected nodes in the properties tree created by this class.
private static int DATASET_ICON
          A static constant to refer to the data set icon position in the CustomIcons array.
private static int ERROR_ICON
          A static constant to refer to the error icon position in the CustomIcons array.
private static int FILE_ICON
          A static constant to refer to the file icon position in the CustomIcons array.
private static int FILTERS_ICON
          A static constant to refer to the filters icon position in the CustomIcons array.
private static int HEURISTICS_ICON
          A static constant to refer to the heuristics icon position in the CustomIcons array.
private static int JOB_ICON
          A static constant to refer to the job icon position in the CustomIcons array.
private static int MST_ICON
          A static constant to refer to the MST icon position in the CustomIcons array.
private static int SERVER_ICON
          A static constant to refer to the server icon position in the CustomIcons array.
private static int STATS_ICON
          A static constant to refer to the statistics icon position in the CustomIcons array.
 
Constructor Summary
private PropertiesTreeMaker()
          The default and only constructor.
 
Method Summary
private static void addPropertiesRenderer(javax.swing.JTree tree)
          Method to set a custom cell renderer to handle icons better.
static javax.swing.JSplitPane createPropertiesLayout(java.lang.String title, javax.swing.JTree summaryInfo, java.awt.Component mainView, javax.swing.JToolBar toolbar, int toolPosition)
          Method to compute and setup summary information.
private static javax.swing.tree.MutableTreeNode makeAnalyzerProperties(FWAnalyzer analyzer)
          Helper method to create a properties node for a given analyzer entry.
private static javax.swing.tree.MutableTreeNode makeDataSetProperties(DataSet dataSet, java.awt.Component parent)
          Helper method to create a properties node for a given data set entry.
private static javax.swing.tree.MutableTreeNode makeFileProperties(java.lang.String fileName, java.lang.String subTreeTitle)
          Helper method to create a properties node for a given file.
private static javax.swing.tree.MutableTreeNode makeFilterProperties(Filter filter)
          Helper method to create a properties node for a given data set entry.
private static javax.swing.tree.MutableTreeNode makeHeuristicProperties(Heuristic heuristic)
          Helper method to create a properties node for a given data set entry.
private static javax.swing.tree.DefaultMutableTreeNode makeJobProperties(Job job)
          Helper method to create a properties node for a given MST entry.
private static javax.swing.tree.DefaultMutableTreeNode makeJobProperties(JobSummary summary)
          Helper method to create a properties node for a given job summary node.
private static javax.swing.tree.DefaultMutableTreeNode makeMSTProperties(MSTData mst, boolean needDataSetInfo, boolean needFileInfo, java.awt.Component parent)
          Helper method to create a properties node for a given MST entry.
static javax.swing.JTree makeProperties(MSTClusterData cluster, java.awt.Component parent)
          Build a property tree with cluster file as the main entry.
static javax.swing.JTree makeProperties(MSTData mst, java.awt.Component parent)
          Build a property tree with MST file as the main entry.
private static javax.swing.tree.MutableTreeNode makeServerProperties(java.lang.String serverID)
          Helper method to create a properties node for a given server entry.
private static javax.swing.tree.MutableTreeNode makeSummaryProperties(MSTClusterData cluster, java.awt.Component parent)
          Helper method to create a summary node for a given clustering.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CustomIcons

private static final javax.swing.Icon[] CustomIcons
The static set of icons that are repeatedly used by this class as the user-defined data for selected nodes in the properties tree created by this class.


MST_ICON

private static final int MST_ICON
A static constant to refer to the MST icon position in the CustomIcons array. The constant is used to make the code more readable.

See Also:
Constant Field Values

CLUSTER_ICON

private static final int CLUSTER_ICON
A static constant to refer to the Cluster icon position in the CustomIcons array. The constant is used to make the code more readable.

See Also:
Constant Field Values

DATASET_ICON

private static final int DATASET_ICON
A static constant to refer to the data set icon position in the CustomIcons array. The constant is used to make the code more readable.

See Also:
Constant Field Values

JOB_ICON

private static final int JOB_ICON
A static constant to refer to the job icon position in the CustomIcons array. The constant is used to make the code more readable.

See Also:
Constant Field Values

FILE_ICON

private static final int FILE_ICON
A static constant to refer to the file icon position in the CustomIcons array. The constant is used to make the code more readable.

See Also:
Constant Field Values

SERVER_ICON

private static final int SERVER_ICON
A static constant to refer to the server icon position in the CustomIcons array. The constant is used to make the code more readable.

See Also:
Constant Field Values

HEURISTICS_ICON

private static final int HEURISTICS_ICON
A static constant to refer to the heuristics icon position in the CustomIcons array. The constant is used to make the code more readable.

See Also:
Constant Field Values

FILTERS_ICON

private static final int FILTERS_ICON
A static constant to refer to the filters icon position in the CustomIcons array. The constant is used to make the code more readable.

See Also:
Constant Field Values

ERROR_ICON

private static final int ERROR_ICON
A static constant to refer to the error icon position in the CustomIcons array. The constant is used to make the code more readable.

See Also:
Constant Field Values

STATS_ICON

private static final int STATS_ICON
A static constant to refer to the statistics icon position in the CustomIcons array. The constant is used to make the code more readable.

See Also:
Constant Field Values
Constructor Detail

PropertiesTreeMaker

private PropertiesTreeMaker()
The default and only constructor. The constructor is private because the methods in this class are static and they are meant to be used directly.

Method Detail

makeProperties

public static javax.swing.JTree makeProperties(MSTData mst,
                                               java.awt.Component parent)
Build a property tree with MST file as the main entry. This method can be used to build a properties tree with the MST entry as the main entry. This method calls the various internal helper methods in this class to build the complete three.

Parameters:
mst - The MST workspace entry for which a detailed properties tree is to be built by this method.
parent - The parent component to be used to display dialog boxes on errors.
Returns:
The detailed properties tree for the given MST entry

createPropertiesLayout

public static javax.swing.JSplitPane createPropertiesLayout(java.lang.String title,
                                                            javax.swing.JTree summaryInfo,
                                                            java.awt.Component mainView,
                                                            javax.swing.JToolBar toolbar,
                                                            int toolPosition)
Method to compute and setup summary information. This method is invoked from the constructor to create and populate the summary information tab. The summary information is computed once when the view is created. After that the summary information is built using the PropertiesTreeMaker class.

Returns:
The scroll pane that contains the summary information.

makeProperties

public static javax.swing.JTree makeProperties(MSTClusterData cluster,
                                               java.awt.Component parent)
Build a property tree with cluster file as the main entry. This method can be used to build a properties tree with the cluster entry as the main entry. This method calls the various internal helper methods in this class to build the complete three.

Parameters:
cluster - The cluster workspace entry for which a detailed properties tree is to be built by this method.
parent - The final parent component that owns the JTree being created. This parent is used to report error messages that may occur when building properties.
Returns:
The detailed properties tree for the given cluster entry.

makeSummaryProperties

private static javax.swing.tree.MutableTreeNode makeSummaryProperties(MSTClusterData cluster,
                                                                      java.awt.Component parent)
Helper method to create a summary node for a given clustering. This is an internal helper method that is used to build the properties node for a given cluster entry/

Parameters:
cluster - The cluster workspace entry for which the properties sub-tree is to be built
Returns:
A sub-tree with necessary statistical summary information to be included in the main properties tree at an appropriate location.

makeJobProperties

private static javax.swing.tree.DefaultMutableTreeNode makeJobProperties(JobSummary summary)
Helper method to create a properties node for a given job summary node. This is an internal helper method that is used to build the properties node for a given job summary node. This method prefers to use the actual Job information if available. If the complete Job information could not be found, then the summary information in the job summary is used instead.

Parameters:
summary - The Job summary entry for which the properties sub-tree is to be built
Returns:
A sub-tree with necessary Job properties information to be included in the main properties tree at an appropriate location.

makeMSTProperties

private static javax.swing.tree.DefaultMutableTreeNode makeMSTProperties(MSTData mst,
                                                                         boolean needDataSetInfo,
                                                                         boolean needFileInfo,
                                                                         java.awt.Component parent)
Helper method to create a properties node for a given MST entry. This is an internal helper method that is used to build the properties node for a given MST entry.

Parameters:
mst - The MST workspace entry for which the properties sub-tree is to be built
needFileInfo - If this flag is true then this method adds a sub-tree with properties about the physical MST file.
parent - The parent component to be used to display dialog boxes on errors.
Returns:
A sub-tree with necessary MST properties information to be included in the main properties tree at an appropriate location.

makeJobProperties

private static javax.swing.tree.DefaultMutableTreeNode makeJobProperties(Job job)
Helper method to create a properties node for a given MST entry. This is an internal helper method that is used to build the properties node for a given MST entry.

Parameters:
job - The job object to be used to create a suitable property sub-tree for display to the user.
Returns:
A sub-tree with necessary MST properties information to be included in the main properties tree at an appropriate location.

makeServerProperties

private static javax.swing.tree.MutableTreeNode makeServerProperties(java.lang.String serverID)
Helper method to create a properties node for a given server entry. This is an internal helper method that is used to build the properties node for a given server entry.

Parameters:
serverID - The internal string identifier that uniquely identifies a server entry in the workspace.
Returns:
A sub-tree with necessary server properties information to be included in the main properties tree at an appropriate location.

makeHeuristicProperties

private static javax.swing.tree.MutableTreeNode makeHeuristicProperties(Heuristic heuristic)
Helper method to create a properties node for a given data set entry. This is an internal helper method that is used to build the properties node for a given data set entry.

Parameters:
heuristic - The heuristic workspace entry for which the properties sub-tree is to be built
Returns:
A sub-tree with necessary data set properties information to be included in the main properties tree at an appropriate location.

makeFilterProperties

private static javax.swing.tree.MutableTreeNode makeFilterProperties(Filter filter)
Helper method to create a properties node for a given data set entry. This is an internal helper method that is used to build the properties node for a given data set entry.

Parameters:
filter - The filter workspace entry for which the properties sub-tree is to be built
Returns:
A sub-tree with necessary data set properties information to be included in the main properties tree at an appropriate location.

makeDataSetProperties

private static javax.swing.tree.MutableTreeNode makeDataSetProperties(DataSet dataSet,
                                                                      java.awt.Component parent)
Helper method to create a properties node for a given data set entry. This is an internal helper method that is used to build the properties node for a given data set entry.

Parameters:
dataSet - The data set workspace entry for which the properties sub-tree is to be built
Returns:
A sub-tree with necessary data set properties information to be included in the main properties tree at an appropriate location.

makeAnalyzerProperties

private static javax.swing.tree.MutableTreeNode makeAnalyzerProperties(FWAnalyzer analyzer)
Helper method to create a properties node for a given analyzer entry. This is an internal helper method that is used to build the properties node for a given MST entry.

Parameters:
analyzer - The analyzer workspace entry for which the properties sub-tree is to be built
Returns:
A sub-tree with necessary analyzer properties information to be included in the main properties tree at an appropriate location.

makeFileProperties

private static javax.swing.tree.MutableTreeNode makeFileProperties(java.lang.String fileName,
                                                                   java.lang.String subTreeTitle)
Helper method to create a properties node for a given file. This is an internal helper method that is used to build the properties node for a given file.

Parameters:
fileName - The file name for which the properties node is to be built
subTreeTitle - The title string to be set for the sub-tree being built by this method. This string is usually in the form "MST File Properties".
Returns:
A sub-tree to be included in the main properties tree at an appropriate location.

addPropertiesRenderer

private static void addPropertiesRenderer(javax.swing.JTree tree)
Method to set a custom cell renderer to handle icons better. This method sets a custom tree cell renderer that essentially provides a better representative set of Icons to make the overall display look a bit prettier.

Parameters:
tree - The tree to which a custom properties renderer is to be added.