Package jadex.base.gui.filechooser
Class RemoteFileSystemView
- java.lang.Object
- 
- javax.swing.filechooser.FileSystemView
- 
- jadex.base.gui.filechooser.RemoteFileSystemView
 
 
- 
 public class RemoteFileSystemView extends javax.swing.filechooser.FileSystemViewRemote file system view. Is programmed asynchronously, i.e. delivers always what it has and then initiates a background search for retrieving current values. When values arrive a refresh operation is used to update the chooser.
- 
- 
Field SummaryFields Modifier and Type Field Description protected java.util.MapchildrenThe cache of children files (String parent -> File[] children).protected javax.swing.JFileChooserchooserThe filechooser.protected RemoteFilecurrentdirThe current directory.protected RemoteFiledefaultdirThe default directory.protected IExternalAccessextaThe external access.protected RemoteFilehomedirThe home directory.protected java.util.MapparentsThe cache of parent files (String child -> File[] parent).
 - 
Constructor SummaryConstructors Constructor Description RemoteFileSystemView(IExternalAccess exta)Create a new file system view.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearCache()Clear the cache.java.io.FilecreateFileObject(java.io.File dir, java.lang.String filename)Returns a File object constructed in dir from the given filename.java.io.FilecreateFileObject(java.lang.String path)Returns a File object constructed from the given path string.java.io.FilecreateNewFolder(java.io.File containingDir)Creates a new folder with a default folder name.java.io.FilegetCurrentDirectory()Get the current directory of the remote VM.java.io.FilegetDefaultDirectory()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.FilegetHomeDirectory()java.io.FilegetParentDirectory(java.io.File dir)Returns the parent directory ofdir.java.io.File[]getRoots()Returns all root partitions on this system.java.lang.StringgetSystemDisplayName(java.io.File f)Name of a file, directory, or folder as it would be displayed in a system file browser.java.lang.StringgetSystemTypeDescription(java.io.File f)Type description for a file, directory, or folder as it would be displayed in a system file browser.IFuture<java.lang.Void>init()Initialize the remote file system view such that home, default and current directory as well as roots are available.booleanisHiddenFile(java.io.File f)Returns whether a file is hidden or not.booleanisParent(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.BooleanisTraversable(java.io.File f)Returns true if the file (directory) can be visited.static voidmain(java.lang.String[] args)Main for testing.voidsetFileChooser(javax.swing.JFileChooser chooser)Set the file chooser.
 
- 
- 
- 
Field Detail- 
extaprotected IExternalAccess exta The external access.
 - 
childrenprotected java.util.Map children The cache of children files (String parent -> File[] children).
 - 
parentsprotected java.util.Map parents The cache of parent files (String child -> File[] parent).
 - 
chooserprotected javax.swing.JFileChooser chooser The filechooser.
 - 
homedirprotected RemoteFile homedir The home directory.
 - 
defaultdirprotected RemoteFile defaultdir The default directory.
 - 
currentdirprotected RemoteFile currentdir The current directory.
 
- 
 - 
Constructor Detail- 
RemoteFileSystemViewpublic RemoteFileSystemView(IExternalAccess exta) Create a new file system view.
 
- 
 - 
Method Detail- 
initpublic IFuture<java.lang.Void> init() Initialize the remote file system view such that home, default and current directory as well as roots are available.
 - 
setFileChooserpublic void setFileChooser(javax.swing.JFileChooser chooser) Set the file chooser.
 - 
isTraversablepublic java.lang.Boolean isTraversable(java.io.File f) Returns true if the file (directory) can be visited. Returns false if the directory cannot be traversed.- Overrides:
- isTraversablein class- javax.swing.filechooser.FileSystemView
- Parameters:
- f- the- File
- Returns:
- trueif the file/directory can be traversed, otherwise- false
- Since:
- 1.4
- See Also:
- JFileChooser.isTraversable(java.io.File),- FileView.isTraversable(java.io.File)
 
 - 
getSystemDisplayNamepublic 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. Example from Windows: the "M:\" directory displays as "CD-ROM (M:)" The default implementation gets information from the ShellFolder class.- Overrides:
- getSystemDisplayNamein class- javax.swing.filechooser.FileSystemView
- Parameters:
- f- a- Fileobject
- Returns:
- the file name as it would be displayed by a native file chooser
- Since:
- 1.4
- See Also:
- JFileChooser.getName(java.io.File)
 
 - 
getSystemTypeDescriptionpublic 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. Example from Windows: the "Desktop" folder is desribed as "Desktop". Override for platforms with native ShellFolder implementations.- Overrides:
- getSystemTypeDescriptionin class- javax.swing.filechooser.FileSystemView
- Parameters:
- f- a- Fileobject
- Returns:
- the file type description as it would be displayed by a native file chooser or null if no native information is available.
- Since:
- 1.4
- See Also:
- JFileChooser.getTypeDescription(java.io.File)
 
 - 
isParentpublic 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. Folder could for example be the "Desktop" folder which is not the same as file.getParentFile().- Overrides:
- isParentin class- javax.swing.filechooser.FileSystemView
- Parameters:
- folder- a- Fileobject repesenting a directory or special folder
- file- a- Fileobject
- Returns:
- trueif- folderis a directory or special folder and contains- file.
- Since:
- 1.4
 
 - 
createNewFolderpublic java.io.File createNewFolder(java.io.File containingDir) throws java.io.IOExceptionCreates a new folder with a default folder name.- Specified by:
- createNewFolderin class- javax.swing.filechooser.FileSystemView
- Throws:
- java.io.IOException
 
 - 
isHiddenFilepublic boolean isHiddenFile(java.io.File f) Returns whether a file is hidden or not.- Overrides:
- isHiddenFilein class- javax.swing.filechooser.FileSystemView
 
 - 
getRootspublic java.io.File[] getRoots() Returns all root partitions on this system. For example, on Windows, this would be the "Desktop" folder, while on DOS this would be the A: through Z: drives.- Overrides:
- getRootsin class- javax.swing.filechooser.FileSystemView
 
 - 
getHomeDirectorypublic java.io.File getHomeDirectory() - Overrides:
- getHomeDirectoryin class- javax.swing.filechooser.FileSystemView
 
 - 
getCurrentDirectorypublic java.io.File getCurrentDirectory() Get the current directory of the remote VM.
 - 
getDefaultDirectorypublic java.io.File getDefaultDirectory() Return the user's default starting directory for the file chooser.- Overrides:
- getDefaultDirectoryin class- javax.swing.filechooser.FileSystemView
- Returns:
- a Fileobject representing the default starting folder
- Since:
- 1.4
 
 - 
createFileObjectpublic java.io.File createFileObject(java.io.File dir, java.lang.String filename)Returns a File object constructed in dir from the given filename.- Overrides:
- createFileObjectin class- javax.swing.filechooser.FileSystemView
 
 - 
createFileObjectpublic java.io.File createFileObject(java.lang.String path) Returns a File object constructed from the given path string.- Overrides:
- createFileObjectin class- javax.swing.filechooser.FileSystemView
 
 - 
getFilespublic java.io.File[] getFiles(java.io.File dir, boolean useFileHiding)Gets the list of shown (i.e. not hidden) files.- Overrides:
- getFilesin class- javax.swing.filechooser.FileSystemView
 
 - 
getParentDirectorypublic java.io.File getParentDirectory(java.io.File dir) Returns the parent directory ofdir.- Overrides:
- getParentDirectoryin class- javax.swing.filechooser.FileSystemView
- Parameters:
- dir- the- Filebeing queried
- Returns:
- the parent directory of dir, ornullifdirisnull
 
 - 
clearCachepublic void clearCache() Clear the cache.
 - 
mainpublic static void main(java.lang.String[] args) throws java.lang.ExceptionMain for testing.- Throws:
- java.lang.Exception
 
 
- 
 
-