summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorJohn Ahlroos <john@vaadin.com>2012-09-10 12:32:24 +0300
committerJohn Ahlroos <john@vaadin.com>2012-09-10 12:32:24 +0300
commit00f75c5a162e58e04d6d6f087ccceab98dfdf1f0 (patch)
tree6b72d611dbd61ae48975ebb5c4b03da4435fb1fe /server
parent9015ff64aa0a5503e29aa57b0d66e0aa6892e315 (diff)
parentb4e243c87d4b4f28fa18affecb855b8731682a59 (diff)
downloadvaadin-framework-00f75c5a162e58e04d6d6f087ccceab98dfdf1f0.tar.gz
vaadin-framework-00f75c5a162e58e04d6d6f087ccceab98dfdf1f0.zip
Merge branch '6.8'
Conflicts: WebContent/VAADIN/themes/base/common/common.scss server/src/com/vaadin/server/VaadinServlet.java server/src/com/vaadin/ui/AbstractField.java src/com/vaadin/terminal/gwt/client/ui/VUriFragmentUtility.java tests/testbench/com/vaadin/tests/components/datefield/DateFieldExtendedRange.java tests/testbench/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.java tests/testbench/com/vaadin/tests/components/table/TableReduceContainerSize.java tests/testbench/com/vaadin/tests/tickets/Ticket8291.java uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.html uitest/src/com/vaadin/tests/components/datefield/PopupDateFieldExtendedRange.java uitest/src/com/vaadin/tests/tickets/Ticket8291.java uitest/test.xml
Diffstat (limited to 'server')
-rw-r--r--server/src/com/vaadin/ui/AbstractField.java80
1 files changed, 42 insertions, 38 deletions
diff --git a/server/src/com/vaadin/ui/AbstractField.java b/server/src/com/vaadin/ui/AbstractField.java
index f673babc26..442fa095d4 100644
--- a/server/src/com/vaadin/ui/AbstractField.java
+++ b/server/src/com/vaadin/ui/AbstractField.java
@@ -282,43 +282,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements
*/
@Override
public void discard() throws Buffered.SourceException {
- if (dataSource != null) {
-
- // Gets the correct value from datasource
- T newFieldValue;
- try {
-
- // Discards buffer by overwriting from datasource
- newFieldValue = convertFromDataSource(getDataSourceValue());
-
- // If successful, remove set the buffering state to be ok
- if (getCurrentBufferedSourceException() != null) {
- setCurrentBufferedSourceException(null);
- }
- } catch (final Throwable e) {
- // FIXME: What should really be done here if conversion fails?
-
- // Sets the buffering state
- currentBufferedSourceException = new Buffered.SourceException(
- this, e);
- markAsDirty();
-
- // Throws the source exception
- throw currentBufferedSourceException;
- }
-
- final boolean wasModified = isModified();
- setModified(false);
-
- // If the new value differs from the previous one
- if (!equals(newFieldValue, getInternalValue())) {
- setInternalValue(newFieldValue);
- fireValueChange(false);
- } else if (wasModified) {
- // If the value did not change, but the modification status did
- markAsDirty();
- }
- }
+ updateValueFromDataSource();
}
/**
@@ -1323,7 +1287,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements
addPropertyListeners();
if (!isModified() && !isBuffered()) {
// Update value from data source
- discard();
+ updateValueFromDataSource();
}
}
}
@@ -1540,6 +1504,46 @@ public abstract class AbstractField<T> extends AbstractComponent implements
}
}
+ private void updateValueFromDataSource() {
+ if (dataSource != null) {
+
+ // Gets the correct value from datasource
+ T newFieldValue;
+ try {
+
+ // Discards buffer by overwriting from datasource
+ newFieldValue = convertFromDataSource(getDataSourceValue());
+
+ // If successful, remove set the buffering state to be ok
+ if (getCurrentBufferedSourceException() != null) {
+ setCurrentBufferedSourceException(null);
+ }
+ } catch (final Throwable e) {
+ // FIXME: What should really be done here if conversion fails?
+
+ // Sets the buffering state
+ currentBufferedSourceException = new Buffered.SourceException(
+ this, e);
+ markAsDirty();
+
+ // Throws the source exception
+ throw currentBufferedSourceException;
+ }
+
+ final boolean wasModified = isModified();
+ setModified(false);
+
+ // If the new value differs from the previous one
+ if (!equals(newFieldValue, getInternalValue())) {
+ setInternalValue(newFieldValue);
+ fireValueChange(false);
+ } else if (wasModified) {
+ // If the value did not change, but the modification status did
+ markAsDirty();
+ }
+ }
+ }
+
/**
* Gets the converter used to convert the property data source value to the
* field value.