/** * Notify item set change listeners that items has been added to the * container. * * @param firstPosition * position of the first visible added item in the view * @param firstItemId * id of the first visible added item * @param numberOfItems * the number of visible added items */ protected void fireItemsAdded(int firstPosition, ITEMIDTYPE firstItemId, int numberOfItems) { BaseItemAddEvent addEvent = new BaseItemAddEvent(this, firstItemId, firstPosition, numberOfItems); fireItemSetChange(addEvent); }
/** * Notify item set change listeners that items has been removed from the * container. * * @param firstPosition * position of the first visible removed item in the view prior * to removal * @param firstItemId * id of the first visible removed item, of type {@link Object} * to satisfy {@link Container#removeItem(Object)} API * @param numberOfItems * the number of removed visible items * */ protected void fireItemsRemoved(int firstPosition, Object firstItemId, int numberOfItems) { BaseItemRemoveEvent removeEvent = new BaseItemRemoveEvent(this, firstItemId, firstPosition, numberOfItems); fireItemSetChange(removeEvent); }
/** * Filter the view to recreate the visible item list from the unfiltered * items, and send a notification if the set of visible items changed in any * way. */ protected void filterAll() { if (doFilterContainer(!getFilters().isEmpty())) { fireItemSetChange(); } }
/** * Sort base implementation to be used to implement {@link Sortable}. * * Subclasses should call this from a public * {@link #sort(Object[], boolean[])} method when implementing Sortable. * * @see Container.Sortable#sort(java.lang.Object[], boolean[]) */ protected void sortContainer(Object[] propertyId, boolean[] ascending) { if (!(this instanceof Sortable)) { throw new UnsupportedOperationException( "Cannot sort a Container that does not implement Sortable"); } // Set up the item sorter for the sort operation getItemSorter().setSortProperties((Sortable) this, propertyId, ascending); // Perform the actual sort doSort(); // Post sort updates if (isFiltered()) { filterAll(); } else { fireItemSetChange(); } }