private void updateSearchControls() {
    // setup search controls
    if (currentSource != null && currentSource.isSearchable()) {

      panel.updateCurrentMatchDisplay(currentSource.currentItem());
      panel.updateTotaMatcheslDisplay(currentSource.getNumberHits());

      if (currentSource.hasNextItem() || currentSource.hasNextPage()) {
        panel.enableNextMatchControl(true);
      } else {
        panel.enableNextMatchControl(false);
      }

      if (currentSource.hasPreviousItem() || currentSource.hasPreviousPage()) {
        panel.enablePrevMatchControl(true);
      } else {
        panel.enablePrevMatchControl(false);
      }

    } else {
      panel.enableNextMatchControl(false);
      panel.enablePrevMatchControl(false);
      panel.updateCurrentMatchDisplay(0);
      panel.updateTotaMatcheslDisplay(0);
    }
  }
    @Override
    public void actionPerformed(ActionEvent e) {
      MarkupSource source = panel.getSelectedSource();
      final boolean hasPreviousItem = source.hasPreviousItem();
      final boolean hasPreviousPage = source.hasPreviousPage();
      int indexVal = 0;
      if (hasPreviousItem || hasPreviousPage) {
        if (!hasPreviousItem) {
          // flip the page
          previousPage();
          indexVal = source.currentItem();
        } else {
          indexVal = source.previousItem();
        }

        // scroll
        panel.scrollToAnchor(source.getAnchorPrefix() + Integer.toString(indexVal));

        // update display
        panel.updateCurrentMatchDisplay(source.currentItem());
        panel.updateTotaMatcheslDisplay(source.getNumberHits());

        // update controls if needed
        if (!source.hasPreviousItem() && !source.hasPreviousPage()) {
          panel.enablePrevMatchControl(false);
        }
        if (source.hasNextItem() || source.hasNextPage()) {
          panel.enableNextMatchControl(true);
        }
      }
    }