List of usage examples for com.vaadin.ui TreeGrid expand
public void expand(Collection<T> items)
From source file:org.jpos.qi.minigl.AccountsView.java
License:Open Source License
public void formatGrid() { setGridGetters();//from w w w . j a va 2 s. c o m TreeGrid<Account> grid = (TreeGrid) getGrid(); //Delete not visible columns //Use columnId as caption //Set sorting for every column. DecimalFormat nf = new DecimalFormat(); nf.setGroupingUsed(false); grid.setStyleGenerator(styleGen -> { if (styleGen.isDebit()) { return "debit-color"; } else { return "credit-color"; } }); Iterator<Grid.Column<Account, ?>> it = grid.getColumns().iterator(); while (it.hasNext()) { Grid.Column c = it.next(); String columnId = c.getId(); if (!Arrays.asList(getVisibleColumns()).contains(columnId)) { grid.removeColumn(columnId); } else { c.setCaption(getCaptionFromId(columnId)).setSortProperty(columnId).setSortable(false) .setHidable(false); c.setStyleGenerator(obj -> { Object value = c.getValueProvider().apply(obj); if (value instanceof BigDecimal) { return "align-right"; } return null; }); } } //fix for when a manual resize is done, the last column takes the empty space. grid.addColumnResizeListener(event -> { int lastColumnIndex = grid.getColumns().size() - 1; ((Grid.Column) grid.getColumns().get(lastColumnIndex)).setWidth(1500); }); //expand root account Account a = (Account) getEntityByParam("5"); grid.expand(a); }
From source file:org.jpos.qi.minigl.AccountsView.java
License:Open Source License
private void expand(Account a) { TreeGrid tree = (TreeGrid) getGrid(); if (a.getParent() != null) { expand(a.getParent());//from w w w . j a v a 2 s .c o m } tree.expand(a); }