Search in sources :

Example 81 with Icon

use of com.vaadin.flow.component.icon.Icon in project furms by unity-idm.

the class AuditLogView method createCommunityGrid.

private Grid<AuditLogGridModel> createCommunityGrid() {
    Grid<AuditLogGridModel> grid = new DenseGrid<>(AuditLogGridModel.class);
    Column<AuditLogGridModel> timestamp = grid.addComponentColumn(model -> {
        if (model.data.isEmpty())
            return new Div(new Label(model.timestamp.format(dateTimeFormatter)));
        Icon icon = grid.isDetailsVisible(model) ? ANGLE_DOWN.create() : ANGLE_RIGHT.create();
        return new Div(icon, new Label(model.timestamp.format(dateTimeFormatter)));
    }).setHeader(getTranslation("view.fenix-admin.audit-log.grid.1")).setSortable(true).setComparator(model -> model.timestamp);
    grid.addColumn(model -> model.originator).setHeader(getTranslation("view.fenix-admin.audit-log.grid.2")).setSortable(true).setComparator(model -> model.originator);
    grid.addColumn(model -> getTranslation("view.fenix-admin.audit-log.operation." + model.operation)).setHeader(getTranslation("view.fenix-admin.audit-log.grid.3")).setSortable(true).setComparator(comparing(model -> model.operation));
    grid.addColumn(model -> getTranslation("view.fenix-admin.audit-log.action." + model.action)).setHeader(getTranslation("view.fenix-admin.audit-log.grid.4")).setSortable(true).setComparator(comparing(model -> model.action));
    grid.addColumn(model -> model.name).setHeader(getTranslation("view.fenix-admin.audit-log.grid.5")).setSortable(true).setComparator(comparing(model -> model.name));
    grid.addColumn(model -> model.id).setHeader(getTranslation("view.fenix-admin.audit-log.grid.6")).setSortable(true).setComparator(comparing(model -> model.id));
    grid.sort(ImmutableList.of(new GridSortOrder<>(timestamp, SortDirection.DESCENDING)));
    grid.setItemDetailsRenderer(new ComponentRenderer<>(c -> AuditLogDetailsComponentFactory.create(c.data)));
    grid.setSelectionMode(Grid.SelectionMode.NONE);
    return grid;
}
Also used : ComponentRenderer(com.vaadin.flow.data.renderer.ComponentRenderer) UTCTimeUtils.convertToZoneTime(io.imunity.furms.utils.UTCTimeUtils.convertToZoneTime) SortDirection(com.vaadin.flow.data.provider.SortDirection) ZonedDateTime(java.time.ZonedDateTime) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout) Div(com.vaadin.flow.component.html.Div) Label(com.vaadin.flow.component.html.Label) HashMap(java.util.HashMap) PageTitle(io.imunity.furms.ui.components.PageTitle) Route(com.vaadin.flow.router.Route) FlexComponent(com.vaadin.flow.component.orderedlayout.FlexComponent) AuditLogService(io.imunity.furms.api.audit_log.AuditLogService) FlexLayout(com.vaadin.flow.component.orderedlayout.FlexLayout) ImmutableList(com.google.common.collect.ImmutableList) DenseGrid(io.imunity.furms.ui.components.DenseGrid) MultiselectComboBox(org.vaadin.gatanaso.MultiselectComboBox) FurmsViewComponent(io.imunity.furms.ui.components.FurmsViewComponent) Map(java.util.Map) Operation(io.imunity.furms.domain.audit_log.Operation) ANGLE_RIGHT(com.vaadin.flow.component.icon.VaadinIcon.ANGLE_RIGHT) Comparator.comparing(java.util.Comparator.comparing) TypeReference(com.fasterxml.jackson.core.type.TypeReference) UserService(io.imunity.furms.api.users.UserService) Icon(com.vaadin.flow.component.icon.Icon) Action(io.imunity.furms.domain.audit_log.Action) Grid(com.vaadin.flow.component.grid.Grid) UIContext(io.imunity.furms.ui.user_context.UIContext) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) VerticalLayout(com.vaadin.flow.component.orderedlayout.VerticalLayout) Set(java.util.Set) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException) AuditLogDetailsComponentFactory(io.imunity.furms.ui.components.AuditLogDetailsComponentFactory) FURMSUser(io.imunity.furms.domain.users.FURMSUser) SearchLayout(io.imunity.furms.ui.components.administrators.SearchLayout) Collectors(java.util.stream.Collectors) ZoneId(java.time.ZoneId) ANGLE_DOWN(com.vaadin.flow.component.icon.VaadinIcon.ANGLE_DOWN) GridSortOrder(com.vaadin.flow.component.grid.GridSortOrder) FurmsDateTimePicker(io.imunity.furms.ui.components.FurmsDateTimePicker) FenixAdminMenu(io.imunity.furms.ui.views.fenix.menu.FenixAdminMenu) Column(com.vaadin.flow.component.grid.Grid.Column) AuditLog(io.imunity.furms.domain.audit_log.AuditLog) DateTimeFormatter(java.time.format.DateTimeFormatter) Div(com.vaadin.flow.component.html.Div) GridSortOrder(com.vaadin.flow.component.grid.GridSortOrder) DenseGrid(io.imunity.furms.ui.components.DenseGrid) Label(com.vaadin.flow.component.html.Label) Icon(com.vaadin.flow.component.icon.Icon)

Example 82 with Icon

use of com.vaadin.flow.component.icon.Icon in project furms by unity-idm.

the class CommunityAllocationComponent method createCommunityGrid.

private Grid<CommunityAllocationGridModel> createCommunityGrid() {
    Grid<CommunityAllocationGridModel> grid = new DenseGrid<>(CommunityAllocationGridModel.class);
    grid.addComponentColumn(model -> {
        Icon icon = grid.isDetailsVisible(model) ? ANGLE_DOWN.create() : ANGLE_RIGHT.create();
        return new Div(icon, new Text(model.siteName));
    }).setHeader(getTranslation("view.fenix-admin.resource-credits-allocation.grid.column.1")).setSortable(true);
    grid.addComponentColumn(model -> new RouterLink(model.name, CommunityAllocationFormView.class, model.id)).setHeader(getTranslation("view.fenix-admin.resource-credits-allocation.grid.column.2")).setSortable(true).setComparator(model -> model.name.toLowerCase());
    grid.addColumn(model -> model.resourceCreditName).setHeader(getTranslation("view.fenix-admin.resource-credits-allocation.grid.column.3")).setSortable(true);
    grid.addColumn(model -> model.resourceTypeName).setHeader(getTranslation("view.fenix-admin.resource-credits-allocation.grid.column.4")).setSortable(true);
    grid.addColumn(model -> model.amountWithUnit).setHeader(getTranslation("view.fenix-admin.resource-credits-allocation.grid.column.5")).setSortable(true).setComparator(comparing(model -> model.amountWithUnit.amount));
    grid.addColumn(model -> model.distributedWithUnit).setHeader(getTranslation("view.fenix-admin.resource-credits-allocation.grid.column.6")).setSortable(true).setComparator(comparing(model -> model.distributedWithUnit.amount));
    grid.addColumn(model -> model.remainingWithUnit).setHeader(getTranslation("view.fenix-admin.resource-credits-allocation.grid.column.7")).setSortable(true).setComparator(comparing(model -> model.remainingWithUnit.amount));
    grid.addComponentColumn(model -> new ResourceProgressBar(model.amountWithUnit.amount, model.consumed, 0)).setHeader(getTranslation("view.fenix-admin.resource-credits-allocation.grid.column.8")).setComparator(comparing(model -> model.consumed));
    grid.addComponentColumn(this::createLastColumnContent).setHeader(getTranslation("view.fenix-admin.resource-credits-allocation.grid.column.9")).setTextAlign(ColumnTextAlign.END);
    grid.setItemDetailsRenderer(new ComponentRenderer<>(model -> AllocationDetailsComponentFactory.create(model.creationTime, model.validFrom, model.validTo)));
    return grid;
}
Also used : Div(com.vaadin.flow.component.html.Div) VaadinExceptionHandler.handleExceptions(io.imunity.furms.ui.utils.VaadinExceptionHandler.handleExceptions) ComponentRenderer(com.vaadin.flow.data.renderer.ComponentRenderer) Component(com.vaadin.flow.component.Component) Composite(com.vaadin.flow.component.Composite) NotificationUtils.showErrorNotification(io.imunity.furms.ui.utils.NotificationUtils.showErrorNotification) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout) Div(com.vaadin.flow.component.html.Div) FurmsDialog(io.imunity.furms.ui.components.FurmsDialog) MenuButton(io.imunity.furms.ui.components.MenuButton) CommunityAllocationService(io.imunity.furms.api.community_allocation.CommunityAllocationService) DenseGrid(io.imunity.furms.ui.components.DenseGrid) RouterLink(com.vaadin.flow.router.RouterLink) SPLINE_CHART(com.vaadin.flow.component.icon.VaadinIcon.SPLINE_CHART) UI(com.vaadin.flow.component.UI) ANGLE_RIGHT(com.vaadin.flow.component.icon.VaadinIcon.ANGLE_RIGHT) Comparator.comparing(java.util.Comparator.comparing) Icon(com.vaadin.flow.component.icon.Icon) Text(com.vaadin.flow.component.Text) VaadinExceptionHandler.getResultOrException(io.imunity.furms.ui.utils.VaadinExceptionHandler.getResultOrException) AllocationDetailsComponentFactory(io.imunity.furms.ui.components.AllocationDetailsComponentFactory) Grid(com.vaadin.flow.component.grid.Grid) TRASH(com.vaadin.flow.component.icon.VaadinIcon.TRASH) EDIT(com.vaadin.flow.component.icon.VaadinIcon.EDIT) RouterGridLink(io.imunity.furms.ui.components.RouterGridLink) GridActionMenu(io.imunity.furms.ui.components.GridActionMenu) GridActionsButtonLayout(io.imunity.furms.ui.components.GridActionsButtonLayout) ResourceProgressBar(io.imunity.furms.ui.components.ResourceProgressBar) ANGLE_DOWN(com.vaadin.flow.component.icon.VaadinIcon.ANGLE_DOWN) Button(com.vaadin.flow.component.button.Button) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) ColumnTextAlign(com.vaadin.flow.component.grid.ColumnTextAlign) Dialog(com.vaadin.flow.component.dialog.Dialog) Collections(java.util.Collections) ViewHeaderLayout(io.imunity.furms.ui.components.ViewHeaderLayout) RouterLink(com.vaadin.flow.router.RouterLink) DenseGrid(io.imunity.furms.ui.components.DenseGrid) Text(com.vaadin.flow.component.Text) Icon(com.vaadin.flow.component.icon.Icon) ResourceProgressBar(io.imunity.furms.ui.components.ResourceProgressBar)

Example 83 with Icon

use of com.vaadin.flow.component.icon.Icon in project furms by unity-idm.

the class FurmsAppLayoutComponentsHolder method createRightNavbarSite.

private HorizontalLayout createRightNavbarSite(Component notificationBar, FurmsRolePicker furmsRolePicker) {
    final Icon logout = LogoutIconFactory.create();
    final HorizontalLayout rightNavbarSite = new HorizontalLayout();
    rightNavbarSite.setAlignItems(FlexComponent.Alignment.CENTER);
    rightNavbarSite.setJustifyContentMode(FlexComponent.JustifyContentMode.END);
    rightNavbarSite.setSizeFull();
    final Text navbarTitle = new Text(getTranslation("navbar.text"));
    rightNavbarSite.add(navbarTitle, furmsRolePicker, notificationBar, logout);
    return rightNavbarSite;
}
Also used : Text(com.vaadin.flow.component.Text) Icon(com.vaadin.flow.component.icon.Icon) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout)

Example 84 with Icon

use of com.vaadin.flow.component.icon.Icon in project furms by unity-idm.

the class LogoutIconFactory method create.

public static Icon create() {
    Icon logout = new Icon(VaadinIcon.SIGN_OUT);
    logout.getStyle().set("cursor", "pointer");
    logout.addClickListener(event -> UI.getCurrent().getPage().setLocation(LOGOUT_TRIGGER_URL));
    return logout;
}
Also used : VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) Icon(com.vaadin.flow.component.icon.Icon)

Example 85 with Icon

use of com.vaadin.flow.component.icon.Icon in project alibaba-rsocket-broker by alibaba.

the class MainLayout method serviceTesting.

private Tab serviceTesting() {
    final Span label = new Span("Service Testing");
    final Icon icon = TOOLS.create();
    final Tab tab = new Tab(new HorizontalLayout(icon, label));
    tab2Workspace.put(tab, new ServiceTestingView(this.handlerRegistry, this.serviceRoutingSelector));
    return tab;
}
Also used : Tab(com.vaadin.flow.component.tabs.Tab) Icon(com.vaadin.flow.component.icon.Icon) VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) Span(com.vaadin.flow.component.html.Span) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout)

Aggregations

Icon (com.vaadin.flow.component.icon.Icon)110 VaadinIcon (com.vaadin.flow.component.icon.VaadinIcon)94 HorizontalLayout (com.vaadin.flow.component.orderedlayout.HorizontalLayout)46 Button (com.vaadin.flow.component.button.Button)39 Span (com.vaadin.flow.component.html.Span)21 Div (com.vaadin.flow.component.html.Div)19 ComponentRenderer (com.vaadin.flow.data.renderer.ComponentRenderer)18 Tab (com.vaadin.flow.component.tabs.Tab)16 Text (com.vaadin.flow.component.Text)15 Test (org.junit.Test)12 EnhancedButton (org.komunumo.ui.component.EnhancedButton)12 Grid (com.vaadin.flow.component.grid.Grid)10 RouterLink (com.vaadin.flow.router.RouterLink)9 Notification (com.vaadin.flow.component.notification.Notification)8 Component (com.vaadin.flow.component.Component)7 ColumnTextAlign (com.vaadin.flow.component.grid.ColumnTextAlign)7 Anchor (com.vaadin.flow.component.html.Anchor)7 TextField (com.vaadin.flow.component.textfield.TextField)7 UI (com.vaadin.flow.component.UI)6 StreamResource (com.vaadin.flow.server.StreamResource)6