public class IFSSystemView extends 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 | Description |
|---|---|
IFSSystemView(AS400 system) |
Constructs an IFSSystemView object.
|
| Modifier and Type | Method | Description |
|---|---|---|
File |
createFileObject(File containingDir,
String name) |
Returns a File object constructed in directory from the given filename.
|
File |
createFileObject(String path) |
Returns a File object constructed from the given path string.
|
File |
createNewFolder(File containingDir) |
Creates a new folder with a default name.
|
File |
getDefaultDirectory() |
Returns the user's default starting directory for the file chooser.
|
File[] |
getFiles(File directory,
boolean useFileHiding) |
Gets the list of shown (that is, not hidden) files in the directory.
|
File |
getHomeDirectory() |
Returns the home directory.
|
File |
getParentDirectory(File dir) |
Returns the parent directory of dir.
|
File[] |
getRoots() |
Returns all root partitions on this system.
|
String |
getSystemDisplayName(File f) |
Returns the name of a file, directory, or folder as it would be displayed in
a system file browser.
|
Icon |
getSystemIcon(File f) |
Always returns an icon representing an IBM i system.
|
String |
getSystemTypeDescription(File f) |
Returns a type description for a file, directory, or folder as it would be displayed in
a system file browser.
|
boolean |
isComputerNode(File dir) |
Always returns false.
|
boolean |
isDrive(File dir) |
Always returns false.
|
boolean |
isFileSystemRoot(File f) |
Returns true if f represents the root directory on the system ("/"),
and false otherwise.
|
boolean |
isFloppyDrive(File dir) |
Always returns false.
|
boolean |
isRoot(File file) |
Determines if the given file is a root in the navigatable tree(s).
|
createFileSystemRoot, getChild, getChooserComboBoxFiles, getFileSystemView, getLinkLocation, isFileSystem, isHiddenFile, isLink, isParent, isTraversablepublic IFSSystemView(AS400 system)
system - The system that contains the file.public File createFileObject(File containingDir, String name)
createFileObject in class FileSystemViewcontainingDir - The directory in which to create the file.
name - The file name.public File createFileObject(String path)
createFileObject in class FileSystemViewpath - The file path name.public File createNewFolder(File containingDir) throws IOException
createNewFolder in class FileSystemViewcontainingDir - The parent directory in which to create the folder.
IOExceptionpublic File getDefaultDirectory()
getDefaultDirectory in class FileSystemViewFile object representing the default
starting folder.public File[] getFiles(File directory, boolean useFileHiding)
getFiles in class FileSystemViewdirectory - The directory to search.useFileHiding - This parameter is ignored.public File getHomeDirectory()
getHomeDirectory in class FileSystemViewpublic File getParentDirectory(File dir)
getParentDirectory in class FileSystemViewdir - The directory being queried.
public File[] getRoots()
getRoots in class FileSystemViewpublic String getSystemDisplayName(File f)
getSystemDisplayName in class FileSystemViewf - A File object.public Icon getSystemIcon(File f)
getSystemIcon in class FileSystemViewpublic String getSystemTypeDescription(File f)
getSystemTypeDescription in class FileSystemViewf - A File object.public boolean isComputerNode(File dir)
isComputerNode in class FileSystemViewpublic boolean isDrive(File dir)
isDrive in class FileSystemViewpublic boolean isFloppyDrive(File dir)
isFloppyDrive in class FileSystemViewpublic boolean isFileSystemRoot(File f)
isFileSystemRoot in class FileSystemViewf - A File object representing a directory.true if f is a root of a filesystempublic boolean isRoot(File file)
isRoot in class FileSystemViewfile - A File object representing a directory.Copyright © 2024. All rights reserved.