use of com.vaadin.flow.component.icon.Icon in project docs by vaadin.
the class BadgeIcons method createIcon.
// tag::snippet3[]
private Icon createIcon(VaadinIcon vaadinIcon) {
Icon icon = vaadinIcon.create();
icon.getStyle().set("padding", "var(--lumo-space-xs");
return icon;
}
use of com.vaadin.flow.component.icon.Icon in project docs by vaadin.
the class ContextMenuPresentation method createIcon.
private Component createIcon(VaadinIcon vaadinIcon) {
Icon icon = vaadinIcon.create();
icon.getStyle().set("color", "var(--lumo-secondary-text-color)").set("margin-inline-end", "var(--lumo-space-s").set("padding", "var(--lumo-space-xs");
return icon;
}
use of com.vaadin.flow.component.icon.Icon in project docs by vaadin.
the class AppLayoutSecondaryNavigation method createTab.
private Tab createTab(VaadinIcon viewIcon, String viewName) {
Icon icon = viewIcon.create();
icon.getStyle().set("box-sizing", "border-box").set("margin-inline-end", "var(--lumo-space-m)").set("padding", "var(--lumo-space-xs)");
RouterLink link = new RouterLink();
link.add(icon, new Span(viewName));
// Demo has no routes
// link.setRoute(viewClass.java);
link.setTabIndex(-1);
return new Tab(link);
}
use of com.vaadin.flow.component.icon.Icon in project docs by vaadin.
the class NotificationRetry method show.
private Notification show() {
// tag::snippet[]
// When creating a notification using the constructor,
// the duration is 0-sec by default which means that
// the notification does not close automatically.
Notification notification = new Notification();
notification.addThemeVariants(NotificationVariant.LUMO_ERROR);
Div statusText = new Div(new Text("Failed to generate report"));
Button retryButton = new Button("Retry");
retryButton.addThemeVariants(ButtonVariant.LUMO_TERTIARY_INLINE);
retryButton.getElement().getStyle().set("margin-left", "var(--lumo-space-xl)");
retryButton.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, retryButton, 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 NotificationRich method createReportError.
public static Notification createReportError() {
Notification notification = new Notification();
notification.addThemeVariants(NotificationVariant.LUMO_ERROR);
Icon icon = VaadinIcon.WARNING.create();
Div info = new Div(new Text("Failed to generate report!"));
Button retryBtn = new Button("Retry", clickEvent -> notification.close());
retryBtn.getStyle().set("margin", "0 0 0 var(--lumo-space-l)");
HorizontalLayout layout = new HorizontalLayout(icon, info, retryBtn, createCloseBtn(notification));
layout.setAlignItems(FlexComponent.Alignment.CENTER);
notification.add(layout);
return notification;
}
Aggregations