edu.northwestern.at.utils.swing
Class SaveTreeData

java.lang.Object
  extended by edu.northwestern.at.utils.swing.SaveTreeData

public class SaveTreeData
extends java.lang.Object

Saves data stored in a JTree to a file is several different formats.


Field Summary
protected static FileExtensionFilter txtFilter
          TXT extension file filter.
 
Constructor Summary
protected SaveTreeData()
          Don't allow instantiation but do allow overrides.
 
Method Summary
static void saveTreeDataToFile(javax.swing.JTree tree, java.lang.String title, java.lang.String fileName)
          Saves the tree data to a file.
static void saveTreeDataToFile(java.awt.Window parentWindow, javax.swing.JTree tree, java.lang.String title)
          Saves the tree model data to a file.
static java.lang.String treeDataToText(javax.swing.JTree tree, java.lang.String title)
          Convert contents of a JTree to text file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

txtFilter

protected static FileExtensionFilter txtFilter
TXT extension file filter.

Constructor Detail

SaveTreeData

protected SaveTreeData()
Don't allow instantiation but do allow overrides.

Method Detail

treeDataToText

public static java.lang.String treeDataToText(javax.swing.JTree tree,
                                              java.lang.String title)
Convert contents of a JTree to text file.

Parameters:
tree - The tree containing the data to convert to command separated values.
title - Title for tree.
Returns:
The tab separated tree data. Each tree row appears on a new line.

saveTreeDataToFile

public static void saveTreeDataToFile(javax.swing.JTree tree,
                                      java.lang.String title,
                                      java.lang.String fileName)
Saves the tree data to a file.

Parameters:
tree - Tree holding data to save.
title - The title for the data. Null if no title.
fileName - The file name to which to save the data.

saveTreeDataToFile

public static void saveTreeDataToFile(java.awt.Window parentWindow,
                                      javax.swing.JTree tree,
                                      java.lang.String title)
Saves the tree model data to a file. Prompts for a file name.

Parameters:
parentWindow - Parent window for file dialog.
tree - The tree whose data is to be saved.
title - The title for the tree data.