/** * Construct a SeparatorList overtop of the <code>source</code> list by * using the given <code>comparator</code> to compute groups of similar * source items. For each group a single separator will be present in this * SeparatorList provided the group contains at least the * <code>minimumSizeForSeparator</code> number of items (otherwise they are * left without a separator). In addition this SeparatorList will never * show more than the <code>defaultLimit</code> number of group elements * from any given group. * * @param source the list containing the raw items to be grouped * @param comparator the Comparator which defines the grouping logic * @param minimumSizeForSeparator the number of elements which must exist * in a group in order for a separator to be created * @param defaultLimit the maximum number of element to display for a group; * extra elements are truncated */ public SeparatorList(EventList<E> source, Comparator<? super E> comparator, int minimumSizeForSeparator, int defaultLimit) { super(new SeparatorInjectorList<E>(new SortedList<E>(source, comparator), defaultLimit)); this.separatorSource = (SeparatorInjectorList<E>)super.source; this.minimumSizeForSeparator = minimumSizeForSeparator; // prepare the collapsed elements rebuildCollapsedElements(); // handle changes to the separators list this.separatorSource.addListEventListener(this); }
/** * Construct a SeparatorList overtop of the <code>source</code> list by * using the given <code>comparator</code> to compute groups of similar * source items. For each group a single separator will be present in this * SeparatorList provided the group contains at least the * <code>minimumSizeForSeparator</code> number of items (otherwise they are * left without a separator). In addition this SeparatorList will never * show more than the <code>defaultLimit</code> number of group elements * from any given group. * * @param source the list containing the raw items to be grouped * @param comparator the Comparator which defines the grouping logic * @param minimumSizeForSeparator the number of elements which must exist * in a group in order for a separator to be created * @param defaultLimit the maximum number of element to display for a group; * extra elements are truncated */ public SeparatorList(EventList<E> source, Comparator<? super E> comparator, int minimumSizeForSeparator, int defaultLimit) { super(new SeparatorInjectorList<E>(new SortedList<E>(source, comparator), defaultLimit)); this.separatorSource = (SeparatorInjectorList<E>)super.source; this.minimumSizeForSeparator = minimumSizeForSeparator; // prepare the collapsed elements rebuildCollapsedElements(); // handle changes to the separators list this.separatorSource.addListEventListener(this); }
/** * Construct a SeparatorList overtop of the <code>source</code> list by * using the given <code>comparator</code> to compute groups of similar * source items. For each group a single separator will be present in this * SeparatorList provided the group contains at least the * <code>minimumSizeForSeparator</code> number of items (otherwise they are * left without a separator). In addition this SeparatorList will never * show more than the <code>defaultLimit</code> number of group elements * from any given group. * * @param source the list containing the raw items to be grouped * @param comparator the Comparator which defines the grouping logic * @param minimumSizeForSeparator the number of elements which must exist * in a group in order for a separator to be created * @param defaultLimit the maximum number of element to display for a group; * extra elements are truncated */ public SeparatorList(EventList<E> source, Comparator<? super E> comparator, int minimumSizeForSeparator, int defaultLimit) { super(new SeparatorInjectorList<E>(new SortedList<E>(source, comparator), defaultLimit)); this.separatorSource = (SeparatorInjectorList<E>)super.source; this.minimumSizeForSeparator = minimumSizeForSeparator; // prepare the collapsed elements rebuildCollapsedElements(); // handle changes to the separators list this.separatorSource.addListEventListener(this); }