GWT Time Picker?
Does anyone know if in GWT we have a good TimePicker ? In fact I want a widget in order to select hour and minute f开发者_StackOverflow社区or GWT.
Thanks
AFAIK there's no such a widget. Also "a good TimePicker" is a bit suggestive. I've been looking for such a widget for a long time and I found some javascript examples that were completely awful, but some people is using.
Finally I decided to do my own, based in a TextBox with value control.
The source code is available, you can find more info here and on github I hope you like it.
I have seen some TimePicker that are simple ComboBoxes.
I know this question was asked a while ago, but I came across it during my search for a GWT time picker and I decided to write my own.
It supports many different input formats (4p => 4:00pm, 745 => 7:45am, etc) and has a drop-down menu with times at fixed intervals.
On iOS, it automatically uses an HTML5 input type="time"
Blog article describing the implementation
Demo of the UTCTimeBox
Demo of the UTCDateBox and UTCTimeBox being used together
Download at Google Code
I created gwt-timepicker which is using the concept of jquery timepicker. It does exactly what you need (hour/minute). Take a look: http://code.google.com/p/gwt-timepicker/
check this post: http://www.summa-tech.com/blog/2011/03/21/gwt-timepicker/
GWT Bootstrap GWT widget library has a nice date+time widget, along with many other solid widgets.
http://gwtbootstrap.github.com/#component:datetimepicker
Edit: Looks like there is newer version available for bootstrap 3.
The gwt incubator has an alright time picker
The code would be something like the example given:
// 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);
I wrote a Time Picker recently. I wrote it in a hurry, so it's not the best out there, but it works fine.
It attempts to create a HTML5 <input type="time"/>
and if it's not supported by the browser, it parses manually. I have tested it on Chrome and Firefox on PC, and iOS.
Accepted formats are:
- 12:59 AM
- 5 - assumed to be 5 AM
- 5p - 5:00 PM
- 13 - 1 PM
- 345 - 3:45 AM
- 1534 - 3:34 PM
- 111p - 1:11 PM
it implements HasValue<Long>
to return the picked time as milliseconds. It also has a method to return the time combined with a given Date
object.
Here's the source: https://github.com/srilankanchurro/gwt-stuff/blob/master/gwt-stuff/src/com/sathkumara/client/TimePicker.java
If you have modifications to contribute to this class, please feel free to send me a request on github.
DatePicker and DateBox
DatePicker datePicker = new DatePicker();
DateBox dateBox = new DateBox();
Here is GWT DatePicker example
and you can format the datetime to your needs with DateTimeFormat and here is example
GXT has a TimeField widget Example Good or not it's your choice :)
Maybe you can give an eye to DateTimePicker
https://github.com/ghuntley/Ext.ux.touch.DateTimePicker
精彩评论