Search in sources :

Example 16 with TextField

use of com.vaadin.flow.component.textfield.TextField in project aire-components by aire-ux.

the class ModuleGrid method valueChanged.

@Override
public void valueChanged(ComponentValueChangeEvent<TextField, String> event) {
    val text = textField.getValue();
    val matches = getZephyr().getPlugins().stream().filter(module -> module.getCoordinate().getName().contains(text) || module.getCoordinate().getGroup().contains(text) || module.getCoordinate().getVersion().toString().contains(text)).collect(Collectors.toList());
    grid.setItems(new ListDataProvider<>(matches));
}
Also used : lombok.val(lombok.val) ListDataProvider(com.vaadin.flow.data.provider.ListDataProvider) ComponentRenderer(com.vaadin.flow.data.renderer.ComponentRenderer) MenuBar(com.vaadin.flow.component.menubar.MenuBar) Component(com.vaadin.flow.component.Component) CssImport(com.vaadin.flow.component.dependency.CssImport) MenuBarVariant(com.vaadin.flow.component.menubar.MenuBarVariant) SerializableBiConsumer(com.vaadin.flow.function.SerializableBiConsumer) ValueProvider(com.vaadin.flow.function.ValueProvider) Route(com.vaadin.flow.router.Route) Inject(javax.inject.Inject) Overlays(io.sunshower.zephyr.ui.components.Overlays) ComponentValueChangeEvent(com.vaadin.flow.component.AbstractField.ComponentValueChangeEvent) TextField(com.vaadin.flow.component.textfield.TextField) Notification(com.vaadin.flow.component.notification.Notification) ValueChangeMode(com.vaadin.flow.data.value.ValueChangeMode) Zephyr(io.zephyr.cli.Zephyr) Grid(com.vaadin.flow.component.grid.Grid) GridVariant(com.vaadin.flow.component.grid.GridVariant) NotificationVariant(com.vaadin.flow.component.notification.NotificationVariant) NonNull(lombok.NonNull) Position(com.vaadin.flow.component.notification.Notification.Position) lombok.val(lombok.val) VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) Breadcrumb(io.sunshower.zephyr.ui.controls.Breadcrumb) Collectors(java.util.stream.Collectors) ValueChangeListener(com.vaadin.flow.component.HasValue.ValueChangeListener) Button(com.vaadin.flow.component.button.Button) MainView(io.sunshower.zephyr.MainView) JsModule(com.vaadin.flow.component.dependency.JsModule) Span(com.vaadin.flow.component.html.Span) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings) Module(io.zephyr.kernel.Module)

Example 17 with TextField

use of com.vaadin.flow.component.textfield.TextField in project aire-components by aire-ux.

the class ModuleGrid method createMenubar.

private Component createMenubar() {
    val result = new MenuBar();
    result.addThemeVariants(MenuBarVariant.LUMO_SMALL, MenuBarVariant.LUMO_ICON, MenuBarVariant.LUMO_TERTIARY_INLINE);
    textField = new TextField();
    textField.setPlaceholder("Search");
    textField.setClearButtonVisible(true);
    textField.setPrefixComponent(VaadinIcon.SEARCH.create());
    textField.setValueChangeMode(ValueChangeMode.EAGER);
    textField.addValueChangeListener(this);
    result.addItem(textField);
    addButtonsToMenubar(result);
    return result;
}
Also used : lombok.val(lombok.val) MenuBar(com.vaadin.flow.component.menubar.MenuBar) TextField(com.vaadin.flow.component.textfield.TextField)

Example 18 with TextField

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

the class DialogBasic method createDialogLayout.

private static VerticalLayout createDialogLayout(Dialog dialog) {
    H2 headline = new H2("Create new employee");
    headline.getStyle().set("margin", "var(--lumo-space-m) 0 0 0").set("font-size", "1.5em").set("font-weight", "bold");
    TextField firstNameField = new TextField("First name");
    TextField lastNameField = new TextField("Last name");
    VerticalLayout fieldLayout = new VerticalLayout(firstNameField, lastNameField);
    fieldLayout.setSpacing(false);
    fieldLayout.setPadding(false);
    fieldLayout.setAlignItems(FlexComponent.Alignment.STRETCH);
    Button cancelButton = new Button("Cancel", e -> dialog.close());
    Button saveButton = new Button("Save", e -> dialog.close());
    saveButton.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
    HorizontalLayout buttonLayout = new HorizontalLayout(cancelButton, saveButton);
    buttonLayout.setJustifyContentMode(FlexComponent.JustifyContentMode.END);
    VerticalLayout dialogLayout = new VerticalLayout(headline, fieldLayout, buttonLayout);
    dialogLayout.setPadding(false);
    dialogLayout.setAlignItems(FlexComponent.Alignment.STRETCH);
    dialogLayout.getStyle().set("width", "300px").set("max-width", "100%");
    return dialogLayout;
}
Also used : Button(com.vaadin.flow.component.button.Button) TextField(com.vaadin.flow.component.textfield.TextField) VerticalLayout(com.vaadin.flow.component.orderedlayout.VerticalLayout) H2(com.vaadin.flow.component.html.H2) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout)

Example 19 with TextField

use of com.vaadin.flow.component.textfield.TextField in project layout-examples by vaadin.

the class FixedNavStickyFooterView method createHeader.

public void createHeader() {
    RouterLink titleLink = new RouterLink("Fixed navbar", getClass());
    titleLink.addClassName("titleLink");
    header.add(titleLink);
    header.add(new RouterLink("Home", getClass()));
    header.add(new Anchor("#", "Link"));
    Anchor a = new Anchor("#", "Help");
    // Stretches this item in the flex container so that the following items
    // will be at the right side of the screen.
    a.getStyle().set("margin-right", "auto");
    header.add(a);
    Div searchBlock = new Div();
    searchBlock.addClassName("searchBlock");
    TextField searchField = new TextField();
    searchField.setPlaceholder("Search");
    searchField.addClassName("searchField");
    searchBlock.add(searchField);
    Button searchButton = new Button("Search");
    searchButton.addClassName("searchButton");
    searchBlock.add(searchButton);
    header.add(searchBlock);
}
Also used : Div(com.vaadin.flow.component.html.Div) RouterLink(com.vaadin.flow.router.RouterLink) Anchor(com.vaadin.flow.component.html.Anchor) Button(com.vaadin.flow.component.button.Button) TextField(com.vaadin.flow.component.textfield.TextField)

Example 20 with TextField

use of com.vaadin.flow.component.textfield.TextField in project layout-examples by vaadin.

the class ListingFormView method createHeader.

private Component createHeader() {
    MenuBar menuBar = new MenuBar();
    menuBar.getStyle().set("flex-grow", "1");
    menuBar.addItem("Today's Deals");
    menuBar.addItem("Help");
    menuBar.addItem("Registry");
    // This HorizontalLayout contains the menuBar, searchTextField and
    // searchButton.
    HorizontalLayout headerLayout = new HorizontalLayout();
    headerLayout.setWidthFull();
    TextField searchTextField = new TextField();
    searchTextField.getStyle().set("overflow", "auto");
    searchTextField.setPlaceholder("Search");
    searchTextField.setValue("Vaadin");
    Button searchButton = new Button("Search");
    searchButton.getStyle().set("overflow", "auto");
    headerLayout.add(menuBar, searchTextField, searchButton);
    headerLayout.getStyle().set("background-color", "#F8F8F8");
    headerLayout.getStyle().set("flex-shrink", "0");
    return headerLayout;
}
Also used : Button(com.vaadin.flow.component.button.Button) MenuBar(com.vaadin.flow.component.menubar.MenuBar) 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