com.alee.extended.tree
Class AbstractTreeDataProvider<E extends AsyncUniqueNode>

java.lang.Object
  extended by com.alee.extended.tree.AbstractTreeDataProvider<E>
All Implemented Interfaces:
AsyncTreeDataProvider<E>
Direct Known Subclasses:
FileTreeDataProvider, SampleDataProvider

public abstract class AbstractTreeDataProvider<E extends AsyncUniqueNode>
extends java.lang.Object
implements AsyncTreeDataProvider<E>

Abstract data provider with implemented comparator and filter getters and setters.

Author:
Mikle Garin

Field Summary
protected  java.util.Comparator<E> comparator
          Childs comparator.
protected  Filter<E> filter
          Childs filter.
 
Constructor Summary
AbstractTreeDataProvider()
           
 
Method Summary
 java.util.Comparator<E> getChildsComparator(E node)
          Returns child nodes comparator for the specified asynchronous tree node.
 Filter<E> getChildsFilter(E node)
          Returns child nodes filter for the specified asynchronous tree node.
 boolean isLeaf(E node)
          Returns false by default to allow childs load requests.
 void setChildsComparator(java.util.Comparator<E> comparator)
          Sets childs comparator for all nodes.
 void setChildsFilter(Filter<E> filter)
          Sets childs filter for all nodes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.alee.extended.tree.AsyncTreeDataProvider
getRoot, loadChilds
 

Field Detail

comparator

protected java.util.Comparator<E extends AsyncUniqueNode> comparator
Childs comparator.


filter

protected Filter<E extends AsyncUniqueNode> filter
Childs filter.

Constructor Detail

AbstractTreeDataProvider

public AbstractTreeDataProvider()
Method Detail

getChildsComparator

public java.util.Comparator<E> getChildsComparator(E node)
Returns child nodes comparator for the specified asynchronous tree node. No sorting applied to childs in case null is returned.

Specified by:
getChildsComparator in interface AsyncTreeDataProvider<E extends AsyncUniqueNode>
Parameters:
node - parent node
Returns:
child nodes comparator

setChildsComparator

public void setChildsComparator(java.util.Comparator<E> comparator)
Sets childs comparator for all nodes.

Parameters:
comparator - childs comparator for all nodes

getChildsFilter

public Filter<E> getChildsFilter(E 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<E extends AsyncUniqueNode>
Parameters:
node - parent node
Returns:
child nodes filter

setChildsFilter

public void setChildsFilter(Filter<E> filter)
Sets childs filter for all nodes.

Parameters:
filter - childs filter for all nodes

isLeaf

public boolean isLeaf(E 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<E extends AsyncUniqueNode>
Parameters:
node - node
Returns:
false