Search in sources :

Example 41 with FormLayout

use of com.vaadin.flow.component.formlayout.FormLayout in project flow-components by vaadin.

the class FormLayoutView method createFormLayoutWithItems.

private void createFormLayoutWithItems() {
    FormLayout layoutWithFormItems = new FormLayout();
    TextField firstName = new TextField();
    firstName.setPlaceholder("John");
    layoutWithFormItems.addFormItem(firstName, "First name");
    TextField lastName = new TextField();
    lastName.setPlaceholder("Doe");
    layoutWithFormItems.addFormItem(lastName, "Last name");
    addCard("A form layout with fields wrapped in items", layoutWithFormItems);
}
Also used : FormLayout(com.vaadin.flow.component.formlayout.FormLayout) TextField(com.vaadin.flow.component.textfield.TextField)

Example 42 with FormLayout

use of com.vaadin.flow.component.formlayout.FormLayout in project flow-components by vaadin.

the class FormLayoutTest method verifyColspanElement.

@Test
public void verifyColspanElement() {
    FormLayout layout = new FormLayout();
    // using layouts as components to avoid importing dependencies.
    // verifying the colspan is correctly set in the element itself
    FormLayout comp1 = new FormLayout();
    layout.add(comp1, 2);
    String strColspan = comp1.getElement().getAttribute("colspan");
    Assert.assertEquals(Integer.parseInt(strColspan), 2);
}
Also used : FormLayout(com.vaadin.flow.component.formlayout.FormLayout) Test(org.junit.Test)

Example 43 with FormLayout

use of com.vaadin.flow.component.formlayout.FormLayout in project flow-components by vaadin.

the class FormLayoutTest method verifyColspanCodeBehaviour.

@Test
public void verifyColspanCodeBehaviour() {
    FormLayout layout = new FormLayout();
    // using layouts as components to avoid importing dependencies.
    // verifying normal use cases
    FormLayout comp1 = new FormLayout();
    layout.add(comp1, 2);
    Assert.assertEquals(layout.getColspan(comp1), 2);
    layout.setColspan(comp1, 1);
    Assert.assertEquals(layout.getColspan(comp1), 1);
    // verifying it correctly sets it to 1 if an number lower than 1 is
    // supplied
    FormLayout comp2 = new FormLayout();
    layout.add(comp2, -1);
    Assert.assertEquals(layout.getColspan(comp2), 1);
    // verifying it correctly gets 1 if invalid colspans are supplied
    // outside the API
    FormLayout compInvalid = new FormLayout();
    layout.add(compInvalid);
    compInvalid.getElement().setAttribute("colspan", "qsd4hdsj%f");
    Assert.assertEquals(layout.getColspan(compInvalid), 1);
    // verifying it correctly gets 1 if no colspan was set.
    FormLayout compUnset = new FormLayout();
    layout.add(compUnset);
    Assert.assertEquals(layout.getColspan(compUnset), 1);
}
Also used : FormLayout(com.vaadin.flow.component.formlayout.FormLayout) Test(org.junit.Test)

Example 44 with FormLayout

use of com.vaadin.flow.component.formlayout.FormLayout in project flow-components by vaadin.

the class FormLayoutTest method getResponsiveSteps_noInitialSteps_emptyListIsReturned.

@Test
public void getResponsiveSteps_noInitialSteps_emptyListIsReturned() {
    FormLayout layout = new FormLayout();
    Assert.assertTrue(layout.getResponsiveSteps().isEmpty());
}
Also used : FormLayout(com.vaadin.flow.component.formlayout.FormLayout) Test(org.junit.Test)

Example 45 with FormLayout

use of com.vaadin.flow.component.formlayout.FormLayout in project flow-components by vaadin.

the class FormLayoutTest method create_FormLayout.

@Test
public void create_FormLayout() {
    // Just testing that creating form layout actually compiles and doesn't
    // throw. Test is on purpose, so that the implementation not
    // accidentally removed.
    FormLayout formLayout = new FormLayout();
    formLayout.addClickListener(event -> {
    });
}
Also used : FormLayout(com.vaadin.flow.component.formlayout.FormLayout) Test(org.junit.Test)

Aggregations

FormLayout (com.vaadin.flow.component.formlayout.FormLayout)47 TextField (com.vaadin.flow.component.textfield.TextField)28 Binder (com.vaadin.flow.data.binder.Binder)21 BinderCrudEditor (com.vaadin.flow.component.crud.BinderCrudEditor)15 Person (com.vaadin.demo.domain.Person)12 EmailField (com.vaadin.flow.component.textfield.EmailField)10 Div (com.vaadin.flow.component.html.Div)8 ResponsiveStep (com.vaadin.flow.component.formlayout.FormLayout.ResponsiveStep)6 FormItem (com.vaadin.flow.component.formlayout.FormLayout.FormItem)4 Label (com.vaadin.flow.component.html.Label)4 NumberField (com.vaadin.flow.component.textfield.NumberField)4 TextArea (com.vaadin.flow.component.textfield.TextArea)4 StringLengthValidator (com.vaadin.flow.data.validator.StringLengthValidator)4 FurmsFormLayout (io.imunity.furms.ui.components.FurmsFormLayout)4 Test (org.junit.Test)4 ValueChangeEvent (com.vaadin.flow.component.HasValue.ValueChangeEvent)3 Checkbox (com.vaadin.flow.component.checkbox.Checkbox)3 ComboBox (com.vaadin.flow.component.combobox.ComboBox)3 RichTextEditor (com.vaadin.flow.component.richtexteditor.RichTextEditor)3 EAGER (com.vaadin.flow.data.value.ValueChangeMode.EAGER)3