1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.ws.jws2; |
22 |
|
|
23 |
|
import java.util.Locale; |
24 |
|
|
25 |
|
import jalview.api.AlignCalcWorkerI; |
26 |
|
import jalview.gui.AlignFrame; |
27 |
|
import jalview.gui.Desktop; |
28 |
|
import jalview.gui.JvSwingUtils; |
29 |
|
import jalview.util.MessageManager; |
30 |
|
import jalview.ws.jws2.dm.AAConSettings; |
31 |
|
import jalview.ws.jws2.jabaws2.Jws2Instance; |
32 |
|
import jalview.ws.params.WsParamSetI; |
33 |
|
import jalview.ws.uimodel.AlignAnalysisUIText; |
34 |
|
|
35 |
|
import java.awt.event.ActionEvent; |
36 |
|
import java.awt.event.ActionListener; |
37 |
|
import java.util.List; |
38 |
|
|
39 |
|
import javax.swing.JMenu; |
40 |
|
import javax.swing.JMenuItem; |
41 |
|
|
42 |
|
|
43 |
|
@author |
44 |
|
|
45 |
|
|
|
|
| 29% |
Uncovered Elements: 66 (93) |
Complexity: 24 |
Complexity Density: 0.4 |
|
46 |
|
public class SequenceAnnotationWSClient extends Jws2Client |
47 |
|
{ |
48 |
|
|
49 |
|
|
50 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
51 |
240 |
public SequenceAnnotationWSClient()... |
52 |
|
{ |
53 |
|
|
54 |
|
} |
55 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
56 |
0 |
public SequenceAnnotationWSClient(final Jws2Instance sh,... |
57 |
|
AlignFrame alignFrame, WsParamSetI preset, boolean editParams) |
58 |
|
{ |
59 |
0 |
super(alignFrame, preset, null); |
60 |
0 |
initSequenceAnnotationWSClient(sh, alignFrame, preset, editParams); |
61 |
|
} |
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
|
|
|
| 0% |
Uncovered Elements: 40 (40) |
Complexity: 10 |
Complexity Density: 0.38 |
|
66 |
0 |
public void initSequenceAnnotationWSClient(final Jws2Instance sh,... |
67 |
|
AlignFrame alignFrame, WsParamSetI preset, boolean editParams) |
68 |
|
{ |
69 |
|
|
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
|
74 |
|
|
75 |
|
|
76 |
|
|
77 |
|
|
78 |
0 |
AlignAnalysisUIText aaui = sh.getAlignAnalysisUI(); |
79 |
0 |
if (aaui != null) |
80 |
|
{ |
81 |
0 |
Class clientClass = aaui.getClient(); |
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
|
86 |
0 |
List<AlignCalcWorkerI> clnts = alignFrame.getViewport() |
87 |
|
.getCalcManager().getRegisteredWorkersOfClass(clientClass); |
88 |
0 |
AbstractJabaCalcWorker worker; |
89 |
0 |
if (clnts == null || clnts.size() == 0) |
90 |
|
{ |
91 |
0 |
if (!processParams(sh, editParams)) |
92 |
|
{ |
93 |
0 |
return; |
94 |
|
} |
95 |
0 |
try |
96 |
|
{ |
97 |
0 |
worker = (AbstractJabaCalcWorker) (clientClass |
98 |
|
.getConstructor(new Class[] |
99 |
|
{ Jws2Instance.class, AlignFrame.class, WsParamSetI.class, |
100 |
|
List.class }) |
101 |
|
.newInstance(new Object[] |
102 |
|
{ sh, alignFrame, this.preset, paramset })); |
103 |
|
} catch (Exception x) |
104 |
|
{ |
105 |
0 |
x.printStackTrace(); |
106 |
0 |
throw new Error( |
107 |
|
MessageManager.getString("error.implementation_error"), |
108 |
|
x); |
109 |
|
} |
110 |
0 |
alignFrame.getViewport().getCalcManager().registerWorker(worker); |
111 |
0 |
alignFrame.getViewport().getCalcManager().startWorker(worker); |
112 |
|
|
113 |
|
} |
114 |
|
else |
115 |
|
{ |
116 |
0 |
worker = (AbstractJabaCalcWorker) clnts.get(0); |
117 |
0 |
if (editParams) |
118 |
|
{ |
119 |
0 |
paramset = worker.getArguments(); |
120 |
0 |
preset = worker.getPreset(); |
121 |
|
} |
122 |
|
|
123 |
0 |
if (!processParams(sh, editParams, true)) |
124 |
|
{ |
125 |
0 |
return; |
126 |
|
} |
127 |
|
|
128 |
|
|
129 |
0 |
alignFrame.getViewport().getCalcManager().enableWorker(worker); |
130 |
0 |
worker.updateParameters(this.preset, paramset); |
131 |
|
} |
132 |
|
} |
133 |
0 |
if (sh.action.toLowerCase(Locale.ROOT).contains("disorder")) |
134 |
|
{ |
135 |
|
|
136 |
|
|
137 |
0 |
if (!processParams(sh, editParams)) |
138 |
|
{ |
139 |
0 |
return; |
140 |
|
} |
141 |
|
|
142 |
0 |
alignFrame.getViewport().getCalcManager().startWorker( |
143 |
|
new AADisorderClient(sh, alignFrame, preset, paramset)); |
144 |
|
} |
145 |
|
} |
146 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
147 |
0 |
public SequenceAnnotationWSClient(AAConSettings fave,... |
148 |
|
AlignFrame alignFrame, boolean b) |
149 |
|
{ |
150 |
0 |
super(alignFrame, fave.getPreset(), fave.getJobArgset()); |
151 |
0 |
initSequenceAnnotationWSClient(fave.getService(), alignFrame, |
152 |
|
fave.getPreset(), b); |
153 |
|
} |
154 |
|
|
155 |
|
|
156 |
|
|
157 |
|
|
158 |
|
@see |
159 |
|
|
160 |
|
|
|
|
| 69.4% |
Uncovered Elements: 11 (36) |
Complexity: 7 |
Complexity Density: 0.27 |
|
161 |
240 |
public void attachWSMenuEntry(JMenu wsmenu, final Jws2Instance service,... |
162 |
|
final AlignFrame alignFrame) |
163 |
|
{ |
164 |
234 |
if (registerAAConWSInstance(wsmenu, service, alignFrame)) |
165 |
|
{ |
166 |
|
|
167 |
81 |
return; |
168 |
|
} |
169 |
153 |
boolean hasparams = service.hasParameters(); |
170 |
|
|
171 |
153 |
String calcName = service.serviceType.substring(0, |
172 |
|
service.serviceType.length() - 2); |
173 |
|
|
174 |
153 |
JMenuItem annotservice = new JMenuItem(MessageManager.formatMessage( |
175 |
|
"label.calcname_with_default_settings", new String[] |
176 |
|
{ calcName })); |
177 |
153 |
annotservice.addActionListener(new ActionListener() |
178 |
|
{ |
179 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
180 |
0 |
@Override... |
181 |
|
public void actionPerformed(ActionEvent e) |
182 |
|
{ |
183 |
0 |
new SequenceAnnotationWSClient(service, alignFrame, null, false); |
184 |
|
} |
185 |
|
}); |
186 |
153 |
wsmenu.add(annotservice); |
187 |
153 |
if (hasparams) |
188 |
|
{ |
189 |
|
|
190 |
|
|
191 |
37 |
annotservice = new JMenuItem( |
192 |
|
MessageManager.getString("label.edit_settings_and_run")); |
193 |
37 |
annotservice.setToolTipText(MessageManager.getString( |
194 |
|
"label.view_and_change_parameters_before_running_calculation")); |
195 |
|
|
196 |
37 |
annotservice.addActionListener(new ActionListener() |
197 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
198 |
0 |
public void actionPerformed(ActionEvent e)... |
199 |
|
{ |
200 |
0 |
new SequenceAnnotationWSClient(service, alignFrame, null, true); |
201 |
|
} |
202 |
|
}); |
203 |
37 |
wsmenu.add(annotservice); |
204 |
37 |
List<WsParamSetI> presets = service.getParamStore().getPresets(); |
205 |
37 |
if (presets != null && presets.size() > 0) |
206 |
|
{ |
207 |
0 |
JMenu presetlist = new JMenu(MessageManager |
208 |
|
.formatMessage("label.run_with_preset", new String[] |
209 |
|
{ calcName })); |
210 |
|
|
211 |
0 |
for (final WsParamSetI preset : presets) |
212 |
|
{ |
213 |
0 |
final JMenuItem methodR = new JMenuItem(preset.getName()); |
214 |
0 |
methodR.setToolTipText(JvSwingUtils.wrapTooltip(true, "<strong>" |
215 |
0 |
+ (preset.isModifiable() |
216 |
|
? MessageManager.getString("label.user_preset") |
217 |
|
: MessageManager |
218 |
|
.getString("label.service_preset")) |
219 |
|
+ "</strong><br/>" + preset.getDescription())); |
220 |
0 |
methodR.addActionListener(new ActionListener() |
221 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
222 |
0 |
public void actionPerformed(ActionEvent e)... |
223 |
|
{ |
224 |
0 |
new SequenceAnnotationWSClient(service, alignFrame, preset, |
225 |
|
false); |
226 |
|
} |
227 |
|
|
228 |
|
}); |
229 |
0 |
presetlist.add(methodR); |
230 |
|
} |
231 |
0 |
wsmenu.add(presetlist); |
232 |
|
} |
233 |
|
|
234 |
|
} |
235 |
|
else |
236 |
|
{ |
237 |
116 |
annotservice = new JMenuItem( |
238 |
|
MessageManager.getString("label.view_documentation")); |
239 |
116 |
if (service.docUrl != null) |
240 |
|
{ |
241 |
116 |
annotservice.addActionListener(new ActionListener() |
242 |
|
{ |
243 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
244 |
0 |
@Override... |
245 |
|
public void actionPerformed(ActionEvent arg0) |
246 |
|
{ |
247 |
0 |
Desktop.instance.showUrl(service.docUrl); |
248 |
|
} |
249 |
|
}); |
250 |
116 |
annotservice.setToolTipText( |
251 |
|
JvSwingUtils.wrapTooltip(true, MessageManager.formatMessage( |
252 |
|
"label.view_service_doc_url", new String[] |
253 |
|
{ service.docUrl, service.docUrl }))); |
254 |
116 |
wsmenu.add(annotservice); |
255 |
|
} |
256 |
|
} |
257 |
|
} |
258 |
|
} |