Example #1
0
  protected void setTrayPresent(String strPath) {
    String strzone = "zones";
    BufferedReader reader = WFileUtil.openReadFile(strPath);
    if (reader == null) return;

    String strLine;
    try {
      // if the zones are set to 0, then there is no tray present
      // set rackInfo(1,zones) 3 => tray 1 present
      // set rackInfo(2,zones) 0 => tray 2 not present
      while ((strLine = reader.readLine()) != null) {
        int index = strLine.indexOf(strzone);
        if (index < 0) continue;

        String strTray = strLine.substring(index - 2, index - 1);
        int nTray = 0;
        try {
          nTray = Integer.parseInt(strTray);
        } catch (Exception e) {
        }

        if (nTray <= 0) continue;

        int nZone = 0;
        try {
          strTray = strLine.substring(index + strzone.length() + 2, strLine.length());
          nZone = Integer.parseInt(strTray);
        } catch (Exception e) {
        }

        Color colorbg = Color.white;
        String strTooltip = TRAY;
        if (nZone <= 0) {
          colorbg = Color.black;
          strTooltip = NOTRAY;
        }
        VBox pnlVast = m_pnlVast[nTray - 1];
        pnlVast.setbackground(colorbg);
        pnlVast.setToolTipText(Util.getTooltipString(strTooltip));
      }
      reader.close();
    } catch (Exception e) {
      // e.printStackTrace();
      Messages.writeStackTrace(e);
    }
  }
Example #2
0
  protected void setTrayActive(String strDir) {
    String strTray;
    String strStudy;
    String strActive = "Active";
    String cmd =
        "SELECT vrack_,studystatus from study WHERE (autodir=\'"
            + strDir
            + "\') AND (hostname=\'"
            + getHost()
            + "\')";
    m_dbResult = null;

    try {
      m_dbResult = getdbmanager().executeQuery(cmd);
    } catch (Exception e) {
      return;
    }
    if (m_dbResult == null) return;

    int nTray = 0;
    try {
      while (m_dbResult.next()) {
        strTray = m_dbResult.getString(1);
        strStudy = m_dbResult.getString(2);
        if (strStudy != null && strStudy.equalsIgnoreCase(strActive)) {
          try {
            nTray = Integer.parseInt(strTray);
          } catch (Exception e) {
          }

          if (nTray > 0) {
            m_pnlVast[nTray - 1].setbackground(Color.blue);
            m_pnlVast[nTray - 1].setToolTipText(Util.getTooltipString(TRAYACTIVE));
            break;
          }
        }
      }
    } catch (Exception e) {
      // e.printStackTrace();
      Messages.writeStackTrace(e);
    }
  }