/** * Returns the last row added. * * @return The last row added. */ private Row getLastRow() { return (Row) grid.getRows().getLastChild(); }
private Row getRow(int row) { return (Row) grdVitals.getRows().getChildren().get(row); }
private int getRowCount() { return grdVitals.getRows().getChildren().size(); }
/** 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); }
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; } } }
public int getTotalSize() { final Rows rows = _grid.getRows(); final ListModel model = _grid.getModel(); return model != null ? model.getSize() : rows != null ? rows.getVisibleItemCount() : 0; }
/** * 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(); } }
/** * 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(); }
protected Set<? extends Component> getAvailableAtClient(int offset, int limit) { final Set<Component> avail = new LinkedHashSet<Component>(32); final Rows rows = _grid.getRows(); Row row = (Row) rows.getFirstChild(); while (row != null) { if (limit == 0) break; if (row.isVisible()) { if (--offset < 0) { --limit; avail.add(row); } } if (row instanceof Group) { final Group g = (Group) row; if (!g.isOpen()) { for (int j = 0, len = g.getItemCount(); j < len && row != null; j++) row = (Row) row.getNextSibling(); } } if (row != null) row = (Row) row.getNextSibling(); } return avail; }
@SuppressWarnings("unchecked") public void render(int x, int y) { Grid grid = target.as(Grid.class); Rows rows = grid.getRows(); if(rows==null) return; List<Component> children = rows.getChildren(); if(x==-1) x = 0; if(y==-1) y = rows.getChildren().size()-1; ArrayList<String> ids = new ArrayList<String>(); while(true){ if(x > y) break; Row r = (Row)children.get(x++); if(r!=null && !isLoaded(r)){//damn, isLoaded is not open in row ids.add(r.getUuid()); } } if(ids.size()==0) return; String desktopId = target.getDesktop().getId(); String cmd = Events.ON_RENDER; Map<String, Object> data = EventDataManager.getInstance().build( new RenderEvent(cmd, new HashSet<String>(ids))); ((ClientCtrl) target.getClient()).postUpdate(desktopId, target.getUuid(), cmd, data, false); ((ClientCtrl) getClient()).flush(desktopId); }; }
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()); } }
/** 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); }
/** * Add a row containing the specified header (left column) and value container (right column). * * @param header Text for header column * @param container Object containing text value(s) */ protected void addRow(String header, Component container) { Row row = new Row(); grid.getRows().appendChild(row); Div div = new Div(); Label label = new Label(header + ":"); label.setMultiline(true); label.setMaxlength(40); label.setStyle("font-weight:bold;word-wrap:word-break"); row.appendChild(div); row.appendChild(label); row.appendChild(container); }
if ((renderer instanceof RowRendererExt) || (_renderer instanceof RowRendererExt)) { getRows().getChildren().clear(); getDataLoader().syncModel(-1, -1); //we have to recreate all } else if (getAttribute(ATTR_ON_INIT_RENDER_POSTED) == null) {
private Row addRow() { Row row = new Row(); grdVitals.getRows().appendChild(row); int colCount = getColCount(); for (int i = 1; i <= colCount; i++) { Span span = new Span(); row.appendChild(span); span.setSclass(SCLASS_UNMARKED); Component child; if (i == 1 || i == colCount) { child = new Label(); } else { Textbox tb = new Textbox(); child = tb; tb.addForward(Events.ON_CHANGE, root, "onDataChange"); } span.appendChild(child); } return row; }
col.setValue(dtmDate.getDate()); col.setLabel(DateUtil.formatDate(dtmDate.getDate())); int rows = grdVitals.getRows().getChildren().size(); int idx = getColumnIndex(col);