Example #1
0
  /**
   * Sets tree nodes filter. Comparator replacement will automatically re-filter all loaded nodes.
   *
   * @param filter tree nodes filter
   */
  public void setFilter(final Filter<E> filter) {
    final Filter<E> oldFilter = this.filter;
    this.filter = filter;

    final ExTreeDataProvider dataProvider = getDataProvider();
    if (dataProvider instanceof AbstractExTreeDataProvider) {
      ((AbstractExTreeDataProvider) dataProvider).setChildsFilter(filter);
      updateSortingAndFiltering();
    }

    firePropertyChange(TREE_FILTER_PROPERTY, oldFilter, filter);
  }
Example #2
0
  /**
   * Sets tree nodes comparator. Comparator replacement will automatically update all loaded nodes
   * sorting.
   *
   * @param comparator tree nodes comparator
   */
  public void setComparator(final Comparator<E> comparator) {
    final Comparator<E> oldComparator = this.comparator;
    this.comparator = comparator;

    final ExTreeDataProvider dataProvider = getDataProvider();
    if (dataProvider instanceof AbstractExTreeDataProvider) {
      ((AbstractExTreeDataProvider) dataProvider).setChildsComparator(comparator);
      updateSortingAndFiltering();
    }

    firePropertyChange(TREE_COMPARATOR_PROPERTY, oldComparator, comparator);
  }