Search in sources :

Example 6 with FlexLayout

use of com.vaadin.flow.component.orderedlayout.FlexLayout in project iesi by metadew.

the class LoginScreen method buildUI.

private void buildUI() {
    setSizeFull();
    setClassName("login-screen");
    // login form, centered in the available part of the screen
    LoginForm loginForm = new LoginForm();
    loginForm.addLoginListener(this::login);
    loginForm.addForgotPasswordListener(event -> Notification.show("Contact your framework administrator"));
    // layout to center login form when there is sufficient screen space
    FlexLayout centeringLayout = new FlexLayout();
    centeringLayout.setSizeFull();
    centeringLayout.setJustifyContentMode(JustifyContentMode.CENTER);
    centeringLayout.setAlignItems(Alignment.CENTER);
    centeringLayout.add(loginForm);
    // information text about logging in
    Component loginInformation = buildLoginInformation();
    add(loginInformation);
    add(centeringLayout);
}
Also used : FlexLayout(com.vaadin.flow.component.orderedlayout.FlexLayout) LoginForm(com.vaadin.flow.component.login.LoginForm) Component(com.vaadin.flow.component.Component)

Example 7 with FlexLayout

use of com.vaadin.flow.component.orderedlayout.FlexLayout in project vaadin-app-layout by appreciated.

the class AppBarBuilder method build.

@Override
public FlexLayout build() {
    FlexLayout layout = new FlexLayout(components.toArray(new Component[0]));
    layout.getStyle().set("flex-direction", "var(--app-layout-app-bar-flex-direction)");
    layout.setWidthFull();
    layout.setAlignItems(FlexComponent.Alignment.CENTER);
    return layout;
}
Also used : FlexLayout(com.vaadin.flow.component.orderedlayout.FlexLayout) FlexComponent(com.vaadin.flow.component.orderedlayout.FlexComponent) Component(com.vaadin.flow.component.Component)

Example 8 with FlexLayout

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

the class SelectCustomRendererLabel method createPersonRenderer.

private static ComponentRenderer<FlexLayout, Person> createPersonRenderer() {
    return new ComponentRenderer<>(person -> {
        FlexLayout wrapper = new FlexLayout();
        wrapper.setAlignItems(FlexComponent.Alignment.CENTER);
        // NOTE
        // We are using inline styles here to keep the example simple.
        // We recommend placing CSS in a separate style sheet and to
        // encapsulating the styling in a new component.
        Image image = new Image();
        image.setSrc(person.getPictureUrl());
        image.setAlt("Portrait of " + person.getFirstName() + " " + person.getLastName());
        image.setWidth("var(--lumo-size-m)");
        image.getStyle().set("margin-right", "var(--lumo-space-s)");
        Div info = new Div();
        info.setText(person.getFirstName() + " " + person.getLastName());
        Div profession = new Div();
        profession.setText(person.getProfession());
        profession.getStyle().set("font-size", "var(--lumo-font-size-s)");
        profession.getStyle().set("color", "var(--lumo-secondary-text-color)");
        info.add(profession);
        wrapper.add(image, info);
        return wrapper;
    });
}
Also used : Div(com.vaadin.flow.component.html.Div) ComponentRenderer(com.vaadin.flow.data.renderer.ComponentRenderer) FlexLayout(com.vaadin.flow.component.orderedlayout.FlexLayout) Image(com.vaadin.flow.component.html.Image)

Example 9 with FlexLayout

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

the class LoginScreen method buildUI.

private void buildUI() {
    setSizeFull();
    setClassName("login-screen");
    // login form, centered in the available part of the screen
    LoginForm loginForm = new LoginForm();
    loginForm.addLoginListener(this::login);
    loginForm.addForgotPasswordListener(event -> Notification.show("Hint: same as username"));
    // layout to center login form when there is sufficient screen space
    FlexLayout centeringLayout = new FlexLayout();
    centeringLayout.setSizeFull();
    centeringLayout.setJustifyContentMode(JustifyContentMode.CENTER);
    centeringLayout.setAlignItems(Alignment.CENTER);
    centeringLayout.add(loginForm);
    // information text about logging in
    Component loginInformation = buildLoginInformation();
    add(loginInformation);
    add(centeringLayout);
}
Also used : FlexLayout(com.vaadin.flow.component.orderedlayout.FlexLayout) LoginForm(com.vaadin.flow.component.login.LoginForm) Component(com.vaadin.flow.component.Component)

Example 10 with FlexLayout

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

the class SitesView method addTable.

private void addTable() {
    FlexLayout tableLayout = new FlexLayout();
    tableLayout.setWidthFull();
    List<SiteGridItem> sites = fetchSites();
    DenseGrid<SiteGridItem> siteGrid = new DenseGrid<>(SiteGridItem.class);
    siteGrid.setItems(sites);
    Binder<SiteGridItem> siteBinder = new Binder<>(SiteGridItem.class);
    Editor<SiteGridItem> siteEditor = siteGrid.getEditor();
    siteEditor.setBinder(siteBinder);
    siteEditor.setBuffered(true);
    siteEditor.addOpenListener(event -> onEditorOpen(event, siteBinder));
    siteEditor.addCloseListener(event -> onEditorClose(siteBinder));
    siteGrid.addComponentColumn(site -> new RouterLink(site.getName(), SitesAdminsView.class, site.getId())).setHeader(getTranslation("view.sites.main.grid.column.name")).setKey("name").setSortable(true).setComparator(SiteGridItem::getName).setEditorComponent(addEditForm(siteEditor));
    siteGrid.addComponentColumn(site -> createLastColumnContent(site, siteGrid)).setHeader(getTranslation("view.sites.main.grid.column.actions")).setKey("actions").setEditorComponent(addEditButtons(siteEditor)).setTextAlign(END);
    tableLayout.add(siteGrid);
    getContent().add(tableLayout);
}
Also used : DuplicatedNameValidationError(io.imunity.furms.api.validation.exceptions.DuplicatedNameValidationError) Component(com.vaadin.flow.component.Component) LoggerFactory(org.slf4j.LoggerFactory) MenuButton(io.imunity.furms.ui.components.MenuButton) PageTitle(io.imunity.furms.ui.components.PageTitle) Route(com.vaadin.flow.router.Route) FlexLayout(com.vaadin.flow.component.orderedlayout.FlexLayout) DenseGrid(io.imunity.furms.ui.components.DenseGrid) Key(com.vaadin.flow.component.Key) UI(com.vaadin.flow.component.UI) TextField(com.vaadin.flow.component.textfield.TextField) USERS(com.vaadin.flow.component.icon.VaadinIcon.USERS) MethodHandles(java.lang.invoke.MethodHandles) Editor(com.vaadin.flow.component.grid.editor.Editor) RouterGridLink(io.imunity.furms.ui.components.RouterGridLink) END(com.vaadin.flow.component.grid.ColumnTextAlign.END) Objects(java.util.Objects) List(java.util.List) Optional(java.util.Optional) NotificationUtils.showSuccessNotification(io.imunity.furms.ui.utils.NotificationUtils.showSuccessNotification) ViewHeaderLayout(io.imunity.furms.ui.components.ViewHeaderLayout) EditorOpenEvent(com.vaadin.flow.component.grid.editor.EditorOpenEvent) NotificationUtils.showErrorNotification(io.imunity.furms.ui.utils.NotificationUtils.showErrorNotification) SiteHasResourceCreditsRemoveValidationError(io.imunity.furms.api.validation.exceptions.SiteHasResourceCreditsRemoveValidationError) Binder(com.vaadin.flow.data.binder.Binder) Div(com.vaadin.flow.component.html.Div) FurmsDialog(io.imunity.furms.ui.components.FurmsDialog) PLUS_CIRCLE(com.vaadin.flow.component.icon.VaadinIcon.PLUS_CIRCLE) LUMO_TERTIARY(com.vaadin.flow.component.button.ButtonVariant.LUMO_TERTIARY) FurmsViewComponent(io.imunity.furms.ui.components.FurmsViewComponent) RouterLink(com.vaadin.flow.router.RouterLink) SiteService(io.imunity.furms.api.sites.SiteService) Icon(com.vaadin.flow.component.icon.Icon) EAGER(com.vaadin.flow.data.value.ValueChangeMode.EAGER) Logger(org.slf4j.Logger) Grid(com.vaadin.flow.component.grid.Grid) TRASH(com.vaadin.flow.component.icon.VaadinIcon.TRASH) FENIX_ADMIN_SITES(io.imunity.furms.domain.constant.RoutesConst.FENIX_ADMIN_SITES) EDIT(com.vaadin.flow.component.icon.VaadinIcon.EDIT) GridActionMenu(io.imunity.furms.ui.components.GridActionMenu) GridActionsButtonLayout(io.imunity.furms.ui.components.GridActionsButtonLayout) ClickEvent(com.vaadin.flow.component.ClickEvent) Site(io.imunity.furms.domain.sites.Site) FenixAdminMenu(io.imunity.furms.ui.views.fenix.menu.FenixAdminMenu) Collectors.toList(java.util.stream.Collectors.toList) Button(com.vaadin.flow.component.button.Button) SitesAdminsView(io.imunity.furms.ui.views.fenix.sites.admins.SitesAdminsView) Comparator(java.util.Comparator) SitesAddView(io.imunity.furms.ui.views.fenix.sites.add.SitesAddView) NAME_MAX_LENGTH(io.imunity.furms.ui.utils.FormSettings.NAME_MAX_LENGTH) Binder(com.vaadin.flow.data.binder.Binder) RouterLink(com.vaadin.flow.router.RouterLink) FlexLayout(com.vaadin.flow.component.orderedlayout.FlexLayout) DenseGrid(io.imunity.furms.ui.components.DenseGrid)

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