Reputation: 5031
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?
Upvotes: 13
Views: 23247
Reputation: 9537
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.
Upvotes: 11
Reputation: 18961
https://developers.google.com/web-toolkit/doc/latest/RefJreEmulation you can't use everything in GWT .... !
Upvotes: 1
Reputation: 4250
Calender class is not supported from GWT, You must use Date class instead of Calender.
Upvotes: 4
Reputation: 20890
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.
Upvotes: 3
Reputation: 17516
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.
Upvotes: 7
Reputation: 21883
I would not have thought you would need the source code although I've never used SWT. But at no time when using any one of a wide range of Java apis have I ever had this message just trying to use a class from them. So I think it's either an incorrect message or you have done something in the IDE that is trying to show you the source code. You can find a zip of the source on the JDKs directories. Id's such as Eclipse have the ability to associate source code zips with jars so that they can automatically look up source when you trigger that action.
Upvotes: -3