GXT(EXT-GWT)默认网格小组件实现。怎么了?

时间:2011-02-21 18:28:52

标签: gwt gridview datagrid grid gxt

网格示例代码

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.client.GraduateProject时出现异常。有关详情,请参阅开发模式 Sun.reflect.DeativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)的java.lang.reflect.InvocationTargetException at 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.extjs.gxt.ui.client.widget.grid.GridTemplates'的延迟绑定失败(你忘了继承一个必需的模块吗?)在com.google.gwt .dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:53)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)com.extjs.gxt.ui.client.widget.Component.render(Component.java:1022)at com.extjs.gxt.ui.client.widget.Component.onAttach (Component.java:1636)位于com.google.gwt.user.client.ui.Panel.adopt(Panel.java)的com.google.gwt.user.client.ui.Widget.setParent(Widget.java:449) :127)com.google.gwt.user.client.ui.ComplexPanel.add(ComplexPanel.java:97)com.google.gwt.user.client.ui.AbsolutePanel.add(AbsolutePanel.java:97)at at com.graduateproject.client.GraduateProject.onModuleLoa d(GraduateProject.java:58)... 9更多引起:java.lang.IncompatibleClassChangeError:找到com.google.gwt.core.ext.typeinfo.JClassType接口,但是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)位于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)at at Com.google.gwt.dev.shell.StandardRebindOracle $ Rebinder.rebind(StandardRebindOracle.java:74)at com.google.gwt.dev.shell.StandardRebindOracle.rebind(S tandardRebindOracle.java:259)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 < / p>

1 个答案:

答案 0 :(得分:1)

我自己想通了。最新的GWT 2.2.0 SDK与标准EXT-GWT 2.2.1之间存在不兼容性。我将GWT版本切换回之前的版本2.0.4,一切正常。我希望EXT-GWT能够很快更新它的SDK以赶上GWT。