Skip to content

Commit

Permalink
0004943: Updated the way SettingsDialog displays errors
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-miller-jumpmind committed Aug 17, 2021
1 parent 31667a4 commit 6af7021
Showing 1 changed file with 2 additions and 12 deletions.
Expand Up @@ -41,7 +41,6 @@
import com.vaadin.flow.component.checkbox.Checkbox;
import com.vaadin.flow.component.formlayout.FormLayout;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.component.html.Span;
import com.vaadin.flow.component.notification.NotificationVariant;
import com.vaadin.flow.component.textfield.TextField;

Expand Down Expand Up @@ -97,18 +96,10 @@ protected HorizontalLayout createSettingsLayout() {

rowsToFetchField = new TextField("Max Results");
rowsToFetchField.setWidth("6em");
Span rowsToFetchSpan = new Span();
rowsToFetchSpan.addClassName("v-label-marked");
binder = new Binder<Integer>();
binder.forField(rowsToFetchField).withConverter(new StringToIntegerConverter("Could not convert value to Integer"))
.withValidator(value -> value != null, "Invalid value").withValidationStatusHandler(event -> {
rowsToFetchSpan.setText(event.getMessage().orElse(""));
if (event.isError()) {
rowsToFetchField.addClassName("v-textfield-error");
} else {
rowsToFetchField.removeClassName("v-textfield-error");
}
}).bind(integer -> integer, (integer, value) -> integer = value);
.withValidator(value -> value != null, "Invalid value")
.bind(integer -> integer, (integer, value) -> integer = value);
rowsToFetchField.setValue(properties.getProperty(SQL_EXPLORER_MAX_RESULTS, "100"));
settingsLayout.add(rowsToFetchField);

Expand Down Expand Up @@ -175,7 +166,6 @@ protected HorizontalLayout createSettingsLayout() {
settingsLayout.add(showResultsInNewTabsBox);

layout.add(settingsLayout);
layout.add(rowsToFetchSpan);

return layout;

Expand Down

0 comments on commit 6af7021

Please sign in to comment.