Search in sources :

Example 56 with H2

use of com.vaadin.flow.component.html.H2 in project flow-components by vaadin.

the class GridMultiSelectionColumnPage method createBasicGridFromMultiToSingleBeforeAttached.

private void createBasicGridFromMultiToSingleBeforeAttached() {
    Grid<String> grid = new Grid<>();
    grid.setItems(IntStream.range(0, ITEM_COUNT).mapToObj(Integer::toString));
    setUp(grid);
    grid.setId("in-testing-multi-selection-mode-grid-single");
    add(new H2("in-testing-multi-selection-mode-grid-single"), grid);
    grid.setSelectionMode(SelectionMode.MULTI);
    grid.setSelectionMode(SelectionMode.SINGLE);
    add(grid);
}
Also used : Grid(com.vaadin.flow.component.grid.Grid) H2(com.vaadin.flow.component.html.H2)

Example 57 with H2

use of com.vaadin.flow.component.html.H2 in project flow-components by vaadin.

the class GridMultiSelectionColumnPage method createDefinedItemCountLazyGrid.

private void createDefinedItemCountLazyGrid() {
    Grid<String> lazyGrid = new Grid<>();
    lazyGrid.setItems(query -> IntStream.range(query.getOffset(), query.getOffset() + query.getLimit()).mapToObj(Integer::toString), query -> ITEM_COUNT);
    setUp(lazyGrid);
    lazyGrid.setId(DEFINED_ITEM_COUNT_LAZY_GRID_ID);
    add(new H2("Lazy grid"), lazyGrid);
}
Also used : Grid(com.vaadin.flow.component.grid.Grid) H2(com.vaadin.flow.component.html.H2)

Example 58 with H2

use of com.vaadin.flow.component.html.H2 in project flow-components by vaadin.

the class GridMultiSelectionColumnPage method createBasicGridMultiOneRowDeSelected.

private void createBasicGridMultiOneRowDeSelected() {
    Grid<String> grid = new Grid<>();
    grid.setId(MULTI_SELECT_GRID_ONE_NOT_SELECTED_GRID_ID);
    grid.setItems(IntStream.range(0, 2).mapToObj(Integer::toString));
    grid.addColumn(i -> i).setHeader("text");
    grid.addColumn(i -> String.valueOf(i.length())).setHeader("length");
    grid.setSelectionMode(Grid.SelectionMode.MULTI);
    grid.getSelectionModel().select("1");
    NativeButton selectRow0Button = new NativeButton("Select Row 0");
    selectRow0Button.setId("selectRow0");
    selectRow0Button.addClickListener(event -> {
        grid.getSelectionModel().select("0");
    });
    add(new H2("Grid with two rows only one row selected"), grid, selectRow0Button);
}
Also used : IntStream(java.util.stream.IntStream) Arrays(java.util.Arrays) Grid(com.vaadin.flow.component.grid.Grid) Query(com.vaadin.flow.data.provider.Query) Div(com.vaadin.flow.component.html.Div) NativeButton(com.vaadin.flow.component.html.NativeButton) CallbackDataProvider(com.vaadin.flow.data.provider.CallbackDataProvider) SelectionMode(com.vaadin.flow.component.grid.Grid.SelectionMode) H2(com.vaadin.flow.component.html.H2) ArrayList(java.util.ArrayList) Route(com.vaadin.flow.router.Route) List(java.util.List) Stream(java.util.stream.Stream) NativeButton(com.vaadin.flow.component.html.NativeButton) Grid(com.vaadin.flow.component.grid.Grid) H2(com.vaadin.flow.component.html.H2)

Example 59 with H2

use of com.vaadin.flow.component.html.H2 in project flow-components by vaadin.

the class GridMultiSelectionColumnPage method createBasicGridMultiAllRowsSelected.

private void createBasicGridMultiAllRowsSelected() {
    Grid<String> grid = new Grid<>();
    grid.setId(MULTI_SELECT_GRID_ALL_SELECTED_GRID_ID);
    grid.setItems(IntStream.range(0, 2).mapToObj(Integer::toString));
    grid.addColumn(i -> i).setHeader("text");
    grid.addColumn(i -> String.valueOf(i.length())).setHeader("length");
    grid.setSelectionMode(Grid.SelectionMode.MULTI);
    grid.getSelectionModel().select("0");
    grid.getSelectionModel().select("1");
    NativeButton deSelectRow0Button = new NativeButton("DeSelect Row 0");
    deSelectRow0Button.setId("deSelectRow0");
    deSelectRow0Button.addClickListener(event -> {
        grid.getSelectionModel().deselect("0");
    });
    add(new H2("Small grid with two rows all selected"), grid, deSelectRow0Button);
}
Also used : IntStream(java.util.stream.IntStream) Arrays(java.util.Arrays) Grid(com.vaadin.flow.component.grid.Grid) Query(com.vaadin.flow.data.provider.Query) Div(com.vaadin.flow.component.html.Div) NativeButton(com.vaadin.flow.component.html.NativeButton) CallbackDataProvider(com.vaadin.flow.data.provider.CallbackDataProvider) SelectionMode(com.vaadin.flow.component.grid.Grid.SelectionMode) H2(com.vaadin.flow.component.html.H2) ArrayList(java.util.ArrayList) Route(com.vaadin.flow.router.Route) List(java.util.List) Stream(java.util.stream.Stream) NativeButton(com.vaadin.flow.component.html.NativeButton) Grid(com.vaadin.flow.component.grid.Grid) H2(com.vaadin.flow.component.html.H2)

Example 60 with H2

use of com.vaadin.flow.component.html.H2 in project flow-components by vaadin.

the class GridMultiSelectionColumnPage method setAutoWidthIsTrueOfSelectionColumn.

private void setAutoWidthIsTrueOfSelectionColumn() {
    Grid<String> grid = new Grid<>();
    grid.setItems(IntStream.range(0, ITEM_COUNT).mapToObj(Integer::toString));
    setUp(grid);
    grid.setId("set-auto-width-true");
    add(new H2("In-set-auto-width-true"), grid);
    grid.setSelectionMode(SelectionMode.MULTI);
    add(grid);
}
Also used : Grid(com.vaadin.flow.component.grid.Grid) H2(com.vaadin.flow.component.html.H2)

Aggregations

H2 (com.vaadin.flow.component.html.H2)68 VerticalLayout (com.vaadin.flow.component.orderedlayout.VerticalLayout)29 Div (com.vaadin.flow.component.html.Div)25 Grid (com.vaadin.flow.component.grid.Grid)11 ComboBox (com.vaadin.flow.component.combobox.ComboBox)10 Button (com.vaadin.flow.component.button.Button)8 Paragraph (com.vaadin.flow.component.html.Paragraph)7 HorizontalLayout (com.vaadin.flow.component.orderedlayout.HorizontalLayout)7 Route (com.vaadin.flow.router.Route)6 List (java.util.List)6 IntStream (java.util.stream.IntStream)6 NativeButton (com.vaadin.flow.component.html.NativeButton)5 ArrayList (java.util.ArrayList)5 Html (com.vaadin.flow.component.Html)4 TextField (com.vaadin.flow.component.textfield.TextField)4 Faker (com.github.javafaker.Faker)3 ItemFilter (com.vaadin.flow.component.combobox.ComboBox.ItemFilter)3 Label (com.vaadin.flow.component.html.Label)3 CallbackDataProvider (com.vaadin.flow.data.provider.CallbackDataProvider)3 ComponentRenderer (com.vaadin.flow.data.renderer.ComponentRenderer)3