use of com.vaadin.flow.component.icon.Icon in project docs by vaadin.
the class MenuBarIcons method createIconItem.
private MenuItem createIconItem(HasMenuItems menu, VaadinIcon iconName, String label, String ariaLabel, boolean isChild) {
Icon icon = new Icon(iconName);
if (isChild) {
icon.getStyle().set("width", "var(--lumo-icon-size-s)");
icon.getStyle().set("height", "var(--lumo-icon-size-s)");
icon.getStyle().set("marginRight", "var(--lumo-space-s)");
}
MenuItem item = menu.addItem(icon, e -> {
});
if (ariaLabel != null) {
item.getElement().setAttribute("aria-label", ariaLabel);
}
if (label != null) {
item.add(new Text(label));
}
return item;
}
use of com.vaadin.flow.component.icon.Icon in project docs by vaadin.
the class GridColumnHeaderFooter method createSubscriberHeader.
// tag::snippet2[]
private static Component createSubscriberHeader() {
Span span = new Span("Subscriber");
Icon icon = VaadinIcon.INFO_CIRCLE.create();
icon.getElement().setAttribute("title", "Subscribers are paying customers");
icon.getStyle().set("height", "var(--lumo-font-size-m)").set("color", "var(--lumo-contrast-70pct)");
HorizontalLayout layout = new HorizontalLayout(span, icon);
layout.setAlignItems(FlexComponent.Alignment.CENTER);
layout.setSpacing(false);
return layout;
}
use of com.vaadin.flow.component.icon.Icon in project docs by vaadin.
the class NotificationRich method createSubmitSuccess.
// tag::snippet[]
public static Notification createSubmitSuccess() {
Notification notification = new Notification();
notification.addThemeVariants(NotificationVariant.LUMO_SUCCESS);
Icon icon = VaadinIcon.CHECK_CIRCLE.create();
Div info = new Div(new Text("Application submitted!"));
Button viewBtn = new Button("View", clickEvent -> notification.close());
viewBtn.getStyle().set("margin", "0 0 0 var(--lumo-space-l)");
HorizontalLayout layout = new HorizontalLayout(icon, info, viewBtn, createCloseBtn(notification));
layout.setAlignItems(FlexComponent.Alignment.CENTER);
notification.add(layout);
return notification;
}
use of com.vaadin.flow.component.icon.Icon in project docs by vaadin.
the class NotificationUndo method show.
public Notification show() {
// tag::snippet[]
Notification notification = new Notification();
notification.setDuration(10000);
notification.addThemeVariants(NotificationVariant.LUMO_CONTRAST);
Div statusText = new Div(new Text("5 tasks deleted"));
Button undoButton = new Button("Undo");
undoButton.addThemeVariants(ButtonVariant.LUMO_TERTIARY_INLINE);
undoButton.getElement().getStyle().set("margin-left", "var(--lumo-space-xl)");
undoButton.addClickListener(event -> {
notification.close();
});
Button closeButton = new Button(new Icon("lumo", "cross"));
closeButton.addThemeVariants(ButtonVariant.LUMO_TERTIARY_INLINE);
closeButton.getElement().setAttribute("aria-label", "Close");
closeButton.addClickListener(event -> {
notification.close();
});
HorizontalLayout layout = new HorizontalLayout(statusText, undoButton, closeButton);
layout.setAlignItems(Alignment.CENTER);
notification.add(layout);
notification.open();
// end::snippet[]
notification.setPosition(Notification.Position.MIDDLE);
return notification;
}
use of com.vaadin.flow.component.icon.Icon in project docs by vaadin.
the class AppLayoutBottomNavbar method createTab.
private Tab createTab(VaadinIcon viewIcon, String viewName) {
Icon icon = viewIcon.create();
icon.setSize("var(--lumo-icon-size-s)");
icon.getStyle().set("margin", "auto");
RouterLink link = new RouterLink();
link.add(icon);
// Demo has no routes
// link.setRoute(viewClass.java);
link.setTabIndex(-1);
return new Tab(link);
}
Aggregations