From: Joonas Lehtinen Date: Mon, 15 Sep 2008 21:02:12 +0000 (+0000) Subject: Fixes #2076 : TextField.getValue() does not use format X-Git-Tag: 6.7.0.beta1~4162 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9f77d02e244fd0425ee4c40734f317c22570ca6f;p=vaadin-framework.git Fixes #2076 : TextField.getValue() does not use format svn changeset:5403/svn branch:trunk --- diff --git a/src/com/itmill/toolkit/ui/TextField.java b/src/com/itmill/toolkit/ui/TextField.java index 50404d643a..741fb84589 100644 --- a/src/com/itmill/toolkit/ui/TextField.java +++ b/src/com/itmill/toolkit/ui/TextField.java @@ -182,20 +182,31 @@ public class TextField extends AbstractField { * @return the Formatted value. * @see #setFormat(Format) * @see Format + * @deprecated */ protected String getFormattedValue() { - final Object value = getValue(); - if (format != null && value != null) { - try { - return format.format(value); - } catch (final IllegalArgumentException e) { - // FIXME: Handle exception ? - } + Object v = getValue(); + if (v == null) { + return null; + } + return v.toString(); + } + + /* + * Gets the value of the field, but uses formatter is given. Don't add a + * JavaDoc comment here, we use the default documentation from implemented + * interface. + */ + public Object getValue() { + Object v = super.getValue(); + if (format == null || v == null) { + return v; } - if (value != null) { - return value.toString(); + try { + return format.format(v); + } catch (final IllegalArgumentException e) { + return v; } - return null; } /*