开发者

Really strange GWT RPC behavior + display

So essentially this project builds a portal of testing results from various test types. The fetching and display of results is fine; however, the resulting tables are not being displayed in the correct order. The order they're displayed in is random, but it's clearly specified the order in which the RPC calls are dispatched and I even implemented an indexing system in my panel to further assist.

Basically, the application consists of three horizontal panels contained within a verticalpanel.

further explanation: new, mid, and old refer to three versions of the software product being tested. A TestTable is just a custom FlexTable, and each of the xxxPanels are HorizontalPanels. The indices are all initiali开发者_开发技巧zed at zero outside of the onModuleLoad() method. Each panel has its own service tasked with dispatching RPC calls to populate the corresponding panel.

public void onSuccess(List<TestResult> result) {

TestTable testTable1 = new TestTable(result);

if(result.get(0).getVrmf().equals(newestVersion)){
 newPanels.insert(testTable1, newIndex + 1); //insert adds element BEFORE specified index, so +1
 newPanels.addStyleName("horizontalPanelStyle");
 newIndex++;
}

if(result.get(0).getVrmf().equals(middleVersion)){
 midPanels.insert(testTable1, midIndex + 1); //insert adds element BEFORE specified index, so +1
 midPanels.addStyleName("horizontalPanelStyle");
 midIndex++;
}

if(result.get(0).getVrmf().equals(oldVersion)){
 oldPanels.insert(testTable1, oldIndex + 1); //insert adds element BEFORE specified index, so +1
 oldPanels.addStyleName("horizontalPanelStyle");
 oldIndex++;
}

}

};

and here is how my calls are dispatched:

if(testPortalSvcNew != null){

testPortalSvcNew.getTestResults(5, newestVersion, TestType.SMOKE, callback); testPortalSvcNew.getTestResults(5, newestVersion, TestType.BVTUNIX, callback); testPortalSvcNew.getTestResults(5, newestVersion, TestType.BVTWINDOWS, callback); }

Every refresh generates a potentially different horizontal display order of test types. Versions are grouped properly and separated vertically, but their horizontal ordering is screwy. I'm stumped!


So you're expecting the tests to come back in the order SMOKE, BVTUNIX then BVTWINDOWS?

If so, you're going to need to chain async calls or group them into one ajax call that returns all of them at once. Asynchronous calls are just that. There's no guarantee of return order.


You could try creating a new TestTable instance for each panel. Now you are adding the same instance to all three panels. I am not sure if this helps but this sometimes may cause strange behaviour in GWT so it is worth a try.

However I agree with @j flemm that you can never be sure in what order your asynchronous services will be executed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜