PDA

View Full Version : [2.0-M2] Weird DualListField behaviour



Rvanlaak
26 May 2009, 1:34 AM
I am using the example code from the DualListField from the explorer. The two stores are filled from a rpc call, but somehow it doesn't show all the results from the query. When I add some hard coded fields it also wents wrong:



...
private ListStore<QueueModel> leftQueueStore, rightQueueStore;
StaticServiceAsync asterSvc = GWT.create(StaticService.class);

...

public SettingsWindow() {

...

// Add the tabs
tabs.add(personalSettingsTab());
tabs.add(configSettingsTab());
tabs.add(queueSettingsTab());

...

public TabItem queueSettingsTab() {

TabItem queueTab = new TabItem();
queueTab.setStyleAttribute("padding", "10px");
queueTab.setText("Wachtrijen instellen");
queueTab.setLayout(new FormLayout());

final DualListField<QueueModel> lists = new DualListField<QueueModel>();
lists.setFieldLabel("Wachtrijen");

ListField<QueueModel> from = lists.getFromList();
from.setDisplayField("name");
leftQueueStore = new ListStore<QueueModel>();
leftQueueStore.setStoreSorter(new StoreSorter<QueueModel>());
from.setStore(leftQueueStore);

ListField<QueueModel> to = lists.getToList();
to.setDisplayField("name");
rightQueueStore = new ListStore<QueueModel>();
rightQueueStore.setStoreSorter(new StoreSorter<QueueModel>());
to.setStore(rightQueueStore);

queueTab.add(lists, new FormData("100%"));

fillList();

return queueTab;
}


private void fillList()
{

for (int i= 0; i < 5; i++)
{
QueueModel a = new QueueModel(i+"queue");
leftQueueStore.add(a);
}

/*/ Get the available queues
asterSvc.getQueues(new AsyncCallback<ArrayList<String>>() {
public void onFailure(Throwable caught) {
Info.display("Wachtrijen", "Kan wachtrijen niet ophalen");
}

public void onSuccess(ArrayList<String> result) {
for (String exten : result) {
System.out.println("test: " + exten);
QueueModel a = new QueueModel(exten);
System.out.println(a.get("name"));
}
}
});
*/


class QueueModel extends BeanModel implements Serializable {

private static final long serialVersionUID = 1L;

public QueueModel() {

}

public QueueModel(String name) {
set("name", name);
}

}

}
I commented out the RPC call, but it shows in wich way I try to add the fields. I can't figure out what is going wrong, because somehow I get a nullpointer exception..



[ERROR] Uncaught exception escaped
java.lang.NullPointerException: null
at com.extjs.gxt.ui.client.data.BeanModel.toString(BeanModel.java:72)
at com.extjs.gxt.ui.client.util.DefaultComparator.compare(DefaultComparator.java:31)
at com.extjs.gxt.ui.client.store.StoreSorter.compare(StoreSorter.java:51)
at com.extjs.gxt.ui.client.store.ListStore$3.compare(ListStore.java:389)
at com.extjs.gxt.ui.client.store.ListStore$3.compare(ListStore.java:1)
at java.util.Arrays.mergeSort(Unknown Source)
at java.util.Arrays.sort(Unknown Source)
at java.util.Collections.sort(Unknown Source)
at com.extjs.gxt.ui.client.store.ListStore.applySort(ListStore.java:387)
at com.extjs.gxt.ui.client.store.ListStore.insert(ListStore.java:415)
at com.extjs.gxt.ui.client.store.ListStore.insert(ListStore.java:263)
at com.extjs.gxt.ui.client.store.ListStore.insert(ListStore.java:276)
at com.extjs.gxt.ui.client.store.ListStore.add(ListStore.java:157)
at com.Indicia.dashboard.client.view.SettingsWindow.fillList(SettingsWindow.java:272)
at com.Indicia.dashboard.client.view.SettingsWindow.queueSettingsTab(SettingsWindow.java:259)
at com.Indicia.dashboard.client.view.SettingsWindow.<init>(SettingsWindow.java:54)
at com.Indicia.dashboard.client.view.DashboardToolbar.<init>(DashboardToolbar.java:168)
at com.Indicia.dashboard.client.view.DashboardViewport.buildEast(DashboardViewport.java:126)
at com.Indicia.dashboard.client.view.DashboardViewport.buildDashboard(DashboardViewport.java:74)
at com.Indicia.dashboard.client.IndiciaDashboard$1.onHide(IndiciaDashboard.java:22)
at com.extjs.gxt.ui.client.widget.Window.hide(Window.java:432)
at com.extjs.gxt.ui.client.widget.Window.hide(Window.java:413)
at com.Indicia.dashboard.client.view.LoginDialog$4$1.onSuccess(LoginDialog.java:136)
at com.Indicia.dashboard.client.view.LoginDialog$4$1.onSuccess(LoginDialog.java:1)
at com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:215)
at com.google.gwt.http.client.Request.fireOnResponseReceivedImpl(Request.java:264)
at com.google.gwt.http.client.Request.fireOnResponseReceivedAndCatch(Request.java:236)
at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:227)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.ie.IDispatchImpl.callMethod(IDispatchImpl.java:126)
at com.google.gwt.dev.shell.ie.IDispatchProxy.invoke(IDispatchProxy.java:155)
at com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke(IDispatchImpl.java:294)
at com.google.gwt.dev.shell.ie.IDispatchImpl.method6(IDispatchImpl.java:194)
at org.eclipse.swt.internal.ole.win32.COMObject.callback6(COMObject.java:117)
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1925)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2966)
at com.google.gwt.dev.SwtHostedModeBase.processEvents(SwtHostedModeBase.java:235)
at com.google.gwt.dev.HostedModeBase.pumpEventLoop(HostedModeBase.java:558)
at com.google.gwt.dev.HostedModeBase.run(HostedModeBase.java:405)
at com.google.gwt.dev.HostedMode.main(HostedMode.java:232)