All Packages Class Hierarchy This Package Previous Next Index
Class com.sun.java.swing.DirectoryModel
java.lang.Object
|
+----com.sun.java.swing.DirectoryModel
- public class DirectoryModel
- extends Object
Models what goes on in a directory of typed files. Has a notion of
its current directory, and provides a notion of file typing.
Can be told to "go up". Fakes a meta level above the root file
system(s) if it thinks this is a Windows box.
-
changeSupport
-
-
cleanupTypes
- Types to check if none of the general ones match.
-
curDir
- Where this chooser is.
-
currentFiles
- Cache of the TypedFiles of the local directory
-
currentFilesFresh
- True if the
currentFiles
cache is trustworth,
false if it should be refreshed
-
haveCheckedWindows
- True if we have executed our hack to see if this is a
Windows file system
-
hiddenRule
- This type is never assigned to a file.
-
isWindows
- Undefined if haveCheckedWindows is false.
-
knownTypes
- All types that are known to this file chooser.
-
listenerList
-
-
overrideTypes
- Special tests that must be failed before any general types
are assigned.
-
sharedWindowsRootDir
-
-
shownType
- The type that may be shown.
-
DirectoryModel()
- Returns a DirectoryModel whose current directory is
the user's home dir
-
DirectoryModel(File)
- Returns a DirectoryModel with current directory
path
-
addKnownFileType(FileType)
-
-
addPropertyChangeListener(PropertyChangeListener)
-
-
applyTypeToFile(FileType, TypedFile)
- Little convenience used by
deduceAndSetTypeOfFile
This is the only place TypedFile.setType
is called
-
canGoUp()
-
-
deduceAndSetTypeOfFile(TypedFile)
- Search the known types et al for the one that applies to
f
.
-
enumerateKnownFileTypes()
-
-
firePropertyChange(String, Object, Object)
-
-
getCurrentDirectory()
-
-
getHiddenRule()
-
-
getKnownFileTypes()
-
-
getSharedWindowsRootDir()
-
-
getShownType()
-
-
getTypedFile(String)
- Given a path, return a TypedFile
-
getTypedFile(String, String)
- Given a path and a file name, return a TypedFile
-
getTypedFiles()
- Convenience, same as
this.getTypedFilesForDirectory(this.getCurrentDirectory())
-
getTypedFilesForDirectory(File)
- Return a Vector of the files in the given directory, filtered
according to
knownTypes
and hiddenRule.
-
goUp()
-
-
invalidateCache()
- Invalidates the cached copy of the current directory
-
isKnownFileType(FileType)
-
-
isWindowsFileSystem()
-
-
lt(TypedFile, TypedFile)
-
-
makeAbsolute(File)
- Convenience method, may return the same object,
or a new one if the give was relative.
-
quickSort(Vector, int, int)
- This is a generic version of C.A.R Hoare's Quick Sort
algorithm.
-
removePropertyChangeListener(PropertyChangeListener)
-
-
setCurrentDirectory(File)
- Change the directory that is the location of this model.
-
setHiddenRule(FileType)
-
-
setKnownFileTypes(FileType[])
-
-
setShownType(FileType)
-
-
sort(Vector)
-
currentFiles
protected transient Vector currentFiles
- Cache of the TypedFiles of the local directory
currentFilesFresh
protected transient boolean currentFilesFresh
- True if the
currentFiles
cache is trustworth,
false if it should be refreshed
knownTypes
protected Vector knownTypes
- All types that are known to this file chooser. In an ideal world,
this would be system level information.
shownType
protected FileType shownType
- The type that may be shown. If null, all types shown.
hiddenRule
protected FileType hiddenRule
- This type is never assigned to a file. Rather, it is a general
rule to apply after all typing and showing is done. E.g., this
is how to hide all files that start with '.', regardless of
type.
overrideTypes
protected FileType overrideTypes[]
- Special tests that must be failed before any general types
are assigned. Devices and such.
cleanupTypes
protected FileType cleanupTypes[]
- Types to check if none of the general ones match. Last type in
this array must always return true for
testFile
curDir
protected File curDir
- Where this chooser is. Provides context for unqualified calls to
getTypedFile
and getTypedFiles
, or calls
with relative paths.
haveCheckedWindows
protected boolean haveCheckedWindows
- True if we have executed our hack to see if this is a
Windows file system
isWindows
protected boolean isWindows
- Undefined if haveCheckedWindows is false. Otherwise, true if we
think this is a windows file system.
listenerList
protected EventListenerList listenerList
changeSupport
protected PropertyChangeSupport changeSupport
sharedWindowsRootDir
protected static DirectoryModel. WindowsRootDir sharedWindowsRootDir
DirectoryModel
public DirectoryModel()
- Returns a DirectoryModel whose current directory is
the user's home dir
DirectoryModel
public DirectoryModel(File path)
- Returns a DirectoryModel with current directory
path
makeAbsolute
protected File makeAbsolute(File f)
- Convenience method, may return the same object,
or a new one if the give was relative.
If
f instanceof TypedFile
, a
TypedFile
is returned.
getCurrentDirectory
public File getCurrentDirectory()
setCurrentDirectory
public void setCurrentDirectory(File dir)
- Change the directory that is the location of this model.
Null means go to the user's home directory
Emit a ChangeEvent if directory is actually changed.
invalidateCache
protected void invalidateCache()
- Invalidates the cached copy of the current directory
getTypedFile
public TypedFile getTypedFile(String path,
String name)
- Given a path and a file name, return a TypedFile
getTypedFile
public TypedFile getTypedFile(String path)
- Given a path, return a TypedFile
getTypedFiles
public Vector getTypedFiles()
- Convenience, same as
this.getTypedFilesForDirectory(this.getCurrentDirectory())
getTypedFilesForDirectory
public Vector getTypedFilesForDirectory(File dir)
- Return a Vector of the files in the given directory, filtered
according to
knownTypes
and hiddenRule. The Vector
may be empty.
The objects in the Vector are of instances of TypedFile
applyTypeToFile
protected boolean applyTypeToFile(FileType t,
TypedFile f)
- Little convenience used by
deduceAndSetTypeOfFile
This is the only place TypedFile.setType
is called
deduceAndSetTypeOfFile
protected void deduceAndSetTypeOfFile(TypedFile f)
- Search the known types et al for the one that applies to
f
. Must be called before f.getType()
is ever called. Do not call this twice on the same instance of
Typedfile, and do not call f.setType()
after this.
canGoUp
public boolean canGoUp()
goUp
public void goUp()
setHiddenRule
public void setHiddenRule(FileType rule)
getHiddenRule
public FileType getHiddenRule()
getShownType
public FileType getShownType()
setShownType
public void setShownType(FileType t)
addKnownFileType
public void addKnownFileType(FileType type)
enumerateKnownFileTypes
public Enumeration enumerateKnownFileTypes()
getKnownFileTypes
public Vector getKnownFileTypes()
isKnownFileType
public boolean isKnownFileType(FileType t)
setKnownFileTypes
public void setKnownFileTypes(FileType types[])
firePropertyChange
protected void firePropertyChange(String propertyName,
Object oldValue,
Object newValue)
addPropertyChangeListener
public synchronized void addPropertyChangeListener(PropertyChangeListener listener)
removePropertyChangeListener
public synchronized void removePropertyChangeListener(PropertyChangeListener listener)
isWindowsFileSystem
protected boolean isWindowsFileSystem()
getSharedWindowsRootDir
public static DirectoryModel. WindowsRootDir getSharedWindowsRootDir()
sort
protected void sort(Vector v)
lt
protected boolean lt(TypedFile a,
TypedFile b)
quickSort
protected void quickSort(Vector v,
int lo0,
int hi0)
- This is a generic version of C.A.R Hoare's Quick Sort
algorithm. This will handle arrays that are already
sorted, and arrays with duplicate keys.
If you think of a one dimensional array as going from
the lowest index on the left to the highest index on the right
then the parameters to this function are lowest index or
left and highest index or right. The first time you call
this function it will be with the parameters 0, a.length - 1.
- Parameters:
- a - an integer array
- lo0 - left boundary of array partition
- hi0 - right boundary of array partition
All Packages Class Hierarchy This Package Previous Next Index