public void setDisplayedSearch(SearchResultsDataModel searchResultsDataModel) {
   if (displayedDataModel != searchResultsDataModel) {
     displayedDataModel = searchResultsDataModel;
     if (searchResultsDataModel != null) {
       Search search = searchResultsDataModel.getSearch();
       SearchButton btn = searchButtonMap.get(search);
       if (btn != null) { // button might not be available yet since its created delayed on
         // event thread.
         btn.setSelected(true);
       }
     } else {
       notSelectedButton.setSelected(true);
     }
   }
 }
  private void addSearch(Search search) {
    SearchButton btn = new SearchButton(search, searchTab);
    btn.addActionListener(buttonHandler);

    synchronized (accessLock) {
      searchButtonMap.put(search, btn);
      searchButtonGroup.add(btn);
      addButton(btn);
    }

    if (displayedDataModel != null
        && search == displayedDataModel.getSearch()) { // select the button of the displayed model
      btn.setSelected(true);
    }
  }
    public void actionPerformed(ActionEvent e) {
      try {
        SearchButton searchButton = ((SearchButton) e.getSource());

        searchButton.updateButtonDisplay();
        searchTab.refreshTabActions();
        Search search = searchButton.getSearch();
        if (search == null) {
          return;
        }
        SearchResultsDataModel dataModel = SearchResultsDataModel.lookupResultDataModel(search);
        searchTab.setDisplayedSearch(dataModel);
      } catch (Exception exp) { // catch all handler
        NLogger.error(ButtonHandler.class, exp, exp);
      }
    }