edu.mit.jmwe.util
Class AbstractFileSelector

java.lang.Object
  extended by edu.mit.jmwe.util.AbstractFileSelector
Direct Known Subclasses:
ConcordanceTagger, IndexBuilder

public abstract class AbstractFileSelector
extends Object

Abstract base class that allows interaction with the user, saving and selecting files and directories.

Since:
jMWE 1.0.0
Version:
$Id: AbstractFileSelector.java 616 2011-05-07 01:00:47Z markaf $
Author:
M.A. Finlayson

Constructor Summary
AbstractFileSelector()
           
 
Method Summary
protected  File choose(String msg, Class<?> key, int dialogType, int selMode)
          Choose a file, opening a file chooser at the location already associated with the class (if any), and saving the selected location with the class.
protected  File chooseDirectory(String msg, Class<?> key)
          Chooses a directory, showing the specified message, associated with the specified key.
protected  File chooseFile(String msg, Class<?> key)
          Chooses a file for opening, showing the specified message, associated with the specified key.
protected  File chooseFileForWriting(String msg, Class<?> key)
          Chooses a file for writing, showing the specified message, associated with the specified key.
protected  JFileChooser getFileChooser()
          Returns the file chooser for this instance.
protected  File getLocation(Class<?> key)
          Gets a location indexed by the specified class as a key.
protected  void setLocation(Class<?> key, File loc)
          Sets a location indexed by the specified class as a key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractFileSelector

public AbstractFileSelector()
Method Detail

getLocation

protected File getLocation(Class<?> key)
Gets a location indexed by the specified class as a key.

Parameters:
key - the class used as a key for the location
Returns:
the location associated with the class, or null if none
Throws:
NullPointerException - if the specified key is null
Since:
jMWE 1.0.0

setLocation

protected void setLocation(Class<?> key,
                           File loc)
Sets a location indexed by the specified class as a key.

Parameters:
key - the class used as a key for the location
loc - the location
Throws:
NullPointerException - if the specified key or location is null
Since:
jMWE 1.0.0

chooseFile

protected File chooseFile(String msg,
                          Class<?> key)
Chooses a file for opening, showing the specified message, associated with the specified key.

Parameters:
msg - the message to show to the user
key - the class with which to associate the location
Returns:
the chosen file
Since:
jMWE 1.0.0

chooseFileForWriting

protected File chooseFileForWriting(String msg,
                                    Class<?> key)
Chooses a file for writing, showing the specified message, associated with the specified key.

Parameters:
msg - the message to show to the user
key - the class with which to associate the location
Returns:
the chosen file
Since:
jMWE 1.0.0

chooseDirectory

protected File chooseDirectory(String msg,
                               Class<?> key)
Chooses a directory, showing the specified message, associated with the specified key.

Parameters:
msg - the message to show to the user
key - the class with which to associate the location
Returns:
the chosen file
Since:
jMWE 1.0.0

choose

protected File choose(String msg,
                      Class<?> key,
                      int dialogType,
                      int selMode)
Choose a file, opening a file chooser at the location already associated with the class (if any), and saving the selected location with the class.

Parameters:
msg - the message to display
key - the class with which the location selected should be associated
dialogType - the type of dialog, see JFileChooser.setDialogType(int)
selMode - file selection mode, see JFileChooser.setFileSelectionMode(int)
Returns:
the file chosen
Since:
jMWE 1.0.0

getFileChooser

protected JFileChooser getFileChooser()
Returns the file chooser for this instance.

Returns:
the file chooser for this instance
Since:
jMWE 1.0.0


Copyright © 2011 Massachusetts Institute of Technology. All Rights Reserved.