summaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/ui
diff options
context:
space:
mode:
authorJohn Ahlroos <john@vaadin.com>2012-09-11 09:11:42 +0300
committerJohn Ahlroos <john@vaadin.com>2012-09-11 09:11:42 +0300
commitff56225f04d1ca67923fb2b05d37adc4907678da (patch)
treeaafaefb72784131c21bd387b7de42719a8cc9fa1 /server/src/com/vaadin/ui
parent2905256998b69b2da6cc5bfbbe2c9230d7cacd48 (diff)
parentdeb4d35b48e51318a961f02d2b6e5969c0875754 (diff)
downloadvaadin-framework-ff56225f04d1ca67923fb2b05d37adc4907678da.tar.gz
vaadin-framework-ff56225f04d1ca67923fb2b05d37adc4907678da.zip
Merge branch 'master' into html5-doctype
Diffstat (limited to 'server/src/com/vaadin/ui')
-rw-r--r--server/src/com/vaadin/ui/AbstractField.java83
-rw-r--r--server/src/com/vaadin/ui/UI.java20
2 files changed, 61 insertions, 42 deletions
diff --git a/server/src/com/vaadin/ui/AbstractField.java b/server/src/com/vaadin/ui/AbstractField.java
index f673babc26..e7d6d9a4ec 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();
}
/**
@@ -417,7 +381,8 @@ public abstract class AbstractField<T> extends AbstractComponent implements
public String toString() {
logger.warning("You are using AbstractField.toString() to get the value for a "
+ getClass().getSimpleName()
- + ". This is not recommended and will not be supported in future versions.");
+ + ". This will not be supported starting from Vaadin 7.1 "
+ + "(your debugger might call toString() and cause this message to appear).");
final Object value = getFieldValue();
if (value == null) {
return null;
@@ -1323,7 +1288,7 @@ public abstract class AbstractField<T> extends AbstractComponent implements
addPropertyListeners();
if (!isModified() && !isBuffered()) {
// Update value from data source
- discard();
+ updateValueFromDataSource();
}
}
}
@@ -1540,6 +1505,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.
diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java
index ef77142312..adb2a63c2e 100644
--- a/server/src/com/vaadin/ui/UI.java
+++ b/server/src/com/vaadin/ui/UI.java
@@ -222,11 +222,11 @@ public abstract class UI extends AbstractComponentContainer implements
* @param resource
* the resource to show in this UI
*
- * @deprecated As of 7.0, use getPage().open instead
+ * @deprecated As of 7.0, use getPage().setLocation instead
*/
@Deprecated
public void open(Resource resource) {
- getPage().open(resource);
+ open(resource, null);
}
/* ********************************************************************* */
@@ -264,6 +264,13 @@ public abstract class UI extends AbstractComponentContainer implements
* that name, either by opening a new window/tab in the browser or by
* replacing the contents of an existing window with that name.
* </p>
+ * <p>
+ * As of Vaadin 7.0.0, the functionality for opening a Resource in a
+ * Page has been replaced with similar methods based on a String URL.
+ * This is because the usage of Resource is problematic with memory
+ * management and with security features in some browsers. Is is
+ * recommended to instead use {@link Link} for starting downloads.
+ * </p>
*
* @param resource
* the resource.
@@ -273,13 +280,20 @@ public abstract class UI extends AbstractComponentContainer implements
*/
@Deprecated
public void open(Resource resource, String windowName) {
- getPage().open(resource, windowName);
+ open(resource, windowName, -1, -1, Page.BORDER_DEFAULT);
}
/**
* Opens the given resource in a window with the given size, border and
* name. For more information on the meaning of {@code windowName}, see
* {@link #open(Resource, String)}.
+ * <p>
+ * As of Vaadin 7.0.0, the functionality for opening a Resource in a
+ * Page has been replaced with similar methods based on a String URL.
+ * This is because the usage of Resource is problematic with memory
+ * management and with security features in some browsers. Is is
+ * recommended to instead use {@link Link} for starting downloads.
+ * </p>
*
* @param resource
* the resource.