Treeviz 0.37 2010-10-17

ch.randelshofer.tree.demo
Class FileNode

java.lang.Object
  extended by ch.randelshofer.tree.demo.FileNode
All Implemented Interfaces:
TreeNode

public class FileNode
extends java.lang.Object
implements TreeNode

The FileNode implements an example of HTNode encapsulating a File.


Constructor Summary
FileNode(java.io.File file)
          Constructor.
FileNode(java.io.File file, java.io.File onlyChild)
           
FileNode(ProgressObserver p, int depth, java.io.File file)
          Constructor.
FileNode(ProgressObserver p, int depth, java.io.File file, java.io.File onlyChild)
          Constructor.
 
Method Summary
protected  void addChild(FileNode child)
          Add child to the node.
 java.util.List<TreeNode> children()
          Returns the children of this node in an Enumeration.
 void dump(int depth)
           
 boolean getAllowsChildren()
          Returns true if this node is not a directory.
 int getDescendantCount()
           
 long getFileSize()
           
 long getLastModified()
           
 java.lang.String getName()
          Returns the name of the file.
 java.lang.String getToolTipText()
           
 long getUnweightedSize()
           
 float getWeight()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileNode

public FileNode(java.io.File file)
Constructor.

Parameters:
file - the File encapsulated in this node

FileNode

public FileNode(java.io.File file,
                java.io.File onlyChild)

FileNode

public FileNode(ProgressObserver p,
                int depth,
                java.io.File file)
Constructor.

Parameters:
file - the File encapsulated in this node

FileNode

public FileNode(ProgressObserver p,
                int depth,
                java.io.File file,
                java.io.File onlyChild)
Constructor.

Parameters:
file - the File encapsulated in this node
Method Detail

getLastModified

public long getLastModified()

addChild

protected void addChild(FileNode child)
Add child to the node.

Parameters:
child - the HSBFileNodeto add as a child

children

public java.util.List<TreeNode> children()
Returns the children of this node in an Enumeration. If this node is a file, return a empty Enumeration. Else, return an Enumeration full with FileNode.

Specified by:
children in interface TreeNode
Returns:
an Iterator containing child values of this node

getAllowsChildren

public boolean getAllowsChildren()
Returns true if this node is not a directory.

Specified by:
getAllowsChildren in interface TreeNode
Returns:
false if this node is a directory; true otherwise

getName

public java.lang.String getName()
Returns the name of the file.

Returns:
the name of the file

getFileSize

public long getFileSize()

getUnweightedSize

public long getUnweightedSize()

getWeight

public float getWeight()

getToolTipText

public java.lang.String getToolTipText()

dump

public void dump(int depth)

getDescendantCount

public int getDescendantCount()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Copyright 2007-2008 (c) Werner Randelshofer.
All rights reserved.