0

我正在使用 GWT 2.5.1 和 GXT 2.2.5,这是我正在使用的 Bean:

public class Modelo extends BaseModel {

public Modelo(String nombre,String noParte,String imagen){
    this.set("nombre", nombre);
    this.set("noParte", noParte);
    this.set("path", imagen);
}

public String getNombre(){
    return (String)get("nombre");
}

public String getNoParte(){
    return (String)get("noParte");
}
public String getPath(){
    return (String)this.get("path");
}

}

//// 这是我正在使用的数据:

public class Lista {

public static List<Modelo> getList() {
    List<Modelo> datos = new ArrayList<Modelo>();
    datos.add(new Modelo("bomba wp", "3234343","selyR.jpg"));
    datos.add(new Modelo("bomba maytag", "343544323","selyR.jpg"));
    datos.add(new Modelo("cople wp", "12323","selyR.jpg"));        
    datos.add(new Modelo("perros wp", "545563","selyR.jpg"));
    datos.add(new Modelo("bobinas secadora wp","534532","selyR.jpg"));
    datos.add(new Modelo("banda maytag","3123123","selyR.jpg"));
    return datos;
}

}

////// 这是窗口配置

public class Carrito extends Window {

public Carrito(String nombre1) {

    this.setHeading(nombre1);
    this.setWidth(900);
    this.setHeight(600);
    this.setResizable(false);
    this.setVisible(true);
    this.setLayout(new FitLayout());

}

@Override
protected void onRender(Element parent, int pos) {
    super.onRender(parent, pos);

    List<ColumnConfig> configs = new ArrayList<ColumnConfig>();

    ColumnConfig column = new ColumnConfig();
    column.setId("nombre");
    column.setHeader("Nombre Producto");
    column.setWidth(200);
    configs.add(column);

    ColumnConfig column1 = new ColumnConfig();
    column.setId("noParte");
    column.setHeader("# parte");
    column.setWidth(200);
    configs.add(column1);

    ColumnConfig column2 = new ColumnConfig();
    column.setId("path");
    column.setHeader("imagen");
    column.setWidth(200);
    configs.add(column2);

    ListStore<Modelo> listaPiezas = new ListStore<Modelo>();
    listaPiezas.add(Lista.getList());

    ColumnModel cm = new ColumnModel(configs);
    Grid<Modelo> grid = new Grid<Modelo>(listaPiezas, cm);
    //grid.setStyleAttribute("borderTop", "none");
    //grid.setAutoExpandColumn("name");
    grid.setBorders(true);
    grid.setStripeRows(true);

    ContentPanel cp = new ContentPanel();
    cp.setBodyBorder(false);
    cp.setHeading("Carrito");
    cp.setButtonAlign(HorizontalAlignment.CENTER);
    cp.setLayout(new FitLayout());
    cp.setSize(900, 600);
    cp.add(grid);

    this.add(cp);


}

}

//// 这是我得到的错误:

         [ERROR] An internal compiler exception occurred
com.google.gwt.dev.jjs.InternalCompilerException: Unexpected error during visit.

java(1362): GWT.create(GridTemplates.class) com.google.gwt.dev.jjs.ast.JMethodCall [错误] at GridView.java(1362): (GridTemplates) GWT.create(GridTemplates.class) com。 GridView.java(1362) 处的 google.gwt.dev.jjs.ast.JCastOperation [错误]:this.templates = (GridTemplates) >GWT.create(GridTemplates.class) com.google.gwt.dev.jjs.ast。 JBinaryOperation [错误] 在 GridView.java(1362):this.templates = (GridTemplates) >GWT.create(GridTemplates.class) com.google.gwt.dev.jjs.ast.JExpressionStatement [错误] 在 GridView.java(1361 ): { this.templates = (GridTemplates) GWT.create(GridTemplates.class); com.google.gwt.dev.jjs.ast.JBlock [错误] 在 GridView.java(1361): { this.templates = (GridTemplates) GWT.create(GridTemplates.class); } com。

    com.google.gwt.dev.jjs.ast.JMethod
 C:\Users\NORE\Documents\NetBeansProjects\ventas\nbproject\build-gwt.xml:330: >The     following error occurred while executing this line:
C:\Users\NORE\Documents\NetBeansProjects\ventas\nbproject\build-gwt.xml:479: Java   >returned: 1
4

2 回答 2

2

万一有人遇到这个问题。确保您使用 gxt-2.3.0- gwt22 .jar 库而不是 gxt-2.3.0- gwt2 .jar 和 gwt 2.5.1

于 2013-05-20T21:00:41.970 回答
0

我遇到了同样的问题,在用 gxt-2.2.5-gwt17 替换 gxt- 2.2.5-gwt22 后它现在工作正常。

于 2013-11-18T05:02:18.903 回答