de.enough.polish.io.file
Class FileSystemTreeModel

java.lang.Object
  extended by de.enough.polish.io.file.FileSystemTreeModel
All Implemented Interfaces:
TreeModel
Direct Known Subclasses:
UiFileSystemTreeModel

public class FileSystemTreeModel
extends Object
implements TreeModel

Provides the file system of a device as a TreeModel. For working efficiently with a TreeItem, use UiFileSystemTreeModel.

Author:
Robert Virkus
See Also:
TreeModel, TreeItem, UiFileSystemTreeModel

Constructor Summary
FileSystemTreeModel()
           
 
Method Summary
 void addChildren(Object parent, ArrayList list)
          Returns the number of children of parent.
 Object getRoot()
          Returns the root of the tree.
 boolean isLeaf(Object node)
          Returns true if node is a leaf.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileSystemTreeModel

public FileSystemTreeModel()
Method Detail

addChildren

public void addChildren(Object parent,
                        ArrayList list)
Description copied from interface: TreeModel
Returns the number of children of parent. Returns 0 if the node is a leaf or if it has no children. parent must be a node previously obtained from this TreeModel.

Specified by:
addChildren in interface TreeModel
Parameters:
parent - a node in the tree, obtained from this TreeModel
list - the ArrayList into which the children should be added

getRoot

public Object getRoot()
Description copied from interface: TreeModel
Returns the root of the tree. Returns null only if the tree has no nodes. Note: The root element itself is not shown by a TreeItem.

Specified by:
getRoot in interface TreeModel
Returns:
the root of the tree

isLeaf

public boolean isLeaf(Object node)
Description copied from interface: TreeModel
Returns true if node is a leaf. It is possible for this method to return false even if node has no children. A directory in a filesystem, for example, may contain no files; the node representing the directory is not a leaf, but it also has no children.

Specified by:
isLeaf in interface TreeModel
Parameters:
node - a node in the tree, obtained from this TreeModel
Returns:
true if the node is a leaf