Changeset 3813


Ignore:
Timestamp:
Sep 2, 2010, 4:57:19 PM (13 years ago)
Author:
Gregory Vincic
Message:

Refs #698. Removed getCombineHitsForm from FormFactory?. Adding several fields and checkboxes related to that form.

Location:
trunk/client/servlet/src/org/proteios
Files:
11 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/client/servlet/src/org/proteios/action/hit/CombineHits.java

    r3267 r3813  
    4646import org.proteios.core.query.Hql;
    4747import org.proteios.core.query.Restrictions;
    48 import org.proteios.gui.form.FormFactory;
     48import org.proteios.gui.form.*;
    4949import se.lu.thep.waf.ActionException;
    5050import se.lu.thep.waf.constraints.InvalidParameterValue;
     
    6161    extends ProteiosAction<CombineHits>
    6262{
    63   public static final VString VCOMBINE_HITS_SCORE_TYPE = new VString("CombineHitsScoreType", 0,
    64     255, false);
    65   public static final VString VCOMBINE_HITS_SCORE_TYPE_SETTING = new VString("CombineHitsScoreTypeSetting", 0,
    66     32, false);
    67   public static final VBoolean VKEEPRANDOM = new VBoolean("isKeepRandom", false);
     63  public static final VString VCOMBINE_HITS_SCORE_TYPE = CombineHitScoreTypeField.VPARAM;
     64  public static final VString VCOMBINE_HITS_SCORE_TYPE_SETTING = CombineHitScoreTypeSettingField.VPARAM;
     65  public static final VBoolean VKEEPRANDOM = KeepRandomCheckbox.VPARAM;
    6866
    6967  /*
  • trunk/client/servlet/src/org/proteios/action/hit/CombineHitsStep1.java

    r3318 r3813  
    3939import org.proteios.gui.TitledWindow;
    4040import org.proteios.gui.Toolbar;
    41 import org.proteios.gui.form.Form;
     41import org.proteios.gui.form.*;
    4242import org.proteios.gui.layout.RowLayout;
    4343import org.proteios.gui.ColumnContainer;
     
    8080    dc = newDbControl();
    8181    project = isProjectActive(dc);
    82     form = getFormFactory().getCombineHitsForm(project);
     82    form = new CombineHitsForm(dc, project);
    8383  title = new Title("CombinedHitsReport");
    8484    instructionArea = new TitledWindow();
  • trunk/client/servlet/src/org/proteios/gui/form/FormFactory.java

    r3812 r3813  
    232232  public static final VString VREQUIRED_FILENAME = new VString("fileName", 1,
    233233    255, true);
    234   public static final VString VFWDACTION = new VString("forwardActionId", 1,
    235     255, false);
     234  public static final VString VFWDACTION = ForwardField.VPARAM;
    236235  public static final VString VFWD2ACTION = new VString("forward2ActionId",
    237236    1, 255, false);
     
    287286  public static final VFloat VUSEDQUANTITYINMICROLITERS = new VFloat(
    288287    "UsedQuantityInMicroLiters", true);
    289   public static final VFloat VFDR = new VFloat("falseDiscoveryRate", true);
     288  public static final VFloat VFDR = FDRField.VPARAM;
    290289  public static final VBoolean VPEPTIDECOMPARE = new VBoolean(
    291290    "isPeptideCompare", false);
     
    849848    fs.add(typeF);
    850849    // Forward action field
    851     TextField<String> fwdactionF = newForwardField();
     850    TextField<String> fwdactionF = new ForwardField();
    852851    fs.add(fwdactionF);
    853852    // Select field
     
    882881    }
    883882    return form;
    884   }
    885 
    886 
    887   /**
    888    * @return Hidden <code>TextField<String></code> using the valid
    889    *         parameter {@link #VFWDACTION}.
    890    */
    891   private TextField<String> newForwardField()
    892   {
    893     TextField<String> field = new TextField<String>(VFWDACTION)
    894       .setHidden(true);
    895     return field;
    896883  }
    897884
     
    24052392    {
    24062393      //
    2407       TextField<String> forwardF = newForwardField();
     2394      TextField<String> forwardF = new ForwardField();
    24082395      forwardF.setValue(actionFactory
    24092396        .getId(CreateProteinAssemblyJob.class));
    24102397      properties.add(forwardF);
    24112398      //
    2412       properties.add(selectExternalGelId(dc, project));
     2399      properties.add(new ExternalGelIdSelect(dc, project));
    24132400      properties.add(selectLocalSampleId(dc, project));
    24142401      TextField<String> nameF = new TextField<String>(VFILENAME);
     
    24212408
    24222409 // Cleaning up from here
    2423   public Form getCombineHitsForm(Project project)
    2424   {
    2425     DbControl dc = project.getDbControl();
    2426     Form form = new Form("combineHitsForm");
    2427     if (dc != null && dc.isConnected())
    2428     {
    2429       //
    2430       Fieldset properties = new Fieldset();
    2431       properties.getLegendTitle().setTitle("SettingsForReport");
    2432       form.addFieldset(properties);
    2433       //
    2434       TextField<String> forwardF = newForwardField();
    2435       forwardF.setValue(actionFactory.getId(CombineHits.class));
    2436       properties.add(forwardF);
    2437       //
    2438       properties.add(selectExternalGelId(dc, project));
    2439       properties.add(selectLocalSampleIdWithAllOption(dc, project));
    2440       TextField<Float> fdrF = new TextField<Float>(VFDR);
    2441       fdrF.setValue(new Float(0.01));
    2442       fdrF.setLabel("AllowedFDR");
    2443       properties.add(fdrF);
    2444       Checkbox<VBoolean> isProteinCB = new Checkbox<VBoolean>(
    2445         VPEPTIDECOMPARE);
    2446       isProteinCB.setLabel("ComparePeptides");
    2447       isProteinCB.setValue("true");
    2448       properties.add(isProteinCB);
    2449       TextField<String> randomString = new TextField<String>(
    2450         VRANDOMSTRING);
    2451       randomString.setValue("IPR");
    2452       randomString.setLabel("RandomHitsPrefix");
    2453       properties.add(randomString);
    2454       Checkbox<VBoolean> keepRandomCB = new Checkbox<VBoolean>(
    2455         CombineHits.VKEEPRANDOM);
    2456       keepRandomCB.setLabel("KeepRandom");
    2457       keepRandomCB.setValue("true");
    2458       properties.add(keepRandomCB);
    2459       //
    2460       // Score Type field set
    2461       Fieldset scoreTypeFS = new Fieldset();
    2462       scoreTypeFS.getLegendTitle().setTitle("ScoreTypeSettings");
    2463       form.addFieldset(scoreTypeFS);
    2464       //
    2465       // Get score types from Hit query
    2466       List<String> scoreTypeList = Hit.getUniqueScoreTypes(project, dc);
    2467       log.debug("scoreTypeList = " + scoreTypeList);
    2468       List<String> scoreTypeUsedList = new ArrayList<String>();
    2469       //
    2470       // Add score type settings select boxes
    2471       if (scoreTypeList != null && scoreTypeList.size() > 0)
    2472       {
    2473         for (String scoreType : scoreTypeList)
    2474         {
    2475           // Beware of null strings in list
    2476           if (scoreType == null)
    2477           {
    2478             continue;
    2479           }
    2480           // Skip "Proteios Protein" score types, as these hits are
    2481           // already combined
    2482           if (scoreType.equals("Proteios Protein"))
    2483           {
    2484             continue;
    2485           }
    2486           // Cut off score type string after space
    2487           log.debug("(1) scoreType = \"" + scoreType + "\"");
    2488           int spaceIndex = scoreType.indexOf(" ");
    2489           if (spaceIndex > 0)
    2490           {
    2491             scoreType = scoreType.substring(0, spaceIndex);
    2492           }
    2493           log.debug("(2) scoreType = \"" + scoreType + "\"");
    2494           // Check that score type not already used
    2495           if (scoreTypeUsedList.contains(scoreType))
    2496           {
    2497             continue;
    2498           }
    2499           else
    2500           {
    2501             // Add score type to used score type list
    2502             scoreTypeUsedList.add(scoreType);
    2503           }
    2504           // Hidden text field for storing score type
    2505           TextField<String> scoreTypeF = newHiddenStringField(CombineHits.VCOMBINE_HITS_SCORE_TYPE);
    2506           scoreTypeF.setValue(scoreType);
    2507           scoreTypeFS.add(scoreTypeF);
    2508           // Combined Hits Score Type select box
    2509           VString validStringParam = CombineHits.VCOMBINE_HITS_SCORE_TYPE_SETTING;
    2510           List<Option> optionList = new ArrayList<Option>();
    2511           optionList.add(new Option("", "Not used"));
    2512           optionList.add(new Option("evalue", "E-value"));
    2513           optionList.add(new Option("score", "Score"));
    2514           // Default is 'E-value', except for Mascot, where 'Score' is
    2515           // used
    2516           String selected = new String("evalue");
    2517           if (scoreType.equals("Mascot"))
    2518           {
    2519             selected = new String("score");
    2520           }
    2521           Select<VString> scoreTypeSelectBox = newStringSelectBox2(
    2522             validStringParam, optionList, selected);
    2523           scoreTypeSelectBox.setLabel(scoreType);
    2524           scoreTypeFS.add(scoreTypeSelectBox);
    2525         }
    2526       }
    2527       //
    2528       // Output field set
    2529       Fieldset outputFS = new Fieldset();
    2530       outputFS.getLegendTitle().setTitle("Output");
    2531       form.addFieldset(outputFS);
    2532       //
    2533       TextField<String> nameF = new TextField<String>(VFILENAME);
    2534       nameF.setValue("CombinedHitsReport.tsv");
    2535       nameF.setLabel("OutputFileName");
    2536       outputFS.add(nameF);
    2537     }
    2538     return form;
    2539   }
    2540 
    25412410
    25422411  public Form getImportHitsForm(Project project)
     
    25512420      form.addFieldset(properties);
    25522421      //
    2553       TextField<String> forwardF = newForwardField();
     2422      TextField<String> forwardF = new ForwardField();
    25542423      forwardF.setValue(actionFactory.getId(ImportHits.class));
    25552424      properties.add(forwardF);
     
    26082477       * selection action called by ImportHitsWizardStep1a.
    26092478       */
    2610       TextField<String> forwardF = newForwardField();
     2479      TextField<String> forwardF = new ForwardField();
    26112480      forwardF
    26122481        .setValue(actionFactory.getId(ImportHitsWizardStep1b.class));
     
    26572526       * selection action called by ImportHitsWizardStep1a.
    26582527       */
    2659       TextField<String> forwardF = newForwardField();
     2528      TextField<String> forwardF = new ForwardField();
    26602529      forwardF
    26612530        .setValue(actionFactory.getId(ImportHitsWizardStep2b.class));
     
    27152584       * selection action called by ImportHitsWizardStep1a.
    27162585       */
    2717       TextField<String> forwardF = newForwardField();
     2586      TextField<String> forwardF = new ForwardField();
    27182587      forwardF
    27192588        .setValue(actionFactory.getId(ImportHitsWizardStep3b.class));
     
    27622631       * selection action called by ImportHitsNonGelWizardStep1a.
    27632632       */
    2764       TextField<String> forwardF = newForwardField();
     2633      TextField<String> forwardF = new ForwardField();
    27652634      forwardF.setValue(actionFactory
    27662635        .getId(ImportHitsNonGelWizardStep1b.class));
     
    28362705       * selection action called by ImportHitsNonGelWizardStep2a.
    28372706       */
    2838       TextField<String> forwardF = newForwardField();
     2707      TextField<String> forwardF = new ForwardField();
    28392708      forwardF.setValue(actionFactory
    28402709        .getId(ImportHitsNonGelWizardStep2b.class));
     
    28772746      noPlateId.setContent("No plate id available");
    28782747      select.addOption(noPlateId);
    2879     }
    2880     return select;
    2881   }
    2882 
    2883 
    2884   private Select<VString> selectExternalGelId(DbControl dc, Project project)
    2885   {
    2886     Select<VString> select = new Select<VString>(VREQUIRED_GELEXTERNALID);
    2887     select.setLabel("GelExternalId");
    2888     if (dc != null && dc.isConnected())
    2889     {
    2890       List<String> gelIdList = Hit.getUniqueGelIds(project, dc);
    2891       /*
    2892        * Add select options for unique gel ids
    2893        */
    2894       for (int i = 0; i < gelIdList.size(); i++)
    2895       {
    2896         // Get plate id
    2897         String gelId = gelIdList.get(i);
    2898         if (gelId != null)
    2899         {
    2900           // Add option for plate id
    2901           Option o = new Option("" + gelId);
    2902           o.setContent(gelId);
    2903           select.addOption(o);
    2904         }
    2905       }
    2906     }
    2907     /*
    2908      * Add dummy option with message if no real options available.
    2909      */
    2910     if (select.getOptions().size() == 0)
    2911     {
    2912       Option noGelId = new Option("0");
    2913       noGelId.setContent("No gel external ID available");
    2914       select.addOption(noGelId);
    29152748    }
    29162749    return select;
     
    35313364    // Hits comparison forward field (hidden)
    35323365    //
    3533     TextField<String> forwardF = newForwardField();
     3366    TextField<String> forwardF = new ForwardField();
    35343367    forwardF.setValue(actionFactory
    35353368      .getId(CreateHitsComparisonReportJob.class));
     
    35713404    if (dc != null && dc.isConnected())
    35723405    {
    3573       prideFilterSettingsFS.add(selectExternalGelId(dc, project));
     3406      prideFilterSettingsFS.add(new ExternalGelIdSelect(dc, project));
    35743407    }
    35753408    //
     
    35853418    prideFilterSettingsFS.add(fdrF);
    35863419    //
    3587     TextField<String> forwardF = newForwardField();
     3420    TextField<String> forwardF = new ForwardField();
    35883421    forwardF.setValue(actionFactory.getId(CreatePrideExportJob.class));
    35893422    prideFilterSettingsFS.add(forwardF);
     
    40643897    fs.add(searchTypeSelectBox);
    40653898    // Hidden text field for forward action id after file selection
    4066     TextField<String> forwardF = newForwardField();
     3899    TextField<String> forwardF = new ForwardField();
    40673900    forwardF.setValue(actionFactory
    40683901      .getId(NewMascotParameterSetStorage.class));
     
    51815014    fs.add(searchSpectrumTypeSelectBox);
    51825015    // Hidden text field for forward action id after file selection
    5183     TextField<String> forwardF = newForwardField();
     5016    TextField<String> forwardF = new ForwardField();
    51845017    forwardF.setValue(actionFactory
    51855018      .getId(NewOMSSAParameterSetStorage.class));
     
    61836016    }
    61846017    // Hidden text field for forward action id after file selection
    6185     TextField<String> forwardF = newForwardField();
     6018    TextField<String> forwardF = new ForwardField();
    61866019    forwardF.setValue(actionFactory
    61876020      .getId(NewXTandemParameterSetStorage.class));
     
    89958828     * Add forward actionId field as first field, for external use.
    89968829     */
    8997     TextField<String> fwdactionF = newForwardField();
     8830    TextField<String> fwdactionF = new ForwardField();
    89988831    mainFS.add(fwdactionF);
    89998832    /*
     
    100369869       * selection action called by MoveFile1.
    100379870       */
    10038       TextField<String> forwardF = newForwardField();
     9871      TextField<String> forwardF = new ForwardField();
    100399872      forwardF.setValue(actionFactory.getId(MoveFile2.class));
    100409873      fs.add(forwardF);
Note: See TracChangeset for help on using the changeset viewer.