/** Display the forwards window history in a menu. */
  private void onShowForwardHistory() {

    UIScrollableMenu hist =
        new UIScrollableMenu(
            LanguageProperties.getString(
                LanguageProperties.TOOLBARS_BUNDLE, "UIToolBarMain.forwardHistory"),
            0); //$NON-NLS-1$

    Vector views = history.getForwardHistory();
    int currentIndex = history.getCurrentPosition();

    int count = views.size();
    if (count == 0) return;

    JMenuItem item = null;
    for (int i = 0; i < count; i++) {
      View view = (View) views.elementAt(i);
      item = new JMenuItem(view.getLabel());

      final View fview = view;
      final int fi = (currentIndex + 1) + i;
      item.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent event) {
              if (history.goToHistoryItem(fi)) oParent.addViewToDesktop(fview, fview.getLabel());
            }
          });

      hist.add(item);
    }

    JPopupMenu pop = hist.getPopupMenu();
    pop.pack();

    Point loc = pbShowForwardHistory.getLocation();
    Dimension size = pbShowForwardHistory.getSize();
    Dimension popsize = hist.getPreferredSize();
    Point finalP = SwingUtilities.convertPoint(tbrToolBar.getParent(), loc, oParent.getDesktop());

    int x = 0;
    int y = 0;
    if (oManager.getLeftToolBarController().containsBar(tbrToolBar)) {
      x = finalP.x + size.width;
      y = finalP.y;
    } else if (oManager.getRightToolBarController().containsBar(tbrToolBar)) {
      x = finalP.x - popsize.width;
      y = finalP.y;
    } else if (oManager.getTopToolBarController().containsBar(tbrToolBar)) {
      x = finalP.x;
      y = finalP.y + size.width;
    } else if (oManager.getBottomToolBarController().containsBar(tbrToolBar)) {
      x = finalP.x;
      y = finalP.y - popsize.height;
    }

    hist.setPopupMenuVisible(true);
    pop.show(oParent.getDesktop(), x, y);
  }
  /** Move forward one item in the window history, if possible, and open the view. */
  private void onForward() {

    View view = history.goForward();
    if (view != null) oParent.addViewToDesktop(view, view.getLabel());

    enableHistoryButtons();
  }
  /**
   * Handles toolbar action event for this toolbar.
   *
   * @param evt the genereated action event to be handled.
   */
  public void actionPerformed(ActionEvent evt) {

    oParent.setWaitCursor();

    Object source = evt.getSource();

    if (source.equals(pbOpen)) {
      oParent.onFileOpen();
    } else if (source.equals(pbClose)) {
      oParent.onFileClose();
    } else if (source.equals(pbDelete)) {
      oParent.onEditDelete();
    } else if (source.equals(pbCut)) {
      oParent.onEditCut();
    } else if (source.equals(pbCopy)) {
      oParent.onEditCopy();
    } else if (source.equals(pbPaste)) {
      oParent.onEditPaste();
    } else if (source.equals(pbUndo)) {
      oParent.onEditUndo();
    } else if (source.equals(pbRedo)) {
      oParent.onEditRedo();
    } else if (source.equals(pbBack)) {
      onBack();
    } else if (source.equals(pbShowBackHistory)) {
      onShowBackHistory();
    } else if (source.equals(pbShowForwardHistory)) {
      onShowForwardHistory();
    } else if (source.equals(pbForward)) {
      onForward();
    } else if (source.equals(pbSearch)) {
      oParent.onSearch();
    } else if (source.equals(pbImageRollover)) {
      oParent.onImageRollover(!FormatProperties.imageRollover);
    }

    oParent.setDefaultCursor();
  }