mckay.utilities.gui.templates
Class ListInputTextParser

java.lang.Object
  extended by mckay.utilities.gui.templates.ListInputTextParser
All Implemented Interfaces:
ListInputParser

public class ListInputTextParser
extends java.lang.Object
implements ListInputParser

An implementation of the ListInputParser interface for use by the ListInputPanel class in choosing and parsing of text files. Displays a file chooser and parses the selected file(s).


Field Summary
protected  javax.swing.JFileChooser file_chooser
          A file chooser used to choose files.
protected  java.awt.Component parent
          The GUI component opening the file chooser.
 
Constructor Summary
ListInputTextParser(java.awt.Component parent)
          Creates a new instance of ListInputTextParser.
 
Method Summary
 java.lang.String[] getStrings()
          Opens a file browser and load strings from the selected textfile.
 void setProgressBar(SimpleProgressBarDialog progress_bar)
          Does not do anything for this class, as the progress bar is not manipulated directly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parent

protected java.awt.Component parent
The GUI component opening the file chooser.


file_chooser

protected javax.swing.JFileChooser file_chooser
A file chooser used to choose files.

Constructor Detail

ListInputTextParser

public ListInputTextParser(java.awt.Component parent)
Creates a new instance of ListInputTextParser.

Parameters:
parent - The GUI component opening the file chooser.
Method Detail

getStrings

public java.lang.String[] getStrings()
                              throws java.lang.Exception
Opens a file browser and load strings from the selected textfile. The parsed file is considered to comprise a list. Each line is counted as a separate item in the list. Blank lines are treated as an item in the list consisting of "". An array of strings is returned with one entry for each item in the list. This array is not sorted or otherwise processed, but no entries may be null. Null is returned if the load is cancelled. A descriptive exception is thrown if a problem occurs during paring.

Specified by:
getStrings in interface ListInputParser
Returns:
The parsed contents of the file.
Throws:
java.lang.Exception - An informative description of any problem that occurs during parsing.

setProgressBar

public void setProgressBar(SimpleProgressBarDialog progress_bar)
Does not do anything for this class, as the progress bar is not manipulated directly.

Specified by:
setProgressBar in interface ListInputParser
Parameters:
progress_bar - A progress bar.