Exemplo n.º 1
0
 public void actionPerformed(ActionEvent e) {
   if (isVisible()) {
     repaint();
   } else {
     animator.stop();
   }
 }
Exemplo n.º 2
0
 public void setVisible(boolean bShow, String title) {
   if (bShow) {
     String strDir = "";
     String strFreq = "";
     String strTraynum = "";
     m_strHelpFile = getHelpFile(title);
     String strSampleName = getSampleName(title);
     String frameBounds = getFrameBounds(title);
     StringTokenizer tok = new QuotedStringTokenizer(title);
     if (tok.hasMoreTokens()) strDir = tok.nextToken();
     if (tok.hasMoreTokens()) strFreq = tok.nextToken();
     if (tok.hasMoreTokens()) strTraynum = tok.nextToken();
     else {
       try {
         Integer.parseInt(strDir);
         // if strdir is number, then strdir is empty, and the
         // strfreq is the number
         strTraynum = strFreq;
         strFreq = strDir;
         strDir = "";
       } catch (Exception e) {
       }
     }
     try {
       setTitle(gettitle(strFreq));
       m_lblSampleName.setText("3");
       boolean bVast = isVast(strTraynum);
       CardLayout layout = (CardLayout) m_pnlSampleName.getLayout();
       if (!bVast) {
         if (strSampleName == null) {
           strSampleName = getSampleName(strDir, strTraynum);
         }
         m_lblSampleName.setText(strSampleName);
         layout.show(m_pnlSampleName, OTHER);
       } else {
         m_strDir = strDir;
         setTrays();
         layout.show(m_pnlSampleName, VAST);
         m_trayTimer.start();
       }
       boolean bSample = bVast || !strSampleName.trim().equals("");
       m_pnlSampleName.setVisible(bSample);
       m_lblLogin.setForeground(getBackground());
       m_lblLogin.setVisible(false);
       m_passwordField.setText("");
       m_passwordField.setCaretPosition(0);
     } catch (Exception e) {
       Messages.writeStackTrace(e);
     }
     setBounds(frameBounds);
     ExpPanel exp = Util.getActiveView();
     if (exp != null) exp.waitLogin(true);
   }
   writePersistence();
   setVisible(bShow);
 }
Exemplo n.º 3
0
  /**
   * Save the data to the file. Read the data from the file, and copy everything to the
   * stringbuffer. The lines in the file are of the form:
   * auditDir:system:/vnmr/part11/auditTrails:system file:standard:text:yes Based on these formats,
   * get the value of either the directory or the checkbox from the corresponding components, and
   * replace that value in the stringbuffer.
   */
  protected void saveData() {
    BufferedReader reader = WFileUtil.openReadFile(m_strPath);
    String strLine = null;
    StringBuffer sbData = new StringBuffer();
    if (reader == null) return;

    int nLineInd = 0;
    try {
      while ((strLine = reader.readLine()) != null) {
        // if the line starts with a comment from sccs, add '#' to it,
        // to make it a comment
        if (strLine.startsWith("%") || strLine.startsWith("@")) strLine = "# " + strLine;

        if (strLine.startsWith("#")) {
          sbData.append(strLine + "\n");
          continue;
        }
        StringTokenizer sTok = new StringTokenizer(strLine, File.pathSeparator);
        boolean bFile = false;
        boolean bLineEnd = false;
        boolean bDir = false;

        for (int i = 0; sTok.hasMoreTokens(); i++) {
          String strValue = sTok.nextToken();
          if (i == 0) {
            bFile = strValue.equalsIgnoreCase("file") ? true : false;
            bDir = false;
            if (strValue.equalsIgnoreCase("dir")) bDir = true;
          } else {
            // Case => file:standard:procpar:yes
            // skip over 'standard', 'procpar',
            // and get the value 'yes' or 'no' from the checkbox
            if (bFile) {
              if (i == 3) {
                String strNewValue = getValue(nLineInd);
                if (strNewValue != null) strValue = strNewValue;
                bLineEnd = true;
              } else bLineEnd = false;
            } else if (bDir) {
              bLineEnd = false;
              if (i == 3) bLineEnd = true;
            }
            // Case => part11Dir:/vnmr/part11/data 0r
            // Case => dataType:FDA
            // skip over 'part11Dir'
            // and get the value of the directory from the textfield,
            // or from the combobox
            else {
              if (i == 1) {
                String strNewValue = getValue(nLineInd);
                if (strNewValue != null) strValue = strNewValue;
                bLineEnd = true;
              } else bLineEnd = false;
            }
          }
          // copy the value to the stringbuffer
          sbData.append(strValue);
          if (!bLineEnd) sbData.append(File.pathSeparator);
        }
        nLineInd++;
        sbData.append("\n");
      }
      // write the data to the file
      reader.close();
      BufferedWriter writer = WFileUtil.openWriteFile(m_strPath);
      WFileUtil.writeAndClose(writer, sbData);
      m_objTimer =
          new javax.swing.Timer(
              200,
              new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                  VItemAreaIF.firePropertyChng(Global.PART11_CONFIG_FILE, "all", "");
                  m_objTimer.stop();
                }
              });
      m_objTimer.start();
    } catch (Exception e) {
      Messages.writeStackTrace(e);
      // e.printStackTrace();
      Messages.postDebug(e.toString());
    }
  }
Exemplo n.º 4
0
 public void go() {
   animator = new javax.swing.Timer(22 + 22 + 22, this);
   animator.start();
 }
Exemplo n.º 5
0
  protected void enterLogin() {
    char[] password = m_passwordField.getPassword();
    String strUser = (String) m_cmbUser.getSelectedItem();
    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    boolean blogin = WUserUtil.isOperatorNameok(strUser, false);
    if (blogin) {
      blogin = vnmrjPassword(strUser, password);
      if (!blogin) blogin = unixPassword(strUser, password);
    }
    if (blogin) {
      m_lblLogin.setForeground(Color.black);
      m_lblLogin.setText("Login Successful");
      m_lblLogin.setVisible(true);
      // Get the Email column string for access to the operator data
      String emStr = vnmr.util.Util.getLabel("_admin_Email");
      String stremail = WUserUtil.getOperatordata(strUser, emStr);

      // Get the Panel Level column string for access to the operator data
      String plStr = vnmr.util.Util.getLabel("_admin_Panel_Level");
      String strPanel = WUserUtil.getOperatordata(strUser, plStr);

      if (stremail == null || stremail.equals("null")) stremail = "";
      try {
        Integer.parseInt(strPanel);
      } catch (Exception e) {
        strPanel = WGlobal.PANELLEVEL;
      }
      m_trayTimer.stop();
      Messages.postDebug(" Login: "******"appdir('reset','")
                .append(strUser)
                .append("','")
                .append(stremail)
                .append("',")
                .append(strPanel)
                .append(")")
                .toString());
        exp.sendToVnmr("vnmrjcmd('util', 'bgReady')\n");
      }
      setVisible(false);

      // Save the current position and size of this panel in case it
      // was changed
      Dimension size = getSize();
      width = size.width;
      height = size.height;
      position = getLocation();
      writePersistence();

      // Call the macro to update this operator's
      // ExperimentSelector_operatorName.xml file
      // from the protocols themselves.  This macro will
      // cause an update of the ES when it is finished

      // Util.getAppIF().sendToVnmr("updateExpSelector");

      // I am not sure why we need to force updates since updateExpSelector
      // should have caused an update by writing to ES_op.xml file.
      // However, it works better if we do the force update.
      // ExpSelector.setForceUpdate(true);
    } else {
      m_lblLogin.setForeground(DisplayOptions.getColor("Error"));
      // m_lblLogin.setText("<HTML>Incorrect username/password <p> Please try again </HTML>");
      m_lblLogin.setVisible(true);
    }
    setCursor(Cursor.getDefaultCursor());
  }