Search in sources :

Example 11 with FlexLayout

use of com.vaadin.flow.component.orderedlayout.FlexLayout in project furms by unity-idm.

the class SitesAddView method addHeader.

private void addHeader() {
    FlexLayout headerLayout = new FlexLayout();
    headerLayout.setWidthFull();
    H4 title = new H4(getTranslation("view.sites.add.title"));
    headerLayout.add(title);
    getContent().add(headerLayout);
}
Also used : FlexLayout(com.vaadin.flow.component.orderedlayout.FlexLayout) H4(com.vaadin.flow.component.html.H4)

Example 12 with FlexLayout

use of com.vaadin.flow.component.orderedlayout.FlexLayout in project flow-components by vaadin.

the class ComboBoxView method customOptionsDemo.

private void customOptionsDemo() {
    // ComponentRenderer
    ComboBox<Information> comboBox = new ComboBox<>();
    comboBox.setLabel("User");
    comboBox.setItems(new Information("Gabriella", "https://randomuser.me/api/portraits/women/43.jpg"), new Information("Rudi", "https://randomuser.me/api/portraits/men/77.jpg"), new Information("Hamsa", "https://randomuser.me/api/portraits/men/35.jpg"), new Information("Jacob", "https://randomuser.me/api/portraits/men/76.jpg"));
    comboBox.setRenderer(new ComponentRenderer<>(information -> {
        Div text = new Div();
        text.setText(information.getText());
        Image image = new Image();
        image.setWidth("21px");
        image.setHeight("21px");
        image.setSrc(information.getImage());
        FlexLayout wrapper = new FlexLayout();
        text.getStyle().set("margin-left", "0.5em");
        wrapper.add(image, text);
        return wrapper;
    }));
    comboBox.setItemLabelGenerator(Information::getText);
    addCard("Presentation", "Customizing drop down items with ComponentRenderer", comboBox);
}
Also used : ItemFilter(com.vaadin.flow.component.combobox.ComboBox.ItemFilter) ComponentRenderer(com.vaadin.flow.data.renderer.ComponentRenderer) Person(com.vaadin.flow.component.combobox.test.entity.Person) Image(com.vaadin.flow.component.html.Image) SortDirection(com.vaadin.flow.data.provider.SortDirection) Component(com.vaadin.flow.component.Component) ProjectData(com.vaadin.flow.component.combobox.test.data.ProjectData) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout) ElementData(com.vaadin.flow.component.combobox.test.data.ElementData) Div(com.vaadin.flow.component.html.Div) ComboBox(com.vaadin.flow.component.combobox.ComboBox) Song(com.vaadin.flow.component.combobox.test.entity.Song) ArrayList(java.util.ArrayList) Route(com.vaadin.flow.router.Route) FlexComponent(com.vaadin.flow.component.orderedlayout.FlexComponent) FlexLayout(com.vaadin.flow.component.orderedlayout.FlexLayout) TemplateRenderer(com.vaadin.flow.data.renderer.TemplateRenderer) IntegerField(com.vaadin.flow.component.textfield.IntegerField) ElementConstants(com.vaadin.flow.dom.ElementConstants) Department(com.vaadin.flow.component.combobox.test.entity.Department) Paragraph(com.vaadin.flow.component.html.Paragraph) Notification(com.vaadin.flow.component.notification.Notification) Ticket(com.vaadin.flow.component.combobox.test.entity.Ticket) Project(com.vaadin.flow.component.combobox.test.entity.Project) Anchor(com.vaadin.flow.component.html.Anchor) Query(com.vaadin.flow.data.provider.Query) ComboBoxLazyDataView(com.vaadin.flow.component.combobox.dataview.ComboBoxLazyDataView) Collection(java.util.Collection) VerticalLayout(com.vaadin.flow.component.orderedlayout.VerticalLayout) PersonService(com.vaadin.flow.component.combobox.test.service.PersonService) H2(com.vaadin.flow.component.html.H2) Element(com.vaadin.flow.component.combobox.test.entity.Element) DepartmentData(com.vaadin.flow.component.combobox.test.data.DepartmentData) List(java.util.List) Button(com.vaadin.flow.component.button.Button) Stream(java.util.stream.Stream) ComboBoxListDataView(com.vaadin.flow.component.combobox.dataview.ComboBoxListDataView) Span(com.vaadin.flow.component.html.Span) Div(com.vaadin.flow.component.html.Div) FlexLayout(com.vaadin.flow.component.orderedlayout.FlexLayout) ComboBox(com.vaadin.flow.component.combobox.ComboBox) Image(com.vaadin.flow.component.html.Image)

Example 13 with FlexLayout

use of com.vaadin.flow.component.orderedlayout.FlexLayout in project flow-components by vaadin.

the class ComboBoxView method configurationForRequired.

private void configurationForRequired() {
    ComboBox<String> requiredComboBox = new ComboBox<>();
    requiredComboBox.setItems("Option one", "Option two", "Option three");
    requiredComboBox.setLabel("Required");
    requiredComboBox.setPlaceholder("Select an option");
    requiredComboBox.setRequired(true);
    requiredComboBox.setClearButtonVisible(true);
    FlexLayout layout = new FlexLayout(requiredComboBox);
    layout.getStyle().set("flex-wrap", "wrap");
    addCard("Validation", "Required", layout);
}
Also used : FlexLayout(com.vaadin.flow.component.orderedlayout.FlexLayout) ComboBox(com.vaadin.flow.component.combobox.ComboBox)

Example 14 with FlexLayout

use of com.vaadin.flow.component.orderedlayout.FlexLayout in project flow-components by vaadin.

the class OrderedLayoutView method createFlexLayoutWithAlignmentContent.

/* FlexLayout demos */
private void createFlexLayoutWithAlignmentContent() {
    FlexLayout layout = new FlexLayout();
    layout.setWidth("130px");
    layout.setHeight("150px");
    layout.getStyle().set("border", "1px solid #9E9E9E");
    layout.setFlexWrap(FlexLayout.FlexWrap.WRAP);
    Component component1 = createComponent(1, "#78909C");
    Component component2 = createComponent(2, "#546E7A");
    Component component3 = createComponent(3, "#37474F");
    layout.add(component1, component2, component3);
    layout.setId("flex-layout-with-alignment-content");
    Consumer<FlexLayout.ContentAlignment> changeLayout = alignment -> layout.setAlignContent(alignment);
    addCard("FlexLayout", "FlexLayout with alignment content", layout, createRadioButtonGroup(FlexLayout.ContentAlignment.values(), changeLayout, layout.getAlignContent()));
}
Also used : Component(com.vaadin.flow.component.Component) Scroller(com.vaadin.flow.component.orderedlayout.Scroller) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout) VerticalLayout(com.vaadin.flow.component.orderedlayout.VerticalLayout) Div(com.vaadin.flow.component.html.Div) H2(com.vaadin.flow.component.html.H2) RadioButtonGroup(com.vaadin.flow.component.radiobutton.RadioButtonGroup) Route(com.vaadin.flow.router.Route) FlexComponent(com.vaadin.flow.component.orderedlayout.FlexComponent) Consumer(java.util.function.Consumer) BoxSizing(com.vaadin.flow.component.orderedlayout.BoxSizing) Alignment(com.vaadin.flow.component.orderedlayout.FlexComponent.Alignment) FlexLayout(com.vaadin.flow.component.orderedlayout.FlexLayout) TextRenderer(com.vaadin.flow.data.renderer.TextRenderer) Span(com.vaadin.flow.component.html.Span) FlexLayout(com.vaadin.flow.component.orderedlayout.FlexLayout) Component(com.vaadin.flow.component.Component) FlexComponent(com.vaadin.flow.component.orderedlayout.FlexComponent)

Example 15 with FlexLayout

use of com.vaadin.flow.component.orderedlayout.FlexLayout in project flow-components by vaadin.

the class OrderedLayoutView method createFlexLayoutWithOrderedItems.

private void createFlexLayoutWithOrderedItems() {
    FlexLayout layout = new FlexLayout();
    layout.setWidth("100%");
    layout.setHeight("50px");
    layout.getStyle().set("border", "1px solid #9E9E9E");
    Component component1 = createComponent(1, "#78909C");
    Component component2 = createComponent(2, "#546E7A");
    Component component3 = createComponent(3, "#37474F");
    layout.add(component1, component2, component3);
    layout.setOrder(0, component3);
    layout.setOrder(1, component1);
    layout.setOrder(2, component2);
    add(layout);
    layout.setId("flex-layout-with-ordered-items");
    addCard("FlexLayout", "FlexLayout with ordered items", layout);
}
Also used : FlexLayout(com.vaadin.flow.component.orderedlayout.FlexLayout) Component(com.vaadin.flow.component.Component) FlexComponent(com.vaadin.flow.component.orderedlayout.FlexComponent)

Aggregations

FlexLayout (com.vaadin.flow.component.orderedlayout.FlexLayout)25 Div (com.vaadin.flow.component.html.Div)14 Test (org.junit.Test)12 Component (com.vaadin.flow.component.Component)10 FlexComponent (com.vaadin.flow.component.orderedlayout.FlexComponent)7 Label (com.vaadin.flow.component.html.Label)4 HorizontalLayout (com.vaadin.flow.component.orderedlayout.HorizontalLayout)4 VerticalLayout (com.vaadin.flow.component.orderedlayout.VerticalLayout)4 Route (com.vaadin.flow.router.Route)4 H2 (com.vaadin.flow.component.html.H2)3 Span (com.vaadin.flow.component.html.Span)3 RadioButtonGroup (com.vaadin.flow.component.radiobutton.RadioButtonGroup)3 Button (com.vaadin.flow.component.button.Button)2 ComboBox (com.vaadin.flow.component.combobox.ComboBox)2 Image (com.vaadin.flow.component.html.Image)2 List (java.util.List)2 ClickEvent (com.vaadin.flow.component.ClickEvent)1 Key (com.vaadin.flow.component.Key)1 UI (com.vaadin.flow.component.UI)1 LUMO_TERTIARY (com.vaadin.flow.component.button.ButtonVariant.LUMO_TERTIARY)1