Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.3.3
-
None
-
Sun JDK 1.6.0
Description
Java 6.0 introduces very usefull possibility to add providers for Locale specific classes from java.text - for example for DateFormatSymbols it may be installed DateFormatSymbolsProvider.
Unfortunately such providers are ignored when DateFormatSymbols are created using constructor DateFormatSymbols(Locale) as it's used in DatePicker.localize method.
Javadoc says clearly:
"This constructor can only construct instances for the locales supported by the Java runtime environment, not for those supported by installed DateFormatSymbolsProvider implementations. For full locale coverage, use the getInstance method. "
So please change DatePicker to support custom DateFormatSymbolsProviders.
My proposal:
protected void localize(Map widgetProperties)
{
DateFormatSymbols dfSymbols = new DateFormatSymbols(getLocale());
try
{
// try to use JDK 6 DateFormatSymbols.getInstance(Locale)
Method getInstanceMethod = DateFormatSymbols.getMethod("getInstance", new Class[]
);
dfSymbols = (DateFormatSymbols)getInstanceMethod.invoke(null, new Object[]
);
}catch(NoSuchMethodException e)
catch(IllegalArgumentException e)
{ // pre JDK 6 - ignore }catch(InvocationTargetException e) { // pre JDK 6 - ignore }