/** * Fix Childitem._index since j-th item. * * @param j * the start index (inclusion) * @param to * the end index (inclusion). If -1, up to the end. */ private void fixRowIndices(int j, int to) { int realj = getRealIndex(j); if (realj < 0) realj = 0; List items = getChildren(); if (realj < items.size()) { for (Iterator it = items.listIterator(realj); it.hasNext() && (to < 0 || j <= to); ++j) ((Row) it.next()).setIndexDirectly(j); } }
/*package*/ Group getGroup(int index) { if (_groupsInfo.isEmpty()) return null; final int[] g = getGroupsInfoAt(index); if (g != null) { final int realIndex = getRealIndex(g[0]); //if realIndex < 0 means g is half loaded, Group head is not in server if (realIndex >= 0 && realIndex < getChildren().size()) { Row row = (Row) getChildren().get(realIndex); return (Group) row; } } return null; }
/*package*/ void fixGroupIndex(int j, int to, boolean infront) { int realj = getRealIndex(j); if (realj < 0) { realj = 0; } if (realj < getChildren().size()) { final int beginning = j; for (Iterator<Component> it = getChildren().listIterator(realj); it.hasNext() && (to < 0 || j <= to); ++j) { Component o = it.next(); ((Row) o).setIndexDirectly(j); if (_isReplacingRow) //@see Grid.Renderer#render break; //set only the first Row, skip handling GroupInfo // if beginning is a group, we don't need to change its groupInfo, // because // it is not reliable when infront is true. if ((!infront || beginning != j) && o instanceof Group) { int[] g = getLastGroupsInfoAt(j + (infront ? -1 : 1)); if (g != null) { g[0] = j; if (g[2] != -1) g[2] += (infront ? 1 : -1); } } } } }
final int idx = remove[2]; if (idx != -1) { final int realIndex = getRealIndex(idx) - 1; //bug #2936064 if (realIndex >= 0 && realIndex < getChildren().size()) removeChild(getChildren().get(realIndex));