/**
   * Reset as navigator.
   *
   * @param overridingProperties the overriding properties
   */
  void resetAsNavigator(Properties overridingProperties) {
    // Invoke in GUI thread
    if (this.launched) {
      return;
    }
    this.launched = true;
    if (this.progressWindow != null) {
      if (!progressWindow.isDisplayable()) {
        if (logger.isLoggable(Level.INFO)) {
          logger.info(
              "resetAsNavigator(): Progress window is not displayable, so it must have been closed; cancelling operation.");
        }
        this.browserWindow.dispose();
        return;
      }
      this.progressWindow.dispose();
    }
    AbstractBrowserWindow window = this.browserWindow;
    if (!window.isVisible()) {
      window.setVisible(true);
    }
    window.toFront();

    // Come up with combination properties object
    if (overridingProperties != null) {
      Properties original = this.requestedProperties;
      if (original == null) {
        original = new Properties();
      }
      original.putAll(overridingProperties);
      WindowFactory wf = windowFactory;
      if (wf == null) {
        throw new IllegalStateException("Global WindowFactory is null.");
      }
      wf.overrideProperties(window, original);
    }

    // Initialize title
    if (window instanceof Frame) {
      NavigationEntry currentEntry = this.getCurrentNavigationEntry();
      if (currentEntry != null) {
        String title = currentEntry.getTitle();
        if (title == null) {
          title = Urls.getNoRefForm(currentEntry.getUrl());
        }
        ((Frame) window).setTitle(title);
      }
    }
    // Make visible and bring to front
    if (!window.isVisible()) {
      window.setVisible(true);
    }
    window.toFront();
  }
Пример #2
0
 /** Populate forward more. */
 public void populateForwardMore() {
   NavigationEntry[] entries = this.window.getForwardNavigationEntries();
   JMenu forwardMoreMenu = this.forwardMoreMenu;
   forwardMoreMenu.removeAll();
   for (NavigationEntry entry : entries) {
     String method = entry.getMethod();
     if ("GET".equals(method)) {
       String title = entry.getTitle();
       URL url = entry.getUrl();
       String text = (title == null) || (title.length() == 0) ? url.toExternalForm() : title;
       Action action = this.actionPool.createGoToAction(entry);
       JMenuItem menuItem = menuItem(text, action);
       menuItem.setToolTipText(url.toExternalForm());
       forwardMoreMenu.add(menuItem);
     }
   }
 }