Package org.aavso.tools.vstar.ui.mediator

Examples of org.aavso.tools.vstar.ui.mediator.StarInfo


      discoverer = getPossiblyNullStringValue(rs, "o_discoverer");
      ra = getRA(rs);
      dec = getDec(rs);
    }

    return new StarInfo(name, auid, period, epoch, varType, spectralType,
        discoverer, ra, dec);
  }
View Full Code Here


      discoverer = getPossiblyNullStringValue(rs, "o_discoverer");
      ra = getRA(rs);
      dec = getDec(rs);
    }

    return new StarInfo(starName, auid, period, epoch, varType,
        spectralType, discoverer, ra, dec);
  }
View Full Code Here

   * @throws SQLException If an exception occurred.
   */
  public StarInfo retrieveData(String queryParam, String id)
      throws SQLException {

    StarInfo info = null;

    try {
      URL vsxUrl = new URL(baseVsxUrlString + "&" + queryParam + "&format=d");

      DocumentBuilderFactory factory = DocumentBuilderFactory
          .newInstance();
      DocumentBuilder builder = factory.newDocumentBuilder();
      Document document = builder.parse(vsxUrl.openStream());

      document.getDocumentElement().normalize();

      NodeList fieldNodes = document.getElementsByTagName("FIELD");
      for (int i = 0; i < fieldNodes.getLength(); i++) {
        Element elt = (Element) fieldNodes.item(i);
        fieldId2DataIndexMap.put(elt.getAttribute("id"), i);
      }

      NodeList dataNodes = document.getElementsByTagName("TD");
      for (int i = 0; i < dataNodes.getLength(); i++) {
        Element elt = (Element) dataNodes.item(i);
        data.add(elt.getTextContent());
      }

      if (!data.isEmpty()) {
        String name = data.get(fieldId2DataIndexMap.get("name"));
        String auid = data.get(fieldId2DataIndexMap.get("auid"));
        Double period = getPossiblyNullDoubleValue("period");
        Double epoch = getPossiblyNullDoubleValue("epoch");
        String varType = data.get(fieldId2DataIndexMap.get("varType"));
        String spectralType = data.get(fieldId2DataIndexMap
            .get("specType"));
        String discoverer = data.get(fieldId2DataIndexMap.get("disc"));
        RAInfo ra = new RAInfo(2000, getCoord(Coord.RA));
        DecInfo dec = new DecInfo(2000, getCoord(Coord.Dec));

        info = new StarInfo(name, auid, period, epoch, varType,
            spectralType, discoverer, ra, dec);
      } else {
        throw new SQLException("Unable to obtain information for " + id);
      }
    } catch (MalformedURLException e) {
View Full Code Here

          Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

      AAVSODatabaseConnector vsxConnector = AAVSODatabaseConnector.vsxDBConnector;
      Connection vsxConnection = vsxConnector.createConnection();

      StarInfo starInfo = vsxConnector.getAUID(vsxConnection, starName);
      auid = starInfo.getAuid();

      getParent().setCursor(null);
    } catch (Exception e) {
      MessageBox.showErrorDialog(this,
          "Star Information Retrieval Error", e);
View Full Code Here

   * @param msg
   *            New star message for a single star.
   * @return The summary component for this star.
   */
  private Component createSummary(NewStarMessage msg) {
    StarInfo starInfo = msg.getStarInfo();

    JTextArea summaryTextArea = new JTextArea();
    summaryTextArea.setEditable(false);
    summaryTextArea
        .setBorder(BorderFactory.createTitledBorder("Summary for "
            + starInfo.getDesignation()));

    StringBuffer summaryBuf = new StringBuffer();

    summaryBuf.append("Source Type: ");
    summaryBuf.append(msg.getStarInfo().getRetriever().getSourceType());
    summaryBuf.append("\n");

    summaryBuf.append("Source Name: ");
    summaryBuf.append(msg.getStarInfo().getRetriever().getSourceName());
    summaryBuf.append("; loaded: ");
    summaryBuf.append(msg.getLoadDate().toString());
    summaryBuf.append("\n");

    if (starInfo.getAuid() != null) {
      summaryBuf.append("AUID: ");
      summaryBuf.append(starInfo.getAuid());
      summaryBuf.append("\n");
    }

    if (starInfo.getPeriod() != null) {
      summaryBuf.append("Period: ");
      summaryBuf.append(starInfo.getPeriod());
      summaryBuf.append(" days\n");
    }

    if (starInfo.getEpoch() != null) {
      summaryBuf.append("Epoch: ");
      summaryBuf.append(starInfo.getEpoch());
      summaryBuf.append("\n");
    }

    if (starInfo.getVarType() != null) {
      summaryBuf.append("Variable Type: ");
      summaryBuf.append(starInfo.getVarType());
      summaryBuf.append("\n");
    }

    if (starInfo.getSpectralType() != null) {
      summaryBuf.append("Spectral Type: ");
      summaryBuf.append(starInfo.getSpectralType());
      summaryBuf.append("\n");
    }

    if (starInfo.getDiscoverer() != null) {
      summaryBuf.append("Discoverer: ");
      summaryBuf.append(starInfo.getDiscoverer());
      summaryBuf.append("\n");
    }

    if (starInfo.getRA() != null) {
      summaryBuf.append(starInfo.getRA());
      summaryBuf.append("\n");
    }

    if (starInfo.getDec() != null) {
      summaryBuf.append(starInfo.getDec());
      summaryBuf.append("\n");
    }

    summaryTextArea.setText(summaryBuf.toString());

View Full Code Here

TOP

Related Classes of org.aavso.tools.vstar.ui.mediator.StarInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.