Search in sources :

Example 26 with TextField

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

the class MainView method createBeanGridWithEditColumns.

protected void createBeanGridWithEditColumns() {
    GridPro<Person> beanGrid = new GridPro<>(Person.class);
    beanGrid.setColumns();
    beanGrid.setItems(createItems());
    beanGrid.addEditColumn("age").text((item, newValue) -> item.setAge(Integer.valueOf(newValue)));
    TextField textField = new TextField();
    beanGrid.addEditColumn("name").custom(textField, (item, newValue) -> item.setName(newValue));
    List<String> listOptions = new ArrayList<>();
    listOptions.add("Services");
    listOptions.add("Marketing");
    listOptions.add("Sales");
    beanGrid.addEditColumn("department").select((item, newValue) -> {
        item.setDepartment(fromStringRepresentation((newValue)));
    }, listOptions).setHeader("Department").setWidth("300px");
    add(beanGrid);
}
Also used : ArrayList(java.util.ArrayList) TextField(com.vaadin.flow.component.textfield.TextField) GridPro(com.vaadin.flow.component.gridpro.GridPro)

Example 27 with TextField

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

the class TextFieldPage method addInvalidCheck.

private void addInvalidCheck() {
    final TextField field = new TextField();
    field.setMaxLength(10);
    field.setMinLength(5);
    TextFieldTestPageUtil.addInvalidCheck(this, field);
}
Also used : TextField(com.vaadin.flow.component.textfield.TextField)

Example 28 with TextField

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

the class TextFieldPage method addHelperText.

private void addHelperText() {
    TextField textField = new TextField();
    textField.setLabel("Helper text should be visible");
    textField.setHelperText("Helper text");
    textField.setId("helper-text-field");
    NativeButton clearButton = new NativeButton("Clear helper text");
    clearButton.setId("clear-helper-text-button");
    clearButton.addClickListener(event -> textField.setHelperText(null));
    add(textField, clearButton);
}
Also used : NativeButton(com.vaadin.flow.component.html.NativeButton) TextField(com.vaadin.flow.component.textfield.TextField)

Example 29 with TextField

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

the class TextFieldPage method addHelperComponent.

private void addHelperComponent() {
    TextField textField = new TextField();
    textField.setLabel("Helper component should be visible");
    Span span = new Span("Helper Component");
    span.setId("helper-component");
    textField.setHelperComponent(span);
    textField.setId("helper-component-field");
    NativeButton clearButton = new NativeButton("Clear helper component");
    clearButton.setId("clear-helper-component-button");
    clearButton.addClickListener(event -> textField.setHelperComponent(null));
    add(textField, clearButton);
}
Also used : NativeButton(com.vaadin.flow.component.html.NativeButton) TextField(com.vaadin.flow.component.textfield.TextField) Span(com.vaadin.flow.component.html.Span)

Example 30 with TextField

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

the class TextFieldPage method addFocusShortcut.

private void addFocusShortcut() {
    TextField textField = new TextField();
    textField.setLabel("Press ALT + 1 to focus");
    textField.addFocusShortcut(Key.DIGIT_1, KeyModifier.ALT);
    textField.setId("shortcut-field");
    add(textField);
}
Also used : TextField(com.vaadin.flow.component.textfield.TextField)

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