GXT (EXT-GWT) 默认网格小部件实现。怎么了?
网格示例代码
public class GraduateProject implements EntryPoint {
public static List<Student> getStudents() {
List<Student> students = new ArrayList<Student>();
students.add(new Student("Kostas", "Trichas"));
students.add(new Student("Dimitris", "Elotriviaris"));
students.add(new Student("Dimitris", "Moutafidis"));
students.add(new Student("Stavros", "Baltas"));
students.add(new Student("Panos", "Paikos"));
students.add(new Student("Nikos", "Antarakis"));
students.add(new Student("Vagelis", "Papaiakos"));
return students;
}
@Override
public void onModuleLoad() {
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
ColumnConfig column = new ColumnConfig();
column.setId("fname");
column.setHeader("First Name");
column.setWidth(250);
configs.add(column);
column = new ColumnConfig();
column.setId("lname");
column.setHeader("Last Name");
column.setWidth(250);
configs.add(column);
ListStore<Student> studentList = new ListStore<Student>();
studentList.add(getStudents());
ColumnModel cm = new ColumnModel(configs);
final Grid<Student> grid = new Grid<Student>(studentList,cm);
RootPanel.get().add(grid);
}
}
错误:
onModuleLoad()
加载模块 com.graduateproject 时抛出异常。客户.研究生项目。详细信息请参见开发模式。 在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处的java.lang.reflect.InitationTargetException 在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)处 在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)处java.lang.reflect.Method.invoke(Method.java:597) 位于 com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396) 位于 com.google.gwt.dev.shell.OophmSessionHandler。 loadModule(OophmSessionHandler.java:183) 在 com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:510) 在 com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)在 java.lang.Thread.run(Thread.java:680) 原因:java.lang.RuntimeException:com.google.gwt 上的“com.extjs.gxt.ui.client.widget.grid.GridTemplates”延迟绑定失败(您是否忘记继承所需的模块?) .dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:53) 在 com.google.gwt.core.client.GWT.create(GWT.java:98) 在 com.extjs.gxt.ui.client.widget.grid .GridView.initTemplates(GridView.java:1351) 在 com.extjs.gxt.ui.client.widget.grid.GridView.init(GridView.java:1224) 在 com.extjs.gxt.ui.client.widget.grid .Grid.onRender(Grid.java:880) 在 com.extjs.gxt.ui.client.widget.Component.render(Component.java:1022) 在 com.extjs.gxt.ui.client.widget.Component.onAttach (Component.java:1636)在com.google.gwt.user.client.ui.Widget.setParent(Widget.java:449)在com.google.gwt.user.client.ui.Panel.adopt(Panel.java :127)在com.google.gwt.user.client.ui.ComplexPanel.add(ComplexPanel.java:97)在com.google.gwt.user.client.ui.AbsolutePanel.add(AbsolutePanel.java:97)在com.graduateproject.client.GraduateProject.onModuleLoad(GraduateProject.java:58) ... 9 更多 引起原因:java.lang.InknownClassChangeError:找到接口 com.google.gwt.core.ext.typeinfo.JClassType,但需要类在 com.extjs.gxt.ui.rebind.core.TemplatesGenerator$SourceGenerator.validateType(TemplatesGenerator.java:142) 在 com.extjs.gxt.ui.rebind.core.TemplatesGenerator$SourceGenerator.generate(TemplatesGenerator.java:97)在 com.extjs.gxt.ui.rebind.core.TemplatesGenerator.generate(TemplatesGenerator.java:56) 在 com.google.gwt.core.ext.GeneratorExtWrapper.generate(GeneratorExtWrapper.java:48) 在 com.google.gwt .core.ext.GeneratorExtWrapper.generateIncrementally(GeneratorExtWrapper.java:60)位于 com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:662)位于 com.google.gwt.dev.cfg.RuleGenerateWith.realize (RuleGenerateWith.java:41) 在 com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:74) 在 com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:259 )在com.google.gwt.dev.shell.ShellModuleSpaceHost.rebind(ShellModuleSpaceHost.java:141)在com.google.gwt.dev.shell.ModuleSpace.rebind(ModuleSpace.java:585)在com.google.gwt。 dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:455) at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:49) ... 20 更多
Sample Code for Grid
public class GraduateProject implements EntryPoint {
public static List<Student> getStudents() {
List<Student> students = new ArrayList<Student>();
students.add(new Student("Kostas", "Trichas"));
students.add(new Student("Dimitris", "Elotriviaris"));
students.add(new Student("Dimitris", "Moutafidis"));
students.add(new Student("Stavros", "Baltas"));
students.add(new Student("Panos", "Paikos"));
students.add(new Student("Nikos", "Antarakis"));
students.add(new Student("Vagelis", "Papaiakos"));
return students;
}
@Override
public void onModuleLoad() {
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
ColumnConfig column = new ColumnConfig();
column.setId("fname");
column.setHeader("First Name");
column.setWidth(250);
configs.add(column);
column = new ColumnConfig();
column.setId("lname");
column.setHeader("Last Name");
column.setWidth(250);
configs.add(column);
ListStore<Student> studentList = new ListStore<Student>();
studentList.add(getStudents());
ColumnModel cm = new ColumnModel(configs);
final Grid<Student> grid = new Grid<Student>(studentList,cm);
RootPanel.get().add(grid);
}
}
And the error:
onModuleLoad() threw an exception
Exception while loading module com.graduateproject.client.GraduateProject. See Development Mode for details.
java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396) at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:183) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:510) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352) at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.RuntimeException: Deferred binding failed for 'com.extjs.gxt.ui.client.widget.grid.GridTemplates' (did you forget to inherit a required module?) at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:53) at com.google.gwt.core.client.GWT.create(GWT.java:98) at com.extjs.gxt.ui.client.widget.grid.GridView.initTemplates(GridView.java:1351) at com.extjs.gxt.ui.client.widget.grid.GridView.init(GridView.java:1224) at com.extjs.gxt.ui.client.widget.grid.Grid.onRender(Grid.java:880) at com.extjs.gxt.ui.client.widget.Component.render(Component.java:1022) at com.extjs.gxt.ui.client.widget.Component.onAttach(Component.java:1636) at com.google.gwt.user.client.ui.Widget.setParent(Widget.java:449) at com.google.gwt.user.client.ui.Panel.adopt(Panel.java:127) at com.google.gwt.user.client.ui.ComplexPanel.add(ComplexPanel.java:97) at com.google.gwt.user.client.ui.AbsolutePanel.add(AbsolutePanel.java:97) at com.graduateproject.client.GraduateProject.onModuleLoad(GraduateProject.java:58) ... 9 more Caused by: java.lang.IncompatibleClassChangeError: Found interface com.google.gwt.core.ext.typeinfo.JClassType, but class was expected at com.extjs.gxt.ui.rebind.core.TemplatesGenerator$SourceGenerator.validateType(TemplatesGenerator.java:142) at com.extjs.gxt.ui.rebind.core.TemplatesGenerator$SourceGenerator.generate(TemplatesGenerator.java:97) at com.extjs.gxt.ui.rebind.core.TemplatesGenerator.generate(TemplatesGenerator.java:56) at com.google.gwt.core.ext.GeneratorExtWrapper.generate(GeneratorExtWrapper.java:48) at com.google.gwt.core.ext.GeneratorExtWrapper.generateIncrementally(GeneratorExtWrapper.java:60) at com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:662) at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:41) at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:74) at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:259) 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) ... 20 more
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我自己想出来了。最新的 GWT 2.2.0 SDK 与标准 EXT-GWT 版本 2.2.1 之间不兼容。我将 GWT 版本切换回之前的版本 2.0.4,一切正常。我希望 EXT-GWT 能够尽快更新它的 SDK 以赶上 GWT。
I figured it out myself. There is an incompatibility between the latest GWT 2.2.0 SDK and the standard EXT-GWT version 2.2.1. I switched back the GWT version to the previous release 2.0.4 and everything works fine. I hope EXT-GWT will soon update it's SDK to catch up with GWT.