示例#1
0
    protected void buildPanel(String strPath) {
      strPath = FileUtil.openPath(strPath);
      ArrayList aListPath = new ArrayList();
      BufferedReader reader = WFileUtil.openReadFile(strPath);
      if (reader == null) return;

      String strLine;
      try {
        while ((strLine = reader.readLine()) != null) {
          StringTokenizer strTok = new StringTokenizer(strLine, ":");
          if (strTok.countTokens() < 4) continue;

          boolean bChecksum = false;
          boolean bShow = false;

          String strDir = strTok.nextToken();
          String strChecksum = strTok.nextToken();

          if (strChecksum.equalsIgnoreCase("checksum")) bChecksum = true;

          if (bChecksum && (strDir.equals("file") || strDir.equals("dir"))) {
            String strValue = strTok.nextToken();
            String strShow = strTok.nextToken();
            if (strShow.equalsIgnoreCase("yes")) bShow = true;

            if (bShow) aListPath.add(strValue);
          }
        }

        m_cmbPath = new JComboBox(aListPath.toArray());

        JPanel pnlDisplay = new JPanel(new GridBagLayout());
        GridBagConstraints gbc =
            new GridBagConstraints(
                0,
                0,
                1,
                1,
                0.2,
                0.2,
                GridBagConstraints.NORTHWEST,
                GridBagConstraints.HORIZONTAL,
                new Insets(0, 0, 0, 0),
                0,
                0);
        pnlDisplay.add(m_cmbPath, gbc);
        gbc.gridx = 1;
        pnlDisplay.add(m_cmbChecksum, gbc);
        add(pnlDisplay, BorderLayout.NORTH);
        add(m_txaChecksum, BorderLayout.CENTER);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
示例#2
0
 /**
  * Gets the list of the vnmrj users(operators) for the current unix user logged in
  *
  * @return the list of vnmrj users
  */
 protected Object[] getOperators() {
   String strUser = System.getProperty("user.name");
   User user = LoginService.getDefault().getUser(strUser);
   ArrayList<String> aListOperators = user.getOperators();
   if (aListOperators == null || aListOperators.isEmpty())
     aListOperators = new ArrayList<String>();
   Collections.sort(aListOperators);
   if (aListOperators.contains(strUser)) aListOperators.remove(strUser);
   aListOperators.add(0, strUser);
   return (aListOperators.toArray());
 }
示例#3
0
  /**
   * Creates the components based on the information in each line.
   *
   * @param sTokLine the tokens in a line.
   *     <p>The file is of the following format: auditDir:/vnmr/part11/auditTrails:system
   *     part11Dir:/vnmr/part11/data:system part11Dir:/vnmr/part11/data:system
   *     file:standard:cmdHistory:yes file:standard:fid:yes file:standard:procpar:yes
   *     file:standard:conpar:yes
   *     <p>Based on this format, the line is parsed as follows: 1) if the line starts with the
   *     keyword 'file', then it skips over the first two tokens in the line which are 'file' and
   *     'standard', and the third token in the line is the label of the item, and the fourth token
   *     in the line corresponds to the value of the checkbox. 2) if the line doesnot start with the
   *     keyword 'file', then the second and the fourth tokens are skipped, first token in the line
   *     is the label of the item, and the third token is the value of the textfield.
   */
  protected void createJComps(StringTokenizer sTokLine) {
    boolean bFile = false;
    boolean bMode = false;
    JComponent compValue = null;
    boolean bDir = false;

    for (int i = 0; sTokLine.hasMoreTokens(); i++) {
      String strTok = sTokLine.nextToken();
      if (i == 0) {
        bFile = strTok.equalsIgnoreCase("file") ? true : false;
        bMode = strTok.equalsIgnoreCase("dataType") ? true : false;
        bDir = false;
        if (strTok.equalsIgnoreCase("dir")) bDir = true;

        // Case 2, create a label for the first token.
        if (!bFile && !bDir) createLabel(strTok, m_pnlDisplay);
      } else {
        // Case 1 => file:standard:conpar:yes
        if (bFile) {
          // skip over the first tokenwhich is the keyword 'file'
          if (i == 1) continue;
          // else check for checkbox value.
          else if (strTok.equalsIgnoreCase("yes") || strTok.equalsIgnoreCase("no"))
            compValue = createChkBox(strTok, m_pnlDisplay);
          // else create a label.
          else createLabel(strTok, m_pnlDisplay);
        }
        // Case 2 => part11Dir:/vnmr/part11/data:system Or dataType:Non-FDA
        else if (!bDir) {
          if (i == 1) {
            // create a combobox
            if (bMode) compValue = createCombo(strTok, m_pnlDisplay);
            // create a textfield and sets it's value.
            else compValue = createTxf(strTok, m_pnlDisplay);
          }
        }
      }
    }
    m_aListComp.add(compValue);
  }