Search in sources :

Example 1 with SEARCH

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

the class ProjectsView method createSearchFilterLayout.

private HorizontalLayout createSearchFilterLayout(Grid<ProjectViewGridModel> grid, Button addButton) {
    TextField textField = new TextField();
    textField.setPlaceholder(getTranslation("view.community-admin.projects.field.search"));
    textField.setPrefixComponent(SEARCH.create());
    textField.setValueChangeMode(ValueChangeMode.EAGER);
    textField.setClearButtonVisible(true);
    textField.addValueChangeListener(event -> {
        String value = textField.getValue().toLowerCase();
        List<ProjectViewGridModel> filteredUsers = projectsViewDataSnapshot.projectViewGridModels.stream().filter(project -> project.matches(value)).collect(toList());
        grid.setItems(filteredUsers);
        // TODO This is a work around to fix disappearing text cursor
        addButton.focus();
        textField.focus();
    });
    HorizontalLayout search = new HorizontalLayout(textField);
    search.setJustifyContentMode(FlexComponent.JustifyContentMode.END);
    return search;
}
Also used : UTCTimeUtils(io.imunity.furms.utils.UTCTimeUtils) Component(com.vaadin.flow.component.Component) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout) MenuButton(io.imunity.furms.ui.components.MenuButton) PageTitle(io.imunity.furms.ui.components.PageTitle) ADMINISTRATORS_PARAM(io.imunity.furms.ui.views.community.projects.ProjectConst.ADMINISTRATORS_PARAM) Route(com.vaadin.flow.router.Route) FlexComponent(com.vaadin.flow.component.orderedlayout.FlexComponent) Collectors.toMap(java.util.stream.Collectors.toMap) Map(java.util.Map) UI(com.vaadin.flow.component.UI) CommunityAdminMenu(io.imunity.furms.ui.views.community.CommunityAdminMenu) SEARCH(com.vaadin.flow.component.icon.VaadinIcon.SEARCH) TextField(com.vaadin.flow.component.textfield.TextField) USERS(com.vaadin.flow.component.icon.VaadinIcon.USERS) Collections.emptyList(java.util.Collections.emptyList) TooltipAlignment(com.vaadin.componentfactory.TooltipAlignment) RouterGridLink(io.imunity.furms.ui.components.RouterGridLink) Set(java.util.Set) PARAM_NAME(io.imunity.furms.ui.views.community.projects.ProjectConst.PARAM_NAME) Collectors(java.util.stream.Collectors) TreeGrid(com.vaadin.flow.component.treegrid.TreeGrid) List(java.util.List) ColumnTextAlign(com.vaadin.flow.component.grid.ColumnTextAlign) StatusLayout(io.imunity.furms.ui.components.StatusLayout) Optional(java.util.Optional) TIME_BACKWARD(com.vaadin.flow.component.icon.VaadinIcon.TIME_BACKWARD) TooltipPosition(com.vaadin.componentfactory.TooltipPosition) Dialog(com.vaadin.flow.component.dialog.Dialog) ViewHeaderLayout(io.imunity.furms.ui.components.ViewHeaderLayout) VaadinExceptionHandler.handleExceptions(io.imunity.furms.ui.utils.VaadinExceptionHandler.handleExceptions) ResourceGetter.getCurrentResourceId(io.imunity.furms.ui.utils.ResourceGetter.getCurrentResourceId) ProjectInstallationJobStatus(io.imunity.furms.domain.project_installation.ProjectInstallationJobStatus) Collectors.groupingBy(java.util.stream.Collectors.groupingBy) FurmsDialog(io.imunity.furms.ui.components.FurmsDialog) Collectors.collectingAndThen(java.util.stream.Collectors.collectingAndThen) Function(java.util.function.Function) PLUS_CIRCLE(com.vaadin.flow.component.icon.VaadinIcon.PLUS_CIRCLE) REFRESH(com.vaadin.flow.component.icon.VaadinIcon.REFRESH) FurmsViewComponent(io.imunity.furms.ui.components.FurmsViewComponent) PIE_CHART(com.vaadin.flow.component.icon.VaadinIcon.PIE_CHART) Collectors.mapping(java.util.stream.Collectors.mapping) RouterLink(com.vaadin.flow.router.RouterLink) ProjectInstallationsService(io.imunity.furms.api.project_installation.ProjectInstallationsService) DenseTreeGrid(io.imunity.furms.ui.views.project.resource_access.DenseTreeGrid) Comparator.comparing(java.util.Comparator.comparing) ProjectUpdateJobStatus(io.imunity.furms.domain.project_installation.ProjectUpdateJobStatus) Icon(com.vaadin.flow.component.icon.Icon) ValueChangeMode(com.vaadin.flow.data.value.ValueChangeMode) Grid(com.vaadin.flow.component.grid.Grid) TRASH(com.vaadin.flow.component.icon.VaadinIcon.TRASH) ALLOCATIONS_PARAM(io.imunity.furms.ui.views.community.projects.ProjectConst.ALLOCATIONS_PARAM) EDIT(com.vaadin.flow.component.icon.VaadinIcon.EDIT) GridActionMenu(io.imunity.furms.ui.components.GridActionMenu) GridActionsButtonLayout(io.imunity.furms.ui.components.GridActionsButtonLayout) Collectors.toList(java.util.stream.Collectors.toList) Tooltip(com.vaadin.componentfactory.Tooltip) Button(com.vaadin.flow.component.button.Button) ProjectService(io.imunity.furms.api.projects.ProjectService) Comparator(java.util.Comparator) Collections(java.util.Collections) TextField(com.vaadin.flow.component.textfield.TextField) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout)

Aggregations

Tooltip (com.vaadin.componentfactory.Tooltip)1 TooltipAlignment (com.vaadin.componentfactory.TooltipAlignment)1 TooltipPosition (com.vaadin.componentfactory.TooltipPosition)1 Component (com.vaadin.flow.component.Component)1 UI (com.vaadin.flow.component.UI)1 Button (com.vaadin.flow.component.button.Button)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 Icon (com.vaadin.flow.component.icon.Icon)1 EDIT (com.vaadin.flow.component.icon.VaadinIcon.EDIT)1 PIE_CHART (com.vaadin.flow.component.icon.VaadinIcon.PIE_CHART)1 PLUS_CIRCLE (com.vaadin.flow.component.icon.VaadinIcon.PLUS_CIRCLE)1 REFRESH (com.vaadin.flow.component.icon.VaadinIcon.REFRESH)1 SEARCH (com.vaadin.flow.component.icon.VaadinIcon.SEARCH)1 TIME_BACKWARD (com.vaadin.flow.component.icon.VaadinIcon.TIME_BACKWARD)1 TRASH (com.vaadin.flow.component.icon.VaadinIcon.TRASH)1 USERS (com.vaadin.flow.component.icon.VaadinIcon.USERS)1 FlexComponent (com.vaadin.flow.component.orderedlayout.FlexComponent)1 HorizontalLayout (com.vaadin.flow.component.orderedlayout.HorizontalLayout)1