org.xnap.commons.gui.tree
Class FileTreeModel

java.lang.Object
  extended by org.xnap.commons.gui.tree.AbstractTreeModel
      extended by org.xnap.commons.gui.tree.FileTreeModel
All Implemented Interfaces:
TreeModel

public class FileTreeModel
extends AbstractTreeModel


Field Summary
 
Fields inherited from class org.xnap.commons.gui.tree.AbstractTreeModel
listenerList, root
 
Constructor Summary
FileTreeModel(String root)
           
FileTreeModel(String root, File[] roots)
           
 
Method Summary
 void addChildOfSubRoot(File file, String subRoot)
           
 void addChildOfSubRoot(File file, String subRoot, String label)
           
 void addSubRoot(File f)
           
 void addSubRoot(String name)
           
 Object getChild(Object parent, int index)
           
 int getChildCount(Object node)
           
 FileFilter getFileFilter()
          Returns the currently set file filter.
 int getIndexOfChild(Object parent, Object child)
           
 boolean getSortListedFiles()
          Returns whether the listed files of a directory are being sorted.
 boolean isLeaf(Object node)
           
 void removeChildOfSubRoot(File file, String subRoot)
           
 void removeChildrenOfSubRoot(String s)
           
 void removeSubRoots()
           
 void setFileFilter(FileFilter filter)
          Sets a file filter that is used for listing directories in the tree.
 void setSortListedFiles(boolean sort)
          Sets whether the listed files of a directory should be sorted.
 
Methods inherited from class org.xnap.commons.gui.tree.AbstractTreeModel
addTreeModelListener, fireTreeNodesInserted, fireTreeNodesRemoved, fireTreeStructureChanged, getRoot, reload, removeTreeModelListener, valueForPathChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileTreeModel

public FileTreeModel(String root,
                     File[] roots)

FileTreeModel

public FileTreeModel(String root)
Method Detail

isLeaf

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

getChildCount

public int getChildCount(Object node)
Specified by:
getChildCount in interface TreeModel
Specified by:
getChildCount in class AbstractTreeModel

getChild

public Object getChild(Object parent,
                       int index)
Specified by:
getChild in interface TreeModel
Specified by:
getChild in class AbstractTreeModel

getIndexOfChild

public int getIndexOfChild(Object parent,
                           Object child)
Specified by:
getIndexOfChild in interface TreeModel
Specified by:
getIndexOfChild in class AbstractTreeModel

addSubRoot

public void addSubRoot(String name)

addSubRoot

public void addSubRoot(File f)

removeSubRoots

public void removeSubRoots()

removeChildrenOfSubRoot

public void removeChildrenOfSubRoot(String s)

addChildOfSubRoot

public void addChildOfSubRoot(File file,
                              String subRoot)

addChildOfSubRoot

public void addChildOfSubRoot(File file,
                              String subRoot,
                              String label)

removeChildOfSubRoot

public void removeChildOfSubRoot(File file,
                                 String subRoot)

setFileFilter

public void setFileFilter(FileFilter filter)
Sets a file filter that is used for listing directories in the tree.

The default filter excludes hidden files and files that are not directories.

Parameters:
filter - can be null

getFileFilter

public FileFilter getFileFilter()
Returns the currently set file filter.

Returns:
can be null

setSortListedFiles

public void setSortListedFiles(boolean sort)
Sets whether the listed files of a directory should be sorted.

Fires TreeModelListener.treeStructureChanged(javax.swing.event.TreeModelEvent) with the root node as parameter to make sure the whole tree is updated correctly.

Parameters:
sort -

getSortListedFiles

public boolean getSortListedFiles()
Returns whether the listed files of a directory are being sorted.



Copyright © 2004-2007 XNap Commons Team. All Rights Reserved.