} else if (hasGroup()) { int index = newItem.getIndex(); final int[] g = getGroupsInfoAt(index);
} else if (hasGroup()) { final int[] g = getGroupsInfoAt(index); if (g != null) {
public void beforeChildAdded(Component child, Component refChild) { if (!(child instanceof Row)) throw new UiException("Unsupported child for rows: " + child); if (child instanceof Groupfoot) { if (!hasGroup()) throw new UiException("Groupfoot cannot exist alone, you have to add a Group first"); if (refChild == null) { if (getLastChild() instanceof Groupfoot) throw new UiException("Only one Goupfooter is allowed per Group"); } } super.beforeChildAdded(child, refChild); }
/** * If the child is a group, its groupfoot will be removed at the same time. */ public boolean removeChild(Component child) { if (child.getParent() == this) beforeRemove(child); final boolean hasGroup = hasGroup(); int index = ((Row) child).getIndex(); if (super.removeChild(child)) { ((Row) child).setIndexDirectly(-1); fixGroupsInfoAfterRemove((Row) child, index); return true; } return false; }
/** 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); }
if (rows == null) return false; //Avoid grid with null group if (rows.hasGroup()) { for (Group group : new ArrayList<Group>(rows.getGroups()))
final Rows rows = grid.getRows(); if (rows != null) { if (rows.hasGroup()) { for (Group group : new ArrayList<Group>(rows.getGroups()))
public boolean insertBefore(Component child, Component refChild) { final Grid grid = getGrid(); final boolean isReorder = child.getParent() == this; //bug #3051305: Active Page not update when drag & drop item to the end if (isReorder) { checkInvalidateForMoved(child, true); } Row newItem = (Row) child; final int jfrom = hasGroup() && newItem.getParent() == this ? newItem.getIndex() : -1; fixGroupsInfoBeforeInsert(newItem, (Row) refChild, isReorder); if (super.insertBefore(child, refChild)) { final int jto = refChild instanceof Row ? ((Row) refChild).getIndex() : -1, fixFrom = jfrom < 0 || (jto >= 0 && jfrom > jto) ? jto : jfrom; if (fixFrom < 0) { newItem.setIndexDirectly( getChildren().size() - 1 + (grid != null ? grid.getDataLoader().getOffset() : 0)); } else { fixGroupIndex(fixFrom, jfrom >= 0 && jto >= 0 ? jfrom > jto ? jfrom : jto : -1, !isReorder); } fixGroupsInfoAfterInsert(newItem); //bug #3049167: Totalsize increase when drag & drop in paging Listbox/Grid if (!isReorder) { afterInsert(child); } return true; } return false; }