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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations