diff options
author | Artur Signell <artur@vaadin.com> | 2011-12-12 16:49:36 +0200 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2011-12-14 22:40:16 +0200 |
commit | eb0027f05d2bb96f84b5df115a5bd010a72dd789 (patch) | |
tree | 309270f1878b1bf03d102e9f0a2decfe8d6aaaf3 /src/com/vaadin/ui/AbstractField.java | |
parent | 015c8335ad2a690a428568bd3ddcd0040cf056eb (diff) | |
download | vaadin-framework-eb0027f05d2bb96f84b5df115a5bd010a72dd789.tar.gz vaadin-framework-eb0027f05d2bb96f84b5df115a5bd010a72dd789.zip |
Use getter and setter for source exception
Diffstat (limited to 'src/com/vaadin/ui/AbstractField.java')
-rw-r--r-- | src/com/vaadin/ui/AbstractField.java | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/src/com/vaadin/ui/AbstractField.java b/src/com/vaadin/ui/AbstractField.java index 2f41929a8e..fb7efc41f5 100644 --- a/src/com/vaadin/ui/AbstractField.java +++ b/src/com/vaadin/ui/AbstractField.java @@ -257,12 +257,12 @@ public abstract class AbstractField<T> extends AbstractComponent implements } catch (final Throwable e) { // Sets the buffering state. - currentBufferedSourceException = new Buffered.SourceException( + SourceException sourceException = new Buffered.SourceException( this, e); - requestRepaint(); + setCurrentBufferedSourceException(sourceException); // Throws the source exception. - throw currentBufferedSourceException; + throw sourceException; } finally { committingValueToDataSource = false; } @@ -281,9 +281,8 @@ public abstract class AbstractField<T> extends AbstractComponent implements } // If successful, remove set the buffering state to be ok - if (currentBufferedSourceException != null) { - currentBufferedSourceException = null; - repaintNeeded = true; + if (getCurrentBufferedSourceException() != null) { + setCurrentBufferedSourceException(currentBufferedSourceException); } if (valueWasModifiedByDataSourceDuringCommit) { @@ -310,9 +309,8 @@ public abstract class AbstractField<T> extends AbstractComponent implements newFieldValue = convertFromDataSource(getDataSourceValue()); // If successful, remove set the buffering state to be ok - if (currentBufferedSourceException != null) { - currentBufferedSourceException = null; - requestRepaint(); + if (getCurrentBufferedSourceException() != null) { + setCurrentBufferedSourceException(null); } } catch (final Throwable e) { // FIXME: What should really be done here if conversion fails? @@ -579,9 +577,8 @@ public abstract class AbstractField<T> extends AbstractComponent implements } // If successful, remove set the buffering state to be ok - if (currentBufferedSourceException != null) { - currentBufferedSourceException = null; - requestRepaint(); + if (getCurrentBufferedSourceException() != null) { + setCurrentBufferedSourceException(null); } if (valueWasModifiedByDataSourceDuringCommit) { @@ -681,9 +678,12 @@ public abstract class AbstractField<T> extends AbstractComponent implements setInternalValue(fieldValue); } setModified(false); + if (getCurrentBufferedSourceException() != null) { + setCurrentBufferedSourceException(null); + } } catch (final Throwable e) { - currentBufferedSourceException = new Buffered.SourceException(this, - e); + setCurrentBufferedSourceException(new Buffered.SourceException( + this, e)); setModified(true); } @@ -1005,13 +1005,13 @@ public abstract class AbstractField<T> extends AbstractComponent implements // Return if there are no errors at all if (superError == null && validationError == null - && currentBufferedSourceException == null) { + && getCurrentBufferedSourceException() == null) { return null; } // Throw combination of the error types return new CompositeErrorMessage(new ErrorMessage[] { superError, - validationError, currentBufferedSourceException }); + validationError, getCurrentBufferedSourceException() }); } @@ -1359,6 +1359,15 @@ public abstract class AbstractField<T> extends AbstractComponent implements } /** + * Gets the current buffered source exception. + * + * @return The current source exception + */ + protected Buffered.SourceException getCurrentBufferedSourceException() { + return currentBufferedSourceException; + } + + /** * A ready-made {@link ShortcutListener} that focuses the given * {@link Focusable} (usually a {@link Field}) when the keyboard shortcut is * invoked. |