/** * Reloads data from new model, creates new search engine to search in new model if model contains * view with the same name */ private void reloadData(HelpModel model) { debug("reloadData using new model"); helpsearch = null; SearchView view = null; newHelpSet = model.getHelpSet(); SearchView oldView = (SearchView) searchnav.getNavigatorView(); String oldName = oldView.getName(); NavigatorView[] navViews = newHelpSet.getNavigatorViews(); for (int i = 0; i < navViews.length; i++) { if ((navViews[i].getName()).equals(oldName)) { NavigatorView tempView = navViews[i]; if (tempView instanceof SearchView) { view = (SearchView) tempView; break; } } } if (view == null) return; topNode.removeAllChildren(); searchnav.setSearchEngine(new MergingSearchEngine(view)); setCellRenderer(view, tree); // add all subhelpsets addSubHelpSets(newHelpSet); }
/** * Adds subhelpsets * * @param hs The HelpSet which subhelpsets will be added */ protected void addSubHelpSets(HelpSet hs) { for (Enumeration e = hs.getHelpSets(); e.hasMoreElements(); ) { HelpSet ehs = (HelpSet) e.nextElement(); // merge views NavigatorView[] views = ehs.getNavigatorViews(); for (int i = 0; i < views.length; i++) { if (searchnav.canMerge(views[i])) searchnav.merge(views[i]); } addSubHelpSets(ehs); } }