public class RemoteFileSystemView
extends javax.swing.filechooser.FileSystemView
Modifier and Type | Field and Description |
---|---|
protected java.util.Map |
children
The cache of children files (String parent -> File[] children).
|
protected javax.swing.JFileChooser |
chooser
The filechooser.
|
protected RemoteFile |
currentdir
The current directory.
|
protected RemoteFile |
defaultdir
The default directory.
|
protected jadex.bridge.IExternalAccess |
exta
The external access.
|
protected RemoteFile |
homedir
The home directory.
|
protected java.util.Map |
parents
The cache of parent files (String child -> File[] parent).
|
Constructor and Description |
---|
RemoteFileSystemView(jadex.bridge.IExternalAccess exta)
Create a new file system view.
|
Modifier and Type | Method and Description |
---|---|
void |
clearCache()
Clear the cache.
|
java.io.File |
createFileObject(java.io.File dir,
java.lang.String filename)
Returns a File object constructed in dir from the given filename.
|
java.io.File |
createFileObject(java.lang.String path)
Returns a File object constructed from the given path string.
|
java.io.File |
createNewFolder(java.io.File containingDir)
Creates a new folder with a default folder name.
|
java.io.File |
getCurrentDirectory()
Get the current directory of the remote VM.
|
java.io.File |
getDefaultDirectory()
Return the user's default starting directory for the file chooser.
|
java.io.File[] |
getFiles(java.io.File dir,
boolean useFileHiding)
Gets the list of shown (i.e.
|
java.io.File |
getHomeDirectory() |
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)
Name of a file, directory, or folder as it would be displayed in a system
file browser.
|
java.lang.String |
getSystemTypeDescription(java.io.File f)
Type description for a file, directory, or folder as it would be
displayed in a system file browser.
|
jadex.commons.future.IFuture<java.lang.Void> |
init()
Initialize the remote file system view such that
home, default and current directory as well as roots
are available.
|
boolean |
isHiddenFile(java.io.File f)
Returns whether a file is hidden or not.
|
boolean |
isParent(java.io.File folder,
java.io.File file)
On Windows, a file can appear in multiple folders, other than its parent
directory in the filesystem.
|
java.lang.Boolean |
isTraversable(java.io.File f)
Returns true if the file (directory) can be visited.
|
static void |
main(java.lang.String[] args)
Main for testing.
|
void |
setFileChooser(javax.swing.JFileChooser chooser)
Set the file chooser.
|
protected jadex.bridge.IExternalAccess exta
protected java.util.Map children
protected java.util.Map parents
protected javax.swing.JFileChooser chooser
protected RemoteFile homedir
protected RemoteFile defaultdir
protected RemoteFile currentdir
public RemoteFileSystemView(jadex.bridge.IExternalAccess exta)
public jadex.commons.future.IFuture<java.lang.Void> init()
public void setFileChooser(javax.swing.JFileChooser chooser)
public java.lang.Boolean isTraversable(java.io.File f)
isTraversable
in class javax.swing.filechooser.FileSystemView
f
- the File
true
if the file/directory can be traversed,
otherwise false
JFileChooser.isTraversable(java.io.File)
,
FileView.isTraversable(java.io.File)
public java.lang.String getSystemDisplayName(java.io.File f)
getSystemDisplayName
in class javax.swing.filechooser.FileSystemView
f
- a File
objectJFileChooser.getName(java.io.File)
public java.lang.String getSystemTypeDescription(java.io.File f)
getSystemTypeDescription
in class javax.swing.filechooser.FileSystemView
f
- a File
objectJFileChooser.getTypeDescription(java.io.File)
public boolean isParent(java.io.File folder, java.io.File file)
isParent
in class javax.swing.filechooser.FileSystemView
folder
- a File
object repesenting a directory or
special folderfile
- a File
objecttrue
if folder
is a directory or
special folder and contains file
.public java.io.File createNewFolder(java.io.File containingDir) throws java.io.IOException
createNewFolder
in class javax.swing.filechooser.FileSystemView
java.io.IOException
public boolean isHiddenFile(java.io.File f)
isHiddenFile
in class javax.swing.filechooser.FileSystemView
public java.io.File[] getRoots()
getRoots
in class javax.swing.filechooser.FileSystemView
public java.io.File getHomeDirectory()
getHomeDirectory
in class javax.swing.filechooser.FileSystemView
public java.io.File getCurrentDirectory()
public java.io.File getDefaultDirectory()
getDefaultDirectory
in class javax.swing.filechooser.FileSystemView
File
object representing the default starting
folderpublic java.io.File createFileObject(java.io.File dir, java.lang.String filename)
createFileObject
in class javax.swing.filechooser.FileSystemView
public java.io.File createFileObject(java.lang.String path)
createFileObject
in class javax.swing.filechooser.FileSystemView
public java.io.File[] getFiles(java.io.File dir, boolean useFileHiding)
getFiles
in class javax.swing.filechooser.FileSystemView
public java.io.File getParentDirectory(java.io.File dir)
dir
.getParentDirectory
in class javax.swing.filechooser.FileSystemView
dir
- the File
being querieddir
, or null
if
dir
is null
public void clearCache()
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception