PDA

View Full Version : Updating TreePanel or ListView



sjzaluk
23 Oct 2009, 6:00 AM
I am seeing an issue when I update either my TreePanel or ListView (when I say I update I mean calling removeAll() on the store and then calling add() with new data). If I don't have a node selected on the TreePanel and I refresh things work great. If I select a node and then refresh, for some reason only the nodes above what I had selected are displayed. If I don't select anything after that and then just do another refresh all the data displays properly again. The same thing is happening in a ListView I have. In the onSuccess() method of the callback I call another service method, buildTree(), which does nothing more than a simple select on the database and builds my BaseTreeModel. Has anybody seen anything similar to this?

Service Calls (You can see me calling the buildTestCaseTree() method in the onSuccess() of addTestSuite()):


public class ServiceManager {

public static void buildTestCaseTree(final TreeStore<ModelData> testCaseTreeStore) {
final TestToolServiceAsync testToolServiceAsync = (TestToolServiceAsync) GWT.create(TestToolService.class);
ServiceDefTarget endpoint = (ServiceDefTarget) testToolServiceAsync;
String moduleBaseURL = GWT.getHostPageBaseURL() + "testToolService";

endpoint.setServiceEntryPoint(moduleBaseURL);
AsyncCallback<TestSuiteTreeNode> testToolServiceCallback = new AsyncCallback<TestSuiteTreeNode>() {

public void onSuccess(TestSuiteTreeNode result) {
testCaseTreeStore.removeAll();
testCaseTreeStore.add(result, true);
}

public void onFailure(Throwable caught) {
Info.display("Failure - load", caught.getMessage());
}
};

testToolServiceAsync.buildTestCasesTree(testToolServiceCallback);
}

public static void addTestSuite(final TreeStore<ModelData> testCaseTreeStore, String testSuiteName) {
final TestToolServiceAsync testToolServiceAsync = (TestToolServiceAsync) GWT.create(TestToolService.class);
ServiceDefTarget endpoint = (ServiceDefTarget) testToolServiceAsync;
String moduleBaseURL = GWT.getHostPageBaseURL() + "testToolService";

endpoint.setServiceEntryPoint(moduleBaseURL);
AsyncCallback<Void> testToolServiceCallback = new AsyncCallback<Void>() {

public void onSuccess(Void result) {
buildTestCaseTree(testCaseTreeStore);
}

public void onFailure(Throwable caught) {
Info.display("Failure - load", caught.getMessage());
}

};

testToolServiceAsync.addTestSuite(testSuiteName, testToolServiceCallback);
}
}