【问题标题】:GWT DatePicker Change In 2.5.1GWT DatePicker 2.5.1 中的更改
【发布时间】:2013-07-26 19:47:51
【问题描述】:

背景

在 GWT 2.5.0 文件中:com.google.gwt.i18n.client.impl.cldr.DateTimeFormatInfoImpl_en 将getFirstDayOfWeek 定义为:

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

这会导致日历呈现为 SMTWTFS

但在更新 GWT 2.5.1 中,这已更改为

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

使日历呈现为 MTWTFSS


问题

有人知道为什么更改默认设置吗?我不太高兴回去更改我所有的日历!

是否有人知道我可以更改的区域设置,以便日历呈现为 SMTWTFS?我不想创建子类,覆盖 firstDayOfTheWeek() 并更改所有日历。 p>

【问题讨论】:

    标签: java gwt


    【解决方案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>
    

    希望能帮助或至少引导您朝着正确的方向前进。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-04-10
      • 1970-01-01
      • 1970-01-01
      • 2013-11-08
      • 2019-04-06
      • 1970-01-01
      • 2012-09-30
      相关资源
      最近更新 更多