Search in sources :

Example 1 with VerticalLayout

use of com.vaadin.flow.component.orderedlayout.VerticalLayout in project flow by vaadin.

the class MainView method createDrawerContent.

private Component createDrawerContent(Tabs menu) {
    VerticalLayout layout = new VerticalLayout();
    layout.setSizeFull();
    layout.setPadding(false);
    layout.setSpacing(false);
    layout.getThemeList().set("spacing-s", true);
    layout.setAlignItems(FlexComponent.Alignment.STRETCH);
    HorizontalLayout logoLayout = new HorizontalLayout();
    logoLayout.addClassName("logo");
    logoLayout.setAlignItems(FlexComponent.Alignment.CENTER);
    logoLayout.add(new Image("public/images/logo.jpg", "Bank of Flow logo"));
    logoLayout.add(new H1("Bank of Flow"));
    Div info = new Div();
    info.setText("The menu intentionally shows items you cannot access so that access control can be tested by clicking on them");
    layout.add(logoLayout, info, menu);
    if (userInfo == null) {
        Button login = new Button("Log in");
        login.setId("login");
        login.addClickListener(e -> {
            e.getSource().getUI().get().navigate(LoginView.class);
        });
        layout.add(login);
    } else {
        Button logout = new Button("Logout");
        logout.setId("logout");
        logout.addClickListener(e -> {
            securityUtils.logout();
        });
        layout.add(logout);
    }
    return layout;
}
Also used : Div(com.vaadin.flow.component.html.Div) Button(com.vaadin.flow.component.button.Button) VerticalLayout(com.vaadin.flow.component.orderedlayout.VerticalLayout) H1(com.vaadin.flow.component.html.H1) Image(com.vaadin.flow.component.html.Image) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout)

Example 2 with VerticalLayout

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

the class NotificationsOverlayView method initViews.

private void initViews() {
    views.clear();
    if (holder.getNotificationSize() > 0) {
        views.addAll(this.holder.getNotificationCards());
    } else {
        noNotificationsLabel = new Label(noNotificationText);
        noNotificationsLabel.getStyle().set("color", "var(--app-layout-notification-font-color)").set("font-size", "var(--app-layout-font-size-menu)");
        VerticalLayout labelWrapper = new VerticalLayout(noNotificationsLabel);
        labelWrapper.setAlignItems(FlexComponent.Alignment.CENTER);
        labelWrapper.setJustifyContentMode(FlexComponent.JustifyContentMode.CENTER);
        Card wrapper = new Card(labelWrapper);
        wrapper.setWidthFull();
        wrapper.setBackground("var(--lumo-base-color)");
        wrapper.setWidth("100%");
        wrapper.setJustifyContentMode(FlexComponent.JustifyContentMode.CENTER);
        views.add(wrapper);
    }
}
Also used : Label(com.vaadin.flow.component.html.Label) VerticalLayout(com.vaadin.flow.component.orderedlayout.VerticalLayout) Card(com.github.appreciated.card.Card)

Aggregations

VerticalLayout (com.vaadin.flow.component.orderedlayout.VerticalLayout)2 Card (com.github.appreciated.card.Card)1 Button (com.vaadin.flow.component.button.Button)1 Div (com.vaadin.flow.component.html.Div)1 H1 (com.vaadin.flow.component.html.H1)1 Image (com.vaadin.flow.component.html.Image)1 Label (com.vaadin.flow.component.html.Label)1 HorizontalLayout (com.vaadin.flow.component.orderedlayout.HorizontalLayout)1