尝试使用gwt-cal和gwt-dnd时出错

jro*_*tte 3 gwt

我有一个简单的GWT项目,我试图使用gwt-cal小部件,但是当我尝试加载我使用小部件的页面时,我收到错误.

我按照这里的说明使用gwt-cal小部件,但它不起作用.我有gwt-cal的0.9.3版本,gwt-dnd的版本3.1.2,我正在使用GWT 2.4.

这是我使用gwt-cal小部件的页面:

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);
}
 }
Run Code Online (Sandbox Code Playgroud)

这是我的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>
Run Code Online (Sandbox Code Playgroud)

最后,这是我得到的堆栈跟踪:

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)
Run Code Online (Sandbox Code Playgroud)

任何人都可以看到我做错了什么?

jro*_*tte 5

我发现了这个问题.我在项目中缺少一些语言环境.我改变了我的app.gwt.xml并且它有效.我用这里的文档来解决这个问题.

这是我的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.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>
Run Code Online (Sandbox Code Playgroud)

一个小项目 - >日食中的清洁似乎有助于解决我的问题.

我改变了app.gwt.xml之后添加了类似的问题,这是因为有人在我的球队(可能是我)已承诺是不应该被提交(在nocache.js),所以在项目中使用的新罐子文件不属于这个文件.更改app.gwt.xml挑起了应用程序的重新编译和新nocache.js文件(从罐子所有需要的功能)的产生.