net.metanotion.io.gui
Class FSTreeModel

java.lang.Object
  extended by net.metanotion.io.gui.FSTreeModel
All Implemented Interfaces:
TreeModel

public class FSTreeModel
extends Object
implements TreeModel

Implementation of a Swing TreeModel so a FileSystem can be used as a model of a Swing TreeView control.


Constructor Summary
FSTreeModel(FileSystem fs)
           
 
Method Summary
 void addTreeModelListener(TreeModelListener l)
           
 Object getChild(Object parent, int index)
          Return the child file based on the index given.
 int getChildCount(Object parent)
          Count the number of files in a directory.
 int getIndexOfChild(Object parent, Object child)
          Return the appropriate index based on the child and parent handed to it.
 Object getRoot()
           
 boolean isLeaf(Object node)
           
 void removeTreeModelListener(TreeModelListener l)
           
 void valueForPathChanged(TreePath path, Object newValue)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FSTreeModel

public FSTreeModel(FileSystem fs)
Method Detail

getChild

public Object getChild(Object parent,
                       int index)
Return the child file based on the index given.

Specified by:
getChild in interface TreeModel

getChildCount

public int getChildCount(Object parent)
Count the number of files in a directory.

Specified by:
getChildCount in interface TreeModel
Parameters:
parent - This should be a File object handed out by the FileSystem object handed to the constructor.

getIndexOfChild

public int getIndexOfChild(Object parent,
                           Object child)
Return the appropriate index based on the child and parent handed to it.

Specified by:
getIndexOfChild in interface TreeModel

getRoot

public Object getRoot()
Specified by:
getRoot in interface TreeModel

isLeaf

public boolean isLeaf(Object node)
Specified by:
isLeaf in interface TreeModel

addTreeModelListener

public void addTreeModelListener(TreeModelListener l)
Specified by:
addTreeModelListener in interface TreeModel

removeTreeModelListener

public void removeTreeModelListener(TreeModelListener l)
Specified by:
removeTreeModelListener in interface TreeModel

valueForPathChanged

public void valueForPathChanged(TreePath path,
                                Object newValue)
Specified by:
valueForPathChanged in interface TreeModel