Search in sources :

Example 1 with ACTIVE

use of io.imunity.furms.ui.views.user_settings.projects.UserStatus.ACTIVE in project furms by unity-idm.

the class ProjectsView method createProjectGrid.

private Grid<ProjectGridModel> createProjectGrid() {
    Grid<ProjectGridModel> grid = new DenseGrid<>(ProjectGridModel.class);
    Grid.Column<ProjectGridModel> firstColumn = grid.addComponentColumn(project -> {
        Component component = new Span(project.name);
        if (project.status.equals(ACTIVE))
            component = new RouterLink(project.name, ProjectView.class, project.id);
        return component;
    }).setHeader(getTranslation("view.user-settings.projects.grid.column.1")).setSortable(true).setComparator(comparing(project -> project.name)).setComparator(project -> project.name.toLowerCase());
    grid.addColumn(project -> project.description).setHeader(getTranslation("view.user-settings.projects.grid.column.2")).setSortable(true);
    grid.addColumn(project -> getTranslation(project.status.gridText)).setHeader(getTranslation("view.user-settings.projects.grid.column.3")).setTextAlign(ColumnTextAlign.END).setSortable(true);
    grid.addComponentColumn(this::createLastColumnContent).setHeader(getTranslation("view.user-settings.projects.grid.column.4")).setTextAlign(ColumnTextAlign.END);
    grid.sort(ImmutableList.of(new GridSortOrder<>(firstColumn, SortDirection.ASCENDING)));
    return grid;
}
Also used : VaadinExceptionHandler.handleExceptions(io.imunity.furms.ui.utils.VaadinExceptionHandler.handleExceptions) SortDirection(com.vaadin.flow.data.provider.SortDirection) Component(com.vaadin.flow.component.Component) NotificationUtils.showErrorNotification(io.imunity.furms.ui.utils.NotificationUtils.showErrorNotification) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout) FurmsDialog(io.imunity.furms.ui.components.FurmsDialog) MenuButton(io.imunity.furms.ui.components.MenuButton) PageTitle(io.imunity.furms.ui.components.PageTitle) Route(com.vaadin.flow.router.Route) FlexComponent(com.vaadin.flow.component.orderedlayout.FlexComponent) HashSet(java.util.HashSet) PLUS_CIRCLE(com.vaadin.flow.component.icon.VaadinIcon.PLUS_CIRCLE) ImmutableList(com.google.common.collect.ImmutableList) DenseGrid(io.imunity.furms.ui.components.DenseGrid) FurmsViewComponent(io.imunity.furms.ui.components.FurmsViewComponent) PIE_CHART(com.vaadin.flow.component.icon.VaadinIcon.PIE_CHART) RouterLink(com.vaadin.flow.router.RouterLink) UserSettingsMenu(io.imunity.furms.ui.views.user_settings.UserSettingsMenu) Comparator.comparing(java.util.Comparator.comparing) TextField(com.vaadin.flow.component.textfield.TextField) SEARCH(com.vaadin.flow.component.icon.VaadinIcon.SEARCH) ValueChangeMode(com.vaadin.flow.data.value.ValueChangeMode) CheckboxGroupVariant(com.vaadin.flow.component.checkbox.CheckboxGroupVariant) MINUS_CIRCLE(com.vaadin.flow.component.icon.VaadinIcon.MINUS_CIRCLE) REQUESTED(io.imunity.furms.ui.views.user_settings.projects.UserStatus.REQUESTED) Grid(com.vaadin.flow.component.grid.Grid) ApplicationNotExistingException(io.imunity.furms.api.validation.exceptions.ApplicationNotExistingException) TRASH(com.vaadin.flow.component.icon.VaadinIcon.TRASH) RouterGridLink(io.imunity.furms.ui.components.RouterGridLink) ACTIVE(io.imunity.furms.ui.views.user_settings.projects.UserStatus.ACTIVE) Set(java.util.Set) GridActionMenu(io.imunity.furms.ui.components.GridActionMenu) GridActionsButtonLayout(io.imunity.furms.ui.components.GridActionsButtonLayout) ProjectApplicationsService(io.imunity.furms.api.applications.ProjectApplicationsService) GridSortOrder(com.vaadin.flow.component.grid.GridSortOrder) UserAlreadyInvitedException(io.imunity.furms.api.validation.exceptions.UserAlreadyInvitedException) Tooltip(com.vaadin.componentfactory.Tooltip) List(java.util.List) Collectors.toList(java.util.stream.Collectors.toList) ColumnTextAlign(com.vaadin.flow.component.grid.ColumnTextAlign) ProjectService(io.imunity.furms.api.projects.ProjectService) CheckboxGroup(com.vaadin.flow.component.checkbox.CheckboxGroup) UserWithoutFenixIdValidationError(io.imunity.furms.api.validation.exceptions.UserWithoutFenixIdValidationError) Dialog(com.vaadin.flow.component.dialog.Dialog) Collections(java.util.Collections) Span(com.vaadin.flow.component.html.Span) ViewHeaderLayout(io.imunity.furms.ui.components.ViewHeaderLayout) NotificationUtils.showSuccessNotification(io.imunity.furms.ui.utils.NotificationUtils.showSuccessNotification) RouterLink(com.vaadin.flow.router.RouterLink) GridSortOrder(com.vaadin.flow.component.grid.GridSortOrder) DenseGrid(io.imunity.furms.ui.components.DenseGrid) DenseGrid(io.imunity.furms.ui.components.DenseGrid) Grid(com.vaadin.flow.component.grid.Grid) Component(com.vaadin.flow.component.Component) FlexComponent(com.vaadin.flow.component.orderedlayout.FlexComponent) FurmsViewComponent(io.imunity.furms.ui.components.FurmsViewComponent) Span(com.vaadin.flow.component.html.Span)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 Tooltip (com.vaadin.componentfactory.Tooltip)1 Component (com.vaadin.flow.component.Component)1 CheckboxGroup (com.vaadin.flow.component.checkbox.CheckboxGroup)1 CheckboxGroupVariant (com.vaadin.flow.component.checkbox.CheckboxGroupVariant)1 Dialog (com.vaadin.flow.component.dialog.Dialog)1 ColumnTextAlign (com.vaadin.flow.component.grid.ColumnTextAlign)1 Grid (com.vaadin.flow.component.grid.Grid)1 GridSortOrder (com.vaadin.flow.component.grid.GridSortOrder)1 Span (com.vaadin.flow.component.html.Span)1 MINUS_CIRCLE (com.vaadin.flow.component.icon.VaadinIcon.MINUS_CIRCLE)1 PIE_CHART (com.vaadin.flow.component.icon.VaadinIcon.PIE_CHART)1 PLUS_CIRCLE (com.vaadin.flow.component.icon.VaadinIcon.PLUS_CIRCLE)1 SEARCH (com.vaadin.flow.component.icon.VaadinIcon.SEARCH)1 TRASH (com.vaadin.flow.component.icon.VaadinIcon.TRASH)1 FlexComponent (com.vaadin.flow.component.orderedlayout.FlexComponent)1 HorizontalLayout (com.vaadin.flow.component.orderedlayout.HorizontalLayout)1 TextField (com.vaadin.flow.component.textfield.TextField)1 SortDirection (com.vaadin.flow.data.provider.SortDirection)1 ValueChangeMode (com.vaadin.flow.data.value.ValueChangeMode)1