Search in sources :

Example 46 with ComponentRenderer

use of com.vaadin.flow.data.renderer.ComponentRenderer in project flow-components by vaadin.

the class GridWithTemplatePage method createStandaloneGridWithTemplatesInTheDetails.

private void createStandaloneGridWithTemplatesInTheDetails() {
    Grid<String> grid = new Grid<>();
    setCommonGridFeatures(grid, "standalone-template-in-details");
    grid.addColumn(value -> value);
    grid.setItemDetailsRenderer(new ComponentRenderer<>(value -> getTestTemplate(value, grid.getId().get())));
    add(new H3("Grid with templates in the details"), grid);
}
Also used : ComponentRenderer(com.vaadin.flow.data.renderer.ComponentRenderer) Grid(com.vaadin.flow.component.grid.Grid) TemplateRenderer(com.vaadin.flow.data.renderer.TemplateRenderer) Element(com.vaadin.flow.dom.Element) Div(com.vaadin.flow.component.html.Div) H3(com.vaadin.flow.component.html.H3) H2(com.vaadin.flow.component.html.H2) Route(com.vaadin.flow.router.Route) Grid(com.vaadin.flow.component.grid.Grid) H3(com.vaadin.flow.component.html.H3)

Example 47 with ComponentRenderer

use of com.vaadin.flow.data.renderer.ComponentRenderer in project flow-components by vaadin.

the class GridWithTemplatePage method createStandaloneGridWithColumnProperties.

private void createStandaloneGridWithColumnProperties() {
    Grid<String> grid = new Grid<>();
    setCommonGridFeatures(grid, "standalone-columns-with-properties");
    grid.addColumn(value -> value).setFlexGrow(2);
    grid.addColumn(TemplateRenderer.of("[[index]]")).setFlexGrow(0).setWidth("20px");
    grid.addColumn(new ComponentRenderer<>(value -> getTestTemplate(value, grid.getId().get()))).setFrozen(true).setResizable(true);
    add(new H3("Grid with column properties"), grid);
}
Also used : ComponentRenderer(com.vaadin.flow.data.renderer.ComponentRenderer) Grid(com.vaadin.flow.component.grid.Grid) TemplateRenderer(com.vaadin.flow.data.renderer.TemplateRenderer) Element(com.vaadin.flow.dom.Element) Div(com.vaadin.flow.component.html.Div) H3(com.vaadin.flow.component.html.H3) H2(com.vaadin.flow.component.html.H2) Route(com.vaadin.flow.router.Route) Grid(com.vaadin.flow.component.grid.Grid) H3(com.vaadin.flow.component.html.H3)

Example 48 with ComponentRenderer

use of com.vaadin.flow.data.renderer.ComponentRenderer in project flow-components by vaadin.

the class OverrideClientValidationPage method createGridSetup.

private void createGridSetup() {
    selectInGrid = new Select<>();
    Grid<String> grid = new Grid<>();
    grid.setItems("test");
    grid.addColumn(new ComponentRenderer<>(item -> selectInGrid, (component, item) -> component));
    add(new H1("Grid select usage"), grid);
}
Also used : ComponentRenderer(com.vaadin.flow.data.renderer.ComponentRenderer) Grid(com.vaadin.flow.component.grid.Grid) Select(com.vaadin.flow.component.select.Select) H1(com.vaadin.flow.component.html.H1) Div(com.vaadin.flow.component.html.Div) NativeButton(com.vaadin.flow.component.html.NativeButton) Span(com.vaadin.flow.component.html.Span) Route(com.vaadin.flow.router.Route) Grid(com.vaadin.flow.component.grid.Grid) H1(com.vaadin.flow.component.html.H1)

Example 49 with ComponentRenderer

use of com.vaadin.flow.data.renderer.ComponentRenderer in project flow-components by vaadin.

the class TimePickerPage method createTimePickerFromRenderer.

private void createTimePickerFromRenderer() {
    ComponentRenderer<TimePicker, TimePickerPage> renderer = new ComponentRenderer<>(() -> {
        TimePicker timePicker = new TimePicker();
        timePicker.setValue(LocalTime.now());
        return timePicker;
    });
    renderer.render(getElement(), null);
}
Also used : TimePicker(com.vaadin.flow.component.timepicker.TimePicker) ComponentRenderer(com.vaadin.flow.data.renderer.ComponentRenderer)

Aggregations

ComponentRenderer (com.vaadin.flow.data.renderer.ComponentRenderer)49 Div (com.vaadin.flow.component.html.Div)33 Route (com.vaadin.flow.router.Route)30 Grid (com.vaadin.flow.component.grid.Grid)23 HorizontalLayout (com.vaadin.flow.component.orderedlayout.HorizontalLayout)20 List (java.util.List)19 Icon (com.vaadin.flow.component.icon.Icon)18 NativeButton (com.vaadin.flow.component.html.NativeButton)14 VaadinIcon (com.vaadin.flow.component.icon.VaadinIcon)14 TemplateRenderer (com.vaadin.flow.data.renderer.TemplateRenderer)14 Collectors (java.util.stream.Collectors)14 Label (com.vaadin.flow.component.html.Label)13 Span (com.vaadin.flow.component.html.Span)12 EnhancedButton (org.komunumo.ui.component.EnhancedButton)12 Component (com.vaadin.flow.component.Component)10 H2 (com.vaadin.flow.component.html.H2)10 ArrayList (java.util.ArrayList)10 Element (com.vaadin.flow.dom.Element)9 Collections (java.util.Collections)9 UI (com.vaadin.flow.component.UI)8