Changeset 3900


Ignore:
Timestamp:
Oct 20, 2010, 1:18:30 PM (13 years ago)
Author:
olle
Message:

Refs #700. Creation of option alternatives for X!Tandem searches is put
in its own helper class/file gui/form/XTandemParameterSetOptionsHelper.java
in client/servlet/, in order to simplify references from more than
one class, and make class XTandemParameterSetForm only responsible
for the design of the actual form. Some general utility methods related
to option lists were also moved to the new helper routine:

  1. New class/file gui/form/XTandemParameterSetOptionsHelper.java in

client/servlet/ added. It contains methods moved from class/file
gui/form/XTandemParameterSetForm.java in client/servlet/ related
to creation of option alternatives for X!Tandem searches. It uses
methods in class/file io/XTandemParameterSetOptionsUtil.java in api/core/
to obtain option alternatives from a GPM web site.

  1. Class/file gui/form/XTandemParameterSetForm.java in client/servlet/

updated to use new helper class XTandemParameterSetOptionsHelper
to obtain option alternatives for X!Tandem searches:

  1. New private method

XTandemParameterSetOptionsHelper fetchXTandemParameterSetOptionsHelperInstance()
added. It returns an existing XTandemParameterSetOptionsHelper instance
or creates a new one if needed.

  1. Public constructor XTandemParameterSetForm(XTandemParameterSet obj)

updated to calls methods in the new helper class to process option lists.

  1. Public method void fetchOptionAlternatives() updated to call

methods in the new helper class to obtain option alternatives.

  1. Other methods moved to the new class are removed from class

XTandemParameterSetForm.

Location:
trunk/client/servlet/src/org/proteios/gui/form
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/client/servlet/src/org/proteios/gui/form/XTandemParameterSetForm.java

    r3893 r3900  
    3131import java.util.List;
    3232import org.proteios.io.XTandemParameterSet;
    33 import org.proteios.io.XTandemParameterSetOptionsUtil;
    3433import se.lu.thep.waf.constraints.VString;
    3534
     
    294293  private List<Option> proteinCleavageSiteOptionList;
    295294  private List<Option> refinePotentialModificationMassOptionList;
     295  // XTandemParameterSetOptionsHelper instance
     296  XTandemParameterSetOptionsHelper xTandemParameterSetOptionsHelper = null;
    296297
    297298  /**
     
    305306    // Fetch lists of option alternatives
    306307    fetchOptionAlternatives();
    307     // Debug output of option alternatives
    308     //debugOptionList("listPathDefaultParametersOptionList", this.listPathDefaultParametersOptionList);
    309     //debugOptionList("residueModificationMassOptionList", this.residueModificationMassOptionList);
    310     //debugOptionList("residuePotentialModificationMassOptionList", this.residuePotentialModificationMassOptionList);
    311     //debugOptionList("speciesOptionList", this.speciesOptionList);
    312     //debugOptionList("proSpeciesOptionList", this.proSpeciesOptionList);
    313     //debugOptionList("proteinCleavageSiteOptionList", this.proteinCleavageSiteOptionList);
    314     //debugOptionList("refinePotentialModificationMassOptionList", this.refinePotentialModificationMassOptionList);
    315308    /*
    316309     * String select box variables
     
    820813    this();
    821814    // Fill out form
     815    // Get XTandemParameterSetOptionsHelper instance
     816    fetchXTandemParameterSetOptionsHelperInstance();
    822817    /*
    823818     * String select box variables
     
    883878    // Residue, modification mass (own entered value)
    884879    // Only insert selected value if not found in select box
    885     if (!itemInOptionList(this.residueModificationMassOptionList, obj.getResidueModificationMass()))
     880    if (!xTandemParameterSetOptionsHelper.itemInOptionList(this.residueModificationMassOptionList, obj.getResidueModificationMass()))
    886881    {
    887882      log.debug("residue modification mass, inserted value = \"" + obj.getResidueModificationMass() + "\"");
     
    903898     * with items separated by ", ".
    904899     */
    905     selectedList = listStringToStringList(obj.getResiduePotentialModificationMass(), ",");
     900    selectedList = xTandemParameterSetOptionsHelper.listStringToStringList(obj.getResiduePotentialModificationMass(), ",");
    906901    log.debug("residue potential modification mass selectedList = " + selectedList);
    907902    residuePotentialModificationMassSB.selectOptions(selectedList);
    908903    // Residue, potential modification mass
    909904    // Only insert selected values if not all found in select box
    910     if (!allItemsInOptionList(this.residuePotentialModificationMassOptionList, selectedList))
     905    if (!xTandemParameterSetOptionsHelper.allItemsInOptionList(this.residuePotentialModificationMassOptionList, selectedList))
    911906    {
    912907      log.debug("residue potential modification mass, inserted value = \"" + obj.getResiduePotentialModificationMass() + "\"");
     
    929924     * string with items separated by ", ".
    930925     */
    931     selectedList = listStringToStringList(obj.getProteinTaxon(), ",\\ ");
     926    selectedList = xTandemParameterSetOptionsHelper.listStringToStringList(obj.getProteinTaxon(), ",\\ ");
    932927    // Taxon - Eukaryotes
    933928    taxonSB.selectOptions(selectedList);
     
    944939    // Protein, cleavage site (own entered value)
    945940    // Only insert selected value if not found in select box
    946     if (!itemInOptionList(this.proteinCleavageSiteOptionList, obj.getProteinCleavageSite()))
     941    if (!xTandemParameterSetOptionsHelper.itemInOptionList(this.proteinCleavageSiteOptionList, obj.getProteinCleavageSite()))
    947942    {
    948943      cleavageSiteF.setValue(obj.getProteinCleavageSite());
     
    994989     * with items separated by ", ".
    995990     */
    996     selectedList = listStringToStringList(obj.getRefinePotentialModificationMass(), ",");
     991    selectedList = xTandemParameterSetOptionsHelper.listStringToStringList(obj.getRefinePotentialModificationMass(), ",");
    997992    log.debug("refine potential modification mass selectedList = " + selectedList);
    998993    refinePotentialModificationMassSB.selectOptions(selectedList);
    999994    // Refine, potential modification mass
    1000995    // Only insert selected values if not all found in select box
    1001     if (!allItemsInOptionList(this.refinePotentialModificationMassOptionList, selectedList))
     996    if (!xTandemParameterSetOptionsHelper.allItemsInOptionList(this.refinePotentialModificationMassOptionList, selectedList))
    1002997    {
    1003998      log.debug("refine potential modification mass, inserted value = \"" + obj.getRefinePotentialModificationMass() + "\"");
     
    10801075
    10811076  /**
     1077   * Fetches an instance of XTandemParameterSetOptionsHelper.
     1078   *
     1079   * @return XTandemParameterSetOptionsHelper
     1080   */
     1081  private XTandemParameterSetOptionsHelper fetchXTandemParameterSetOptionsHelperInstance()
     1082  {
     1083    if (this.xTandemParameterSetOptionsHelper == null)
     1084    {     
     1085      // Get XTandemParameterSetOptionsHelper instance
     1086      this.xTandemParameterSetOptionsHelper = new XTandemParameterSetOptionsHelper();
     1087    }
     1088    // Return XTandemParameterSetOptionsHelper instance
     1089    return this.xTandemParameterSetOptionsHelper;
     1090  }
     1091
     1092 
     1093  /**
    10821094   * Convenience method to fetch lists of option alternatives
    10831095   * from GPM web site. Otherwise, default option alternatives
     
    10861098  public void fetchOptionAlternatives()
    10871099  {
    1088     // Fetch default lists of option alternatives
    1089     fetchDefaultOptionAlternatives();
    1090     // Get XTandemParameterSetOptionsUtil instance
    1091     XTandemParameterSetOptionsUtil xTandemParameterSetOptionUtil = new XTandemParameterSetOptionsUtil();
     1100    // Get XTandemParameterSetOptionsHelper instance
     1101    fetchXTandemParameterSetOptionsHelperInstance();
     1102    // Fetch lists of option alternatives
     1103    xTandemParameterSetOptionsHelper.fetchOptionAlternatives();
    10921104    //
    1093     // Get list path default parameters option data
    1094     List<String> webListPathDefaultParametersStringList = xTandemParameterSetOptionUtil.fetchListPathDefaultParametersStringList();
    1095     List<Option> webListPathDefaultParametersOptionList = stringListToOptionList(webListPathDefaultParametersStringList);
    1096     // Get residue modification mass option data
    1097     List<String> webResidueModificationMassStringList = xTandemParameterSetOptionUtil.fetchResidueModificationMassStringList();
    1098     List<Option> webResidueModificationMassOptionList = stringListToOptionList(webResidueModificationMassStringList);
    1099     // Get residue potential modification mass option data
    1100     List<String> webResiduePotentialModificationMassStringList = xTandemParameterSetOptionUtil.fetchResiduePotentialModificationMassStringList();
    1101     List<Option> webResiduePotentialModificationMassOptionList = stringListToOptionList(webResiduePotentialModificationMassStringList);
    1102     // Get Eukaryotes species option data
    1103     List<String> webSpeciesStringList = xTandemParameterSetOptionUtil.fetchSpeciesStringList();
    1104     List<Option> webSpeciesOptionList = stringListToOptionList(webSpeciesStringList);
    1105     // Get Prokaryotes species option data
    1106     List<String> webProSpeciesStringList = xTandemParameterSetOptionUtil.fetchProSpeciesStringList();
    1107     List<Option> webProSpeciesOptionList = stringListToOptionList(webProSpeciesStringList);
    1108     // Get protein cleavage site option data
    1109     List<String> webProteinCleavageSiteStringList = xTandemParameterSetOptionUtil.fetchProteinCleavageSiteStringList();
    1110     List<Option> webProteinCleavageSiteOptionList = stringListToOptionList(webProteinCleavageSiteStringList);
    1111     // Get refine potential modification mass option data
    1112     List<String> webRefinePotentialModificationMassStringList = xTandemParameterSetOptionUtil.fetchRefinePotentialModificationMassStringList();
    1113     List<Option> webRefinePotentialModificationMassOptionList = stringListToOptionList(webRefinePotentialModificationMassStringList);
    1114     /*
    1115     log.debug("webListPathDefaultParametersStringList = " + webListPathDefaultParametersStringList);
    1116     log.debug("webResidueModificationMassStringList = " + webResidueModificationMassStringList);
    1117     log.debug("webResiduePotentialModificationMassStringList = " + webResiduePotentialModificationMassStringList);
    1118     log.debug("webSpeciesStringList = " + webSpeciesStringList);
    1119     log.debug("webProSpeciesStringList = " + webProSpeciesStringList);
    1120     log.debug("webProteinCleavageSiteStringList = " + webProteinCleavageSiteStringList);
    1121     log.debug("webRefinePotentialModificationMassStringList = " + webRefinePotentialModificationMassStringList);
    1122     */
    1123     // Use option lists from web site if available
    11241105    this.listPathDefaultParametersOptionList =
    1125       optionListPotentialReplacement("listPathDefaultParametersOptionList",
    1126       this.listPathDefaultParametersOptionList, webListPathDefaultParametersOptionList);
     1106      xTandemParameterSetOptionsHelper.getListPathDefaultParametersOptionList();
    11271107    this.residueModificationMassOptionList =
    1128       optionListPotentialReplacement("residueModificationMassOptionList",
    1129       this.residueModificationMassOptionList, webResidueModificationMassOptionList);
     1108      xTandemParameterSetOptionsHelper.getResidueModificationMassOptionList();
    11301109    this.residuePotentialModificationMassOptionList =
    1131       optionListPotentialReplacement("residuePotentialModificationMassOptionList",
    1132       this.residuePotentialModificationMassOptionList, webResiduePotentialModificationMassOptionList);
     1110      xTandemParameterSetOptionsHelper.getResiduePotentialModificationMassOptionList();
    11331111    this.speciesOptionList =
    1134       optionListPotentialReplacement("speciesOptionList",
    1135       this.speciesOptionList, webSpeciesOptionList);
     1112      xTandemParameterSetOptionsHelper.getSpeciesOptionList();
    11361113    this.proSpeciesOptionList =
    1137       optionListPotentialReplacement("proSpeciesOptionList",
    1138       this.proSpeciesOptionList, webProSpeciesOptionList);
     1114      xTandemParameterSetOptionsHelper.getProSpeciesOptionList();
    11391115    this.proteinCleavageSiteOptionList =
    1140       optionListPotentialReplacement("proteinCleavageSiteOptionList",
    1141       this.proteinCleavageSiteOptionList, webProteinCleavageSiteOptionList);
     1116      xTandemParameterSetOptionsHelper.getProteinCleavageSiteOptionList();
    11421117    this.refinePotentialModificationMassOptionList =
    1143       optionListPotentialReplacement("refinePotentialModificationMassOptionList",
    1144       this.refinePotentialModificationMassOptionList, webRefinePotentialModificationMassOptionList);
     1118      xTandemParameterSetOptionsHelper.getRefinePotentialModificationMassOptionList();
    11451119  }
    11461120
    11471121
    1148   /**
    1149    * Convenience method to fetch default lists of option alternatives.
    1150    */
    1151   public void fetchDefaultOptionAlternatives()
    1152   {
    1153     List<Option> optionList = null;
    1154     // List path, default parameters
    1155     optionList = new ArrayList<Option>();
    1156     optionList.add(new Option("/tandem/methods/fticr.xml", "FTICR (10 ppm)"));
    1157     optionList.add(new Option("/tandem/methods/qstar.xml",  "Quad-TOF (100 ppm)"));
    1158     optionList.add(new Option("/tandem/methods/qstar_l.xml",  "Quad-TOF (0.5 Da)"));
    1159     optionList.add(new Option("/tandem/methods/iontrap.xml",  "Ion Trap (4 Da)"));
    1160     this.listPathDefaultParametersOptionList = optionList;
    1161     // Residue, modification mass
    1162     optionList = new ArrayList<Option>();
    1163     optionList.add(new Option("", "none"));
    1164     optionList.add(new Option("57.021464@C", "Carbamidomethyl (C)"));
    1165     optionList.add(new Option("442.224991@C", "ICAT-D (C)"));
    1166     optionList.add(new Option("227.126991@C", "ICAT-C (C)"));
    1167     optionList.add(new Option("58.005479@C", "Carboxymethyl (C)"));
    1168     optionList.add(new Option("105.057849@C", "Pyridylethyl (C)"));
    1169     optionList.add(new Option("71.037114@C", "Propionamide (C)"));
    1170     optionList.add(new Option("144.102063@[,144.102063@K", "iTRAQ (N-term,K)"));
    1171     this.residueModificationMassOptionList = optionList;
    1172     // Residue, potential modification mass
    1173     optionList = new ArrayList<Option>();
    1174     optionList.add(new Option("", "none"));
    1175     optionList.add(new Option("15.994915@M", "Oxidation (M)"));
    1176     optionList.add(new Option("15.994915@W", "Oxidation (W)"));
    1177     optionList.add(new Option("0.984016@N", "Deamidation (N)"));
    1178     optionList.add(new Option("0.984016@Q", "Deamidation (Q)"));
    1179     optionList.add(new Option("8.0502@C", "ICAT-D:2H(8) (C)"));
    1180     optionList.add(new Option("9.0302@C", "ICAT-C:13C(9) (C)"));
    1181     optionList.add(new Option("144.102063@[", "iTRAQ (N-term)"));
    1182     optionList.add(new Option("144.102063@K", "iTRAQ (K)"));
    1183     optionList.add(new Option("79.966331@S", "Phospho (S)"));
    1184     optionList.add(new Option("79.966331@T", "Phospho (T)"));
    1185     optionList.add(new Option("79.966331@Y", "Phospho (Y)"));
    1186     optionList.add(new Option("79.956815@Y", "Sulfo (Y)"));
    1187     optionList.add(new Option("42.010565@K", "Acetyl (K)"));
    1188     this.residuePotentialModificationMassOptionList = optionList;
    1189     // Taxon - Eukaryotes
    1190     optionList = new ArrayList<Option>();
    1191     optionList.add(new Option("", "none"));
    1192     optionList.add(new Option("human", "H. sapiens (human)"));
    1193     optionList.add(new Option("mouse", "M. musculus (mouse)"));
    1194     optionList.add(new Option("rat", "R. norvegicus (rat)"));
    1195     optionList.add(new Option("yeast", "S. cerevisiae (budding yeast)"));
    1196     optionList.add(new Option("", "------------------"));
    1197     optionList.add(new Option("mosquito", "A. gambiae (mosquito)"));
    1198     optionList.add(new Option("aspergillus_fumigatus", "A. fumigatus (mould)"));
    1199     optionList.add(new Option("bee", "A. mellifera (honey bee)"));
    1200     optionList.add(new Option("thalecress", "A. thaliana (thale cress)"));
    1201     optionList.add(new Option("cow", "B. taurus (cow)"));
    1202     optionList.add(new Option("dog", "C. familiaris (dog)"));
    1203     optionList.add(new Option("worm", "C. elegans (round worm)"));
    1204     optionList.add(new Option("zebrafish", "D. rerio (zebra fish)"));
    1205     optionList.add(new Option("fly", "D. melanogaster (fruit fly)"));
    1206     optionList.add(new Option("chicken", "G. gallus (hen)"));
    1207     optionList.add(new Option("human", "H. sapiens (human)"));
    1208     optionList.add(new Option("mouse", "M. musculus (mouse)"));
    1209     optionList.add(new Option("rice", "O.sativa (rice)"));
    1210     optionList.add(new Option("rat", "R. norvegicus (rat)"));
    1211     optionList.add(new Option("spombe", "S. pombe (fission yeast)"));
    1212     optionList.add(new Option("yeast", "S. cerevisiae (budding yeast)"));
    1213     optionList.add(new Option("frog", "S. tropicalis (toad)"));
    1214     this.speciesOptionList = optionList;
    1215     // Taxon - Prokaryotes
    1216     optionList = new ArrayList<Option>();
    1217     optionList.add(new Option("", "none"));
    1218     optionList.add(new Option("Bacillus_subtilis", "Bacillus subtilis"));
    1219     optionList.add(new Option("Clostridium_perfringens",
    1220       "Clostridium perfringens"));
    1221     optionList.add(new Option("Deinococcus_radiodurans",
    1222       "Deinococcus radiodurans"));
    1223     optionList.add(new Option("Escherichia_coli_K12",
    1224       "Escherichia coli K12"));
    1225     optionList.add(new Option("Francisella_tularensis_tularensis",
    1226       "Francisella tularensis tularensis"));
    1227     optionList.add(new Option("Geobacter_sulfurreducens",
    1228       "Geobacter sulfurreducens"));
    1229     optionList.add(new Option("Haemophilus_influenzae",
    1230       "Haemophilus influenzae"));
    1231     optionList.add(new Option("Listeria_innocua", "Listeria innocua"));
    1232     optionList.add(new Option("Mycobacterium_leprae",
    1233       "Mycobacterium leprae"));
    1234     optionList.add(new Option("Mycobacterium_tuberculosis_CDC1551",
    1235       "Mycobacterium tuberculosis CDC1551"));
    1236     optionList
    1237       .add(new Option("Mycoplasma_pulmonis", "Mycoplasma pulmonis"));
    1238     optionList.add(new Option("Staphylococcus_aureus_MW2",
    1239       "Staphylococcus aureus MW2"));
    1240     optionList.add(new Option("Streptococcus_pneumoniae_TIGR4",
    1241       "Streptococcus pneumoniae TIGR4"));
    1242     optionList.add(new Option("Streptococcus_pyogenes_M1_GAS",
    1243       "Streptococcus pyogenes M1 GAS"));
    1244     optionList.add(new Option("Yersinia_pestis_CO92",
    1245       "Yersinia pestis CO92"));
    1246     this.proSpeciesOptionList = optionList;
    1247     // Protein, cleavage site
    1248     optionList = new ArrayList<Option>();
    1249     optionList.add(new Option("[RK]|{P}", "trypsin, [RK]|{P}"));
    1250     optionList.add(new Option("[R]|[X]", "endo-arg-C, [R]|[X]"));
    1251     optionList.add(new Option("[K]|[X]", "endo-lys-C, [K]|[X]"));
    1252     optionList.add(new Option("[E]|[X]", "endo-glu-C, [E]|[X]"));
    1253     optionList.add(new Option("[X]|[D]", "endo-asp-N, [X]|[D]"));
    1254     optionList.add(new Option("[ED]|[X]", "V8, [ED]|[X]"));
    1255     this.proteinCleavageSiteOptionList = optionList;
    1256     // Refine, potential modification mass
    1257     optionList = new ArrayList<Option>();
    1258     optionList.add(new Option("", "none"));
    1259     optionList.add(new Option("15.994915@M", "Oxidation (M)"));
    1260     optionList.add(new Option("15.994915@W", "Oxidation (W)"));
    1261     optionList.add(new Option("0.984016@N", "Deamidation (N)"));
    1262     optionList.add(new Option("0.984016@Q", "Deamidation (Q)"));
    1263     optionList.add(new Option("8.0502@C", "ICAT-D:2H(8) (C)"));
    1264     optionList.add(new Option("9.0302@C", "ICAT-C:13C(9) (C)"));
    1265     optionList.add(new Option("144.102063@[", "iTRAQ (N-term)"));
    1266     optionList.add(new Option("144.102063@K", "iTRAQ (K)"));
    1267     optionList.add(new Option("79.966331@S", "Phospho (S)"));
    1268     optionList.add(new Option("79.966331@T", "Phospho (T)"));
    1269     optionList.add(new Option("79.966331@Y", "Phospho (Y)"));
    1270     optionList.add(new Option("79.956815@Y", "Sulfo (Y)"));
    1271     optionList.add(new Option("42.010565@K", "Acetyl (K)"));
    1272     this.refinePotentialModificationMassOptionList = optionList;
    1273   }
    1274 
    1275  
    1276   /**
    1277    * Convenience method to replace a target option list
    1278    * with a candidate list,if the latter fulfills basic requirements.
    1279    *
    1280    * @param listName String Name of option list.
    1281    * @param targetList List<Option> Option list to replace.
    1282    * @param candidateList List<Option> Option list candidate.
    1283    * @return List<Option> The optionally replaced target list.
    1284    */
    1285   public List<Option> optionListPotentialReplacement(
    1286     String listName, List<Option> targetList, List<Option> candidateList)
    1287   {
    1288     // Use candidate option list if available
    1289     boolean listReplaced = false;
    1290     if (candidateList != null && candidateList.size() > 0)
    1291     {
    1292       targetList = candidateList;
    1293       listReplaced = true;
    1294     }
    1295     // Debug output
    1296     if (candidateList != null && candidateList.size() > 0)
    1297     {
    1298       log.debug(listName + ": candidate list size = " + candidateList.size());
    1299     }
    1300     else
    1301     {
    1302       log.debug(listName + ": candidate list == null");
    1303     }
    1304     if (listReplaced)
    1305     {
    1306       log.debug(listName + " replaced with option list from web site");
    1307     }
    1308     else
    1309     {
    1310       log.debug(listName + ": default option list used");
    1311     }
    1312     return targetList;
    1313   }
    1314 
    1315 
    1316   /**
    1317    * Checks if a string is found as option value in an option list.
    1318    *
    1319    * @param optionList List<Option> Option list of options.
    1320    * @param item String String to look for in option values.
    1321    * @return boolean True if item found as option value, else false.
    1322    */
    1323   private boolean itemInOptionList(List<Option> optionList, String item)
    1324   {
    1325     boolean isFound = false;
    1326     // Check if item if found as option value in option list
    1327     if (optionList != null)
    1328     {
    1329       for (int i = 0; i < optionList.size(); i++)
    1330       {
    1331         if (optionList.get(i) != null)
    1332         {
    1333           if (optionList.get(i).getValue().equals(item))
    1334           {
    1335             isFound = true;
    1336             break;
    1337           }
    1338         }
    1339       }
    1340     }
    1341     return isFound;
    1342   }
    1343 
    1344 
    1345   /**
    1346    * Checks if all strings in input list are found as option values in an
    1347    * option list.
    1348    *
    1349    * @param optionList List<Option> Option list of options.
    1350    * @param itemList List<String> List with strings to look for in option
    1351    *        values.
    1352    * @return boolean True if all items found as option values, else false.
    1353    */
    1354   private boolean allItemsInOptionList(List<Option> optionList,
    1355       List<String> itemList)
    1356   {
    1357     // Check if all items are found among option values
    1358     if (itemList != null)
    1359     {
    1360       for (int j = 0; j < itemList.size(); j++)
    1361       {
    1362         if (itemList.get(j) != null)
    1363         {
    1364           // Check if item is found among option values
    1365           String item = itemList.get(j);
    1366           boolean isFound = false;
    1367           if (optionList != null)
    1368           {
    1369             for (int i = 0; i < optionList.size(); i++)
    1370             {
    1371               if (optionList.get(i) != null)
    1372               {
    1373                 if (optionList.get(i).getValue().equals(item))
    1374                 {
    1375                   isFound = true;
    1376                 }
    1377               }
    1378             }
    1379           }
    1380           // Return if item was not found among option values
    1381           if (!isFound)
    1382           {
    1383             log
    1384               .debug("j = " + j + " item = \"" + item + "\" isFound = " + isFound + " - return false");
    1385             return false;
    1386           }
    1387         }
    1388       }
    1389     }
    1390     return true;
    1391   }
    1392 
    1393 
    1394   /**
    1395    * Converts a list String to a list with String elements. If the list string
    1396    * contains two delimiter strings directly after each other, an empty string
    1397    * element will be added to the list in the corresponding place. Example:
    1398    * List string "one, two, three" will be converted to a list with the three
    1399    * String elements "one", "two", and "three" using delimiter regular
    1400    * expression ",\\ ".
    1401    *
    1402    * @param listString String A string with a list
    1403    * @param delimiterRegex String A regular expression for the delimiter
    1404    *        between list elements
    1405    * @return List<String> A list of String elements
    1406    */
    1407   private List<String> listStringToStringList(String listString,
    1408       String delimiterRegex)
    1409   {
    1410     List<String> stringList = null;
    1411     if (listString != null)
    1412     {
    1413       stringList = new ArrayList<String>(0);
    1414       for (String part : listString.split(delimiterRegex, -1))
    1415       {
    1416         // Add list part if not already in list
    1417         if (part != null && !stringList.contains(part))
    1418         {
    1419           stringList.add(part);
    1420         }
    1421       }
    1422     }
    1423     return stringList;
    1424   }
    1425 
    1426 
    1427   /**
    1428    * Converts a list of alternating key and value strings
    1429    * into a list of options.
    1430    *
    1431    * @param stringList List<String> A list of alternating key and value strings.
    1432    * @return List<Option> A list of options
    1433    */
    1434   private List<Option> stringListToOptionList(List<String> stringList)
    1435   {
    1436     List<Option> optionList = new ArrayList<Option>(0);
    1437     for (int i = 0; i < stringList.size(); i = i + 2)
    1438     {
    1439       String key = stringList.get(i);
    1440       String value = stringList.get(i + 1);
    1441       /*
    1442        * Note that the option "value" corresponds
    1443        * to the "key" in the key-value string pair,
    1444        * while the option "content" corresponds
    1445        * to the "value" in the key-value string pair.
    1446        */
    1447       Option option = new Option(key, value);
    1448       optionList.add(option);
    1449     }
    1450     return optionList;
    1451   }
    1452 
    1453 
    1454   /**
    1455    * Lists debug output of all option keys and values in an option list.
    1456    *
    1457    * @param optionListName String Name of option list
    1458    * @param optionList List<Option> Option list of options.
    1459    */
    1460   private void debugOptionList(String optionListName, List<Option> optionList)
    1461   {
    1462     if (optionList != null)
    1463     {
    1464       log.debug("" + optionListName + ": size = " + optionList.size());
    1465       for (int i = 0; i < optionList.size(); i++)
    1466       {
    1467         if (optionList.get(i) != null)
    1468         {
    1469           log.debug("" + optionListName + ": (" + i + ") \"" + optionList.get(i).getContent() + "\" -> \"" + optionList.get(i).getValue() + "\"");
    1470         }
    1471       }
    1472     }
    1473     else
    1474     {
    1475       log.debug("" + optionListName + ": option list == null");
    1476     }
    1477   }
    1478 
    1479  
    14801122  /**
    14811123   * Creates a single choice select box
Note: See TracChangeset for help on using the changeset viewer.