diff options
author | Artur Signell <artur@vaadin.com> | 2016-08-31 16:17:50 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2016-08-31 17:11:44 +0300 |
commit | 814c29c1521a42f355cfc254fb8b00ae436b4956 (patch) | |
tree | b934305f718059ae6b55addae755c0fd54b5c098 /uitest/src | |
parent | 82806ef9b7f12c66e620a813c7987c0fbea723dc (diff) | |
download | vaadin-framework-814c29c1521a42f355cfc254fb8b00ae436b4956.tar.gz vaadin-framework-814c29c1521a42f355cfc254fb8b00ae436b4956.zip |
Implement Binder.saveIfValid and fix Binder.save to throw exception
Change-Id: I44498b4b34b2e9732b50abb14e8eb7be01314158
Diffstat (limited to 'uitest/src')
-rw-r--r-- | uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarTest.java | 8 | ||||
-rw-r--r-- | uitest/src/main/java/com/vaadin/tests/themes/valo/CalendarTest.java | 8 |
2 files changed, 10 insertions, 6 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarTest.java b/uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarTest.java index 7bab92a513..2b7fe664cd 100644 --- a/uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarTest.java +++ b/uitest/src/main/java/com/vaadin/tests/components/calendar/CalendarTest.java @@ -24,6 +24,7 @@ import java.util.TimeZone; import com.vaadin.annotations.Theme; import com.vaadin.data.Binder; +import com.vaadin.data.ValidationException; import com.vaadin.server.VaadinRequest; import com.vaadin.shared.ui.MarginInfo; import com.vaadin.shared.ui.datefield.Resolution; @@ -968,7 +969,7 @@ public class CalendarTest extends UI { public void buttonClick(ClickEvent event) { try { commitCalendarEvent(); - } catch (CommitException e) { + } catch (CommitException | ValidationException e) { e.printStackTrace(); } } @@ -1027,7 +1028,7 @@ public class CalendarTest extends UI { } private void updateCalendarEventForm(CalendarEvent event) { - BeanItem<CalendarEvent> item = new BeanItem<CalendarEvent>(event); + BeanItem<CalendarEvent> item = new BeanItem<>(event); scheduleEventFieldLayout.removeAllComponents(); scheduleEventFieldGroup = new FieldGroup(); initFormFields(scheduleEventFieldLayout, event.getClass()); @@ -1063,7 +1064,8 @@ public class CalendarTest extends UI { } /* Adds/updates the event in the data source and fires change event. */ - private void commitCalendarEvent() throws CommitException { + private void commitCalendarEvent() + throws CommitException, ValidationException { scheduleEventFieldGroup.commit(); BasicEvent event = getFormCalendarEvent(); scheduledEventBinder.save(event); diff --git a/uitest/src/main/java/com/vaadin/tests/themes/valo/CalendarTest.java b/uitest/src/main/java/com/vaadin/tests/themes/valo/CalendarTest.java index 617ec7d584..bd3473246e 100644 --- a/uitest/src/main/java/com/vaadin/tests/themes/valo/CalendarTest.java +++ b/uitest/src/main/java/com/vaadin/tests/themes/valo/CalendarTest.java @@ -8,6 +8,7 @@ import java.util.TimeZone; import com.vaadin.annotations.Theme; import com.vaadin.data.Binder; +import com.vaadin.data.ValidationException; import com.vaadin.navigator.View; import com.vaadin.navigator.ViewChangeListener.ViewChangeEvent; import com.vaadin.shared.ui.datefield.Resolution; @@ -903,7 +904,7 @@ public class CalendarTest extends GridLayout implements View { public void buttonClick(ClickEvent event) { try { commitCalendarEvent(); - } catch (CommitException e) { + } catch (CommitException | ValidationException e) { e.printStackTrace(); } } @@ -968,7 +969,7 @@ public class CalendarTest extends GridLayout implements View { } private void updateCalendarEventForm(CalendarEvent event) { - BeanItem<CalendarEvent> item = new BeanItem<CalendarEvent>(event); + BeanItem<CalendarEvent> item = new BeanItem<>(event); scheduleEventFieldLayout.removeAllComponents(); scheduleEventFieldGroup = new FieldGroup(); initFormFields(scheduleEventFieldLayout, event.getClass()); @@ -1003,7 +1004,8 @@ public class CalendarTest extends GridLayout implements View { } /* Adds/updates the event in the data source and fires change event. */ - private void commitCalendarEvent() throws CommitException { + private void commitCalendarEvent() + throws ValidationException, CommitException { scheduleEventFieldGroup.commit(); BasicEvent event = getFormCalendarEvent(); scheduledEventBinder.save(event); |