Search in sources :

Example 51 with TextField

use of com.vaadin.flow.component.textfield.TextField in project iesi by metadew.

the class ConnectionView method createTopBar.

public HorizontalLayout createTopBar() {
    filter = new TextField();
    filter.setPlaceholder("Filter name or description");
    // Apply the filter to grid's data provider. TextField value is never null
    filter.addValueChangeListener(event -> dataProvider.setFilter(event.getValue()));
    filter.addFocusShortcut(Key.KEY_F, KeyModifier.CONTROL);
    newConnection = new Button("New Connection");
    newConnection.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
    newConnection.setIcon(VaadinIcon.PLUS_CIRCLE.create());
    newConnection.addClickListener(click -> viewLogic.newConnection());
    // CTRL+N will create a new window which is unavoidable
    newConnection.addClickShortcut(Key.KEY_N, KeyModifier.ALT);
    HorizontalLayout topLayout = new HorizontalLayout();
    topLayout.setWidth("100%");
    topLayout.add(filter);
    topLayout.add(newConnection);
    topLayout.setVerticalComponentAlignment(Alignment.START, filter);
    topLayout.expand(filter);
    return topLayout;
}
Also used : Button(com.vaadin.flow.component.button.Button) TextField(com.vaadin.flow.component.textfield.TextField) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout)

Example 52 with TextField

use of com.vaadin.flow.component.textfield.TextField in project iesi by metadew.

the class EnvironmentView method createTopBar.

public HorizontalLayout createTopBar() {
    filter = new TextField();
    filter.setPlaceholder("Filter name or description");
    // Apply the filter to grid's data provider. TextField value is never null
    filter.addValueChangeListener(event -> dataProvider.setFilter(event.getValue()));
    filter.addFocusShortcut(Key.KEY_F, KeyModifier.CONTROL);
    newEnvironment = new Button("New Environment");
    newEnvironment.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
    newEnvironment.setIcon(VaadinIcon.PLUS_CIRCLE.create());
    newEnvironment.addClickListener(click -> viewLogic.newEnvironment());
    // CTRL+N will create a new window which is unavoidable
    newEnvironment.addClickShortcut(Key.KEY_N, KeyModifier.ALT);
    HorizontalLayout topLayout = new HorizontalLayout();
    topLayout.setWidth("100%");
    topLayout.add(filter);
    topLayout.add(newEnvironment);
    topLayout.setVerticalComponentAlignment(Alignment.START, filter);
    topLayout.expand(filter);
    return topLayout;
}
Also used : Button(com.vaadin.flow.component.button.Button) TextField(com.vaadin.flow.component.textfield.TextField) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout)

Example 53 with TextField

use of com.vaadin.flow.component.textfield.TextField in project iesi by metadew.

the class AdminView method createCategoryEditor.

private Component createCategoryEditor(Category category) {
    TextField nameField = new TextField();
    if (category.getId() < 0) {
        nameField.focus();
    }
    Button deleteButton = new Button(VaadinIcon.MINUS_CIRCLE_O.create(), event -> {
        DataService.get().deleteCategory(category.getId());
        dataProvider.getItems().remove(category);
        dataProvider.refreshAll();
        Notification.show("Category Deleted.");
    });
    deleteButton.addThemeVariants(ButtonVariant.LUMO_ERROR);
    BeanValidationBinder<Category> binder = new BeanValidationBinder<>(Category.class);
    binder.forField(nameField).bind("name");
    binder.setBean(category);
    binder.addValueChangeListener(event -> {
        if (binder.isValid()) {
            DataService.get().updateCategory(category);
            deleteButton.setEnabled(true);
            newCategoryButton.setEnabled(true);
            Notification.show("Category Saved.");
        }
    });
    deleteButton.setEnabled(category.getId() > 0);
    HorizontalLayout layout = new HorizontalLayout(nameField, deleteButton);
    layout.setFlexGrow(1);
    return layout;
}
Also used : Category(io.metadew.iesi.cockpit.backend.data.Category) Button(com.vaadin.flow.component.button.Button) TextField(com.vaadin.flow.component.textfield.TextField) BeanValidationBinder(com.vaadin.flow.data.binder.BeanValidationBinder) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout)

Example 54 with TextField

use of com.vaadin.flow.component.textfield.TextField in project bookstore-example by vaadin.

the class InventoryView method createTopBar.

public HorizontalLayout createTopBar() {
    filter = new TextField();
    filter.setPlaceholder("Filter name, availability or category");
    // Apply the filter to grid's data provider. TextField value is never
    filter.addValueChangeListener(event -> dataProvider.setFilter(event.getValue()));
    // A shortcut to focus on the textField by pressing ctrl + F
    filter.addFocusShortcut(Key.KEY_F, KeyModifier.CONTROL);
    newProduct = new Button("New product");
    // Setting theme variant of new production button to LUMO_PRIMARY that
    // changes its background color to blue and its text color to white
    newProduct.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
    newProduct.setIcon(VaadinIcon.PLUS_CIRCLE.create());
    newProduct.addClickListener(click -> viewLogic.newProduct());
    // A shortcut to click the new product button by pressing ALT + N
    newProduct.addClickShortcut(Key.KEY_N, KeyModifier.ALT);
    final HorizontalLayout topLayout = new HorizontalLayout();
    topLayout.setWidth("100%");
    topLayout.add(filter);
    topLayout.add(newProduct);
    topLayout.setVerticalComponentAlignment(Alignment.START, filter);
    topLayout.expand(filter);
    return topLayout;
}
Also used : Button(com.vaadin.flow.component.button.Button) TextField(com.vaadin.flow.component.textfield.TextField) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout)

Example 55 with TextField

use of com.vaadin.flow.component.textfield.TextField 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

TextField (com.vaadin.flow.component.textfield.TextField)227 Test (org.junit.jupiter.api.Test)61 Button (com.vaadin.flow.component.button.Button)54 Div (com.vaadin.flow.component.html.Div)38 HorizontalLayout (com.vaadin.flow.component.orderedlayout.HorizontalLayout)32 FormLayout (com.vaadin.flow.component.formlayout.FormLayout)29 Binder (com.vaadin.flow.data.binder.Binder)29 GeneratedVaadinTextField (com.vaadin.flow.component.textfield.GeneratedVaadinTextField)28 Element (com.vaadin.flow.dom.Element)26 VerticalLayout (com.vaadin.flow.component.orderedlayout.VerticalLayout)23 Route (com.vaadin.flow.router.Route)21 Component (com.vaadin.flow.component.Component)16 Checkbox (com.vaadin.flow.component.checkbox.Checkbox)15 BinderCrudEditor (com.vaadin.flow.component.crud.BinderCrudEditor)15 Grid (com.vaadin.flow.component.grid.Grid)15 Span (com.vaadin.flow.component.html.Span)15 List (java.util.List)15 EmailField (com.vaadin.flow.component.textfield.EmailField)14 TextArea (com.vaadin.flow.component.textfield.TextArea)14 Test (org.junit.Test)14