/** Checks whether to invalidate, when a child has been added or * or will be removed. * @param bRemove if child will be removed */ private void checkInvalidateForMoved(Component child, boolean bRemove) { //No need to invalidate if //1) act == last and child in act //2) act != last and child after act //Except removing last element which in act and act has only one element final Grid grid = getGrid(); if (grid != null && grid.inPagingMold() && !isInvalidated()) { final List<Component> children = getChildren(); final int sz = children.size(), pgsz = grid.getPageSize(); int n = sz - (grid.getActivePage() + 1) * pgsz; if (n <= 0) { //must be last page n += pgsz; //check in-act (otherwise, check after-act) if (bRemove && n <= 1) { //last element, in act and remove invalidate(); return; } } else if (n > 50) n = 50; //check at most 50 items (for better performance) for (ListIterator<Component> it = children.listIterator(sz); --n >= 0 && it.hasPrevious();) if (it.previous() == child) return; //no need to invalidate invalidate(); } }
grid.getRows().invalidate(); return true;
grid.getRows().invalidate();
rows.invalidate(); rows.invalidate();
grid.invalidate(); else { invalidate(); grid.getDataLoader().updateModelInfo(); invalidate(); grid.getDataLoader().updateModelInfo(); } else {
public void onEvent(Event event) { if (_rows != null && _model != null && inPagingMold()) { //theoretically, _rows shall not be null if _model is not null when //this method is called. But, just in case -- if sent manually final Paginal pgi = getPaginal(); int pgsz = pgi.getPageSize(); int ofs = pgi.getActivePage() * pgsz; if (event instanceof PagingEvent) { // Bug ZK-1696: PagingEvent have the newest paging information pgsz = ((PagingEvent) event).getPageable().getPageSize(); ofs = ((PagingEvent) event).getActivePage() * pgsz; } if (_model instanceof Pageable) { ((Pageable) _model).setPageSize(pgsz); ((Pageable) _model).setActivePage(pgi.getActivePage()); } if (_rod) { getDataLoader().syncModel(ofs, pgsz); } postOnPagingInitRender(); } if (getModel() != null || getPagingPosition().equals("both")) invalidate(); // just in case. else if (_rows != null) { _rows.invalidate(); // Bug 3218078 if (_frozen != null) _frozen.invalidate(); } }
rows.invalidate(); rows.invalidate();
grid.getRows().invalidate(); return true;