private void search() { if (win.getHeight() < RESULT_HEIGHT) { win.setHeight(RESULT_HEIGHT); } win.show(); win.center(); results.search(searchInput.getText()); }
private void onSearchChange(final boolean filteredOnly) { final String filter = searchField.getText(); if (filter == null || filter.equals("")) { treeFilter.clear(); treeFilter.filterBy( new TreeTraversalCallback() { public boolean execute(TreeNode node) { node.setText(Format.stripTags(node.getText())); return true; } }); } else { treeFilter.filterBy( new TreeTraversalCallback() { public boolean execute(TreeNode node) { String text = Format.stripTags(node.getText()); node.setText(text); if (text.toLowerCase().indexOf(filter.toLowerCase()) != -1) { node.setText("<b>" + text + "</b>"); ((TreeNode) node.getParentNode()).expand(); return true; } else { final List childMatches = new ArrayList(); node.cascade( new NodeTraversalCallback() { public boolean execute(Node node) { String childText = ((TreeNode) node).getText(); if (childText.toLowerCase().indexOf(filter.toLowerCase()) != -1) { childMatches.add(new Object()); } return true; } }); return !filteredOnly || childMatches.size() != 0; } } }); } }