PDA

View Full Version : Problem on RpcProxy with TreePanel



eudoxem
3 Aug 2010, 7:28 AM
Hi, I'm having an error which I don't understand. I have a form on which I have a fieldset. In my fieldset, there is a DualListField. On the To listfield I add a double click listener which displays a window. This window (visibilityWindow) have many content panel where each panel is supposed to contain a checkable TreePanel.

My problem is that when I double click my window appears but my TreePanel although containing many items just displays the first item. With my logs I see that my service implementation is not call in my proxy but after. I put a snippet to help you to understand my issue. May be I'm doing something wrong... Thanks for your help


private com.extjs.gxt.ui.client.widget.Window createVisibilityWindow(String name) {

System.out.println("Debut dans createVisibilityWindow");

com.extjs.gxt.ui.client.widget.Window visibilityWindow = new com.extjs.gxt.ui.client.widget.Window();
visibilityWindow.setMaximizable(true);
visibilityWindow.setHeading(constants.visibility() + " on " + name);
visibilityWindow.setWidth(200);
visibilityWindow.setHeight(350);
visibilityWindow.setLayout(new AccordionLayout());

// Onglet Transports
ContentPanel cp = new ContentPanel();
cp.setAnimCollapse(false);
cp.setHeading(constants.transport());

TreeLoader<TransportView> loader;
TreePanel<TransportView> tree;

// data proxy
RpcProxy<List<TransportView>> proxy = new RpcProxy<List<TransportView>>() {
@Override
protected void load(Object loadConfig, AsyncCallback<List<TransportView>> callback) {
userService.getFleetTransports(1, callback);
}
};

// tree loader
loader = new BaseTreeLoader<TransportView>(proxy);

// trees store
TreeStore<TransportView> store = new TreeStore<TransportView>(loader);

tree = new TreePanel<TransportView>(store);
tree.setStateful(true);
tree.setCheckable(true);
tree.setDisplayProperty("name");

cp.add(tree);
visibilityWindow.add(cp);
return visibilityWindow;
}

At runtime, I get the exception java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String which I don't understand (MyService, MyServiceAsync and MyServiceImpl are expecting an Integer and I pass to the method 1 (or new Integer(1)) which is an integer.

sven
3 Aug 2010, 7:36 AM
It is hard to guess without having a fully working testcase. Have you tried to reproduce the problem in a small standalone testcase that implements EntryPoint?

eudoxem
4 Aug 2010, 12:53 AM
Yes I've tried but it doesn't work

sven
4 Aug 2010, 1:12 AM
Than you should try to post this example here

eudoxem
4 Aug 2010, 5:18 AM
Finally I realize that I don't have to use a TreePanel but just a grid with a checkable column. I was wrong by choosing that component which doesn't fit my needs. Thanks