diff options
author | Henri Sara <hesara@vaadin.com> | 2012-03-14 12:32:21 +0200 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2012-03-21 17:42:34 +0200 |
commit | e905f033ff2b2aa094b51eae72fef63e68bd1800 (patch) | |
tree | 4d81f4d1e1bd5a7c0b1a356905f328ec5059c5c2 /src/com/vaadin/ui/Form.java | |
parent | ead998ecf701bb270ac810ab76af48484d9b1296 (diff) | |
download | vaadin-framework-e905f033ff2b2aa094b51eae72fef63e68bd1800.tar.gz vaadin-framework-e905f033ff2b2aa094b51eae72fef63e68bd1800.zip |
Refactor error messages on server side (#8437).
This is an intermediate step towards moving error messages from UIDL to
shared state.
Diffstat (limited to 'src/com/vaadin/ui/Form.java')
-rw-r--r-- | src/com/vaadin/ui/Form.java | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/com/vaadin/ui/Form.java b/src/com/vaadin/ui/Form.java index 1abfefbc58..a66c8e723b 100644 --- a/src/com/vaadin/ui/Form.java +++ b/src/com/vaadin/ui/Form.java @@ -24,10 +24,12 @@ import com.vaadin.event.Action; import com.vaadin.event.Action.Handler; import com.vaadin.event.Action.ShortcutNotifier; import com.vaadin.event.ActionManager; +import com.vaadin.terminal.AbstractErrorMessage; import com.vaadin.terminal.CompositeErrorMessage; import com.vaadin.terminal.ErrorMessage; import com.vaadin.terminal.PaintException; import com.vaadin.terminal.PaintTarget; +import com.vaadin.terminal.UserError; import com.vaadin.terminal.gwt.client.ui.FormConnector; /** @@ -242,15 +244,13 @@ public class Form extends AbstractField<Object> implements Item.Editor, if (validationError != null) { // Show caption as error for fields with empty errors if ("".equals(validationError.toString())) { - validationError = new Validator.InvalidValueException( - field.getCaption()); + validationError = new UserError(field.getCaption()); } break; } else if (f instanceof Field && !((Field<?>) f).isValid()) { // Something is wrong with the field, but no proper // error is given. Generate one. - validationError = new Validator.InvalidValueException( - field.getCaption()); + validationError = new UserError(field.getCaption()); break; } } @@ -264,9 +264,12 @@ public class Form extends AbstractField<Object> implements Item.Editor, } // Throw combination of the error types - return new CompositeErrorMessage(new ErrorMessage[] { - getComponentError(), validationError, - currentBufferedSourceException }); + return new CompositeErrorMessage( + new ErrorMessage[] { + getComponentError(), + validationError, + AbstractErrorMessage + .getErrorMessageForException(currentBufferedSourceException) }); } /** |