Search in sources :

Example 6 with HeaderRow

use of com.vaadin.flow.component.grid.HeaderRow in project flow-components by vaadin.

the class JoinedHeadersPage method createGrid2.

private static Grid<String> createGrid2() {
    Grid<String> grid = new Grid<>();
    grid.setId("grid2");
    addColumns(grid);
    grid.appendHeaderRow();
    HeaderRow header = grid.prependHeaderRow();
    header.join(header.getCells()).setText("Title");
    grid.setItems("1", "2", "3");
    return grid;
}
Also used : HeaderRow(com.vaadin.flow.component.grid.HeaderRow) Grid(com.vaadin.flow.component.grid.Grid)

Example 7 with HeaderRow

use of com.vaadin.flow.component.grid.HeaderRow in project karnak by OsiriX-Foundation.

the class ExternalIDGrid method addFilterElements.

public void addFilterElements() {
    HeaderRow filterRow = appendHeaderRow();
    extidFilter = new TextField();
    extidFilter.addValueChangeListener(event -> checkAndUpdateAllFilters());
    extidFilter.setValueChangeMode(ValueChangeMode.EAGER);
    filterRow.getCell(extidColumn).setComponent(extidFilter);
    extidFilter.setSizeFull();
    extidFilter.setPlaceholder(LABEL_FILTER);
    patientIdFilter = new TextField();
    patientIdFilter.addValueChangeListener(event -> checkAndUpdateAllFilters());
    patientIdFilter.setValueChangeMode(ValueChangeMode.EAGER);
    filterRow.getCell(patientIdColumn).setComponent(patientIdFilter);
    patientIdFilter.setSizeFull();
    patientIdFilter.setPlaceholder(LABEL_FILTER);
    patientFirstNameFilter = new TextField();
    patientFirstNameFilter.addValueChangeListener(event -> checkAndUpdateAllFilters());
    patientFirstNameFilter.setValueChangeMode(ValueChangeMode.EAGER);
    filterRow.getCell(patientFirstNameColumn).setComponent(patientFirstNameFilter);
    patientFirstNameFilter.setSizeFull();
    patientFirstNameFilter.setPlaceholder(LABEL_FILTER);
    patientLastNameFilter = new TextField();
    patientLastNameFilter.addValueChangeListener(event -> checkAndUpdateAllFilters());
    patientLastNameFilter.setValueChangeMode(ValueChangeMode.EAGER);
    filterRow.getCell(patientLastNameColumn).setComponent(patientLastNameFilter);
    patientLastNameFilter.setSizeFull();
    patientLastNameFilter.setPlaceholder(LABEL_FILTER);
    issuerOfPatientIDFilter = new TextField();
    issuerOfPatientIDFilter.addValueChangeListener(event -> checkAndUpdateAllFilters());
    issuerOfPatientIDFilter.setValueChangeMode(ValueChangeMode.EAGER);
    filterRow.getCell(issuerOfPatientIDColumn).setComponent(issuerOfPatientIDFilter);
    issuerOfPatientIDFilter.setSizeFull();
    issuerOfPatientIDFilter.setPlaceholder(LABEL_FILTER);
}
Also used : HeaderRow(com.vaadin.flow.component.grid.HeaderRow) TextField(com.vaadin.flow.component.textfield.TextField)

Example 8 with HeaderRow

use of com.vaadin.flow.component.grid.HeaderRow in project karnak by OsiriX-Foundation.

the class TransferStatusGrid method createFiltersOnRows.

/**
 * Create filters
 *
 * @param transferDateColumn Transfer Date column
 * @param studyUidColumn Study Uid Column
 * @param serieUidColumn Serie Uid Column
 * @param sopInstanceUidColumn Sop Instance Uid Column
 * @param statusColumn Status Column
 */
private void createFiltersOnRows(Column<TransferStatusEntity> transferDateColumn, Column<TransferStatusEntity> studyUidColumn, Column<TransferStatusEntity> serieUidColumn, Column<TransferStatusEntity> sopInstanceUidColumn, Column<TransferStatusEntity> statusColumn) {
    // Filters
    HeaderRow filterRow = appendHeaderRow();
    transferStatusFilter = new TransferStatusFilter();
    // Transfer date filter
    createTransferDateFilter(transferDateColumn, filterRow);
    // Study uid filter
    createStudyUidFilter(studyUidColumn, filterRow);
    // Serie uid filter
    createSerieUidFilter(serieUidColumn, filterRow);
    // Sop Instance uid filter
    createSopInstanceUidFilter(sopInstanceUidColumn, filterRow);
    // Sent status
    createHasBeenSentFilter(statusColumn, filterRow);
}
Also used : HeaderRow(com.vaadin.flow.component.grid.HeaderRow)

Example 9 with HeaderRow

use of com.vaadin.flow.component.grid.HeaderRow in project flow-components by vaadin.

the class GridViewHeaderAndFooterRowsPage method createHeaderAndFooterUsingComponents.

private void createHeaderAndFooterUsingComponents() {
    Grid<Person> grid = new Grid<>();
    grid.setItems(getItems());
    Column<Person> nameColumn = grid.addColumn(Person::getFirstName).setHeader(new Span("Name")).setComparator((p1, p2) -> p1.getFirstName().compareToIgnoreCase(p2.getFirstName()));
    Column<Person> ageColumn = grid.addColumn(Person::getAge, "age").setHeader(new Span("Age"));
    Column<Person> streetColumn = grid.addColumn(person -> person.getAddress().getStreet()).setHeader(new Span("Street"));
    Column<Person> postalCodeColumn = grid.addColumn(person -> person.getAddress().getPostalCode()).setHeader(new Span("Postal Code"));
    HeaderRow topRow = grid.prependHeaderRow();
    HeaderCell informationCell = topRow.join(nameColumn, ageColumn);
    informationCell.setComponent(new Span("Basic Information"));
    HeaderCell addressCell = topRow.join(streetColumn, postalCodeColumn);
    addressCell.setComponent(new Span("Address Information"));
    grid.appendFooterRow().getCell(nameColumn).setComponent(new Span("Total: " + getItems().size() + " people"));
    grid.setId("grid-header-with-components");
    addCard("Header and footer rows", "Header and footer using components", grid);
}
Also used : Column(com.vaadin.flow.component.grid.Grid.Column) Person(com.vaadin.flow.data.bean.Person) Grid(com.vaadin.flow.component.grid.Grid) HeaderRow(com.vaadin.flow.component.grid.HeaderRow) Span(com.vaadin.flow.component.html.Span) HeaderCell(com.vaadin.flow.component.grid.HeaderRow.HeaderCell) Route(com.vaadin.flow.router.Route) HeaderRow(com.vaadin.flow.component.grid.HeaderRow) Grid(com.vaadin.flow.component.grid.Grid) HeaderCell(com.vaadin.flow.component.grid.HeaderRow.HeaderCell) Person(com.vaadin.flow.data.bean.Person) Span(com.vaadin.flow.component.html.Span)

Aggregations

HeaderRow (com.vaadin.flow.component.grid.HeaderRow)9 Grid (com.vaadin.flow.component.grid.Grid)5 TextField (com.vaadin.flow.component.textfield.TextField)4 Route (com.vaadin.flow.router.Route)4 Column (com.vaadin.flow.component.grid.Grid.Column)3 Person (com.vaadin.flow.data.bean.Person)3 HeaderCell (com.vaadin.flow.component.grid.HeaderRow.HeaderCell)2 Span (com.vaadin.flow.component.html.Span)2 ListDataProvider (com.vaadin.flow.data.provider.ListDataProvider)2 ArrayList (java.util.ArrayList)2 ColumnTextAlign (com.vaadin.flow.component.grid.ColumnTextAlign)1 SelectionMode (com.vaadin.flow.component.grid.Grid.SelectionMode)1 Query (com.vaadin.flow.data.provider.Query)1 NumberRenderer (com.vaadin.flow.data.renderer.NumberRenderer)1 ValueChangeMode (com.vaadin.flow.data.value.ValueChangeMode)1 ValueProvider (com.vaadin.flow.function.ValueProvider)1 BigDecimal (java.math.BigDecimal)1 DecimalFormat (java.text.DecimalFormat)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1