2013-07-26 53 views
3

背景

在GWT 文件中2.5.0:com.google.gwt.i18n.client.impl.cldr.DateTimeFormatInfoImpl_en定义getFirstDayOfWeek为:GWT的DatePicker变化2.5.1

@Override 
public int firstDayOfTheWeek() { 
    return 0; 
} 

这导致日历呈现为SMTWTFS

但在更新GWT 2.5.1这个改为

@Override 
public int firstDayOfTheWeek() { 
    return 1; 
} 

导致日历呈现为MTWTFSS


的问题(一个或多个)

有谁知道为什么默认的改变?我真的很兴奋回去改变我所有的日历!

有谁知道我可以更改的区域设置,以便日历呈现为SMTWTFS?我不希望创建子类,请覆盖firstDayOfTheWeek()并更改所有日历。

+0

看看这个主题 - http://stackoverflow.com/questions/3508213/how-to-make-gwt-datepicker-to-use-monday-as-the-first-day-of-the-week –

回答

1

我不准备测试此解决方案,但可以尝试使用GWT Deferred Binding。如果它起作用,那么好处是你不必更改大量的代码。

1:创建一个新类并重写firstDayOfTheWeek()方法。

public class CustomDateTimeFormatInfoImpl_en extends DateTimeFormatInfoImpl_en { 

    @Override 
    public int firstDayOfTheWeek() { 
     // make Sunday my first day of the week 
     return 0; 
    } 
} 

2:在gwt.xml模块文件中添加延迟绑定指令。

<replace-with class="com.example.sample.CustomDateTimeFormatInfoImpl_en"> 
    <when-type-is class="com.google.gwt.i18n.client.impl.cldr.DateTimeFormatInfoImpl_en"/> 
</replace-with> 

希望能够帮助或至少将您引向正确的方向。