GWT时间选择器?

时间:2010-12-22 13:32:44

标签: gwt

有人知道在GWT中我们是否有一个好的TimePicker? 事实上,我想要一个小部件,以便为GWT选择小时和分钟。

由于

8 个答案:

答案 0 :(得分:16)

AFAIK没有这样的小部件。 “一个好的TimePicker”也有点暗示。我一直在寻找这样的小部件很长一段时间,我发现一些javascript的例子非常糟糕,但有些人正在使用。

最后,我决定自己做一个基于带有值控制的TextBox。

alt text

源代码可用,你可以找到更多信息heregithub我希望你喜欢它。

我见过一些简单的ComboBox的TimePicker。

答案 1 :(得分:8)

我知道这个问题前一段时间被问过,但是在搜索GWT时间选择器时遇到了它,我决定自己编写。

Picture of UTCTimeBox

它支持许多不同的输入格式(4p =>下午4:00,745 =>早上7:45等),并且有一个固定时间间隔的下拉菜单。

在iOS上,它会自动使用HTML5输入类型=“时间”

enter image description here

Blog article describing the implementation

Demo of the UTCTimeBox

Demo of the UTCDateBox and UTCTimeBox being used together

Download at Google Code

答案 2 :(得分:4)

我创建了gwt-timepicker,它使用了jquery timepicker的概念。它完全符合您的需求(小时/分钟)。看看:http://code.google.com/p/gwt-timepicker/

查看此帖子:http://www.summa-tech.com/blog/2011/03/21/gwt-timepicker/

答案 3 :(得分:4)

GWT Bootstrap GWT小部件库有一个很好的日期+时间小部件,以及许多其他可靠的小部件。

http://gwtbootstrap.github.com/#component:datetimepicker

编辑:看起来有更新版本可用于bootstrap 3。

答案 4 :(得分:1)

gwt孵化器有一个好的time picker

代码将类似于给出的示例:

// A TimePicker with no "AM/PM" and no "seconds" field and using 24H formatting for "hours" field
TimePicker timePicker = new TimePicker(new Date(), null, DateTimeFormat.getFormat("HH"), DateTimeFormat.getFormat("mm"), null);

答案 5 :(得分:1)

我最近写了一个时间选择器。我匆匆写了它,所以它并不是最好的,但它运行正常。

尝试创建HTML5 <input type="time"/>,如果浏览器不支持,则会手动解析。我已在PC和iOS上的Chrome和Firefox上测试过它。

接受的格式为:

  • 12:59 AM
  • 5 - 假设是凌晨5点
  • 5p - 5:00 PM
  • 13 - 1 PM
  • 345 - 3:45 AM
  • 1534 - 3:34 PM
  • 111p - 1:11 PM

它实现HasValue<Long>以将选择的时间返回为毫秒。它还有一个返回时间与给定Date对象相结合的方法。

以下是来源:https://github.com/srilankanchurro/gwt-stuff/blob/master/gwt-stuff/src/com/sathkumara/client/TimePicker.java

如果您有修改要为此课程做出贡献,请随时在github上向我发送请求。

答案 6 :(得分:0)

DatePickerDateBox

 DatePicker datePicker = new DatePicker(); 

 DateBox dateBox = new DateBox();

这是GWT DatePicker example

您可以使用DateTimeFormat格式化日期时间,这里是example

答案 7 :(得分:0)

GXT有一个TimeField小部件Example好不好是你的选择:)

也许你可以关注DateTimePicker alt text https://github.com/ghuntley/Ext.ux.touch.DateTimePicker