use of com.vaadin.flow.component.textfield.TextField in project linkki by linkki-framework.
the class BindPlaceholderIntegrationTest method testAspectBindPlaceholderAnnotation_DynamicEmptyValue.
@Test
void testAspectBindPlaceholderAnnotation_DynamicEmptyValue() {
TextField textfield = (TextField) uiElements.get("placeholderFieldDynamic");
pmo.setPlaceholder("");
bindingContext.modelChanged();
String placeholderResult = textfield.getPlaceholder();
assertThat(placeholderResult).isEmpty();
}
use of com.vaadin.flow.component.textfield.TextField in project linkki by linkki-framework.
the class BindPlaceholderIntegrationTest method testAspectBindPlaceholderAnnotation_NotBound.
@Test
void testAspectBindPlaceholderAnnotation_NotBound() {
TextField textfield = (TextField) uiElements.get("notBoundPlaceholderField");
String placeholderResult = textfield.getPlaceholder();
assertThat(placeholderResult).isNull();
}
use of com.vaadin.flow.component.textfield.TextField in project linkki by linkki-framework.
the class DefaultErrorDialog method createRootCauseTextField.
private static TextField createRootCauseTextField(@CheckForNull Throwable t) {
TextField textField = new TextField(NlsText.getString("DefaultErrorHandler.errorDialogDescription"));
String message = Optional.ofNullable(ExceptionUtils.getRootCause(t)).map(Throwable::getLocalizedMessage).orElse(ExceptionUtils.getRootCauseMessage(t));
textField.setValue(message);
formatText(textField);
return textField;
}
use of com.vaadin.flow.component.textfield.TextField in project linkki by linkki-framework.
the class UIDoubleFieldIntegrationTest method testSetValue_WithPrimitiveDoubleInModelObject.
@Test
void testSetValue_WithPrimitiveDoubleInModelObject() {
TestModelObjectWithPrimitiveDouble modelObject = new TestModelObjectWithPrimitiveDouble();
TextField textField = createFirstComponent(modelObject);
assertThat(textField.getMaxLength(), is(MAX_LENGTH));
assertThat(textField.getValue(), is(formatter.format(0.0)));
TestUiUtil.setUserOriginatedValue(textField, formatter.format(1.0));
assertThat(modelObject.getValue(), is(1.0));
modelObject.setValue(2.0);
getBindingContext().modelChanged();
assertThat(textField.getValue(), is(formatter.format(2.0)));
}
use of com.vaadin.flow.component.textfield.TextField in project linkki by linkki-framework.
the class UIDoubleFieldIntegrationTest method testSetValue_WithObjectDoubleInModelObject.
@Test
void testSetValue_WithObjectDoubleInModelObject() {
TestModelObjectWithObjectDouble modelObject = new TestModelObjectWithObjectDouble();
TextField textField = createFirstComponent(modelObject);
assertThat(textField.getValue(), is(emptyString()));
TestUiUtil.setUserOriginatedValue(textField, formatter.format(1.0));
assertThat(modelObject.getValue(), is(1.0));
modelObject.setValue(2.0);
getBindingContext().modelChanged();
assertThat(textField.getValue(), is(formatter.format(2.0)));
TestUiUtil.setUserOriginatedValue(textField, textField.getEmptyValue());
assertThat(modelObject.getValue(), is(nullValue()));
}
Aggregations