Example #1
0
 /** Reload the current xml and update the display. */
 public void doUpdateInner() {
   String selected = urlBox.getSelectedItem().toString().trim();
   // Only save off the list on a successful load
   if (selected.length() == 0) {
     if (handlers.size() > 0) {
       goBack();
     } else {
       makeBlankTree();
     }
     return;
   }
   if (makeUiFromPath(selected)) {
     urlListHandler.saveState(urlBox);
   }
 }
Example #2
0
  /**
   * Create and return the Gui contents.
   *
   * @return The gui contents.
   */
  protected JComponent doMakeContents() {
    //        dataSelector = new DataSelector(getIdv(), new Dimension(400, 200),
    //                                        true);

    // Get the list of catalogs but remove the old catalog.xml entry
    urlListHandler = getPreferenceList(PREF_CATALOGLIST);
    final XmlChooser xmlChooser = this;
    ActionListener catListListener =
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            if (!okToDoUrlListEvents) {
              return;
            }
            xmlChooser.actionPerformed(ae);
          }
        };
    urlBox = urlListHandler.createComboBox(GuiUtils.CMD_UPDATE, catListListener, true);

    GuiUtils.setPreferredWidth(urlBox, 200);

    // top panel
    JButton browseButton = new JButton("Select File...");
    browseButton.setToolTipText("Choose a catalog from disk");
    browseButton.setActionCommand(CMD_BROWSE);
    browseButton.addActionListener(this);

    GuiUtils.setHFill();
    JPanel catListPanel =
        GuiUtils.doLayout(new Component[] {urlBox}, 1, GuiUtils.WT_Y, GuiUtils.WT_N);

    backBtn =
        GuiUtils.getImageButton(GuiUtils.getImageIcon("/auxdata/ui/icons/Left16.gif", getClass()));
    backBtn.setToolTipText("View previous selection");
    GuiUtils.makeMouseOverBorder(backBtn);
    backBtn.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            goBack();
          }
        });

    fwdBtn =
        GuiUtils.getImageButton(GuiUtils.getImageIcon("/auxdata/ui/icons/Right16.gif", getClass()));
    GuiUtils.makeMouseOverBorder(fwdBtn);
    fwdBtn.setToolTipText("View next selection");
    fwdBtn.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            goForward();
          }
        });

    checkButtons();
    JComponent bottomButtons = getDefaultButtons();
    handlerHolder = new JPanel();
    handlerHolder.setLayout(new BorderLayout());
    //        JPanel tmp = new JPanel();
    //        tmp.setPreferredSize(new Dimension(200,500));
    //        handlerHolder.add(tmp, BorderLayout.CENTER);

    if (getIdv().getArgsManager().getInitCatalogs().size() > 0) {
      initialUrlPath = (String) getIdv().getArgsManager().getInitCatalogs().get(0);
      urlBox.setSelectedItem(initialUrlPath);
    } else {
      if ((initialUrlPath != null) && (initialUrlPath.length() > 0)) {
        makeUiFromPath(initialUrlPath);
      } else {
        makeBlankTree();
      }
    }
    JPanel navButtons = GuiUtils.hbox(backBtn, fwdBtn);

    GuiUtils.tmpInsets = GRID_INSETS;
    JPanel catPanel =
        GuiUtils.doLayout(
            new Component[] {new JLabel("Catalogs:"), catListPanel, browseButton},
            3,
            GuiUtils.WT_NYN,
            GuiUtils.WT_N);
    JPanel topPanel = GuiUtils.leftCenter(navButtons, catPanel);
    myContents = GuiUtils.topCenterBottom(topPanel, handlerHolder, bottomButtons);
    //        myContents = GuiUtils.topCenter(getStatusComponent(), myContents);
    return myContents;
  }