/** Returns the grid that contains this row. */ public Grid getGrid() { final Component parent = getParent(); return parent != null ? (Grid) parent.getParent() : null; }
/** * Returns the group that this row belongs to, or null. * @since 3.5.0 */ public Group getGroup() { final Rows rows = (Rows) getParent(); return (rows != null) ? rows.getGroup(getIndex()) : null; }
public boolean setVisible(boolean visible) { if (isVisible() != visible) { final Rows rows = (Rows) getParent(); if (rows != null) { final Group g = rows.getGroup(getIndex()); if (g == null || g.isOpen()) rows.addVisibleItemCount(visible ? 1 : -1); } } return super.setVisible(visible); }
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; }
public void render(final Row row, final Object data, final int index) { final Rows rows = (Rows) row.getParent(); final Grid grid = (Grid) rows.getParent(); Template tm = getTemplate(grid, rows, "model");
public void render(final Row row, final Object data, final int index) { final Rows rows = (Rows) row.getParent(); final Grid grid = (Grid) rows.getParent(); final int size = grid.getModel().getSize();