public class IFSSystemView
extends javax.swing.filechooser.FileSystemView
JFileChooser is a standard Java way to build dialogs for navigating and choosing files.
The following example demonstrates the use of IFSSystemView.
import com.ibm.as400.access.AS400; import com.ibm.as400.access.IFSJavaFile; import com.ibm.as400.access.IFSSystemView; import javax.swing.JFileChooser; import java.awt.Frame; // Work with directory /Dir on the system myAS400. AS400 system = new AS400("myAS400"); IFSJavaFile dir = new IFSJavaFile(system, "/Dir"); JFileChooser chooser = new JFileChooser(dir, new IFSSystemView(system)); Frame parent = new Frame(); int returnVal = chooser.showOpenDialog(parent); if (returnVal == JFileChooser.APPROVE_OPTION) { IFSJavaFile chosenFile = (IFSJavaFile)(chooser.getSelectedFile()); System.out.println("You selected the file named " + chosenFile.getName()); }
IFSJavaFile
Constructor and Description |
---|
IFSSystemView(AS400 system)
Constructs an IFSSystemView object.
|
Modifier and Type | Method and Description |
---|---|
java.io.File |
createFileObject(java.io.File containingDir,
java.lang.String name)
Returns a File object constructed in directory from the given filename.
|
java.io.File |
createFileObject(java.lang.String path)
Returns a File object constructed from the given path string.
|
protected java.io.File |
createFileSystemRoot(java.io.File f) |
java.io.File |
createNewFolder(java.io.File containingDir)
Creates a new folder with a default name.
|
java.io.File |
getDefaultDirectory()
Returns the user's default starting directory for the file chooser.
|
java.io.File[] |
getFiles(java.io.File directory,
boolean useFileHiding)
Gets the list of shown (that is, not hidden) files in the directory.
|
java.io.File |
getHomeDirectory()
Returns the home directory.
|
java.io.File |
getParentDirectory(java.io.File dir)
Returns the parent directory of dir.
|
java.io.File[] |
getRoots()
Returns all root partitions on this system.
|
java.lang.String |
getSystemDisplayName(java.io.File f)
Returns the name of a file, directory, or folder as it would be displayed in
a system file browser.
|
javax.swing.Icon |
getSystemIcon(java.io.File f)
Always returns an icon representing an IBM i system.
|
java.lang.String |
getSystemTypeDescription(java.io.File f)
Returns a type description for a file, directory, or folder as it would be displayed in
a system file browser.
|
boolean |
isComputerNode(java.io.File dir)
Always returns false.
|
boolean |
isDrive(java.io.File dir)
Always returns false.
|
boolean |
isFileSystemRoot(java.io.File f)
Returns true if f represents the root directory on the system ("/"),
and false otherwise.
|
boolean |
isFloppyDrive(java.io.File dir)
Always returns false.
|
boolean |
isRoot(java.io.File file)
Determines if the given file is a root in the navigatable tree(s).
|
public IFSSystemView(AS400 system)
system
- The system that contains the file.public java.io.File createFileObject(java.io.File containingDir, java.lang.String name)
createFileObject
in class javax.swing.filechooser.FileSystemView
containingDir
- The directory in which to create the file.
name
- The file name.public java.io.File createFileObject(java.lang.String path)
createFileObject
in class javax.swing.filechooser.FileSystemView
path
- The file path name.protected java.io.File createFileSystemRoot(java.io.File f)
createFileSystemRoot
in class javax.swing.filechooser.FileSystemView
public java.io.File createNewFolder(java.io.File containingDir) throws java.io.IOException
createNewFolder
in class javax.swing.filechooser.FileSystemView
containingDir
- The parent directory in which to create the folder.
java.io.IOException
public java.io.File getDefaultDirectory()
getDefaultDirectory
in class javax.swing.filechooser.FileSystemView
File
object representing the default
starting folder.public java.io.File[] getFiles(java.io.File directory, boolean useFileHiding)
getFiles
in class javax.swing.filechooser.FileSystemView
directory
- The directory to search.useFileHiding
- This parameter is ignored.public java.io.File getHomeDirectory()
getHomeDirectory
in class javax.swing.filechooser.FileSystemView
public java.io.File getParentDirectory(java.io.File dir)
getParentDirectory
in class javax.swing.filechooser.FileSystemView
dir
- The directory being queried.
public java.io.File[] getRoots()
getRoots
in class javax.swing.filechooser.FileSystemView
public java.lang.String getSystemDisplayName(java.io.File f)
getSystemDisplayName
in class javax.swing.filechooser.FileSystemView
f
- A File
object.public javax.swing.Icon getSystemIcon(java.io.File f)
getSystemIcon
in class javax.swing.filechooser.FileSystemView
public java.lang.String getSystemTypeDescription(java.io.File f)
getSystemTypeDescription
in class javax.swing.filechooser.FileSystemView
f
- A File
object.public boolean isComputerNode(java.io.File dir)
isComputerNode
in class javax.swing.filechooser.FileSystemView
public boolean isDrive(java.io.File dir)
isDrive
in class javax.swing.filechooser.FileSystemView
public boolean isFloppyDrive(java.io.File dir)
isFloppyDrive
in class javax.swing.filechooser.FileSystemView
public boolean isFileSystemRoot(java.io.File f)
isFileSystemRoot
in class javax.swing.filechooser.FileSystemView
f
- A File
object representing a directory.true
if f
is a root of a filesystempublic boolean isRoot(java.io.File file)
isRoot
in class javax.swing.filechooser.FileSystemView
file
- A File object representing a directory.