use of org.adempiere.webui.util.DocumentSearch in project adempiere by adempiere.
the class TreeSearchPanel method onEvent.
/**
* @param event
* @see EventListener#onEvent(Event)
*/
public void onEvent(Event event) {
if (cmbSearch.equals(event.getTarget()) && ((event.getName().equals(Events.ON_CHANGE) || event.getName().equals(Events.ON_OK)))) {
String value = cmbSearch.getValue();
if (value != null && value.trim().length() > 0 && value.substring(0, 1).equals(PREFIX_DOCUMENT_SEARCH)) {
DocumentSearch search = new DocumentSearch();
if (search.openDocumentsByDocumentNo(value.substring(1)))
cmbSearch.setText(null);
return;
}
Object node = treeNodeItemMap.get(value);
Treeitem treeItem = null;
if (node == null) {
return;
} else if (node instanceof Treeitem) {
treeItem = (Treeitem) node;
} else {
DefaultTreeNode<?> sNode = (DefaultTreeNode<?>) node;
int[] path = tree.getModel().getPath(sNode);
treeItem = tree.renderItemByPath(path);
tree.setSelectedItem(treeItem);
}
if (treeItem != null) {
select(treeItem);
Clients.showBusy(Msg.getMsg(Env.getCtx(), "Loading"));
Events.echoEvent("onPostSelect", this, null);
}
}
}
Aggregations