3

I have a simple GWT project and I was trying to use the gwt-cal widget but I am getting errors when I try to load a page where I use the widget.

I followed the instruction here to use the gwt-cal widget, but it is not working. I have the version 0.9.3 of gwt-cal, the version 3.1.2 of gwt-dnd and I am using GWT 2.4.

Here is the page where I use the gwt-cal widget:

public class ClientCalendarPage extends Composite {

private VerticalPanel mainPanel = new VerticalPanel();
private Calendar calendar;

public ClientCalendarPage() {
    CalendarSettings settings = new CalendarSettings();
    settings.setEnableDragDropCreation(false);
    settings.setEnableDragDrop(false);

    calendar = new Calendar();
    calendar.setSettings(settings);
    calendar.setDate(new Date()); // calendar date, not required
    calendar.setDays(3); // number of days displayed at a time, not required
    calendar.setWidth("500px");
    calendar.setHeight("400px");

    Appointment appt = new Appointment();
    appt.setStart(new Date(System.currentTimeMillis() + 86400000));
    appt.setEnd(new Date(System.currentTimeMillis() + 90000000));
    appt.setTitle("Test");
    appt.setStyle(AppointmentStyle.BLUE);
    calendar.addAppointment(appt);

    mainPanel.add(calendar);

    initWidget(mainPanel);
}
 }

Here is my app.gwt.xml :

<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='minoscrossfit'>
 <inherits name='com.google.gwt.user.User'/>
 <inherits name='com.google.gwt.user.theme.clean.Clean'/>                                   
 <inherits name='com.bradrydzewski.gwt.calendar.Calendar' />
 <inherits name='com.bradrydzewski.gwt.calendar.theme.google.Google' />
 <inherits name='com.allen_sauer.gwt.dnd.gwt-dnd'/>
 <entry-point class='com.afrsoftware.minoscrossfit.client.MinosCrossfit'/>
 <source path='client'/>
 <source path='shared'/>
</module>

And finaly, here is the stacktrace I get :

20:38:43.735 [ERROR] [minoscrossfit] Error while executing the JavaScript provider for property 'locale'

com.google.gwt.core.client.JavaScriptException: (TypeError): Property 'locale' of object  is not a function
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:248)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
at com.google.gwt.dev.shell.ModuleSpacePropertyOracle.computePropertyValue(ModuleSpacePropertyOracle.java:193)
at com.google.gwt.dev.shell.ModuleSpacePropertyOracle.getSelectionProperty(ModuleSpacePropertyOracle.java:130)
at com.google.gwt.resources.ext.ResourceGeneratorUtil.getLocale(ResourceGeneratorUtil.java:543)
at com.google.gwt.resources.ext.ResourceGeneratorUtil.findResources(ResourceGeneratorUtil.java:435)
at com.google.gwt.resources.ext.ResourceGeneratorUtil.findResources(ResourceGeneratorUtil.java:290)
at com.google.gwt.resources.ext.ResourceGeneratorUtil.findResources(ResourceGeneratorUtil.java:254)
at com.google.gwt.resources.rg.CssResourceGenerator.getResources(CssResourceGenerator.java:564)
at com.google.gwt.resources.rg.CssResourceGenerator.prepare(CssResourceGenerator.java:506)
at com.google.gwt.resources.rebind.context.AbstractClientBundleGenerator.initAndPrepare(AbstractClientBundleGenerator.java:1043)
at com.google.gwt.resources.rebind.context.AbstractClientBundleGenerator.initAndPrepare(AbstractClientBundleGenerator.java:1069)
at com.google.gwt.resources.rebind.context.AbstractClientBundleGenerator.generateIncrementally(AbstractClientBundleGenerator.java:412)
at com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:647)
at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:41)
at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:78)
at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:268)
at com.google.gwt.dev.shell.ShellModuleSpaceHost.rebind(ShellModuleSpaceHost.java:141)
at com.google.gwt.dev.shell.ModuleSpace.rebind(ModuleSpace.java:585)
at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:455)
at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:49)
at com.google.gwt.core.client.GWT.create(GWT.java:97)
at com.allen_sauer.gwt.dnd.client.util.DragClientBundle.&lt;clinit&gt;(DragClientBundle.java:72)
at com.allen_sauer.gwt.dnd.client.util.DragEntryPoint.onModuleLoad(DragEntryPoint.java:32)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396)
at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:525)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
at java.lang.Thread.run(Unknown Source)

Can anyone see what am I doing wrong?

jrochette
  • 1,117
  • 5
  • 22
  • What Web browser are you using for dev mode ? Are you sure you have the correct version of the GWT browser plugin ? – David Levesque Aug 21 '12 at 03:37
  • I am using Chrome for browser and the plugin is up to date. I tried my app on firefox this morning and it worked. After that, I tried checking out my project on another computer to make sure it was working, but it is not (on any browser with the plugin up to date) – jrochette Aug 21 '12 at 12:31

1 Answers1

5

I found the problem. I was missing some locales in my project. I changed my app.gwt.xml and it worked. I used the documentation here to solve this.

Here is what my app.gwt.xml looks like now :

<?xml version="1.0" encoding="UTF-8"?>
 <module rename-to='minoscrossfit'>
  <inherits name='com.google.gwt.user.User'/>
  <inherits name="com.google.gwt.i18n.I18N"/>
  <extend-property name="locale" values="fr"/>
  <extend-property name="locale" values="fr_CA"/>
  <extend-property name="locale" values="en"/>
  <inherits name='com.google.gwt.user.theme.clean.Clean'/>                                     
  <inherits name='com.bradrydzewski.gwt.calendar.Calendar' />
  <inherits name='com.bradrydzewski.gwt.calendar.theme.google.Google' />
  <inherits name='com.allen_sauer.gwt.dnd.gwt-dnd'/>
  <entry-point class='com.afrsoftware.minoscrossfit.client.MinosCrossfit'/>
  <source path='client'/>
  <source path='shared'/>
 </module>

A little project->clean in eclipse seems to have helped solving my issue.

I add a similar problem after changing the app.gwt.xml and it was because someone in my team (probably me) had committed a file that is not supposed to be committed (the nocache.js) so the new jars used in the project were not in this file. Changing the app.gwt.xml provoked a recompilation of the app and a new nocache.js file (with all the needed functions from the jars) was generated.

jrochette
  • 1,117
  • 5
  • 22
  • I got the same problem, however I'm not able to fix it using the direction on the reference link. In my code I'm using `param.toLowerCase(Locale.ENGLISH)` where param is a string. I though it should've worked according to [this](http://stackoverflow.com/questions/11063102/using-locales-with-javas-tolowercase-and-touppercase). Any thoughts? – Harsh Jul 02 '13 at 16:32