public Group get(int index) { final int realIndex = getRealIndex(_groupsInfo.get(index)[0]); return (realIndex >= 0 && realIndex < getChildren().size()) ? (Group) getChildren().get(realIndex) : null; } };
public Group next() { ++_j; final int realIndex = getRealIndex((_it.next())[0]); return (realIndex >= 0 && realIndex < getChildren().size()) ? (Group) getChildren().get(realIndex) : null; }
private void afterUnmarshal(int index) { for (Iterator it = getChildren().iterator(); it.hasNext();) { ((Row) it.next()).setIndexDirectly(index++); } }
private int getRowCount() { return grdVitals.getRows().getChildren().size(); }
/*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; }
private Row getRow(int row) { return (Row) grdVitals.getRows().getChildren().get(row); }
/** * Clear all alerts. */ @Override public void clearAlerts() { List<Component> children = alertRoot.getChildren(); while (children.size() > 0) { AlertContainer alertContainer = (AlertContainer) children.get(0); alertContainer.doAction(Action.REMOVE); } openAlertPanel(false); }
public Row get(int index) { final Rows rows = (Rows) getParent(); if (rows != null) { int i = 0; for (Iterator<Component> it = rows.getChildren().listIterator(getIndex() + 1); it.hasNext() && i <= index; i++) { if (i == index) return (Row) it.next(); it.next(); } } throw new IndexOutOfBoundsException("Index: " + index); } };
/** Returns the specified cell, or null if not available. * @param row which row to fetch (starting at 0). * @param col which column to fetch (starting at 0). */ public Component getCell(int row, int col) { final Rows rows = getRows(); if (rows == null) return null; List children = rows.getChildren(); if (children.size() <= row) return null; children = ((Row) children.get(row)).getChildren(); return children.size() <= col ? null : (Component) children.get(col); }
/** * Returns the Groupfoot, if any. Otherwise, null is returned. */ public Groupfoot getGroupfoot() { int index = getGroupfootIndex(); if (index < 0) return null; final Rows rows = (Rows) getParent(); return (Groupfoot) rows.getChildren().get(index); }
/** * 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); } }
public List getItems(Component comp) { if (comp instanceof Grid) { final Grid grid = (Grid) comp; return grid.getRows().getChildren(); } else { throw new UiException("Unsupported type for RowCollectionItem: " + comp); } } }
/** * Re-renders a model object. * * @param object Model object */ protected void rerender(M object) { for (Row row : grid.getRows().<Row> getChildren()) { if (object.equals(row.getValue())) { rerender(row); break; } } }
/** * Scroll to the specified row by the given index. * @param index the index of row * @since 8.5.2 */ public void scrollToIndex(int index) { ListModel<Object> model = getModel(); int rowCount = model != null ? model.getSize() : getRows().getChildren().size(); if (index < 0 || index > rowCount - 1) { throw new IndexOutOfBoundsException("Illegal index: " + index); } response(new AuInvoke(this, "scrollToIndex", index, (double) index / rowCount)); } }
private void initGrid(int colcount) { grdVitals.getRows().getChildren().clear(); while (getColCount() > 2) { getColumn(1).detach(); } for (int i = 0; i < colcount; i++) { addColumn(); } }
private void updateControls() { boolean visible = radYes.isSelected(); boolean first = true; for (Component row : rows.getChildren()) { row.setVisible(first || visible); first = false; } pnlGoalOther.setVisible("other".equalsIgnoreCase(cboGoal.getValue())); Clients.resize(pnlGoalOther); }
/** 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); }
/** * Show the popup dialog, populating it with detail information for the specified data object. */ @Override public void show() { addRows(); if (debug) { debugObject(dataObject, false); } if (grid.getRows().getChildren().size() > 20) { grid.setHeight("600px"); } super.show(); }
/** Renders all {@link Row} if not loaded yet, * with {@link #getRowRenderer}. */ public void renderAll() { if (_model == null) return; _renderAll = true; getDataLoader().setLoadAll(_renderAll); final Renderer renderer = new Renderer(); if (!_rows.getChildren().isEmpty()) try { Row row = (Row) _rows.getChildren().get(0); int index = row.getIndex(); for (Row nxt; row != null; row = nxt) { nxt = (Row) row.getNextSibling(); //retrieve first since it might be changed renderer.render(row, index++); } } catch (Throwable ex) { renderer.doCatch(ex); } finally { renderer.doFinally(); } }
public void doGroupsDataChange(GroupsDataEvent event) { if (event.getType() == GroupsDataEvent.GROUPS_OPENED) { Grid grid = (Grid) getOwner(); GroupsListModel groupsListModel = ((GroupsListModel) grid.getModel()); int offset = groupsListModel.getGroupOffset(event.getGroupIndex()); ((Group) grid.getRows().getChildren().get(offset)).setOpen(groupsListModel.getDataInfo(offset).isOpen()); } }