Search in sources :

Example 11 with PasswordField

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

the class PasswordFieldPage method addInvalidCheck.

private void addInvalidCheck() {
    final PasswordField field = new PasswordField();
    field.setMaxLength(10);
    field.setMinLength(5);
    TextFieldTestPageUtil.addInvalidCheck(this, field);
}
Also used : PasswordField(com.vaadin.flow.component.textfield.PasswordField)

Example 12 with PasswordField

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

the class PasswordFieldPage method addBasicField.

private void addBasicField() {
    Div message = new Div();
    PasswordField passwordField = new PasswordField();
    passwordField.setLabel("Password field label");
    passwordField.setPlaceholder("placeholder text");
    passwordField.addValueChangeListener(event -> message.setText(String.format("Password field value changed from '%s' to '%s'", event.getOldValue(), event.getValue())));
    NativeButton button = new NativeButton("Toggle eye icon", event -> {
        passwordField.setRevealButtonVisible(!passwordField.isRevealButtonVisible());
    });
    passwordField.setId("password-field-with-value-change-listener");
    message.setId("password-field-value");
    button.setId("toggle-button");
    add(button, passwordField, new ValueChangeModeButtonProvider(passwordField).getValueChangeModeRadios(), message);
}
Also used : Div(com.vaadin.flow.component.html.Div) NativeButton(com.vaadin.flow.component.html.NativeButton) PasswordField(com.vaadin.flow.component.textfield.PasswordField)

Example 13 with PasswordField

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

the class PasswordFieldPage method addFocusShortcut.

private void addFocusShortcut() {
    PasswordField passwordField = new PasswordField();
    passwordField.setLabel("Press ALT + 1 to focus");
    passwordField.addFocusShortcut(Key.DIGIT_1, KeyModifier.ALT);
    passwordField.setId("shortcut-field");
    add(passwordField);
}
Also used : PasswordField(com.vaadin.flow.component.textfield.PasswordField)

Aggregations

PasswordField (com.vaadin.flow.component.textfield.PasswordField)13 Test (org.junit.Test)4 Div (com.vaadin.flow.component.html.Div)3 Button (com.vaadin.flow.component.button.Button)2 EmailField (com.vaadin.flow.component.textfield.EmailField)2 TextField (com.vaadin.flow.component.textfield.TextField)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 H1 (com.vaadin.flow.component.html.H1)1 NativeButton (com.vaadin.flow.component.html.NativeButton)1 Notification (com.vaadin.flow.component.notification.Notification)1 Alignment (com.vaadin.flow.component.orderedlayout.FlexComponent.Alignment)1 VerticalLayout (com.vaadin.flow.component.orderedlayout.VerticalLayout)1 Select (com.vaadin.flow.component.select.Select)1 BigDecimalField (com.vaadin.flow.component.textfield.BigDecimalField)1 IntegerField (com.vaadin.flow.component.textfield.IntegerField)1 NumberField (com.vaadin.flow.component.textfield.NumberField)1 TextArea (com.vaadin.flow.component.textfield.TextArea)1