/** Sorts the components in the list. * * <p>Note: you cannot use {@link Collections#sort} to sort * {@link Component#getChildren} because Collections.sort might cause * some replicated item in the list. * @see #sort(List, int, int, Comparator) */ public static void sort(List<? extends Component> list, Comparator<? super Component> cpr) { sort(list, 0, list.size(), cpr); }
/** Sorts the treechildren. * @since 5.0.6 */ @SuppressWarnings("unchecked") private static void sort0(Treechildren treechildren, Comparator cmpr) { if (treechildren == null) return; Components.sort(treechildren.getChildren(), cmpr); for (Iterator it = treechildren.getChildren().iterator(); it.hasNext();) { Treeitem item = (Treeitem) it.next(); sort0(item.getTreechildren(), cmpr); } }
/** Sorts the items. If with group, each group is sorted independently. */ @SuppressWarnings("unchecked") private static void sort0(Listbox box, Comparator cmpr) { if (box.hasGroup()) for (Listgroup g : box.getGroups()) { int index = g.getIndex() + 1; Components.sort(box.getItems(), index, index + g.getItemCount(), cmpr); } else Components.sort(box.getItems(), cmpr); }
/** Sorts the rows. If with group, each group is sorted independently. */ @SuppressWarnings("unchecked") private static void sort0(Grid grid, Comparator cmpr) { final Rows rows = grid.getRows(); if (rows.hasGroup()) for (Group g : rows.getGroups()) { int index = g.getIndex() + 1; Components.sort(rows.getChildren(), index, index + g.getItemCount(), cmpr); } else Components.sort(rows.getChildren(), cmpr); }