Exemple #1
0
  public Message(String message) {
    Vector indexes = new Vector();
    int pos1 = message.indexOf(NMC_STATUS);
    if (pos1 != -1) {
      indexes.addElement(new Index(NMC_STATUS, pos1));
    }

    int pos2 = message.indexOf(NMC_ERRTYPE);
    if (pos2 != -1) {
      indexes.addElement(new Index(NMC_ERRTYPE, pos2));
    }

    int pos3 = message.indexOf(NMC_ERRINFO);
    if (pos3 != -1) {
      indexes.addElement(new Index(NMC_ERRINFO, pos3));
    }

    int pos4 = message.indexOf(NMC_ERRDETAIL);
    if (pos4 != -1) {
      indexes.addElement(new Index(NMC_ERRDETAIL, pos4));
    }

    int pos5 = message.indexOf(NMC_DESCRIPTION);
    if (pos5 != -1) {
      indexes.addElement(new Index(NMC_DESCRIPTION, pos5));
    }

    int extraIndex =
        message.indexOf('\n', Math.max(Math.max(Math.max(pos1, pos2), Math.max(pos3, pos4)), pos5));
    if (extraIndex != -1) {
      NMC_Extra = message.substring(extraIndex + 1, message.length());

      /* temp solution until Yu-Jen can think up another header schema */
      NMC_Extra = KeyCertUtility.replace(NMC_Extra, "Content-type: text/html", "");
    }
    indexes.addElement(new Index(NMC_EXTRA, extraIndex + 1));

    int size = indexes.size();
    for (int i = 0; i < size - 1; i++) {
      Index beginIndex = (Index) (indexes.elementAt(i));
      Index endIndex = (Index) (indexes.elementAt(i + 1));
      if (beginIndex.getIndexValue().equals(NMC_STATUS)) {
        String val =
            message.substring(beginIndex.getPos() + NMC_STATUS.length(), endIndex.getPos());
        NMC_Status = Integer.parseInt(val.trim());
      } else if (beginIndex.getIndexValue().equals(NMC_DESCRIPTION)) {
        NMC_Description =
            message.substring(beginIndex.getPos() + NMC_DESCRIPTION.length(), endIndex.getPos());
      } else if (beginIndex.getIndexValue().equals(NMC_ERRTYPE)) {
        NMC_ErrType =
            message.substring(beginIndex.getPos() + NMC_ERRTYPE.length(), endIndex.getPos());
      } else if (beginIndex.getIndexValue().equals(NMC_ERRINFO)) {
        NMC_ErrInfo =
            message.substring(beginIndex.getPos() + NMC_ERRINFO.length(), endIndex.getPos());
      } else if (beginIndex.getIndexValue().equals(NMC_ERRDETAIL)) {
        NMC_ErrDetail =
            message.substring(beginIndex.getPos() + NMC_ERRDETAIL.length(), endIndex.getPos());
      }
    }
  }
  public GuideCertInstallPane() {
    super();
    setLayout(new GridBagLayout());

    ResourceSet resource = KeyCertUtility.getKeyCertWizardResourceSet();

    setBorder(
        new TitledBorder(
            new CompoundBorder(
                new EtchedBorder(),
                new EmptyBorder(
                    COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE, COMPONENT_SPACE)),
            resource.getString("GuideCertInstallPane", "title")));

    int y = 0;

    GridBagUtil.constrain(
        this,
        new MultilineLabel(resource.getString("GuideCertInstallPane", "explain")),
        0,
        ++y,
        1,
        1,
        1.0,
        0.0,
        GridBagConstraints.NORTH,
        GridBagConstraints.BOTH,
        0,
        0,
        SEPARATED_COMPONENT_SPACE,
        0);

    GridBagUtil.constrain(
        this,
        Box.createVerticalGlue(),
        0,
        ++y,
        1,
        1,
        1.0,
        1.0,
        GridBagConstraints.NORTH,
        GridBagConstraints.BOTH,
        0,
        0,
        0,
        0);

    GridBagUtil.constrain(
        this,
        new JLabel(resource.getString(null, "clickNextToContinue")),
        0,
        ++y,
        1,
        1,
        1.0,
        0.0,
        GridBagConstraints.NORTH,
        GridBagConstraints.BOTH,
        0,
        0,
        0,
        0);
  }