Search in sources :

Example 6 with TextArea

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);
}
Also used : Div(com.vaadin.flow.component.html.Div) TextArea(com.vaadin.flow.component.textfield.TextArea)

Example 7 with TextArea

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);
}
Also used : TextArea(com.vaadin.flow.component.textfield.TextArea)

Example 8 with TextArea

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);
}
Also used : NativeButton(com.vaadin.flow.component.html.NativeButton) TextArea(com.vaadin.flow.component.textfield.TextArea)

Example 9 with TextArea

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);
}
Also used : Div(com.vaadin.flow.component.html.Div) TextArea(com.vaadin.flow.component.textfield.TextArea)

Example 10 with TextArea

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);
}
Also used : TextArea(com.vaadin.flow.component.textfield.TextArea) Test(org.junit.Test)

Aggregations

TextArea (com.vaadin.flow.component.textfield.TextArea)52 TextField (com.vaadin.flow.component.textfield.TextField)14 Test (org.junit.jupiter.api.Test)13 Div (com.vaadin.flow.component.html.Div)8 VerticalLayout (com.vaadin.flow.component.orderedlayout.VerticalLayout)6 Test (org.junit.Test)6 Button (com.vaadin.flow.component.button.Button)5 HorizontalLayout (com.vaadin.flow.component.orderedlayout.HorizontalLayout)5 Checkbox (com.vaadin.flow.component.checkbox.Checkbox)4 FormLayout (com.vaadin.flow.component.formlayout.FormLayout)4 H3 (com.vaadin.flow.component.html.H3)3 EmailField (com.vaadin.flow.component.textfield.EmailField)3 NumberField (com.vaadin.flow.component.textfield.NumberField)3 ValueChangeEvent (com.vaadin.flow.component.HasValue.ValueChangeEvent)2 ResponsiveStep (com.vaadin.flow.component.formlayout.FormLayout.ResponsiveStep)2 H2 (com.vaadin.flow.component.html.H2)2 NativeButton (com.vaadin.flow.component.html.NativeButton)2 StringLengthValidator (com.vaadin.flow.data.validator.StringLengthValidator)2 Route (com.vaadin.flow.router.Route)2 EFieldTypeDefinition (ch.akros.marketplace.administration.constants.EFieldTypeDefinition)1