Ejemplo n.º 1
0
  /**
   * submit
   *
   * @param a
   * @param b
   * @return boolean
   */
  public boolean submit(String a, String b) {
    int selected[];
    int i;
    StringBuffer extra = new StringBuffer();

    waitCursor();

    for (int j = 0; j < nSection; j++) {
      selected = lk[j].getSelectedIndices();
      for (i = 0; i < selected.length; i++)
        CDSMethods.append(
            extra,
            (String) vq.getNameKey().elementAt(j),
            (String) lk[j].getModel().getElementAt(selected[i]));
    }

    boolean res =
        vq.submit(
            a,
            b,
            (String) unit.getSelectedItem(),
            (String) coordinate.getSelectedItem(),
            tauthor.getText(),
            extra.toString(),
            outputMode,
            resList.getList());
    defaultCursor();
    return res;
  }
Ejemplo n.º 2
0
  /**
   * Returns Missions or Surveys
   *
   * @param type MISSION or SURVEY
   * @return a strings table
   */
  public String[] getSelection(String type) {

    try {
      // type MISSION
      if (type.compareTo("MISSION") == 0) {
        String[] temp = new String[vq.getvArchives().size()];

        for (int i = 0; i < vq.getvArchives().size(); i++) {
          temp[i] = new String((String) vq.getvArchives().elementAt(i));
        }
        return temp;
      } else // type SURVEY
      if (type.compareTo("SURVEY") == 0) {
        String[] temp = new String[vq.getvSurveys().size()];

        for (int i = 0; i < vq.getvSurveys().size(); i++) {
          temp[i] = new String((String) vq.getvSurveys().elementAt(i));
        }
        return temp;
      }
    } catch (ArrayIndexOutOfBoundsException e) {
      System.out.println(e);
    }
    return null;
  }
Ejemplo n.º 3
0
  /**
   * Constructor
   *
   * @param glu
   * @param outputMode
   * @param withparam
   * @param target
   * @param radius
   * @param rows
   */
  public VizieRPanel(
      Glu glu, int outputMode, boolean withparam, String target, String radius, int rows) {
    try {
      this.aladin = glu.aladin; // pas très beau tout ça !
      createChaine();
      this.outputMode = outputMode;

      //
      vq = new VizieRQuery();
      vq.setGLU(glu);

      // VizieR call for meta information
      if (vq.metaDataQuery() == false || vq.getNameKey().size() == 0) {
        System.err.println(
            "VizieR meta query error " + (vq.getMetaError() == null ? "" : vq.getMetaError()));
      }

      nSection = vq.getNameKey().size();
      this.setLayout(borderLayout1);
      makeForm(withparam, target, radius, rows);
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Ejemplo n.º 4
0
 /**
  * Return the Catalogs data input stream
  *
  * @return xml stream
  */
 public MyInputStream getResultStream() {
   return vq.getResultStream();
 }
Ejemplo n.º 5
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);
  }