Skip to content
This repository has been archived by the owner on Mar 15, 2022. It is now read-only.

Commit

Permalink
[HAL865] - Refresh button on webservices runtime view does not refres…
Browse files Browse the repository at this point in the history
…h statistics
  • Loading branch information
dpospisil committed Sep 30, 2015
1 parent efe831c commit 9d3e556
Showing 1 changed file with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public class WebServiceRuntimeView extends SuspendableViewImpl implements WebSer
private Sampler sampler;
private Column[] columns;
private WebServiceRuntimePresenter presenter;
private SingleSelectionModel<WebServiceEndpoint> selectionModel;

@Override
public void setPresenter(WebServiceRuntimePresenter presenter) {
Expand Down Expand Up @@ -115,20 +116,15 @@ public int compare(WebServiceEndpoint o1, WebServiceEndpoint o2) {
table.addColumnSortHandler(sortHandler);
table.getColumnSortList().push(nameCol); // initial sort is on name

final SingleSelectionModel<WebServiceEndpoint> selectionModel = new SingleSelectionModel(keyProvider);
selectionModel = new SingleSelectionModel(keyProvider);
table.setSelectionModel(selectionModel);

selectionModel.addSelectionChangeHandler(new SelectionChangeEvent.Handler() {
@Override
public void onSelectionChange(SelectionChangeEvent event) {

final WebServiceEndpoint selection = selectionModel.getSelectedObject();
sampler.addSample(
new Metric(
selection.getRequestCount(),
selection.getResponseCount(),
selection.getFaultCount()
));
addSample(selection);
}
});
DefaultPager pager = new DefaultPager();
Expand Down Expand Up @@ -215,5 +211,19 @@ public void updateEndpoints(List<WebServiceEndpoint> endpoints) {
ColumnSortEvent.fire(table, table.getColumnSortList());

table.selectDefaultEntity();
SingleSelectionModel<WebServiceEndpoint> selectionModel =
(SingleSelectionModel<WebServiceEndpoint>) table.getSelectionModel();
WebServiceEndpoint selection = selectionModel.getSelectedObject();
addSample(selection);
}

private void addSample(WebServiceEndpoint endpoint) {
if (endpoint != null) {
sampler.addSample(new Metric(
endpoint.getRequestCount(),
endpoint.getResponseCount(),
endpoint.getFaultCount()));
}
}

}

0 comments on commit 9d3e556

Please sign in to comment.