|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--edu.virginia.cs.mng.hypercast.demo.FileSystemModel2.FileNode
A FileNode is a derivative of the File class - though we delegate to the File object rather than subclassing it. It is used to maintain a cache of a directory's children and therefore avoid repeated access to the underlying file system during rendering.
| Field Summary | |
protected java.lang.String |
canonicalPath
Path of the receiver. |
protected FileSystemModel2.FileNode[] |
children
Children of the receiver. |
protected java.io.File |
file
java.io.File the receiver represents. |
protected boolean |
isLink
True if the canonicalPath of this instance does not start with the canonical path of the parent. |
protected java.util.Date |
lastModified
Date last modified. |
private FileSystemModel2.FileNode |
parent
Parent FileNode of the receiver. |
protected long |
totalSize
Size of the receiver and all its children. |
protected boolean |
totalSizeValid
Valid if the totalSize has finished being calced. |
| Constructor Summary | |
protected |
FileSystemModel2.FileNode(java.io.File file)
|
protected |
FileSystemModel2.FileNode(FileSystemModel2.FileNode parent,
java.io.File file)
|
| Method Summary | |
protected void |
alterTotalSize(long sizeDelta)
|
protected void |
childTotalSizeChanged(FileSystemModel2.FileNode child)
Invoked when a childs total size has changed. |
protected FileSystemModel2.FileNode[] |
createChildren(MergeSort sorter)
Loads the children of of the receiver. |
protected void |
forceTotalSizeValid()
Marks the receivers total size as valid, but does not invoke node changed, nor message the parent. |
java.lang.String |
getCanonicalPath()
Returns the canonical path for the receiver. |
protected FileSystemModel2.FileNode[] |
getChildren()
Loads the children, caching the results in the children instance variable. |
java.io.File |
getFile()
Returns the java.io.File the receiver represents. |
FileSystemModel2.FileNode |
getParent()
Returns the parent of the receiver. |
FileSystemModel2.FileNode[] |
getPath()
Gets the path from the root to the receiver. |
protected FileSystemModel2.FileNode[] |
getPathToRoot(FileSystemModel2.FileNode aNode,
int depth)
|
boolean |
isLeaf()
Returns true if the receiver represents a leaf, that is it is isn't a directory. |
boolean |
isLink()
Returns true if the receiver's path does not begin with the parent's canonical path. |
boolean |
isTotalSizeValid()
Returns true if the total size is valid. |
java.util.Date |
lastModified()
Returns the date the receiver was last modified. |
protected void |
loadChildren(MergeSort sorter)
Recursively loads all the children of the receiver. |
protected boolean |
loadedChildren()
Returns true if the children have been loaded. |
protected void |
nodeChanged()
Can be invoked when a node has changed, will create the appropriate event. |
protected void |
resetLastModified()
Clears the date. |
protected void |
resetSize()
Sets the size of the receiver to be 0. |
protected void |
setChildren(FileSystemModel2.FileNode[] newChildren,
boolean generateEvent)
Sets the children of the receiver, updates the total size, and if generateEvent is true a tree structure changed event is created. |
protected void |
setTotalSizeValid(boolean newValue)
This should only be invoked on the event dispatching thread. |
java.lang.String |
toString()
Returns the the string to be used to display this leaf in the JTree. |
long |
totalSize()
Returns size of the receiver and all its children. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
protected java.io.File file
private FileSystemModel2.FileNode parent
protected FileSystemModel2.FileNode[] children
protected long totalSize
protected boolean totalSizeValid
protected java.lang.String canonicalPath
protected boolean isLink
protected java.util.Date lastModified
| Constructor Detail |
protected FileSystemModel2.FileNode(java.io.File file)
protected FileSystemModel2.FileNode(FileSystemModel2.FileNode parent,
java.io.File file)
| Method Detail |
public java.util.Date lastModified()
public java.lang.String toString()
public java.io.File getFile()
public long totalSize()
public FileSystemModel2.FileNode getParent()
public boolean isLeaf()
public boolean isTotalSizeValid()
protected void resetLastModified()
protected void resetSize()
protected FileSystemModel2.FileNode[] getChildren()
protected void loadChildren(MergeSort sorter)
protected FileSystemModel2.FileNode[] createChildren(MergeSort sorter)
protected boolean loadedChildren()
public FileSystemModel2.FileNode[] getPath()
public java.lang.String getCanonicalPath()
public boolean isLink()
protected FileSystemModel2.FileNode[] getPathToRoot(FileSystemModel2.FileNode aNode,
int depth)
protected void setChildren(FileSystemModel2.FileNode[] newChildren,
boolean generateEvent)
protected void alterTotalSize(long sizeDelta)
protected void setTotalSizeValid(boolean newValue)
protected void forceTotalSizeValid()
protected void childTotalSizeChanged(FileSystemModel2.FileNode child)
protected void nodeChanged()
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||