uk.ac.rdg.resc.jstyx.client
Class StyxFileSystemView

java.lang.Object
  extended by javax.swing.filechooser.FileSystemView
      extended by uk.ac.rdg.resc.jstyx.client.StyxFileSystemView

public class StyxFileSystemView
extends javax.swing.filechooser.FileSystemView

A FileSystemView for a Styx filesystem that can be used by a JFileChooser to select files on a remote Styx server

Author:
Jon Blower $Revision: 259 $ $Date: 2005-05-23 17:48:23 +0100 (Mon, 23 May 2005) $ $Log$ Revision 1.4 2005/05/23 16:48:17 jonblower Overhauled CStyxFile (esp. asynchronous methods) and StyxConnection (added cache of CStyxFiles) Revision 1.3 2005/03/11 13:58:25 jonblower Merged MINA-Test_20059309 into main line of development Revision 1.2.2.1 2005/03/11 08:29:52 jonblower Moved to log4j logging system (from apache commons logging) Revision 1.1 2005/03/07 08:27:51 jonblower Initial import

Constructor Summary
StyxFileSystemView(StyxConnection conn)
          Creates a new instance of StyxFileSystemView to view the contents of the Styx server on the given StyxConnection.
 
Method Summary
 java.io.File createFileObject(java.io.File dir, java.lang.String filename)
           
 java.io.File createFileObject(java.lang.String path)
           
protected  java.io.File createFileSystemRoot(java.io.File f)
           
 java.io.File createNewFolder(java.io.File containingDir)
          Creates a new folder with a default folder name
 java.io.File getChild(java.io.File parent, java.lang.String fileName)
           
 java.io.File getDefaultDirectory()
          Simply calls getHomeDirectory();
 java.io.File[] getFiles(java.io.File dir, boolean useFileHiding)
          gets the list of files in the given directory
static javax.swing.filechooser.FileSystemView getFileSystemView()
           
 java.io.File getHomeDirectory()
           
 java.io.File getParentDirectory(java.io.File f)
           
 java.io.File[] getRoots()
          Gets the root of the remote Styx server, as a (single-membered) array of FileWrappers that wraps the CStyxFile that represents the root of the server
 java.lang.String getSystemDisplayName(java.io.File f)
          Always returns the name of the file (not the full path)
 boolean isComputerNode(java.io.File f)
           
 boolean isDrive(java.io.File f)
           
 boolean isFileSystem(java.io.File f)
          Always returns false (all files are "real" files)
 boolean isFileSystemRoot(java.io.File dir)
           
 boolean isFloppyDrive(java.io.File f)
           
 boolean isHiddenFile(java.io.File f)
          Always returns false
 boolean isParent(java.io.File folder, java.io.File file)
           
 boolean isRoot(java.io.File f)
           
 java.lang.Boolean isTraversable(java.io.File f)
           
static void main(java.lang.String[] args)
          Test function for StyxFileSystemView
 
Methods inherited from class javax.swing.filechooser.FileSystemView
getSystemIcon, getSystemTypeDescription
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StyxFileSystemView

public StyxFileSystemView(StyxConnection conn)
Creates a new instance of StyxFileSystemView to view the contents of the Styx server on the given StyxConnection.

Method Detail

getFileSystemView

public static javax.swing.filechooser.FileSystemView getFileSystemView()

isRoot

public boolean isRoot(java.io.File f)
Overrides:
isRoot in class javax.swing.filechooser.FileSystemView
Returns:
true if the given File is a root in the filesystem. Simply returns true if the file's path is "/"

isFileSystemRoot

public boolean isFileSystemRoot(java.io.File dir)
Overrides:
isFileSystemRoot in class javax.swing.filechooser.FileSystemView
Returns:
true if this file is the root directory (i.e. its path equals "/") Simply calls this.isRoot(f)

getHomeDirectory

public java.io.File getHomeDirectory()
Overrides:
getHomeDirectory in class javax.swing.filechooser.FileSystemView
Returns:
FileWrapper that wraps the root directory of the remote Styx server

getDefaultDirectory

public java.io.File getDefaultDirectory()
Simply calls getHomeDirectory();

Overrides:
getDefaultDirectory in class javax.swing.filechooser.FileSystemView

getFiles

public java.io.File[] getFiles(java.io.File dir,
                               boolean useFileHiding)
gets the list of files in the given directory

Overrides:
getFiles in class javax.swing.filechooser.FileSystemView

getParentDirectory

public java.io.File getParentDirectory(java.io.File f)
Overrides:
getParentDirectory in class javax.swing.filechooser.FileSystemView
Returns:
a FileWrapper representing the parent directory of the given File

getRoots

public java.io.File[] getRoots()
Gets the root of the remote Styx server, as a (single-membered) array of FileWrappers that wraps the CStyxFile that represents the root of the server

Overrides:
getRoots in class javax.swing.filechooser.FileSystemView

createNewFolder

public java.io.File createNewFolder(java.io.File containingDir)
Creates a new folder with a default folder name

Specified by:
createNewFolder in class javax.swing.filechooser.FileSystemView

createFileObject

public java.io.File createFileObject(java.io.File dir,
                                     java.lang.String filename)
Overrides:
createFileObject in class javax.swing.filechooser.FileSystemView
Returns:
a FileWrapper object constructed from the given directory and filename

createFileObject

public java.io.File createFileObject(java.lang.String path)
Overrides:
createFileObject in class javax.swing.filechooser.FileSystemView
Returns:
a FileWrapper object constructed from the given path string

getChild

public java.io.File getChild(java.io.File parent,
                             java.lang.String fileName)
Overrides:
getChild in class javax.swing.filechooser.FileSystemView
Returns:
a new FileWrapper representing the given child of the given directory

isParent

public boolean isParent(java.io.File folder,
                        java.io.File file)
Overrides:
isParent in class javax.swing.filechooser.FileSystemView
Returns:
true if folder contains file

isFileSystem

public boolean isFileSystem(java.io.File f)
Always returns false (all files are "real" files)

Overrides:
isFileSystem in class javax.swing.filechooser.FileSystemView

getSystemDisplayName

public java.lang.String getSystemDisplayName(java.io.File f)
Always returns the name of the file (not the full path)

Overrides:
getSystemDisplayName in class javax.swing.filechooser.FileSystemView

isHiddenFile

public boolean isHiddenFile(java.io.File f)
Always returns false

Overrides:
isHiddenFile in class javax.swing.filechooser.FileSystemView

isDrive

public boolean isDrive(java.io.File f)
Overrides:
isDrive in class javax.swing.filechooser.FileSystemView

isFloppyDrive

public boolean isFloppyDrive(java.io.File f)
Overrides:
isFloppyDrive in class javax.swing.filechooser.FileSystemView

isComputerNode

public boolean isComputerNode(java.io.File f)
Overrides:
isComputerNode in class javax.swing.filechooser.FileSystemView

isTraversable

public java.lang.Boolean isTraversable(java.io.File f)
Overrides:
isTraversable in class javax.swing.filechooser.FileSystemView
Returns:
true if the file is a directory

createFileSystemRoot

protected java.io.File createFileSystemRoot(java.io.File f)
Overrides:
createFileSystemRoot in class javax.swing.filechooser.FileSystemView

main

public static void main(java.lang.String[] args)
Test function for StyxFileSystemView



Copyright © 2004-2006 Reading e-Science Centre. All Rights Reserved.