use of com.vaadin.flow.component.textfield.TextArea in project SODevelopment by syampillai.
the class ChangeObjectPassword method buildFields.
@Override
protected void buildFields() {
addField(objectField);
setRequired(objectField);
trackValueChange(objectField);
addField(password = createPasswordField("Current Password"));
password.setVisible(false);
addField(newPassword = createPasswordField("New Password"));
addField(repeatNewPassword = createPasswordField("Repeat New Password"));
TextArea conditon = new TextArea();
conditon.setValue(PasswordPolicy.getForClass(objectField.getObjectClass()).describe());
conditon.setReadOnly(true);
add(conditon);
}
use of com.vaadin.flow.component.textfield.TextArea in project komunumo-server by komunumo.
the class MailTemplateDialog method createForm.
@Override
public void createForm(@NotNull final FormLayout formLayout, @NotNull final Binder<MailTemplateRecord> binder) {
final var id = new Select<>(mailTemplateIds.stream().map(MailTemplateId::name).toArray(String[]::new));
id.setRequiredIndicatorVisible(true);
id.setLabel("ID");
formLayout.add(id);
final var subject = new TextField("Subject");
subject.setRequiredIndicatorVisible(true);
subject.setValueChangeMode(EAGER);
formLayout.add(subject);
final var contentText = new TextArea();
contentText.setRequiredIndicatorVisible(true);
formLayout.add(new CustomLabel("Content as plain text"), contentText);
final var contentHTML = new RichTextEditor();
contentHTML.setRequiredIndicatorVisible(true);
formLayout.add(new CustomLabel("Content as formatted HTML"), contentHTML);
binder.forField(id).withValidator(Objects::nonNull, "Please select the ID").bind(MailTemplateRecord::getId, MailTemplateRecord::setId);
binder.forField(subject).withValidator(new StringLengthValidator("Please enter the subject (max. 255 chars)", 1, 255)).bind(MailTemplateRecord::getSubject, MailTemplateRecord::setSubject);
binder.forField(contentText).withValidator(new StringLengthValidator("Please enter the content as plain text (max. 8'000 chars)", 1, 8_000)).bind(MailTemplateRecord::getContentText, MailTemplateRecord::setContentText);
binder.forField(contentHTML.asHtml()).withValidator(new StringLengthValidator("Please enter the content as formattet HTML (max. 8'000 chars)", 1, 8_000)).bind(MailTemplateRecord::getContentHtml, MailTemplateRecord::setContentHtml);
afterOpen = () -> id.setReadOnly(id.getValue() != null);
}
use of com.vaadin.flow.component.textfield.TextArea in project komunumo-server by komunumo.
the class MembersView method createFeedbackForm.
private Component createFeedbackForm() {
final var div = new Div();
div.addClassName("feedback-form");
div.add(new H2("Your Feedback, suggestion, idea..."));
final var firstName = new TextField("First name");
firstName.setMinLength(1);
firstName.setMaxLength(2_000);
final var lastName = new TextField("Last name");
lastName.setMinLength(1);
lastName.setMaxLength(2_000);
final var email = new EmailField("Email");
email.setMinLength(1);
email.setMaxLength(2_000);
final var feedback = new TextArea("Feedback");
feedback.setMinLength(1);
feedback.setMaxLength(2_000);
final var submit = new Button("Send");
submit.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
submit.setEnabled(false);
submit.setDisableOnClick(true);
List.of(firstName, lastName, email, feedback).forEach(field -> {
field.setRequiredIndicatorVisible(true);
field.setValueChangeMode(ValueChangeMode.EAGER);
field.addValueChangeListener(valueChangeEvent -> submit.setEnabled(!firstName.getValue().isBlank() && !lastName.getValue().isBlank() && !email.isInvalid() && !feedback.getValue().isBlank()));
});
final var form = new FormLayout();
form.setResponsiveSteps(new FormLayout.ResponsiveStep("0", 1));
form.add(firstName, lastName, email, feedback, submit);
div.add(form);
submit.addClickListener(buttonClickEvent -> {
databaseService.receiveFeedback(firstName.getValue(), lastName.getValue(), email.getValue(), feedback.getValue());
div.replace(form, new Paragraph("We have received your feedback, thank you very much!"));
});
firstName.focus();
return div;
}
use of com.vaadin.flow.component.textfield.TextArea in project linkki by linkki-framework.
the class BindPlaceholderAspectDefinitionTest method testPlaceholderType_AutoFilledPlaceholder.
@Test
void testPlaceholderType_AutoFilledPlaceholder() {
TextArea area = new TextArea();
callPlaceholderAspectDefinition(area, "I am a placeholder", PlaceholderType.AUTO);
String suffixResult = area.getPlaceholder();
assertThat(suffixResult).isEqualTo("I am a placeholder");
}
use of com.vaadin.flow.component.textfield.TextArea in project linkki by linkki-framework.
the class BindReadOnlyAspectDefinitionTest method createWritableComponent.
private HasValue<?, ?> createWritableComponent() {
TextArea text = new TextArea();
text.setReadOnly(false);
return text;
}
Aggregations