Search in sources :

Example 11 with EmailField

use of com.vaadin.flow.component.textfield.EmailField in project docs by vaadin.

the class CrudItemInitialization method createEditor.

private CrudEditor<Person> createEditor() {
    TextField firstName = new TextField("First name");
    TextField lastName = new TextField("Last name");
    EmailField email = new EmailField("Email");
    TextField profession = new TextField("Profession");
    FormLayout form = new FormLayout(firstName, lastName, email, profession);
    Binder<Person> binder = new Binder<>(Person.class);
    binder.forField(firstName).asRequired().bind(Person::getFirstName, Person::setFirstName);
    binder.forField(lastName).asRequired().bind(Person::getLastName, Person::setLastName);
    binder.forField(email).asRequired().bind(Person::getEmail, Person::setEmail);
    binder.forField(profession).asRequired().bind(Person::getProfession, Person::setProfession);
    return new BinderCrudEditor<>(binder, form);
}
Also used : FormLayout(com.vaadin.flow.component.formlayout.FormLayout) Binder(com.vaadin.flow.data.binder.Binder) EmailField(com.vaadin.flow.component.textfield.EmailField) TextField(com.vaadin.flow.component.textfield.TextField) BinderCrudEditor(com.vaadin.flow.component.crud.BinderCrudEditor) Person(com.vaadin.demo.domain.Person)

Example 12 with EmailField

use of com.vaadin.flow.component.textfield.EmailField in project docs by vaadin.

the class CrudLocalization method createEditor.

private CrudEditor<Person> createEditor() {
    TextField firstName = new TextField("First name");
    TextField lastName = new TextField("Last name");
    EmailField email = new EmailField("Email");
    TextField profession = new TextField("Profession");
    FormLayout form = new FormLayout(firstName, lastName, email, profession);
    Binder<Person> binder = new Binder<>(Person.class);
    binder.forField(firstName).asRequired().bind(Person::getFirstName, Person::setFirstName);
    binder.forField(lastName).asRequired().bind(Person::getLastName, Person::setLastName);
    binder.forField(email).asRequired().bind(Person::getEmail, Person::setEmail);
    binder.forField(profession).asRequired().bind(Person::getProfession, Person::setProfession);
    return new BinderCrudEditor<>(binder, form);
}
Also used : FormLayout(com.vaadin.flow.component.formlayout.FormLayout) Binder(com.vaadin.flow.data.binder.Binder) EmailField(com.vaadin.flow.component.textfield.EmailField) TextField(com.vaadin.flow.component.textfield.TextField) BinderCrudEditor(com.vaadin.flow.component.crud.BinderCrudEditor) Person(com.vaadin.demo.domain.Person)

Example 13 with EmailField

use of com.vaadin.flow.component.textfield.EmailField in project docs by vaadin.

the class CrudOpenEditor method createEditor.

private CrudEditor<Person> createEditor() {
    TextField firstName = new TextField("First name");
    TextField lastName = new TextField("Last name");
    EmailField email = new EmailField("Email");
    TextField profession = new TextField("Profession");
    FormLayout form = new FormLayout(firstName, lastName, email, profession);
    Binder<Person> binder = new Binder<>(Person.class);
    binder.forField(firstName).asRequired().bind(Person::getFirstName, Person::setFirstName);
    binder.forField(lastName).asRequired().bind(Person::getLastName, Person::setLastName);
    binder.forField(email).asRequired().bind(Person::getEmail, Person::setEmail);
    binder.forField(profession).asRequired().bind(Person::getProfession, Person::setProfession);
    return new BinderCrudEditor<>(binder, form);
}
Also used : FormLayout(com.vaadin.flow.component.formlayout.FormLayout) Binder(com.vaadin.flow.data.binder.Binder) EmailField(com.vaadin.flow.component.textfield.EmailField) TextField(com.vaadin.flow.component.textfield.TextField) BinderCrudEditor(com.vaadin.flow.component.crud.BinderCrudEditor) Person(com.vaadin.demo.domain.Person)

Example 14 with EmailField

use of com.vaadin.flow.component.textfield.EmailField in project projecte-dam-v2-equip2 by IESEBRE.

the class RegisterView method initContent.

@Override
protected Component initContent() {
    TextField username = new TextField("Nom");
    EmailField email = new EmailField("Email");
    PasswordField password1 = new PasswordField("Contrasenya");
    PasswordField password2 = new PasswordField("Confirmar Contrasenya");
    VerticalLayout register = new VerticalLayout(new H1("Crear usuari"), username, email, password1, password2, new Button("Crear", event -> register(username.getValue(), email.getValue(), password1.getValue(), password2.getValue())));
    register.setAlignItems(Alignment.CENTER);
    return register;
}
Also used : Component(com.vaadin.flow.component.Component) Composite(com.vaadin.flow.component.Composite) EmailField(com.vaadin.flow.component.textfield.EmailField) H1(com.vaadin.flow.component.html.H1) VerticalLayout(com.vaadin.flow.component.orderedlayout.VerticalLayout) PageTitle(com.vaadin.flow.router.PageTitle) Route(com.vaadin.flow.router.Route) Alignment(com.vaadin.flow.component.orderedlayout.FlexComponent.Alignment) Button(com.vaadin.flow.component.button.Button) PasswordField(com.vaadin.flow.component.textfield.PasswordField) MainLayout(com.example.application.views.MainLayout) AuthService(com.example.application.data.services.AuthService) TextField(com.vaadin.flow.component.textfield.TextField) Notification(com.vaadin.flow.component.notification.Notification) Button(com.vaadin.flow.component.button.Button) EmailField(com.vaadin.flow.component.textfield.EmailField) TextField(com.vaadin.flow.component.textfield.TextField) VerticalLayout(com.vaadin.flow.component.orderedlayout.VerticalLayout) H1(com.vaadin.flow.component.html.H1) PasswordField(com.vaadin.flow.component.textfield.PasswordField)

Example 15 with EmailField

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

the class EmailFieldTest method initialValuePropertyValue.

@Test
public void initialValuePropertyValue() {
    EmailField emailField = new EmailField();
    assertEquals(emailField.getEmptyValue(), emailField.getElement().getProperty("value"));
}
Also used : EmailField(com.vaadin.flow.component.textfield.EmailField) Test(org.junit.Test)

Aggregations

EmailField (com.vaadin.flow.component.textfield.EmailField)17 TextField (com.vaadin.flow.component.textfield.TextField)14 FormLayout (com.vaadin.flow.component.formlayout.FormLayout)10 Person (com.vaadin.demo.domain.Person)9 BinderCrudEditor (com.vaadin.flow.component.crud.BinderCrudEditor)9 Binder (com.vaadin.flow.data.binder.Binder)9 TextArea (com.vaadin.flow.component.textfield.TextArea)3 Test (org.junit.Test)3 Button (com.vaadin.flow.component.button.Button)2 Div (com.vaadin.flow.component.html.Div)2 PasswordField (com.vaadin.flow.component.textfield.PasswordField)2 EmailValidator (com.vaadin.flow.data.validator.EmailValidator)2 StringLengthValidator (com.vaadin.flow.data.validator.StringLengthValidator)2 AuthService (com.example.application.data.services.AuthService)1 MainLayout (com.example.application.views.MainLayout)1 Component (com.vaadin.flow.component.Component)1 Composite (com.vaadin.flow.component.Composite)1 HasLabel (com.vaadin.flow.component.HasLabel)1 Checkbox (com.vaadin.flow.component.checkbox.Checkbox)1 ComboBox (com.vaadin.flow.component.combobox.ComboBox)1