aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/ui/Label.java
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2013-04-22 15:06:09 +0300
committerVaadin Code Review <review@vaadin.com>2013-04-24 09:41:22 +0000
commitbe433ace81027bfe9225513badbf4a07d3816377 (patch)
tree0cac26e36226ab27901a58276a4ebadd9eae3ccd /server/src/com/vaadin/ui/Label.java
parent9fe007a843805e8f8d8926848ce07bdab0bcd1d7 (diff)
downloadvaadin-framework-be433ace81027bfe9225513badbf4a07d3816377.tar.gz
vaadin-framework-be433ace81027bfe9225513badbf4a07d3816377.zip
Re-added Property.toString warning messages (#10916)
* Made it possible to toggle the toString() behavior using the "legacyPropertyToString" init parameter. The default value is "warning" which enables the legacy Property.toString implementation and logs a warning message when it is used. Other supported values are "true" which enables the legacy mode and "false" which disables it. Change-Id: Ife19352b86590464c8e441b7f82f4fec3b1f3235
Diffstat (limited to 'server/src/com/vaadin/ui/Label.java')
-rw-r--r--server/src/com/vaadin/ui/Label.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/server/src/com/vaadin/ui/Label.java b/server/src/com/vaadin/ui/Label.java
index 72f556ee5b..d037652a09 100644
--- a/server/src/com/vaadin/ui/Label.java
+++ b/server/src/com/vaadin/ui/Label.java
@@ -21,6 +21,8 @@ import java.util.Locale;
import java.util.logging.Logger;
import com.vaadin.data.Property;
+import com.vaadin.data.util.AbstractProperty;
+import com.vaadin.data.util.LegacyPropertyHelper;
import com.vaadin.data.util.converter.Converter;
import com.vaadin.data.util.converter.ConverterUtil;
import com.vaadin.shared.ui.label.ContentMode;
@@ -525,4 +527,35 @@ public class Label extends AbstractComponent implements Property<String>,
markAsDirty();
}
+ /**
+ * Returns a string representation of this object. The returned string
+ * representation depends on if the legacy Property toString mode is enabled
+ * or disabled.
+ * <p>
+ * If legacy Property toString mode is enabled, returns the value displayed
+ * by this label.
+ * </p>
+ * <p>
+ * If legacy Property toString mode is disabled, the string representation
+ * has no special meaning
+ * </p>
+ *
+ * @see AbstractProperty#isLegacyToStringEnabled()
+ *
+ * @return The value displayed by this label or a string representation of
+ * this Label object.
+ *
+ * @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() {
+ if (!LegacyPropertyHelper.isLegacyToStringEnabled()) {
+ return super.toString();
+ } else {
+ return LegacyPropertyHelper.legacyPropertyToString(this);
+ }
+ }
}