use of annis.gui.components.OnLoadCallbackExtension in project ANNIS by korpling.
the class ResultViewPanel method addQueryResult.
private void addQueryResult(PagedResultQuery q, List<SaltProject> subgraphList) {
if (q == null) {
return;
}
List<SingleResultPanel> newPanels = new LinkedList<>();
try {
if (subgraphList == null || subgraphList.isEmpty()) {
Notification.show("Could not get subgraphs", Notification.Type.TRAY_NOTIFICATION);
} else {
for (SaltProject p : subgraphList) {
updateVariables(p);
newPanels = createPanels(p, currentResults, q.getOffset() + currentResults);
currentResults += newPanels.size();
String strResults = numberOfResults > 1 ? "results" : "result";
sui.getSearchView().getControlPanel().getQueryPanel().setStatus(sui.getSearchView().getControlPanel().getQueryPanel().getLastPublicStatus(), " (showing " + currentResults + "/" + numberOfResults + " " + strResults + ")");
if (currentResults == numberOfResults) {
resetQueryResultQueue();
}
for (SingleResultPanel panel : newPanels) {
resultPanelList.add(panel);
resultLayout.addComponent(panel);
panel.setSegmentationLayer(sui.getQueryState().getVisibleBaseText().getValue());
}
}
if (currentResults == numberOfResults) {
showFinishedSubgraphSearch();
if (!initialQuery.getSelectedMatches().isEmpty()) {
// scroll to the first selected match
JavaScript.eval("$(\".v-panel-content-result-view-panel\").animate({scrollTop: $(\".selected-match\").offset().top - $(\".result-view-panel\").offset().top}, 1000);");
}
}
if (projectQueue != null && !newPanels.isEmpty() && currentResults < numberOfResults) {
log.debug("adding callback for result " + currentResults);
// add a callback so we can load the next single result
OnLoadCallbackExtension ext = new OnLoadCallbackExtension(this, 250);
ext.extend(newPanels.get(newPanels.size() - 1));
}
}
} catch (Throwable ex) {
log.error(null, ex);
}
}
Aggregations