I tried to use java.util.Calendar
in my GWT application as following:
Calendar cal = Calendar.getInstance();
then i got this error:
No source code is available for type
java.util.Calendar
; did you forget to inherit a required module?
anyone know what's wrong with it?
The relevant bug is logged in GWT since GWT version 1.3 and you can find it here - http://code.google.com/p/google-web-toolkit/issues/detail?id=603
1) The Calendar class support for GWT is a long pending request from GWT User community.
2) Unfortunately GWT team has decided we can do without it.
You can find all possible discussions on Google GWT forum. There are other alternatives which you look up in the forum and the issue discussion thread runs into a few pages.
Essentially we decided to do away with any client side code using Calendar and just handle the stuff on server side.
The Calendar class depends on a lot of Java classes that GWT cannot possibly convert to Javascript. If it fits your needs, you could simply do new Date()
on the client side. See here for more details.
You could also try the gwt-calendar project.
Calender class is not supported from GWT, You must use Date class instead of Calender.
java.util.Date will still work, and you can use com.google.gwt.i18n.client.DateTimeFormat to do any date formatting you need to do.
Check that link for full example code.
https://developers.google.com/web-toolkit/doc/latest/RefJreEmulation you can't use everything in GWT .... !
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With