Esempio n. 1
0
  String getOptionsLOV(String sLOV, boolean isSearch, boolean isRequired, String selectedValue) {
    String sSel = "";
    String slOptions = "";
    String sOptions = "";
    String id = "";
    String val = "";
    java.util.StringTokenizer LOV = new java.util.StringTokenizer(sLOV, ";", true);
    int i = 0;
    String old = ";";
    while (LOV.hasMoreTokens()) {
      id = LOV.nextToken();
      if (!old.equals(";") && (id.equals(";"))) {
        id = LOV.nextToken();
      } else {
        if (old.equals(";") && (id.equals(";"))) {
          id = "";
        }
      }
      if (!id.equals("")) {
        old = id;
      }

      i++;

      if (LOV.hasMoreTokens()) {
        val = LOV.nextToken();
        if (!old.equals(";") && (val.equals(";"))) {
          val = LOV.nextToken();
        } else {
          if (old.equals(";") && (val.equals(";"))) {
            val = "";
          }
        }
        if (val.equals(";")) {
          val = "";
        }
        if (!val.equals("")) {
          old = val;
        }
        i++;
      }

      if (id.compareTo(selectedValue) == 0) {
        sSel = "SELECTED";
      } else {
        sSel = "";
      }
      slOptions += "<option value=\"" + id + "\" " + sSel + ">" + val + "</option>";
    }
    if ((i % 2) == 0) sOptions += slOptions;
    return sOptions;
  }
Esempio n. 2
0
  String getValFromLOV(String selectedValue, String sLOV) {
    String sRes = "";
    String id = "";
    String val = "";
    java.util.StringTokenizer LOV = new java.util.StringTokenizer(sLOV, ";", true);
    int i = 0;
    String old = ";";
    while (LOV.hasMoreTokens()) {
      id = LOV.nextToken();
      if (!old.equals(";") && (id.equals(";"))) {
        id = LOV.nextToken();
      } else {
        if (old.equals(";") && (id.equals(";"))) {
          id = "";
        }
      }
      if (!id.equals("")) {
        old = id;
      }

      i++;

      if (LOV.hasMoreTokens()) {
        val = LOV.nextToken();
        if (!old.equals(";") && (val.equals(";"))) {
          val = LOV.nextToken();
        } else {
          if (old.equals(";") && (val.equals(";"))) {
            val = "";
          }
        }
        if (val.equals(";")) {
          val = "";
        }
        if (!val.equals("")) {
          old = val;
        }
        i++;
      }

      if (id.compareTo(selectedValue) == 0) {
        sRes = val;
      }
    }
    return sRes;
  }