com.alee.extended.tree
Class FileTreeDataProvider

java.lang.Object
  extended by com.alee.extended.tree.AbstractTreeDataProvider<FileTreeNode>
      extended by com.alee.extended.tree.FileTreeDataProvider
All Implemented Interfaces:
AsyncTreeDataProvider<FileTreeNode>

public class FileTreeDataProvider
extends AbstractTreeDataProvider<FileTreeNode>

Asynchronous data provider for WebFileTree.

Author:
Mikle Garin

Field Summary
protected  java.util.List<java.io.File> rootFiles
          Tree root files.
 
Fields inherited from class com.alee.extended.tree.AbstractTreeDataProvider
comparator, filter
 
Constructor Summary
FileTreeDataProvider(java.io.File... rootFiles)
          Constructs file tree data provider with the specified files as root.
FileTreeDataProvider(Filter<FileTreeNode> filter, java.io.File... rootFiles)
          Constructs file tree data provider with the specified files as root.
FileTreeDataProvider(Filter<FileTreeNode> filter, java.util.List<java.io.File> rootFiles)
          Constructs file tree data provider with the specified files as root.
FileTreeDataProvider(java.util.List<java.io.File> rootFiles)
          Constructs file tree data provider with the specified files as root.
 
Method Summary
 Filter<FileTreeNode> getChildsFilter(FileTreeNode node)
          Returns child nodes filter for the specified asynchronous tree node.
 java.util.List<FileTreeNode> getFileChilds(FileTreeNode node)
          Returns child nodes for specified node.
 FileTreeNode getRoot()
          Returns asynchronous tree root node.
protected  java.util.List<FileTreeNode> getRootChilds()
          Returns root child nodes.
 boolean isLeaf(FileTreeNode node)
          Returns false by default to allow childs load requests.
 void loadChilds(FileTreeNode parent, ChildsListener<FileTreeNode> listener)
          Starts loading child nodes for the specified asynchronous tree node.
 
Methods inherited from class com.alee.extended.tree.AbstractTreeDataProvider
getChildsComparator, setChildsComparator, setChildsFilter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rootFiles

protected java.util.List<java.io.File> rootFiles
Tree root files.

Constructor Detail

FileTreeDataProvider

public FileTreeDataProvider(java.io.File... rootFiles)
Constructs file tree data provider with the specified files as root.

Parameters:
rootFiles - tree root files

FileTreeDataProvider

public FileTreeDataProvider(java.util.List<java.io.File> rootFiles)
Constructs file tree data provider with the specified files as root.

Parameters:
rootFiles - tree root files

FileTreeDataProvider

public FileTreeDataProvider(Filter<FileTreeNode> filter,
                            java.io.File... rootFiles)
Constructs file tree data provider with the specified files as root.

Parameters:
filter - tree nodes filter
rootFiles - tree root files

FileTreeDataProvider

public FileTreeDataProvider(Filter<FileTreeNode> filter,
                            java.util.List<java.io.File> rootFiles)
Constructs file tree data provider with the specified files as root.

Parameters:
filter - tree nodes filter
rootFiles - tree root files
Method Detail

getRoot

public FileTreeNode getRoot()
Returns asynchronous tree root node. This request uses the EDT and should be processed quickly.

Returns:
root node

loadChilds

public void loadChilds(FileTreeNode parent,
                       ChildsListener<FileTreeNode> listener)
Starts loading child nodes for the specified asynchronous tree node. When you finish loading childs for the specified node or you failed to load them, simply inform the listener about that. This request uses a separate thread and might take a lot of time to process without having any UI issues.

Parameters:
parent - parent node
listener - childs loading progress listener

getRootChilds

protected java.util.List<FileTreeNode> getRootChilds()
Returns root child nodes.

Returns:
root child nodes

getFileChilds

public java.util.List<FileTreeNode> getFileChilds(FileTreeNode node)
Returns child nodes for specified node.

Parameters:
node - parent node
Returns:
child nodes

getChildsFilter

public Filter<FileTreeNode> getChildsFilter(FileTreeNode node)
Returns child nodes filter for the specified asynchronous tree node. No filtering applied to childs in case null is returned.

Specified by:
getChildsFilter in interface AsyncTreeDataProvider<FileTreeNode>
Overrides:
getChildsFilter in class AbstractTreeDataProvider<FileTreeNode>
Parameters:
node - parent node
Returns:
child nodes filter

isLeaf

public boolean isLeaf(FileTreeNode node)
Returns false by default to allow childs load requests. It is recommended to override this behavior if you can easily determine whether node is leaf or not.

Specified by:
isLeaf in interface AsyncTreeDataProvider<FileTreeNode>
Overrides:
isLeaf in class AbstractTreeDataProvider<FileTreeNode>
Parameters:
node - node
Returns:
false