use of com.vaadin.flow.component.textfield.TextArea in project flow-components by vaadin.
the class TextAreaPage method addMaxHeightFeature.
private void addMaxHeightFeature() {
Div message = new Div();
TextArea textArea = new TextArea();
textArea.setLabel("Text area growing stops at 125px");
textArea.getStyle().set("maxHeight", "125px");
textArea.getStyle().set("padding", "0");
textArea.setId("text-area-with-max-height");
add(textArea, message);
}
use of com.vaadin.flow.component.textfield.TextArea in project flow-components by vaadin.
the class TextAreaPage method addInvalidCheck.
private void addInvalidCheck() {
final TextArea field = new TextArea();
field.setMaxLength(10);
field.setMinLength(5);
TextFieldTestPageUtil.addInvalidCheck(this, field);
}
use of com.vaadin.flow.component.textfield.TextArea in project flow-components by vaadin.
the class TextAreaPage method addHelperText.
private void addHelperText() {
TextArea field = new TextArea();
field.setHelperText("Helper text");
field.setId("helper-text-field");
NativeButton clearButton = new NativeButton("Clear helper text");
clearButton.setId("clear-helper-text-button");
clearButton.addClickListener(event -> field.setHelperText(null));
add(field, clearButton);
}
use of com.vaadin.flow.component.textfield.TextArea in project flow-components by vaadin.
the class TextAreaPage method addBasicFeatures.
private void addBasicFeatures() {
Div message = new Div();
TextArea textArea = new TextArea();
textArea.setLabel("Text area label");
textArea.setPlaceholder("placeholder text");
textArea.addValueChangeListener(event -> message.setText(String.format("Text area value changed from '%s' to '%s'", event.getOldValue(), event.getValue())));
textArea.setId("text-area-with-value-change-listener");
message.setId("text-area-value");
add(textArea, new ValueChangeModeButtonProvider(textArea).getValueChangeModeRadios(), message);
}
use of com.vaadin.flow.component.textfield.TextArea in project flow-components by vaadin.
the class TextAreaTest method setValueNull.
@Test
public void setValueNull() {
TextArea textArea = new TextArea();
assertEquals("Value should be an empty string", "", textArea.getValue());
thrown.expect(NullPointerException.class);
thrown.expectMessage("Null value is not supported");
textArea.setValue(null);
}
Aggregations