Filtering the tree nodes

The tree component allows you to filter the nodes that are displayed. To do so, attach an instance of IlpFilter to the tree component by using the method setFilter. The accept() method of the filter object will be invoked whenever the tree is prompted to display an IlpObject. If the method returns false , the object will not be shown in the tree. In the same way, an object will not be shown if its parent is not displayed.
For example, write the following code to show only objects of the class IltNetworkElement.

How to filter objects to be shown in the tree component

IlpTree tree = // ...
// Create a new IlpFilter instance
IlpFilter filter = new IlpFilter(){
  // This method is called for every object in the data source
  public boolean accept (Object object){
    IlpObject ilpObject = (IlpObject)object;
    IlpClass clz = ilpObject.getIlpClass();
    // Check if the class == IltNetworkElement
    return clz.equals(IltNetworkElement.GetIlpClass());
  }
// Set the filter to the tree
tree.setFilter(filter);
All the objects are refiltered whenever a new filter is set. If the filter is null (which is the default), all the objects under the root nodes will be displayed.
To retrieve the active filter, use the method getFilter.
Note
The filtering takes actually place at the adapter level.