use of com.vaadin.flow.component.button.ButtonVariant.LUMO_TERTIARY in project furms by unity-idm.
the class UserContextMenuFactory method get.
public Component get(UserGridItem gridItem, Runnable gridReloader, Supplier<Long> gridSizeLoader) {
GridActionMenu contextMenu = new GridActionMenu();
if (removeUserAction != null && gridItem.getStatus().equals(UserUIStatus.ENABLED)) {
Button button = new Button(getTranslation("component.administrators.context.menu.remove"), MINUS_CIRCLE.create());
button.addThemeVariants(LUMO_TERTIARY);
contextMenu.addItem(button, event -> {
if (gridItem.getId().isPresent() && gridItem.getId().get().equals(currentUserId))
doRemoveYourself(gridReloader, gridSizeLoader);
else
doRemoveItemAction(gridItem, gridReloader, gridSizeLoader);
});
}
if (resendInvitationAction != null && gridItem.getStatus().equals(UserUIStatus.AWAITS_APPROVAL)) {
Button button = new Button(getTranslation("component.administrators.context.menu.resend.invitation"), PAPERPLANE.create());
button.addThemeVariants(LUMO_TERTIARY);
contextMenu.addItem(button, event -> resendInvitationAction.accept(gridItem.getInvitationId().get()));
}
if (removeInvitationAction != null && gridItem.getStatus().equals(UserUIStatus.AWAITS_APPROVAL)) {
Button button = new Button(getTranslation("component.administrators.context.menu.remove.invitation"), TRASH.create());
button.addThemeVariants(LUMO_TERTIARY);
contextMenu.addItem(button, event -> removeInvitationAction.accept(gridItem.getInvitationId().get()));
}
customContextMenuItems.stream().filter(item -> item.confirmer.test(gridItem)).forEach(item -> contextMenu.addItem(item.buttonProvider.apply(gridItem), event -> item.menuButtonHandler.accept(gridItem)));
if (contextMenu.getChildren().count() == 0)
return new Div();
return contextMenu.getTarget();
}
Aggregations