use of com.vaadin.flow.component.orderedlayout.HorizontalLayout in project flow by vaadin.
the class MainView method createHeaderContent.
private Component createHeaderContent() {
HorizontalLayout layout = new HorizontalLayout();
layout.addClassName("header");
layout.getThemeList().set("dark", true);
layout.setWidthFull();
layout.setSpacing(false);
layout.setAlignItems(FlexComponent.Alignment.CENTER);
layout.add(new DrawerToggle());
viewTitle = new H1();
layout.add(viewTitle);
Avatar avatar = new Avatar();
if (userInfo != null) {
avatar.setName(userInfo.getFullName());
avatar.setImage(userInfo.getImageUrl());
}
layout.add(avatar);
return layout;
}
use of com.vaadin.flow.component.orderedlayout.HorizontalLayout 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;
}
Aggregations