/** * Set the history position to correspond to the new list box selection. * * @param event The change event. */ @EventHandler(value = "change", target = "@lstHistory") private void onChange$lstHistory(ChangeEvent event) { if (event.getValue() == Boolean.TRUE) { history.setPosition(lstHistory.getSelectedIndex()); } }
/** * Locates and selects a matching keyword as the user types in the quick find text box. * * @param event The input event. */ @EventHandler(value = "change", target = "@txtFind") private void onChange$txtFind(ChangeEvent event) { String find = event.getValue(String.class).toLowerCase(); if (StringUtils.isEmpty(find)) { return; } int match = -1; for (int i = 0; i < keywordList.size(); i++) { if (keywordList.get(i).toLowerCase().startsWith(find)) { match = i; break; } } if (match != lstKeywords.getSelectedIndex()) { Listitem item = match == -1 ? null : (Listitem) lstKeywords.getChildAt(match); lstKeywords.setSelectedItem(item); onSelect$lstKeywords(); } }
/** * Set the topic view when a topic selection is made. */ @EventHandler(value = "change", target = "@lstTopics") private void onSelect$lstTopics() { Listitem item = lstTopics.getSelectedItem(); Listitem keywordItem = lstKeywords.getSelectedItem(); if (item == null) { int i = keywordItem.hasAttribute("last") ? (Integer) keywordItem.getAttribute("last") : 0; item = (Listitem) lstTopics.getChildAt(i); lstTopics.setSelectedItem(item); } if (item != null) { keywordItem.setAttribute("last", lstTopics.getSelectedIndex()); setTopic((HelpTopic) item.getData()); } else { setTopic(null); } }