Пример #1
0
 /**
  * Form title modification depending on the presence of a target
  *
  * @param target the string containing the target, ou <I>null</I> if nothing
  */
 protected void setTitre(String target) {
   String s = null;
   s =
       (target == null)
           ? DEFAULT_TITRE
           : "Click directly on the SUBMIT button to retrieve all VizieR catalogs around "
               + target
               + "\n"
               + " or include constraints below to reduce the number of matching catalogs.";
   if (s != null) titre.setText(s);
   else titre.setText("probleme");
 }
Пример #2
0
 /**
  * Set label
  *
  * @param label
  */
 public void setLabel(String label) {
   titre.setText(label);
 }
Пример #3
0
  /**
   * Manage the associated panels design
   *
   * @param withparam
   * @param target
   * @param radius
   * @param rows
   */
  protected void makeForm(boolean withparam, String target, String radius, int rows) {
    JPanel byword = null; // keyword panel
    JPanel fields = null; // fields panel
    JPanel parameters = null; // parameters panel
    JPanel lll = null; // 3 lists panel
    JPanel actions = null; // action panel
    int i;

    GridBagConstraints c = new GridBagConstraints();

    // Form title setting
    titre = new MyLabel(DEFAULT_TITRE, Label.CENTER, PLAIN);
    titre.setBackground(Aladin.BLUE);
    fields = new JPanel();
    fields.setLayout(new BorderLayout(3, 3));

    byword = new JPanel();
    byword.setBackground(Aladin.BLUE);
    byword.setLayout(new BorderLayout(3, 3));
    byword.setFont(BOLD);

    // Construction
    // title panel and keyword query panel
    JPanel haut = new JPanel();
    haut.setBackground(Aladin.BLUE);
    haut.setLayout(new BorderLayout(3, 3));

    // Free keyword interrogation panel (author...)
    makeAdd(byword, new JLabel(KEYWORD), "West");
    makeAdd(byword, tauthor, "Center");

    // Window components are depending on
    if ((target == null && radius == null)) {

      // Target panel construction
      parameters = new JPanel();
      GridBagLayout gridbag = new GridBagLayout();

      parameters.setLayout(gridbag);
      parameters.setFont(BOLD);

      JLabel label = new JLabel("Target ");
      c = new GridBagConstraints();
      c.gridx = 0;
      c.gridy = 0;
      c.gridwidth = 2;
      c.weightx = 1;
      c.weighty = 0.1;
      c.anchor = GridBagConstraints.SOUTH;
      c.insets = new Insets(5, 5, 5, 5);
      gridbag.setConstraints(label, c);
      parameters.add(label);

      // Target field
      c = new GridBagConstraints();
      c.gridx = 2;
      c.gridy = 0;
      c.gridwidth = 4;
      c.weightx = 1;
      c.weighty = 0.1;
      c.ipadx = 50;
      c.fill = GridBagConstraints.HORIZONTAL;
      c.insets = new Insets(5, 5, 5, 5);
      gridbag.setConstraints(ttarget, c);
      parameters.add(ttarget);

      // Create and fill coordinate popup
      coordinate = new JComboBox();
      coordinate.addItem("today");
      coordinate.addItem("J2000");
      coordinate.addItem("B1975");
      coordinate.addItem("B1950");
      coordinate.addItem("B1900");
      coordinate.addItem("B1875");
      coordinate.addItem("B1855");
      coordinate.addItem("Galactic");
      coordinate.addItem("Supergal.");
      coordinate.setSelectedItem("J2000");

      // Coordinate field
      c = new GridBagConstraints();
      c.gridx = 6;
      c.gridy = 0;
      c.gridwidth = 2;
      c.weightx = 1;
      c.weighty = 0.1;
      c.insets = new Insets(5, 5, 5, 5);
      gridbag.setConstraints(coordinate, c);
      parameters.add(coordinate);

      // Radius label
      label = new JLabel("Radius ");
      c = new GridBagConstraints();
      c.gridx = 8;
      c.gridy = 0;
      c.gridwidth = 2;
      c.weightx = 1;
      c.weighty = 0.1;
      c.anchor = GridBagConstraints.SOUTH;
      c.insets = new Insets(5, 5, 5, 5);
      gridbag.setConstraints(label, c);
      parameters.add(label);

      // Radius field
      c = new GridBagConstraints();
      c.gridx = 10;
      c.gridy = 0;
      c.gridwidth = 1;
      c.weightx = 0.1;
      c.weighty = 0.1;
      c.insets = new Insets(5, 5, 5, 5);
      gridbag.setConstraints(tradius, c);
      parameters.add(tradius);
      tradius.setText("10.0"); // default value

      // Radius panel construction
      unit = new JComboBox();
      unit.addItem("deg");
      unit.addItem(ARCMIN);
      unit.addItem(ARCSEC);

      // Set default unit to arcmin
      unit.setSelectedItem(ARCMIN);
      c = new GridBagConstraints();
      c.gridx = 11;
      c.gridy = 0;
      c.gridwidth = 2;
      c.weightx = 1;
      c.weighty = 0.1;
      c.insets = new Insets(5, 5, 5, 5);
      gridbag.setConstraints(unit, c);
      parameters.add(unit);
    } else {
      if (radius != null) tradius.setText(radius);
      if (target != null) ttarget.setText(target);
    }

    // Keywords section panel construction
    lll = new JPanel();

    GridBagLayout gridbag = new GridBagLayout();
    lll.setLayout(gridbag);
    lll.setFont(BOLD);
    lll.setBackground(Aladin.BLUE);
    c = new GridBagConstraints();

    lk = new JList[nSection];
    JLabel label = null;
    for (int j = 0; j < nSection; j++) {
      label = new JLabel();
      c = new GridBagConstraints();
      c.gridx = j;
      c.gridy = 0;
      c.gridwidth = 1;
      c.weightx = 0.1;
      c.weighty = 0.1;
      c.fill = GridBagConstraints.HORIZONTAL;
      c.anchor = GridBagConstraints.SOUTH;
      c.insets = new Insets(0, 0, 0, 0);
      gridbag.setConstraints(label, c);
      label.setText(getSectionName((String) vq.getNameKey().elementAt(j)));

      lll.add(label);

      Vector v = (Vector) vq.gethKey().get(vq.getNameKey().elementAt(j));
      if (rows < 0) lk[j] = new JList(v);
      else {
        lk[j] = new JList(v);
        lk[j].setVisibleRowCount(rows);
        lk[j].setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
      }
      //      Enumeration e = v.elements();
      //      while( e.hasMoreElements() )
      //        lk[j].addItem((String)e.nextElement());
      c = new GridBagConstraints();
      c.gridx = j;
      c.gridy = 1;
      c.gridwidth = 1;
      c.weightx = 1;
      c.weighty = 1;
      c.fill = GridBagConstraints.BOTH;
      c.insets = new Insets(0, 2, 0, 2);

      JScrollPane jp = new JScrollPane(lk[j]);
      gridbag.setConstraints(jp, c);
      lll.add(jp);
    }

    // Change to a GridBagLayout to have non equal lists

    // Action button panel construction
    actions = new JPanel();
    actions.setBackground(Aladin.BLUE);
    actions.setLayout(new FlowLayout(FlowLayout.RIGHT));
    actions.setFont(BOLD);

    makeAdd(haut, titre, "North");
    makeAdd(haut, byword, "Center");
    if ((target == null && radius == null) && withparam == true) makeAdd(haut, parameters, "South");

    // List and action panel
    JPanel bas = new JPanel();
    bas.setBackground(Aladin.BLUE);
    bas.setLayout(new BorderLayout(3, 3));
    makeAdd(bas, lll, "Center");
    makeAdd(bas, actions, "South");

    // Previous panels are added to the main frame
    makeAdd(this, haut, "North");
    makeAdd(this, bas, "Center");

    setTitre(this.target);
  }