|
Quaqua 7.4.2 2011-07-05 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectch.randelshofer.quaqua.filechooser.FileSystemTreeModel
public class FileSystemTreeModel
The FileSystemTreeModel provides the data model for the file system in a QuaquaFileChooserUI.
It is capable of resolving aliases to files, and it updates its content asynchronously to the AWT Event Dispatcher thread.
Nested Class Summary | |
---|---|
class |
FileSystemTreeModel.AliasDirectoryNode
|
class |
FileSystemTreeModel.AliasNode
|
class |
FileSystemTreeModel.DirectoryNode
This is the implementation for a directory node (a composite node). |
class |
FileSystemTreeModel.Node
This is the implementation for a file node (a leaf node). |
Field Summary | |
---|---|
static java.io.File |
COMPUTER
|
static int |
INVALID
This is used for keeping track of the validation state of a node. |
protected javax.swing.event.EventListenerList |
listenerList
We store all our listeners here. |
static int |
VALID
This is used for keeping track of the validation state of a node. |
static int |
VALIDATING
This is used for keeping track of the validation state of a node. |
Constructor Summary | |
---|---|
FileSystemTreeModel(javax.swing.JFileChooser fileChooser)
Creates a new instance. |
Method Summary | |
---|---|
void |
addTreeModelListener(javax.swing.event.TreeModelListener l)
Adds a listener for the TreeModelEvent posted after the tree changes. |
void |
clear()
Removes all children from the root node. |
protected FileSystemTreeModel.Node |
createNode(java.io.File f)
Creates a node for the specified file. |
void |
dispatchAliasResolution(java.lang.Runnable r)
|
void |
dispatchDirectoryUpdater(java.lang.Runnable r)
|
void |
dispatchFileUpdater(java.lang.Runnable r)
|
void |
dispose()
|
protected void |
fireTreeNodeChanged(FileSystemTreeModel.Node node)
Notifies all listeners that have registered interest for notification on this event type. |
protected void |
fireTreeNodesChanged(javax.swing.tree.TreeModel source,
java.lang.Object[] path,
int[] childIndices,
java.lang.Object[] children)
Notifies all listeners that have registered interest for notification on this event type. |
protected void |
fireTreeNodesInserted(javax.swing.tree.TreeModel source,
java.lang.Object[] path,
int[] childIndices,
java.lang.Object[] children)
Notifies all listeners that have registered interest for notification on this event type. |
protected void |
fireTreeNodesRemoved(javax.swing.tree.TreeModel source,
java.lang.Object[] path,
int[] childIndices,
java.lang.Object[] children)
Notifies all listeners that have registered interest for notification on this event type. |
protected void |
fireTreeStructureChanged(javax.swing.tree.TreeModel source,
java.lang.Object[] path)
Notifies all listeners that have registered interest for notification on this event type. |
java.lang.Object |
getChild(java.lang.Object parent,
int index)
|
int |
getChildCount(java.lang.Object parent)
|
int |
getIndexOfChild(java.lang.Object parent,
java.lang.Object child)
|
FileSystemTreeModel.Node |
getPrototypeValue()
|
java.lang.Object |
getRoot()
|
void |
invalidateAll()
Invalidates all nodes in the tree. |
void |
invalidateCache()
|
void |
invalidatePath(javax.swing.tree.TreePath path)
Invalidates the provided path. |
boolean |
isAutoValidate()
|
boolean |
isLeaf(java.lang.Object node)
|
boolean |
isResolveAliasesToFiles()
|
boolean |
isResolveFileLabels()
|
void |
lazyInvalidatePath(javax.swing.tree.TreePath path)
Lazily invalidates the provided path. |
void |
removeTreeModelListener(javax.swing.event.TreeModelListener l)
Removes a listener previously added with addTreeModelListener(). |
void |
setAutoValidate(boolean b)
Sets auto validation of the tree. |
void |
setResolveAliasesToFiles(boolean newValue)
|
void |
setResolveFileLabels(boolean newValue)
|
void |
stopValidation()
Stalls validation of the the provided path. |
javax.swing.tree.TreePath |
toPath(java.io.File file,
javax.swing.tree.TreePath templatePath)
|
javax.swing.tree.TreePath |
toPath0(java.io.File file)
|
void |
validatePath(javax.swing.tree.TreePath path)
Validates (refreshes) the nodes specified by the provided path. |
void |
valueForPathChanged(javax.swing.tree.TreePath path,
java.lang.Object newValue)
Messaged when the user has altered the value for the item identified by path to newValue . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.io.File COMPUTER
public static final int INVALID
public static final int VALIDATING
public static final int VALID
protected javax.swing.event.EventListenerList listenerList
Constructor Detail |
---|
public FileSystemTreeModel(javax.swing.JFileChooser fileChooser)
fileChooser
- The JFileChooser is used to determine the user
presentable (localized) names of the files.Method Detail |
---|
public void dispatchDirectoryUpdater(java.lang.Runnable r)
public void dispatchFileUpdater(java.lang.Runnable r)
public void dispatchAliasResolution(java.lang.Runnable r)
public void clear()
public void dispose()
public FileSystemTreeModel.Node getPrototypeValue()
public java.lang.Object getChild(java.lang.Object parent, int index)
getChild
in interface javax.swing.tree.TreeModel
public int getChildCount(java.lang.Object parent)
getChildCount
in interface javax.swing.tree.TreeModel
public int getIndexOfChild(java.lang.Object parent, java.lang.Object child)
getIndexOfChild
in interface javax.swing.tree.TreeModel
public java.lang.Object getRoot()
getRoot
in interface javax.swing.tree.TreeModel
protected FileSystemTreeModel.Node createNode(java.io.File f)
public javax.swing.tree.TreePath toPath(java.io.File file, javax.swing.tree.TreePath templatePath)
public javax.swing.tree.TreePath toPath0(java.io.File file)
public boolean isLeaf(java.lang.Object node)
isLeaf
in interface javax.swing.tree.TreeModel
public void valueForPathChanged(javax.swing.tree.TreePath path, java.lang.Object newValue)
path
to newValue
.
If newValue
signifies a truly new value
the model should post a treeNodesChanged
event.
valueForPathChanged
in interface javax.swing.tree.TreeModel
path
- path to the node that the user has alterednewValue
- the new value from the TreeCellEditorpublic void setAutoValidate(boolean b)
public boolean isAutoValidate()
public void setResolveAliasesToFiles(boolean newValue)
public boolean isResolveAliasesToFiles()
public void setResolveFileLabels(boolean newValue)
public boolean isResolveFileLabels()
public void invalidateCache()
public void invalidatePath(javax.swing.tree.TreePath path)
public void invalidateAll()
public void stopValidation()
public void lazyInvalidatePath(javax.swing.tree.TreePath path)
public void validatePath(javax.swing.tree.TreePath path)
public void addTreeModelListener(javax.swing.event.TreeModelListener l)
addTreeModelListener
in interface javax.swing.tree.TreeModel
l
- the listener to addremoveTreeModelListener(javax.swing.event.TreeModelListener)
public void removeTreeModelListener(javax.swing.event.TreeModelListener l)
removeTreeModelListener
in interface javax.swing.tree.TreeModel
l
- the listener to removeaddTreeModelListener(javax.swing.event.TreeModelListener)
protected void fireTreeNodeChanged(FileSystemTreeModel.Node node)
node
- the node being changedEventListenerList
protected void fireTreeNodesChanged(javax.swing.tree.TreeModel source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)
source
- the node being changedpath
- the path to the root nodechildIndices
- the indices of the changed elementschildren
- the changed elementsEventListenerList
protected void fireTreeNodesInserted(javax.swing.tree.TreeModel source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)
source
- the node where new elements are being insertedpath
- the path to the root nodechildIndices
- the indices of the new elementschildren
- the new elementsEventListenerList
protected void fireTreeNodesRemoved(javax.swing.tree.TreeModel source, java.lang.Object[] path, int[] childIndices, java.lang.Object[] children)
source
- the node where elements are being removedpath
- the path to the root nodechildIndices
- the indices of the removed elementschildren
- the removed elementsEventListenerList
protected void fireTreeStructureChanged(javax.swing.tree.TreeModel source, java.lang.Object[] path)
source
- the node where the tree model has changedpath
- the path to the root nodeEventListenerList
|
Copyright 2003-2007 (c) Werner Randelshofer. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |