3700 |
07 May 10 |
fredrik |
1 |
package satoshi; |
3700 |
07 May 10 |
fredrik |
2 |
|
3700 |
07 May 10 |
fredrik |
3 |
import org.proteios.ActionLink; |
3700 |
07 May 10 |
fredrik |
4 |
import org.proteios.Context; |
3700 |
07 May 10 |
fredrik |
5 |
import org.proteios.ContextEnabled; |
3779 |
18 Aug 10 |
fredrik |
6 |
import org.proteios.TableToolbarContext; |
3700 |
07 May 10 |
fredrik |
7 |
import org.proteios.action.ProteiosAction; |
3779 |
18 Aug 10 |
fredrik |
8 |
import org.proteios.core.Hit; |
3700 |
07 May 10 |
fredrik |
9 |
import org.proteios.gui.Title; |
3700 |
07 May 10 |
fredrik |
10 |
import org.proteios.gui.Toolbar; |
3700 |
07 May 10 |
fredrik |
11 |
import org.proteios.gui.form.Checkbox; |
3700 |
07 May 10 |
fredrik |
12 |
import org.proteios.gui.form.Fieldset; |
3700 |
07 May 10 |
fredrik |
13 |
import org.proteios.gui.form.Form; |
3700 |
07 May 10 |
fredrik |
14 |
import org.proteios.gui.form.TextField; |
3700 |
07 May 10 |
fredrik |
15 |
import org.proteios.gui.layout.RowLayout; |
3700 |
07 May 10 |
fredrik |
16 |
|
3700 |
07 May 10 |
fredrik |
17 |
import se.lu.thep.waf.ActionException; |
3700 |
07 May 10 |
fredrik |
18 |
import se.lu.thep.waf.constraints.InvalidParameterValue; |
3700 |
07 May 10 |
fredrik |
19 |
import se.lu.thep.waf.constraints.VBoolean; |
3700 |
07 May 10 |
fredrik |
20 |
import se.lu.thep.waf.constraints.VFloat; |
3700 |
07 May 10 |
fredrik |
21 |
import se.lu.thep.waf.constraints.VString; |
3700 |
07 May 10 |
fredrik |
22 |
|
3700 |
07 May 10 |
fredrik |
23 |
import java.util.ArrayList; |
3700 |
07 May 10 |
fredrik |
24 |
import java.util.List; |
3700 |
07 May 10 |
fredrik |
25 |
|
3700 |
07 May 10 |
fredrik |
26 |
/** |
3702 |
10 May 10 |
fredrik |
* Form |
3700 |
07 May 10 |
fredrik |
28 |
* |
3700 |
07 May 10 |
fredrik |
* @author satoshi |
3700 |
07 May 10 |
fredrik |
30 |
*/ |
3700 |
07 May 10 |
fredrik |
31 |
public class LibraryExportForm |
3700 |
07 May 10 |
fredrik |
32 |
extends ProteiosAction<LibraryExportForm> |
3700 |
07 May 10 |
fredrik |
33 |
implements ContextEnabled |
3700 |
07 May 10 |
fredrik |
34 |
{ |
3700 |
07 May 10 |
fredrik |
35 |
/** |
3700 |
07 May 10 |
fredrik |
* The prefix added to each file that is imported, 1-12 characters long. |
3700 |
07 May 10 |
fredrik |
37 |
*/ |
4264 |
26 Oct 11 |
fredrik |
38 |
public static final VFloat FDRCUTOFF = new VFloat("fdrCutOff", 0f, 1f); |
4264 |
26 Oct 11 |
fredrik |
39 |
public static final VString OUTFILENAME = new VString("filename", 1, 100, |
4264 |
26 Oct 11 |
fredrik |
40 |
true); |
4264 |
26 Oct 11 |
fredrik |
41 |
public static final VString OUTFILENAME2 = new VString("filename2", 1, 100, |
4264 |
26 Oct 11 |
fredrik |
42 |
true); |
4264 |
26 Oct 11 |
fredrik |
43 |
public static final VBoolean SSLFORMAT = new VBoolean("sslON", false); |
3700 |
07 May 10 |
fredrik |
44 |
public static final VBoolean MSPFORMAT = new VBoolean("mspON", false); |
4545 |
26 Feb 14 |
fredrik |
45 |
public static final VBoolean EVALUE = new VBoolean("evalueON", false); |
4545 |
26 Feb 14 |
fredrik |
46 |
public static final VFloat FRAGMENTTOL = new VFloat("fragTol", 0f, 1f); |
4264 |
26 Oct 11 |
fredrik |
47 |
|
4264 |
26 Oct 11 |
fredrik |
48 |
|
3700 |
07 May 10 |
fredrik |
49 |
@Override |
3700 |
07 May 10 |
fredrik |
50 |
protected void runMe() |
3700 |
07 May 10 |
fredrik |
51 |
throws ActionException, InvalidParameterValue |
3700 |
07 May 10 |
fredrik |
52 |
{ |
4264 |
26 Oct 11 |
fredrik |
53 |
Form form = new Form("exportform"); |
4264 |
26 Oct 11 |
fredrik |
54 |
Fieldset fieldSet = new Fieldset(); |
4264 |
26 Oct 11 |
fredrik |
55 |
form.addFieldset(fieldSet); |
4264 |
26 Oct 11 |
fredrik |
56 |
fieldSet.setTitle(new Title("Export settings")); |
4264 |
26 Oct 11 |
fredrik |
57 |
/* |
4264 |
26 Oct 11 |
fredrik |
* Then add an optional parameter. We'll add a string field. This will |
4264 |
26 Oct 11 |
fredrik |
* be the prefix add to each file that has been "imported". 1. FDR |
4264 |
26 Oct 11 |
fredrik |
* cutoff 2. export file name |
4264 |
26 Oct 11 |
fredrik |
61 |
*/ |
4264 |
26 Oct 11 |
fredrik |
62 |
TextField<String> fdrCutOff = new TextField<String>(FDRCUTOFF); |
4264 |
26 Oct 11 |
fredrik |
63 |
fdrCutOff.setLabel(getLocale().get("FDR cutoff")); |
4264 |
26 Oct 11 |
fredrik |
64 |
fdrCutOff.setValue("0.01"); |
4264 |
26 Oct 11 |
fredrik |
65 |
fieldSet.add(fdrCutOff); |
3700 |
07 May 10 |
fredrik |
66 |
|
4545 |
26 Feb 14 |
fredrik |
67 |
Checkbox<VBoolean> eON = new Checkbox<VBoolean>(EVALUE); |
4545 |
26 Feb 14 |
fredrik |
68 |
eON.setValue("true"); |
4545 |
26 Feb 14 |
fredrik |
69 |
eON.isChecked(false); |
4545 |
26 Feb 14 |
fredrik |
70 |
eON.setLabel(getLocale().get("E-value")); |
4545 |
26 Feb 14 |
fredrik |
71 |
eON.setHelp("E-value instead of FDR cutoff"); |
4545 |
26 Feb 14 |
fredrik |
72 |
fieldSet.add(eON); |
4545 |
26 Feb 14 |
fredrik |
73 |
|
4264 |
26 Oct 11 |
fredrik |
74 |
TextField<String> filename = new TextField<String>(OUTFILENAME); |
4264 |
26 Oct 11 |
fredrik |
75 |
filename.setLabel(getLocale().get(".ssl file name")); |
4264 |
26 Oct 11 |
fredrik |
76 |
filename.setValue("spectrum_library.ssl"); |
4264 |
26 Oct 11 |
fredrik |
77 |
fieldSet.add(filename); |
3700 |
07 May 10 |
fredrik |
78 |
|
4264 |
26 Oct 11 |
fredrik |
79 |
TextField<String> filename2 = new TextField<String>(OUTFILENAME2); |
4300 |
13 Mar 12 |
fredrik |
80 |
filename2.setValue("spectrum_library.msp"); |
4264 |
26 Oct 11 |
fredrik |
81 |
filename2.setLabel(getLocale().get(".ms2 or .msp file name")); |
4264 |
26 Oct 11 |
fredrik |
82 |
fieldSet.add(filename2); |
3700 |
07 May 10 |
fredrik |
83 |
|
4264 |
26 Oct 11 |
fredrik |
84 |
Checkbox<VBoolean> mgfON = new Checkbox<VBoolean>(SSLFORMAT); |
4264 |
26 Oct 11 |
fredrik |
85 |
mgfON.setValue("true"); // default check value |
4264 |
26 Oct 11 |
fredrik |
86 |
mgfON.isChecked(false); // default check status |
4264 |
26 Oct 11 |
fredrik |
87 |
mgfON.setLabel(getLocale().get(".ssl format as output")); |
4264 |
26 Oct 11 |
fredrik |
88 |
fieldSet.add(mgfON); |
3700 |
07 May 10 |
fredrik |
89 |
|
4264 |
26 Oct 11 |
fredrik |
90 |
Checkbox<VBoolean> mspON = new Checkbox<VBoolean>(MSPFORMAT); |
4264 |
26 Oct 11 |
fredrik |
91 |
mspON.setValue("true"); |
4264 |
26 Oct 11 |
fredrik |
92 |
mspON.isChecked(true); |
4264 |
26 Oct 11 |
fredrik |
93 |
mspON.setLabel(getLocale().get(".msp format as output")); |
4264 |
26 Oct 11 |
fredrik |
94 |
fieldSet.add(mspON); |
4545 |
26 Feb 14 |
fredrik |
95 |
|
4545 |
26 Feb 14 |
fredrik |
96 |
TextField<String> fragTolF = new TextField<String>(FRAGMENTTOL); |
4545 |
26 Feb 14 |
fredrik |
97 |
fragTolF.setLabel(getLocale().get("Fragment m/z tolerance")); |
4545 |
26 Feb 14 |
fredrik |
98 |
fragTolF.setValue("0.5"); |
4545 |
26 Feb 14 |
fredrik |
99 |
fieldSet.add(fragTolF); |
4264 |
26 Oct 11 |
fredrik |
100 |
|
4264 |
26 Oct 11 |
fredrik |
101 |
/* |
4264 |
26 Oct 11 |
fredrik |
* Add the toolbar with one button labeled 'Next' to the form. |
4264 |
26 Oct 11 |
fredrik |
103 |
*/ |
4264 |
26 Oct 11 |
fredrik |
104 |
Toolbar toolbar = new Toolbar(); |
4264 |
26 Oct 11 |
fredrik |
105 |
ActionLink next = getActionFactory().getActionLink( |
4264 |
26 Oct 11 |
fredrik |
106 |
CreateLibraryExportJob.class, getLocale().get("Execute")); |
4264 |
26 Oct 11 |
fredrik |
107 |
toolbar.add(next); |
4264 |
26 Oct 11 |
fredrik |
108 |
form.setToolbar(toolbar); |
4264 |
26 Oct 11 |
fredrik |
109 |
/* |
4264 |
26 Oct 11 |
fredrik |
* Build and set the layout used to display our form necessary for |
4264 |
26 Oct 11 |
fredrik |
* creating a next page |
4264 |
26 Oct 11 |
fredrik |
112 |
*/ |
4264 |
26 Oct 11 |
fredrik |
113 |
RowLayout layout = getLayoutFactory().getRowLayout(); |
4264 |
26 Oct 11 |
fredrik |
114 |
layout.add(form); |
4264 |
26 Oct 11 |
fredrik |
115 |
setLayout(layout); |
4264 |
26 Oct 11 |
fredrik |
116 |
} |
4264 |
26 Oct 11 |
fredrik |
117 |
|
4264 |
26 Oct 11 |
fredrik |
118 |
// } |
4264 |
26 Oct 11 |
fredrik |
119 |
|
3779 |
18 Aug 10 |
fredrik |
120 |
private static List<Context> contexts = new ArrayList<Context>(1); |
3779 |
18 Aug 10 |
fredrik |
121 |
static |
3779 |
18 Aug 10 |
fredrik |
122 |
{ |
3779 |
18 Aug 10 |
fredrik |
123 |
TableToolbarContext btn = new TableToolbarContext("libraryexport", |
3779 |
18 Aug 10 |
fredrik |
124 |
"Library export", LibraryExportForm.class, Hit.class); |
3779 |
18 Aug 10 |
fredrik |
125 |
contexts.add(btn); |
3779 |
18 Aug 10 |
fredrik |
126 |
} |
3779 |
18 Aug 10 |
fredrik |
127 |
|
3779 |
18 Aug 10 |
fredrik |
128 |
|
3700 |
07 May 10 |
fredrik |
129 |
public List<Context> listContexts() |
3700 |
07 May 10 |
fredrik |
130 |
{ |
3700 |
07 May 10 |
fredrik |
131 |
return contexts; |
3700 |
07 May 10 |
fredrik |
132 |
} |
3779 |
18 Aug 10 |
fredrik |
133 |
|
3700 |
07 May 10 |
fredrik |
134 |
} |