use of org.olat.search.model.ResultDocument in project openolat by klemens.
the class ResultsController method updateUI.
private void updateUI(UserRequest ureq) {
removeResultsController();
int start = currentPage * RESULT_PER_PAGE;
SearchServiceUIFactory searchUIFactory = (SearchServiceUIFactory) CoreSpringFactory.getBean(SearchServiceUIFactory.class);
int count = 0;
for (int i = start; (count < RESULT_PER_PAGE) && (i < documents.size()); i++) {
ResultDocument document = documents.get(i);
ResultController ctrl = searchUIFactory.createController(ureq, getWindowControl(), mainForm, document);
ctrl.setHighlight(highlight);
listenTo(ctrl);
flc.add("result_" + (++count), ctrl.getInitialFormItem());
resultsCtrl.add(ctrl);
}
flc.contextPut("numOfPages", getMaxPage() + 1);
flc.contextPut("numOfResults", getNumOfResults());
flc.contextPut("results", resultsCtrl);
flc.contextPut("hasResult", searchResults != null);
flc.contextPut("emptyResult", documents.isEmpty());
flc.contextPut("searchResults", searchResults);
flc.contextPut("currentPage", currentPage + 1);
previousLink.setEnabled(currentPage != 0);
nextLink.setEnabled(currentPage != getMaxPage());
String[] args = { Integer.toString(getStartResult()), Integer.toString(getEndResult()), Integer.toString(getNumOfResults()) };
flc.contextPut("resultTitle", getTranslator().translate("search.result.title", args));
}
use of org.olat.search.model.ResultDocument in project openolat by klemens.
the class SearchInputController method event.
@Override
public void event(UserRequest ureq, Controller source, Event event) {
if (source == resultCtlr) {
if (event instanceof SearchEvent) {
SearchEvent goEvent = (SearchEvent) event;
ResultDocument doc = goEvent.getDocument();
gotoSearchResult(ureq, doc);
} else if (event == Event.DONE_EVENT) {
setSearchString(resultCtlr.getSearchString());
}
} else if (source == searchDialogBox) {
cleanUp();
fireEvent(ureq, Event.DONE_EVENT);
}
}
Aggregations