Class GroupByTreeFormat<T>

  • Type Parameters:
    T - The type of the base objects carried in the TreeList.
    All Implemented Interfaces:
    ca.odell.glazedlists.TreeList.Format<Object>

    public class GroupByTreeFormat<T>
    extends Object
    implements ca.odell.glazedlists.TreeList.Format<Object>
    The TreeList.Format that is used by the TreeList that is created and used by the GroupByDataLayer. Note that the TreeList created by the GroupByDataLayer is generic for Object because the groupBy functionality will add GroupByObjects to the path for creating the grouping.
    • Constructor Detail

      • GroupByTreeFormat

        public GroupByTreeFormat​(GroupByModel model,
                                 IColumnAccessor<T> columnAccessor)
        Parameters:
        model - The GroupByModel that carries the information about the groupBy states.
        columnAccessor - The IColumnAccessor that is used to get the column value for the columns that are grouped by. Needed for compare operations and creating the path in the tree.
    • Method Detail

      • getPath

        public void getPath​(List<Object> path,
                            Object element)
        Specified by:
        getPath in interface ca.odell.glazedlists.TreeList.Format<T>
      • getGroupByObject

        protected GroupByObject getGroupByObject​(Object columnValue,
                                                 Map<Integer,​Object> descriptor)
        Parameters:
        columnValue - The column value that is used to create the GroupByObject. Specifies the groupBy value.
        descriptor - The descriptor that is used to create the GroupByObject. Specifies the groupBy depth.
        Returns:
        The GroupByObject for the given value and descriptor.
      • allowsChildren

        public boolean allowsChildren​(Object element)
        Specified by:
        allowsChildren in interface ca.odell.glazedlists.TreeList.Format<T>
      • getComparator

        public Comparator<Object> getComparator​(int depth)
        Specified by:
        getComparator in interface ca.odell.glazedlists.TreeList.Format<T>
      • clearComparatorCache

        public void clearComparatorCache()
        Clear the comparator local cache of summary information that is used to increase performance on sorting. Can be called often since the cache is only valid for a sorting operation.
      • setComparator

        public void setComparator​(IGroupByComparator<T> comparator)
        Parameters:
        comparator - The IGroupByComparator that should be used to sort the TreeList in order to be able to build the tree structure correctly.