com.sun.xfilechooser
Class XFileChooser
JFileChooser
com.sun.xfilechooser.XFileChooser
- PropertyChangeListener
public class XFileChooser
extends JFileChooser
implements PropertyChangeListener
XFileChooser is an extension of the JFileChooser. It
provides a simple mechanism for the user to choose a file locally
and remotely via NFS URLs. Instead of returning a File Object
which is done in JFileChooser it returns and XFile Object.
The XFile object allows access to local and remote files.
XFileChooser() - Creates a XFileChooser pointing to the user's home directory.
|
XFileChooser(String currentDirectoryPath) - Creates a XFileChooser using the given path.
|
XFileChooser(XFile currentDirectory) - Creates a XFileChooser using the given XFile as the path.
|
SELECTED_XFILES_CHANGED_PROPERTY
public static final String SELECTED_XFILES_CHANGED_PROPERTY
Identifes change in user's multiple-file selection.
SELECTED_XFILE_CHANGED_PROPERTY
public static final String SELECTED_XFILE_CHANGED_PROPERTY
Identifes change in user's single-file selection.
XDIRECTORY_CHANGED_PROPERTY
public static final String XDIRECTORY_CHANGED_PROPERTY
Identifies user's directory change.
XFileChooser
public XFileChooser()
Creates a XFileChooser pointing to the user's home directory.
Initializes some of the private variables needed for bean's editor.
XFileChooser
public XFileChooser(String currentDirectoryPath)
Creates a XFileChooser using the given path. Passing in a null
string causes the file chooser to point to the users home directory.
currentDirectoryPath
- a String giving the path to a file or directory
XFileChooser
public XFileChooser(XFile currentDirectory)
Creates a XFileChooser using the given XFile as the path. Passing
in a null file causes the file chooser to point to the users's
home directory.
currentDirectory
- a XFile object specifying the path to a file
or directory
ensureFileIsVisible
public void ensureFileIsVisible(XFile f)
Make sure that the specified file is viewable, and
not hidden.
getCurrentXDirectory
public XFile getCurrentXDirectory()
Returns XFile Object of the current directory.
- the XFile object of the current directory
getSelectedXFile
public XFile getSelectedXFile()
Returns the XFile object of the selected file. This can be set
either by the programmer via setSelectedXFile() or by a user
action, such as either typing the filename int the UI or selecting the
file from a list in the UI.
- the XFile object of the selected file
getSelectedXFileInputStream
public XFileInputStream getSelectedXFileInputStream()
Returns the XFileInputStream object of the selected file
- XFileInputStream of the selected input file
getSelectedXFileOutputStream
public XFileOutputStream getSelectedXFileOutputStream()
Returns the XFileOutputStream object of the selected file
- XFileOutputStream of the selected output file
getSelectedXFiles
public XFile[] getSelectedXFiles()
Returns a list of selected files if the filechooser is
set to allow multi-selection.
- list of XFile objects of the selected files
main
public static void main(args[] )
Used only for testing of bean
propertyChange
public void propertyChange(PropertyChangeEvent e)
This method gets called when certain bound properties has changed
on the associated JFileChooser. The properties it will
listen to include: DIRECTORY_CHANGED_PROPERTY,
SELECTED_FILE_CHANGED_PROPERTY, SELECTED_FILES_CHANGED_PROPERTY.
This method is needed to create the corresponding XFile for
the File object of the selected file or directory.
setCurrentXDirectory
public void setCurrentXDirectory(XFile currentDirectory)
Sets the current directory. Passing in null sets the filechooser
to point to the users's home directory.
If the file passed in as currentDirectory is not a directory, the
parent of the file will be used as the currentDirectory. If the
parent is not traversable, then it will walk up the parent tree
until it finds a traversable direcotry, or hits the root of the
file system.
currentDirectory
- the XFile object of the
current directory to point to.
setSelectedXFile
public void setSelectedXFile(XFile selectedFile)
Sets the XFile object of the selected file.
If the file's parent directory is
not the current directory, it changed the current directory
to be the files parent directory. This just calls the
setSelectedFile() of JFileChooser, passing it the corresponding
File object of the selected file.
selectedFile
- the XFile object of the selected file
setSelectedXFiles
public void setSelectedXFiles(XFile[] selectedFiles)
Sets the list of selected files if the filechooser is
set to allow multi-selection.