Exemplo n.º 1
0
 /**
  * Remove the currently display gui and insert the given one.
  *
  * @param comp The new gui.
  */
 private void addToContents(JComponent comp) {
   handlerHolder.removeAll();
   comp.setPreferredSize(new Dimension(200, 300));
   handlerHolder.add(comp, BorderLayout.CENTER);
   if (myContents != null) {
     myContents.invalidate();
     myContents.validate();
     myContents.repaint();
   }
 }
Exemplo n.º 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;
  }