PDA

View Full Version : GWT Compiler generating null.nullMethod with BeanModel Grid



cesarulo
19 Oct 2009, 2:55 PM
Hey there everyone,

I'm back to ExtJS after a long leave. I'm excited to see where this vibrant community has come in the last two years. Seems like the product is just getting better and better. Congrats everyone.

I have been trying GWT. It's been pretty difficult to get it to work, and I still can't quite get Seam to work well in hosted mode, but hey - life can't be perfect, can it?

Since GWT widgetry is extremely basic, I've decided to try GXT. It's amazing... if it only worked. Here is my problem, and I think it might have to do with a GWT compiler bug. Can anyone help? Here it goes...

I am using Eclipse Galileo, maven, Seam, Hibernate, and of course... GWT with Ext. If you want to see my pom or something else, please let me know. Here is the code of the class that is generating the broken code:



package com.resiliencesw.tres.admin.client;

import java.util.ArrayList;
import java.util.List;

import com.extjs.gxt.ui.client.data.BaseListLoader;
import com.extjs.gxt.ui.client.data.BeanModel;
import com.extjs.gxt.ui.client.data.BeanModelFactory;
import com.extjs.gxt.ui.client.data.BeanModelLookup;
import com.extjs.gxt.ui.client.data.BeanModelReader;
import com.extjs.gxt.ui.client.data.ListLoadResult;
import com.extjs.gxt.ui.client.data.ListLoader;
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.data.RpcProxy;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.grid.Grid;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
import com.resiliencesw.tres.admin.client.dto.DisciplineDTO;

public class DisciplinesGrid extends LayoutContainer {

private BeanModelFactory disciplineFactory = BeanModelLookup.get().getFactory(DisciplineDTO.class);

protected void onRender(Element parent, int index) {
super.onRender(parent, index);
setStyleAttribute("padding", "20px");

// gwt service
final GWTDisciplineServiceAsync disciplineService = getDisciplineService();

// proxy and reader
RpcProxy<List<BeanModel>> proxy = new RpcProxy<List<BeanModel>>() {
public void load(Object loadConfig, final AsyncCallback<List<BeanModel>> callback) {
disciplineService.getAllDisciplines(new AsyncCallback<List<DisciplineDTO>>() {
@Override
public void onFailure(Throwable e) {
callback.onFailure(e);
}

@Override
public void onSuccess(List<DisciplineDTO> data) {
callback.onSuccess(disciplineFactory.createModel(data));
}
});
}
};
BeanModelReader reader = new BeanModelReader();

// loader and store
ListLoader<ListLoadResult<ModelData>> loader = new BaseListLoader<ListLoadResult<ModelData>>(proxy, reader);
ListStore<BeanModel> store = new ListStore<BeanModel>(loader);

loader.load();

// column model
List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
columns.add(new ColumnConfig("name", "Name", 200));
columns.add(new ColumnConfig("description", "Description", 100));
ColumnModel cm = new ColumnModel(columns);

Grid<BeanModel> grid = new Grid<BeanModel>(store, cm);
grid.setAutoExpandColumn("name");

ContentPanel panel = new ContentPanel();
panel.setHeading("BeanModel Grid Example");
panel.setSize(400, 200);
panel.setLayout(new FitLayout());
panel.add(grid);
add(panel);
panel.layout();
}

private GWTDisciplineServiceAsync getDisciplineService() {
String endpointURL = GWT.getModuleBaseURL() + "seam/resource/gwt";
GWTDisciplineServiceAsync svc = (GWTDisciplineServiceAsync) GWT.create(GWTDisciplineService.class);
((ServiceDefTarget) svc).setServiceEntryPoint(endpointURL);
return svc;
}

}


The problem: this compiles and generates a workable WAR, but the generated Javascript contains the following code:



function com_resiliencesw_tres_admin_client_DisciplinesGrid$1$1_$onSuccess__Lcom_resiliencesw_tres_admin_client_DisciplinesGrid$1$1_2Ljava_util_List_2(this$static, data){
22339 $wnd.alert($intern_860 + data.size__() + $intern_861);
22340 $wnd.alert($intern_862 + java_lang_Object_$toString__Ljava_lang_Object_2(this$static.com_resiliencesw_tres_admin_client_DisciplinesGrid$1$1_val$callback));
22341 com_extjs_gxt_ui_client_data_RpcProxy$1_$onSuccess__Lcom_extjs_gxt_ui_client_data_RpcProxy$1_2Ljava_lang_Object_2(this$static.com_resiliencesw_tres_admin_client_DisciplinesGrid$1$1_val$callback, null.nullMethod());
22342}
22343


Huh? null.nullMethod? I've googled for it, and found very little short of Jira tickets from the Google guys reporting on compiler bugs that arose in situations very different form mine and that were reported fixed a long time ago... any help? Does anyone have any idea what this could be? Thank you all very much in advance...

CESAR