// force recreating format string\r
formatStr = null;\r
}\r
+ if (uidl.hasAttribute("format")) {\r
+ formatStr = uidl.getStringAttribute("format");\r
+ }\r
+\r
buildDate();\r
// not a FocusWidget -> needs own tabindex handling\r
if (uidl.hasAttribute("tabindex")) {\r
*/
private Calendar calendar;
+ /**
+ * Overridden format string
+ */
+ private String dateFormat;
+
/* Constructors */
/**
target.addAttribute("locale", l.toString());
}
+ if (getDateFormat() != null) {
+ target.addAttribute("format", dateFormat);
+ }
+
target.addAttribute("type", type);
// Gets the calendar
return newCal;
}
+
+ /**
+ * Sets formatting used by some component implementations. See
+ * {@link SimpleDateFormat} for format details.
+ *
+ * By default it is encouraged to used default formatting defined by Locale,
+ * but due some JVM bugs it is sometimes necessary to use this method to
+ * override formatting. See Toolkit issue #2200.
+ *
+ * @param dateFormat
+ * the dateFormat to set
+ *
+ * @see com.itmill.toolkit.ui.AbstractComponent#setLocale(Locale))
+ */
+ public void setDateFormat(String dateFormat) {
+ this.dateFormat = dateFormat;
+ }
+
+ /**
+ * Reterns a format string used to format date value on client side or null
+ * if default formatting from {@link Component#getLocale()} is used.
+ *
+ * @return the dateFormat
+ */
+ public String getDateFormat() {
+ return dateFormat;
+ }
+
}