summaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorHenri Sara <hesara@vaadin.com>2013-02-15 16:14:40 +0200
committerHenri Sara <hesara@vaadin.com>2013-02-15 16:14:40 +0200
commitd8412a30200a17497d60e1f4cf7e6a600d710d42 (patch)
treeaee294229512eeef9185037cb94714382dd94b68 /server
parent59802e0deb28daa091b3f54a7d3cf6ce8882de11 (diff)
downloadvaadin-framework-d8412a30200a17497d60e1f4cf7e6a600d710d42.tar.gz
vaadin-framework-d8412a30200a17497d60e1f4cf7e6a600d710d42.zip
Revert "Removed legacy toString implementations as promised in 7.0
(#10916)" (accidentally merged from 7.1) This reverts commit 5be248803b9b670cd4cf24d5173e7f580180545e. Change-Id: If4371976f8afe68d08e814128e3256d66b8ecdb3
Diffstat (limited to 'server')
-rw-r--r--server/src/com/vaadin/ui/AbstractField.java24
-rw-r--r--server/src/com/vaadin/ui/Label.java17
2 files changed, 41 insertions, 0 deletions
diff --git a/server/src/com/vaadin/ui/AbstractField.java b/server/src/com/vaadin/ui/AbstractField.java
index 619d717d97..422e0a1796 100644
--- a/server/src/com/vaadin/ui/AbstractField.java
+++ b/server/src/com/vaadin/ui/AbstractField.java
@@ -373,6 +373,30 @@ public abstract class AbstractField<T> extends AbstractComponent implements
/* Property interface implementation */
/**
+ * Returns the (field) value converted to a String using toString().
+ *
+ * @see java.lang.Object#toString()
+ * @deprecated As of 7.0, use {@link #getValue()} to get the value of the
+ * field, {@link #getConvertedValue()} to get the field value
+ * converted to the data model type or
+ * {@link #getPropertyDataSource()} .getValue() to get the value
+ * of the data source.
+ */
+ @Deprecated
+ @Override
+ public String toString() {
+ logger.warning("You are using AbstractField.toString() to get the value for a "
+ + getClass().getSimpleName()
+ + ". 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;
+ }
+ return value.toString();
+ }
+
+ /**
* Gets the current value of the field.
*
* <p>
diff --git a/server/src/com/vaadin/ui/Label.java b/server/src/com/vaadin/ui/Label.java
index f413ea47f2..f49a1403cf 100644
--- a/server/src/com/vaadin/ui/Label.java
+++ b/server/src/com/vaadin/ui/Label.java
@@ -203,6 +203,23 @@ public class Label extends AbstractComponent implements Property<String>,
}
/**
+ * Returns the value displayed by this label.
+ *
+ * @see java.lang.Object#toString()
+ * @deprecated As of 7.0, use {@link #getValue()} to get the value of the
+ * label or {@link #getPropertyDataSource()} .getValue() to get
+ * the value of the data source.
+ */
+ @Deprecated
+ @Override
+ public String toString() {
+ logger.warning("You are using Label.toString() to get the value for a "
+ + getClass().getSimpleName()
+ + ". This will not be supported starting from Vaadin 7.1 (your debugger might call toString() and cause this message to appear).");
+ return getValue();
+ }
+
+ /**
* Gets the type of the Property.
*
* @see com.vaadin.data.Property#getType()