org.apache.webdav.ui
Class WebdavSystemView

java.lang.Object
  extended by javax.swing.filechooser.FileSystemView
      extended by org.apache.webdav.ui.WebdavSystemView

public class WebdavSystemView
extends javax.swing.filechooser.FileSystemView

WebdavSystemView.java


Constructor Summary
WebdavSystemView(java.lang.String uri, java.lang.String rootPath, java.lang.String username, java.lang.String password)
           
 
Method Summary
 void connect()
           
 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.
protected  java.io.File createFileSystemRoot(java.io.File f)
          Creates a new File object for f with correct behavior for a file system root directory.
 java.io.File createNewFolder(java.io.File containingDir)
          Creates a new folder with a default folder name.
 void disconnect()
           
 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.
static javax.swing.filechooser.FileSystemView getFileSystemView()
           
 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.
 boolean isComputerNode(java.io.File dir)
          Used by UI classes to decide whether to display a special icon for a computer node, e.g.
 boolean isDrive(java.io.File dir)
          Used by UI classes to decide whether to display a special icon for drives or partitions, e.g.
 boolean isFileSystem(java.io.File f)
          Checks if f represents a real directory or file as opposed to a special folder such as "Desktop".
 boolean isFileSystemRoot(java.io.File dir)
          Is dir the root of a tree in the file system, such as a drive or partition.
 boolean isFloppyDrive(java.io.File dir)
          Used by UI classes to decide whether to display a special icon for a floppy disk.
 boolean isHiddenFile(java.io.File f)
          Returns whether a file is hidden or not.
 java.lang.Boolean isTraversable(java.io.File f)
          Returns true if the file (directory) can be visited.
static void main(java.lang.String[] args)
           
 
Methods inherited from class javax.swing.filechooser.FileSystemView
getChild, getSystemIcon, isParent, isRoot
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebdavSystemView

public WebdavSystemView(java.lang.String uri,
                        java.lang.String rootPath,
                        java.lang.String username,
                        java.lang.String password)
                 throws java.lang.IllegalAccessError,
                        org.apache.commons.httpclient.URIException,
                        java.io.IOException
Throws:
java.lang.IllegalAccessError
org.apache.commons.httpclient.URIException
java.io.IOException
Method Detail

disconnect

public void disconnect()
                throws java.lang.UnknownError
Throws:
java.lang.UnknownError

connect

public void connect()
             throws java.lang.IllegalAccessError
Throws:
java.lang.IllegalAccessError

getFileSystemView

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

createFileObject

public java.io.File createFileObject(java.io.File dir,
                                     java.lang.String filename)
Returns a File object constructed in dir from the given filename.

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

createFileObject

public java.io.File createFileObject(java.lang.String path)
Returns a File object constructed from the given path string.

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

createNewFolder

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

Specified by:
createNewFolder in class javax.swing.filechooser.FileSystemView
Throws:
java.io.IOException

getRoots

public 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:
getRoots in class javax.swing.filechooser.FileSystemView

isTraversable

public 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:
isTraversable in class javax.swing.filechooser.FileSystemView
Parameters:
f - the File
Returns:
true if the file/directory can be traversed, otherwise false
See Also:
JFileChooser#isTraversable, FileView#isTraversable

getSystemDisplayName

public 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:
getSystemDisplayName in class javax.swing.filechooser.FileSystemView
Parameters:
f - a File object
Returns:
the file name as it would be displayed by a native file chooser
See Also:
JFileChooser#getName

getSystemTypeDescription

public 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:
getSystemTypeDescription in class javax.swing.filechooser.FileSystemView
Parameters:
f - a File object
Returns:
the file type description as it would be displayed by a native file chooser or null if no native information is available.
See Also:
JFileChooser#getTypeDescription

isFileSystem

public boolean isFileSystem(java.io.File f)
Checks if f represents a real directory or file as opposed to a special folder such as "Desktop". Used by UI classes to decide if a folder is selectable when doing directory choosing.

Overrides:
isFileSystem in class javax.swing.filechooser.FileSystemView
Parameters:
f - a File object
Returns:
true if f is a real file or directory.

isHiddenFile

public boolean isHiddenFile(java.io.File f)
Returns whether a file is hidden or not.

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

isFileSystemRoot

public boolean isFileSystemRoot(java.io.File dir)
Is dir the root of a tree in the file system, such as a drive or partition. Example: Returns true for "C:\" on Windows 98.

Overrides:
isFileSystemRoot in class javax.swing.filechooser.FileSystemView
Parameters:
f - a File object representing a directory
Returns:
true if f is a root of a filesystem
See Also:
FileSystemView.isRoot(java.io.File)

isDrive

public boolean isDrive(java.io.File dir)
Used by UI classes to decide whether to display a special icon for drives or partitions, e.g. a "hard disk" icon. The default implementation has no way of knowing, so always returns false.

Overrides:
isDrive in class javax.swing.filechooser.FileSystemView
Parameters:
dir - a directory
Returns:
false always

isFloppyDrive

public boolean isFloppyDrive(java.io.File dir)
Used by UI classes to decide whether to display a special icon for a floppy disk. Implies isDrive(dir). The default implementation has no way of knowing, so always returns false.

Overrides:
isFloppyDrive in class javax.swing.filechooser.FileSystemView
Parameters:
dir - a directory
Returns:
false always

isComputerNode

public boolean isComputerNode(java.io.File dir)
Used by UI classes to decide whether to display a special icon for a computer node, e.g. "My Computer" or a network server. The default implementation has no way of knowing, so always returns false.

Overrides:
isComputerNode in class javax.swing.filechooser.FileSystemView
Parameters:
dir - a directory
Returns:
false always

getHomeDirectory

public java.io.File getHomeDirectory()
Overrides:
getHomeDirectory in class javax.swing.filechooser.FileSystemView

getDefaultDirectory

public java.io.File getDefaultDirectory()
Return the user's default starting directory for the file chooser.

Overrides:
getDefaultDirectory in class javax.swing.filechooser.FileSystemView
Returns:
a File object representing the default starting folder

getFiles

public java.io.File[] getFiles(java.io.File dir,
                               boolean useFileHiding)
Gets the list of shown (i.e. not hidden) files.

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

getParentDirectory

public java.io.File getParentDirectory(java.io.File dir)
Returns the parent directory of dir.

Overrides:
getParentDirectory in class javax.swing.filechooser.FileSystemView
Parameters:
dir - the File being queried
Returns:
the parent directory of dir, or null if dir is null

createFileSystemRoot

protected java.io.File createFileSystemRoot(java.io.File f)
Creates a new File object for f with correct behavior for a file system root directory.

Overrides:
createFileSystemRoot in class javax.swing.filechooser.FileSystemView
Parameters:
f - a File object representing a file system root directory, for example "/" on Unix or "C:\" on Windows.
Returns:
a new File object

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception


Copyright © {inceptionYear}-2006 null. All Rights Reserved.