1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
|
package jalview.gui; |
23 |
|
|
24 |
|
import jalview.datamodel.AlignmentAnnotation; |
25 |
|
import jalview.datamodel.HiddenColumns; |
26 |
|
import jalview.io.cache.JvCacheableInputBox; |
27 |
|
import jalview.schemes.AnnotationColourGradient; |
28 |
|
import jalview.util.MessageManager; |
29 |
|
import jalview.util.Platform; |
30 |
|
import jalview.viewmodel.annotationfilter.AnnotationFilterParameter; |
31 |
|
|
32 |
|
import java.awt.BorderLayout; |
33 |
|
import java.awt.CardLayout; |
34 |
|
import java.awt.Color; |
35 |
|
import java.awt.Dimension; |
36 |
|
import java.awt.event.ActionEvent; |
37 |
|
import java.awt.event.ActionListener; |
38 |
|
import java.awt.event.FocusAdapter; |
39 |
|
import java.awt.event.FocusEvent; |
40 |
|
import java.awt.event.ItemEvent; |
41 |
|
import java.awt.event.ItemListener; |
42 |
|
import java.awt.event.KeyEvent; |
43 |
|
|
44 |
|
import javax.swing.ButtonGroup; |
45 |
|
import javax.swing.JCheckBox; |
46 |
|
import javax.swing.JComboBox; |
47 |
|
import javax.swing.JInternalFrame; |
48 |
|
import javax.swing.JLayeredPane; |
49 |
|
import javax.swing.JPanel; |
50 |
|
import javax.swing.JRadioButton; |
51 |
|
import javax.swing.border.TitledBorder; |
52 |
|
|
53 |
|
import net.miginfocom.swing.MigLayout; |
54 |
|
|
55 |
|
@SuppressWarnings("serial") |
|
|
| 58.9% |
Uncovered Elements: 109 (265) |
Complexity: 50 |
Complexity Density: 0.26 |
|
56 |
|
public class AnnotationColumnChooser extends AnnotationRowFilter |
57 |
|
implements ItemListener |
58 |
|
{ |
59 |
|
private JPanel switchableViewsPanel = new JPanel(new CardLayout()); |
60 |
|
|
61 |
|
private JPanel annotationComboBoxPanel = new JPanel(); |
62 |
|
|
63 |
|
private StructureFilterPanel gStructureFilterPanel; |
64 |
|
|
65 |
|
private StructureFilterPanel ngStructureFilterPanel; |
66 |
|
|
67 |
|
private StructureFilterPanel currentStructureFilterPanel; |
68 |
|
|
69 |
|
private SearchPanel currentSearchPanel; |
70 |
|
|
71 |
|
private SearchPanel gSearchPanel; |
72 |
|
|
73 |
|
private SearchPanel ngSearchPanel; |
74 |
|
|
75 |
|
private FurtherActionPanel currentFurtherActionPanel; |
76 |
|
|
77 |
|
private FurtherActionPanel gFurtherActionPanel; |
78 |
|
|
79 |
|
private FurtherActionPanel ngFurtherActionPanel; |
80 |
|
|
81 |
|
public static final int ACTION_OPTION_SELECT = 1; |
82 |
|
|
83 |
|
public static int ACTION_OPTION_HIDE = 2; |
84 |
|
|
85 |
|
public static String NO_GRAPH_VIEW = "0"; |
86 |
|
|
87 |
|
public static String GRAPH_VIEW = "1"; |
88 |
|
|
89 |
|
private int actionOption = ACTION_OPTION_SELECT; |
90 |
|
|
91 |
|
private HiddenColumns oldHiddenColumns; |
92 |
|
|
93 |
|
protected static int MIN_WIDTH = (Platform.isJS() ? 370 : 420); |
94 |
|
protected static int MIN_HEIGHT = (Platform.isJS() ? 370 : 430); |
95 |
|
|
|
|
| 71.9% |
Uncovered Elements: 9 (32) |
Complexity: 4 |
Complexity Density: 0.14 |
|
96 |
1 |
public AnnotationColumnChooser(AlignViewport av, final AlignmentPanel ap)... |
97 |
|
{ |
98 |
1 |
super(av, ap); |
99 |
1 |
frame = new JInternalFrame(); |
100 |
1 |
frame.setContentPane(this); |
101 |
1 |
frame.setLayer(JLayeredPane.PALETTE_LAYER); |
102 |
1 |
Desktop.addInternalFrame(frame, |
103 |
|
MessageManager.getString("label.select_by_annotation"), 0, |
104 |
|
0); |
105 |
|
|
106 |
|
|
107 |
1 |
frame.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT)); |
108 |
|
|
109 |
1 |
addSliderChangeListener(); |
110 |
1 |
addSliderMouseListeners(); |
111 |
|
|
112 |
1 |
if (av.getAlignment().getAlignmentAnnotation() == null) |
113 |
|
{ |
114 |
0 |
return; |
115 |
|
} |
116 |
1 |
setOldHiddenColumns(av.getAlignment().getHiddenColumns()); |
117 |
1 |
adjusting = true; |
118 |
|
|
119 |
1 |
setAnnotations(new JComboBox<>(getAnnotationItems(false))); |
120 |
1 |
populateThresholdComboBox(threshold); |
121 |
1 |
AnnotationColumnChooser lastChooser = av |
122 |
|
.getAnnotationColumnSelectionState(); |
123 |
|
|
124 |
1 |
if (lastChooser != null) |
125 |
|
{ |
126 |
0 |
currentSearchPanel = lastChooser.getCurrentSearchPanel(); |
127 |
0 |
currentStructureFilterPanel = lastChooser |
128 |
|
.getCurrentStructureFilterPanel(); |
129 |
0 |
annotations.setSelectedIndex( |
130 |
|
lastChooser.getAnnotations().getSelectedIndex()); |
131 |
0 |
threshold.setSelectedIndex( |
132 |
|
lastChooser.getThreshold().getSelectedIndex()); |
133 |
0 |
actionOption = lastChooser.getActionOption(); |
134 |
0 |
percentThreshold |
135 |
|
.setSelected(lastChooser.percentThreshold.isSelected()); |
136 |
|
} |
137 |
|
|
138 |
1 |
try |
139 |
|
{ |
140 |
1 |
jbInit(); |
141 |
|
} catch (Exception ex) |
142 |
|
{ |
143 |
|
} |
144 |
1 |
adjusting = false; |
145 |
|
|
146 |
1 |
updateView(); |
147 |
1 |
frame.invalidate(); |
148 |
1 |
frame.pack(); |
149 |
|
} |
150 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (48) |
Complexity: 1 |
Complexity Density: 0.02 |
|
151 |
1 |
@Override... |
152 |
|
protected void jbInit() |
153 |
|
{ |
154 |
1 |
super.jbInit(); |
155 |
|
|
156 |
1 |
JPanel thresholdPanel = new JPanel(); |
157 |
1 |
thresholdPanel.setBorder(new TitledBorder( |
158 |
|
MessageManager.getString("label.threshold_filter"))); |
159 |
1 |
thresholdPanel.setBackground(Color.white); |
160 |
1 |
thresholdPanel.setFont(JvSwingUtils.getLabelFont()); |
161 |
1 |
thresholdPanel.setLayout(new MigLayout("", "[left][right]", "[][]") ); |
162 |
|
|
163 |
1 |
percentThreshold.setBackground(Color.white); |
164 |
1 |
percentThreshold.setFont(JvSwingUtils.getLabelFont()); |
165 |
|
|
166 |
1 |
JPanel actionPanel = new JPanel(); |
167 |
1 |
actionPanel.setBackground(Color.white); |
168 |
1 |
actionPanel.setFont(JvSwingUtils.getLabelFont()); |
169 |
|
|
170 |
1 |
JPanel graphFilterView = new JPanel(); |
171 |
1 |
graphFilterView.setLayout(new MigLayout("", "[left][right]", "[][]")); |
172 |
1 |
graphFilterView.setBackground(Color.white); |
173 |
|
|
174 |
1 |
JPanel noGraphFilterView = new JPanel(); |
175 |
1 |
noGraphFilterView.setLayout(new MigLayout("", "[left][right]", "[][]")); |
176 |
1 |
noGraphFilterView.setBackground(Color.white); |
177 |
|
|
178 |
1 |
annotationComboBoxPanel.setBackground(Color.white); |
179 |
1 |
annotationComboBoxPanel.setFont(JvSwingUtils.getLabelFont()); |
180 |
|
|
181 |
1 |
gSearchPanel = new SearchPanel(this); |
182 |
1 |
ngSearchPanel = new SearchPanel(this); |
183 |
1 |
gFurtherActionPanel = new FurtherActionPanel(this); |
184 |
1 |
ngFurtherActionPanel = new FurtherActionPanel(this); |
185 |
1 |
gStructureFilterPanel = new StructureFilterPanel(this); |
186 |
1 |
ngStructureFilterPanel = new StructureFilterPanel(this); |
187 |
|
|
188 |
1 |
thresholdPanel.add(getThreshold()); |
189 |
1 |
thresholdPanel.add(percentThreshold, "wrap"); |
190 |
1 |
thresholdPanel.add(slider, "grow"); |
191 |
1 |
thresholdPanel.add(thresholdValue, "span, wrap"); |
192 |
|
|
193 |
1 |
actionPanel.add(ok); |
194 |
1 |
actionPanel.add(cancel); |
195 |
|
|
196 |
1 |
graphFilterView.add(gSearchPanel, "grow, span, wrap"); |
197 |
1 |
graphFilterView.add(gStructureFilterPanel, "grow, span, wrap"); |
198 |
1 |
graphFilterView.add(thresholdPanel, "grow, span, wrap"); |
199 |
1 |
graphFilterView.add(gFurtherActionPanel); |
200 |
|
|
201 |
1 |
noGraphFilterView.add(ngSearchPanel, "grow, span, wrap"); |
202 |
1 |
noGraphFilterView.add(ngStructureFilterPanel, "grow, span, wrap"); |
203 |
1 |
noGraphFilterView.add(ngFurtherActionPanel); |
204 |
|
|
205 |
1 |
annotationComboBoxPanel.add(getAnnotations()); |
206 |
1 |
switchableViewsPanel.add(noGraphFilterView, |
207 |
|
AnnotationColumnChooser.NO_GRAPH_VIEW); |
208 |
1 |
switchableViewsPanel.add(graphFilterView, |
209 |
|
AnnotationColumnChooser.GRAPH_VIEW); |
210 |
1 |
this.setLayout(new BorderLayout()); |
211 |
1 |
this.add(annotationComboBoxPanel, java.awt.BorderLayout.PAGE_START); |
212 |
1 |
this.add(switchableViewsPanel, java.awt.BorderLayout.CENTER); |
213 |
1 |
this.add(actionPanel, java.awt.BorderLayout.SOUTH); |
214 |
|
|
215 |
1 |
selectedAnnotationChanged(); |
216 |
1 |
updateThresholdPanelToolTip(); |
217 |
1 |
this.validate(); |
218 |
|
} |
219 |
|
|
|
|
| 88.9% |
Uncovered Elements: 1 (9) |
Complexity: 2 |
Complexity Density: 0.29 |
|
220 |
2 |
protected void updateThresholdPanelToolTip()... |
221 |
|
{ |
222 |
2 |
thresholdValue.setToolTipText(""); |
223 |
2 |
slider.setToolTipText(""); |
224 |
|
|
225 |
2 |
String defaultTtip = MessageManager |
226 |
|
.getString("info.change_threshold_mode_to_enable"); |
227 |
|
|
228 |
2 |
String thresh = getThreshold().getSelectedItem().toString(); |
229 |
2 |
if (thresh.equalsIgnoreCase("No Threshold")) |
230 |
|
{ |
231 |
2 |
thresholdValue.setToolTipText(defaultTtip); |
232 |
2 |
slider.setToolTipText(defaultTtip); |
233 |
|
} |
234 |
|
} |
235 |
|
|
|
|
| 81.8% |
Uncovered Elements: 2 (11) |
Complexity: 3 |
Complexity Density: 0.43 |
|
236 |
3 |
@Override... |
237 |
|
protected void reset() |
238 |
|
{ |
239 |
3 |
if (this.getOldHiddenColumns() != null) |
240 |
|
{ |
241 |
3 |
av.getColumnSelection().clear(); |
242 |
|
|
243 |
3 |
if (av.getAnnotationColumnSelectionState() != null) |
244 |
|
{ |
245 |
3 |
HiddenColumns oldHidden = av.getAnnotationColumnSelectionState() |
246 |
|
.getOldHiddenColumns(); |
247 |
3 |
av.getAlignment().setHiddenColumns(oldHidden); |
248 |
|
} |
249 |
3 |
av.sendSelection(); |
250 |
3 |
ap.paintAlignment(true, true); |
251 |
|
} |
252 |
|
} |
253 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
254 |
0 |
@Override... |
255 |
|
public void valueChanged(boolean updateAllAnnotation) |
256 |
|
{ |
257 |
0 |
if (slider.isEnabled()) |
258 |
|
{ |
259 |
0 |
getCurrentAnnotation().threshold.value = getSliderValue(); |
260 |
0 |
updateView(); |
261 |
0 |
propagateSeqAssociatedThreshold(updateAllAnnotation, |
262 |
|
getCurrentAnnotation()); |
263 |
0 |
ap.paintAlignment(false, false); |
264 |
|
} |
265 |
|
} |
266 |
|
|
|
|
| 36% |
Uncovered Elements: 55 (86) |
Complexity: 17 |
Complexity Density: 0.31 |
|
267 |
2 |
@Override... |
268 |
|
public void updateView() |
269 |
|
{ |
270 |
|
|
271 |
2 |
if (adjusting) |
272 |
|
{ |
273 |
1 |
return; |
274 |
|
} |
275 |
|
|
276 |
1 |
AnnotationFilterParameter filterParams = new AnnotationFilterParameter(); |
277 |
|
|
278 |
1 |
setCurrentAnnotation(av.getAlignment() |
279 |
|
.getAlignmentAnnotation()[annmap[getAnnotations() |
280 |
|
.getSelectedIndex()]]); |
281 |
|
|
282 |
1 |
int selectedThresholdItem = getSelectedThresholdItem( |
283 |
|
getThreshold().getSelectedIndex()); |
284 |
|
|
285 |
1 |
slider.setEnabled(true); |
286 |
1 |
thresholdValue.setEnabled(true); |
287 |
1 |
percentThreshold.setEnabled(true); |
288 |
|
|
289 |
1 |
final AlignmentAnnotation currentAnnotation = getCurrentAnnotation(); |
290 |
1 |
if (selectedThresholdItem == AnnotationColourGradient.NO_THRESHOLD) |
291 |
|
{ |
292 |
1 |
slider.setEnabled(false); |
293 |
1 |
thresholdValue.setEnabled(false); |
294 |
1 |
thresholdValue.setText(""); |
295 |
1 |
percentThreshold.setEnabled(false); |
296 |
|
|
297 |
|
} |
298 |
0 |
else if (selectedThresholdItem != AnnotationColourGradient.NO_THRESHOLD) |
299 |
|
{ |
300 |
0 |
if (currentAnnotation.threshold == null) |
301 |
|
{ |
302 |
0 |
currentAnnotation.setThreshold(new jalview.datamodel.GraphLine( |
303 |
|
(currentAnnotation.graphMax |
304 |
|
- currentAnnotation.graphMin) / 2f, |
305 |
|
"Threshold", Color.black)); |
306 |
|
} |
307 |
|
|
308 |
0 |
adjusting = true; |
309 |
|
|
310 |
0 |
setSliderModel(currentAnnotation.graphMin, |
311 |
|
currentAnnotation.graphMax, |
312 |
|
currentAnnotation.threshold.value); |
313 |
|
|
314 |
0 |
setThresholdValueText(); |
315 |
|
|
316 |
0 |
slider.setEnabled(true); |
317 |
0 |
thresholdValue.setEnabled(true); |
318 |
0 |
adjusting = false; |
319 |
|
|
320 |
|
|
321 |
0 |
filterParams.setThresholdType( |
322 |
|
AnnotationFilterParameter.ThresholdType.NO_THRESHOLD); |
323 |
0 |
if (currentAnnotation.isQuantitative()) |
324 |
|
{ |
325 |
0 |
filterParams |
326 |
|
.setThresholdValue(currentAnnotation.threshold.value); |
327 |
|
|
328 |
0 |
if (selectedThresholdItem == AnnotationColourGradient.ABOVE_THRESHOLD) |
329 |
|
{ |
330 |
0 |
filterParams.setThresholdType( |
331 |
|
AnnotationFilterParameter.ThresholdType.ABOVE_THRESHOLD); |
332 |
|
} |
333 |
0 |
else if (selectedThresholdItem == AnnotationColourGradient.BELOW_THRESHOLD) |
334 |
|
{ |
335 |
0 |
filterParams.setThresholdType( |
336 |
|
AnnotationFilterParameter.ThresholdType.BELOW_THRESHOLD); |
337 |
|
} |
338 |
|
} |
339 |
|
} |
340 |
|
|
341 |
1 |
updateThresholdPanelToolTip(); |
342 |
1 |
if (currentStructureFilterPanel != null) |
343 |
|
{ |
344 |
0 |
if (currentStructureFilterPanel.alphaHelix.isSelected()) |
345 |
|
{ |
346 |
0 |
filterParams.setFilterAlphaHelix(true); |
347 |
|
} |
348 |
0 |
if (currentStructureFilterPanel.betaStrand.isSelected()) |
349 |
|
{ |
350 |
0 |
filterParams.setFilterBetaSheet(true); |
351 |
|
} |
352 |
0 |
if (currentStructureFilterPanel.turn.isSelected()) |
353 |
|
{ |
354 |
0 |
filterParams.setFilterTurn(true); |
355 |
|
} |
356 |
|
} |
357 |
|
|
358 |
1 |
if (currentSearchPanel != null) |
359 |
|
{ |
360 |
0 |
if (!currentSearchPanel.searchBox.getUserInput().isEmpty()) |
361 |
|
{ |
362 |
0 |
filterParams.setRegexString( |
363 |
|
currentSearchPanel.searchBox.getUserInput()); |
364 |
0 |
if (currentSearchPanel.displayName.isSelected()) |
365 |
|
{ |
366 |
0 |
filterParams.addRegexSearchField( |
367 |
|
AnnotationFilterParameter.SearchableAnnotationField.DISPLAY_STRING); |
368 |
|
} |
369 |
0 |
if (currentSearchPanel.description.isSelected()) |
370 |
|
{ |
371 |
0 |
filterParams.addRegexSearchField( |
372 |
|
AnnotationFilterParameter.SearchableAnnotationField.DESCRIPTION); |
373 |
|
} |
374 |
|
} |
375 |
|
} |
376 |
|
|
377 |
|
|
378 |
|
|
379 |
|
|
380 |
1 |
av.showAllHiddenColumns(); |
381 |
1 |
av.getColumnSelection().filterAnnotations( |
382 |
|
currentAnnotation.annotations, filterParams); |
383 |
|
|
384 |
1 |
boolean hideCols = getActionOption() == ACTION_OPTION_HIDE; |
385 |
1 |
if (hideCols) |
386 |
|
{ |
387 |
0 |
av.hideSelectedColumns(); |
388 |
|
} |
389 |
1 |
av.sendSelection(); |
390 |
|
|
391 |
1 |
filterParams = null; |
392 |
1 |
av.setAnnotationColumnSelectionState(this); |
393 |
|
|
394 |
1 |
ap.paintAlignment(hideCols, hideCols); |
395 |
|
} |
396 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
397 |
6 |
public HiddenColumns getOldHiddenColumns()... |
398 |
|
{ |
399 |
6 |
return oldHiddenColumns; |
400 |
|
} |
401 |
|
|
|
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 1 |
|
402 |
4 |
public void setOldHiddenColumns(HiddenColumns currentHiddenColumns)... |
403 |
|
{ |
404 |
4 |
if (currentHiddenColumns != null) |
405 |
|
{ |
406 |
4 |
this.oldHiddenColumns = new HiddenColumns(currentHiddenColumns); |
407 |
|
} |
408 |
|
} |
409 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
410 |
0 |
public FurtherActionPanel getCurrentFutherActionPanel()... |
411 |
|
{ |
412 |
0 |
return currentFurtherActionPanel; |
413 |
|
} |
414 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
415 |
0 |
public void setCurrentFutherActionPanel(... |
416 |
|
FurtherActionPanel currentFutherActionPanel) |
417 |
|
{ |
418 |
0 |
this.currentFurtherActionPanel = currentFutherActionPanel; |
419 |
|
} |
420 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
421 |
4 |
public SearchPanel getCurrentSearchPanel()... |
422 |
|
{ |
423 |
4 |
return currentSearchPanel; |
424 |
|
} |
425 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
426 |
0 |
public void setCurrentSearchPanel(SearchPanel currentSearchPanel)... |
427 |
|
{ |
428 |
0 |
this.currentSearchPanel = currentSearchPanel; |
429 |
|
} |
430 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
431 |
5 |
public int getActionOption()... |
432 |
|
{ |
433 |
5 |
return actionOption; |
434 |
|
} |
435 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
436 |
0 |
public void setActionOption(int actionOption)... |
437 |
|
{ |
438 |
0 |
this.actionOption = actionOption; |
439 |
|
} |
440 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
441 |
2 |
public StructureFilterPanel getCurrentStructureFilterPanel()... |
442 |
|
{ |
443 |
2 |
return currentStructureFilterPanel; |
444 |
|
} |
445 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
446 |
0 |
public void setCurrentStructureFilterPanel(... |
447 |
|
StructureFilterPanel currentStructureFilterPanel) |
448 |
|
{ |
449 |
0 |
this.currentStructureFilterPanel = currentStructureFilterPanel; |
450 |
|
} |
451 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
452 |
0 |
public void select_action(ActionEvent actionEvent)... |
453 |
|
{ |
454 |
0 |
JRadioButton radioButton = (JRadioButton) actionEvent.getSource(); |
455 |
0 |
if (radioButton.isSelected()) |
456 |
|
{ |
457 |
0 |
setActionOption(ACTION_OPTION_SELECT); |
458 |
0 |
updateView(); |
459 |
|
} |
460 |
|
} |
461 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
462 |
0 |
public void hide_action(ActionEvent actionEvent)... |
463 |
|
{ |
464 |
0 |
JRadioButton radioButton = (JRadioButton) actionEvent.getSource(); |
465 |
0 |
if (radioButton.isSelected()) |
466 |
|
{ |
467 |
0 |
setActionOption(ACTION_OPTION_HIDE); |
468 |
0 |
updateView(); |
469 |
|
} |
470 |
|
} |
471 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
472 |
0 |
@Override... |
473 |
|
public void itemStateChanged(ItemEvent e) |
474 |
|
{ |
475 |
0 |
selectedAnnotationChanged(); |
476 |
|
} |
477 |
|
|
|
|
| 93.3% |
Uncovered Elements: 1 (15) |
Complexity: 2 |
Complexity Density: 0.15 |
|
478 |
1 |
@Override... |
479 |
|
public void selectedAnnotationChanged() |
480 |
|
{ |
481 |
1 |
String currentView = AnnotationColumnChooser.NO_GRAPH_VIEW; |
482 |
1 |
if (av.getAlignment().getAlignmentAnnotation()[annmap[getAnnotations() |
483 |
|
.getSelectedIndex()]].isQuantitative()) |
484 |
|
{ |
485 |
1 |
currentView = AnnotationColumnChooser.GRAPH_VIEW; |
486 |
|
} |
487 |
1 |
saveCache(); |
488 |
1 |
gSearchPanel.syncState(); |
489 |
1 |
gFurtherActionPanel.syncState(); |
490 |
1 |
gStructureFilterPanel.syncState(); |
491 |
|
|
492 |
1 |
ngSearchPanel.syncState(); |
493 |
1 |
ngFurtherActionPanel.syncState(); |
494 |
1 |
ngStructureFilterPanel.syncState(); |
495 |
|
|
496 |
1 |
CardLayout switchableViewsLayout = (CardLayout) switchableViewsPanel |
497 |
|
.getLayout(); |
498 |
1 |
switchableViewsLayout.show(switchableViewsPanel, currentView); |
499 |
1 |
updateView(); |
500 |
|
} |
501 |
|
|
|
|
| 58.6% |
Uncovered Elements: 12 (29) |
Complexity: 7 |
Complexity Density: 0.33 |
|
502 |
|
public class FurtherActionPanel extends JPanel |
503 |
|
{ |
504 |
|
private AnnotationColumnChooser aColChooser; |
505 |
|
|
506 |
|
private JRadioButton hideOption = new JRadioButton(); |
507 |
|
|
508 |
|
private JRadioButton selectOption = new JRadioButton(); |
509 |
|
|
510 |
|
private ButtonGroup optionsGroup = new ButtonGroup(); |
511 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 1 |
Complexity Density: 0.08 |
|
512 |
2 |
public FurtherActionPanel(AnnotationColumnChooser aColChooser)... |
513 |
|
{ |
514 |
2 |
this.aColChooser = aColChooser; |
515 |
2 |
JvSwingUtils.jvInitComponent(selectOption, "action.select"); |
516 |
2 |
selectOption.addActionListener(new ActionListener() |
517 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
518 |
0 |
@Override... |
519 |
|
public void actionPerformed(ActionEvent actionEvent) |
520 |
|
{ |
521 |
0 |
selectRadioAction(actionEvent); |
522 |
|
} |
523 |
|
}); |
524 |
|
|
525 |
2 |
JvSwingUtils.jvInitComponent(hideOption, "action.hide"); |
526 |
2 |
hideOption.addActionListener(new ActionListener() |
527 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
528 |
0 |
@Override... |
529 |
|
public void actionPerformed(ActionEvent actionEvent) |
530 |
|
{ |
531 |
0 |
hideRadioAction(actionEvent); |
532 |
|
} |
533 |
|
}); |
534 |
|
|
535 |
2 |
optionsGroup.add(selectOption); |
536 |
2 |
optionsGroup.add(hideOption); |
537 |
2 |
optionsGroup.setSelected(selectOption.getModel(), true); |
538 |
|
|
539 |
2 |
JvSwingUtils.jvInitComponent(this); |
540 |
2 |
syncState(); |
541 |
|
|
542 |
2 |
this.add(selectOption); |
543 |
2 |
this.add(hideOption); |
544 |
|
} |
545 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
546 |
0 |
public void selectRadioAction(ActionEvent actionEvent)... |
547 |
|
{ |
548 |
0 |
aColChooser.setCurrentFutherActionPanel(this); |
549 |
0 |
aColChooser.select_action(actionEvent); |
550 |
|
} |
551 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
552 |
0 |
public void hideRadioAction(ActionEvent actionEvent)... |
553 |
|
{ |
554 |
0 |
aColChooser.setCurrentFutherActionPanel(this); |
555 |
0 |
aColChooser.hide_action(actionEvent); |
556 |
|
} |
557 |
|
|
|
|
| 60% |
Uncovered Elements: 2 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
558 |
4 |
public void syncState()... |
559 |
|
{ |
560 |
4 |
if (aColChooser |
561 |
|
.getActionOption() == AnnotationColumnChooser.ACTION_OPTION_HIDE) |
562 |
|
{ |
563 |
0 |
this.optionsGroup.setSelected(this.hideOption.getModel(), true); |
564 |
|
} |
565 |
|
else |
566 |
|
{ |
567 |
4 |
this.optionsGroup.setSelected(this.selectOption.getModel(), true); |
568 |
|
} |
569 |
|
} |
570 |
|
} |
571 |
|
|
|
|
| 29% |
Uncovered Elements: 49 (69) |
Complexity: 17 |
Complexity Density: 0.34 |
|
572 |
|
public class StructureFilterPanel extends JPanel |
573 |
|
{ |
574 |
|
private AnnotationColumnChooser aColChooser; |
575 |
|
|
576 |
|
private JCheckBox alphaHelix = new JCheckBox(); |
577 |
|
|
578 |
|
private JCheckBox betaStrand = new JCheckBox(); |
579 |
|
|
580 |
|
private JCheckBox turn = new JCheckBox(); |
581 |
|
|
582 |
|
private JCheckBox all = new JCheckBox(); |
583 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (15) |
Complexity: 1 |
Complexity Density: 0.07 |
|
584 |
2 |
public StructureFilterPanel(AnnotationColumnChooser aColChooser)... |
585 |
|
{ |
586 |
2 |
this.aColChooser = aColChooser; |
587 |
|
|
588 |
2 |
JvSwingUtils.jvInitComponent(alphaHelix, "label.alpha_helix"); |
589 |
2 |
alphaHelix.addActionListener(new ActionListener() |
590 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
591 |
0 |
@Override... |
592 |
|
public void actionPerformed(ActionEvent actionEvent) |
593 |
|
{ |
594 |
0 |
alphaHelix_actionPerformed(); |
595 |
|
} |
596 |
|
}); |
597 |
|
|
598 |
2 |
JvSwingUtils.jvInitComponent(betaStrand, "label.beta_strand"); |
599 |
2 |
betaStrand.addActionListener(new ActionListener() |
600 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
601 |
0 |
@Override... |
602 |
|
public void actionPerformed(ActionEvent actionEvent) |
603 |
|
{ |
604 |
0 |
betaStrand_actionPerformed(); |
605 |
|
} |
606 |
|
}); |
607 |
|
|
608 |
2 |
JvSwingUtils.jvInitComponent(turn, "label.turn"); |
609 |
2 |
turn.addActionListener(new ActionListener() |
610 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
611 |
0 |
@Override... |
612 |
|
public void actionPerformed(ActionEvent actionEvent) |
613 |
|
{ |
614 |
0 |
turn_actionPerformed(); |
615 |
|
} |
616 |
|
}); |
617 |
|
|
618 |
2 |
JvSwingUtils.jvInitComponent(all, "label.select_all"); |
619 |
2 |
all.addActionListener(new ActionListener() |
620 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
621 |
0 |
@Override... |
622 |
|
public void actionPerformed(ActionEvent actionEvent) |
623 |
|
{ |
624 |
0 |
all_actionPerformed(); |
625 |
|
} |
626 |
|
}); |
627 |
|
|
628 |
2 |
this.setBorder(new TitledBorder( |
629 |
|
MessageManager.getString("label.structures_filter"))); |
630 |
2 |
JvSwingUtils.jvInitComponent(this); |
631 |
|
|
632 |
2 |
this.add(all); |
633 |
2 |
this.add(alphaHelix); |
634 |
2 |
this.add(betaStrand); |
635 |
2 |
this.add(turn); |
636 |
|
} |
637 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
638 |
0 |
public void alphaHelix_actionPerformed()... |
639 |
|
{ |
640 |
0 |
updateSelectAllState(); |
641 |
0 |
aColChooser.setCurrentStructureFilterPanel(this); |
642 |
0 |
aColChooser.updateView(); |
643 |
|
} |
644 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
645 |
0 |
public void betaStrand_actionPerformed()... |
646 |
|
{ |
647 |
0 |
updateSelectAllState(); |
648 |
0 |
aColChooser.setCurrentStructureFilterPanel(this); |
649 |
0 |
aColChooser.updateView(); |
650 |
|
} |
651 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
652 |
0 |
public void turn_actionPerformed()... |
653 |
|
{ |
654 |
0 |
updateSelectAllState(); |
655 |
0 |
aColChooser.setCurrentStructureFilterPanel(this); |
656 |
0 |
aColChooser.updateView(); |
657 |
|
} |
658 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 2 |
Complexity Density: 0.22 |
|
659 |
0 |
public void all_actionPerformed()... |
660 |
|
{ |
661 |
0 |
if (all.isSelected()) |
662 |
|
{ |
663 |
0 |
alphaHelix.setSelected(true); |
664 |
0 |
betaStrand.setSelected(true); |
665 |
0 |
turn.setSelected(true); |
666 |
|
} |
667 |
|
else |
668 |
|
{ |
669 |
0 |
alphaHelix.setSelected(false); |
670 |
0 |
betaStrand.setSelected(false); |
671 |
0 |
turn.setSelected(false); |
672 |
|
} |
673 |
0 |
aColChooser.setCurrentStructureFilterPanel(this); |
674 |
0 |
aColChooser.updateView(); |
675 |
|
} |
676 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 4 |
Complexity Density: 1.33 |
|
677 |
0 |
public void updateSelectAllState()... |
678 |
|
{ |
679 |
0 |
if (alphaHelix.isSelected() && betaStrand.isSelected() |
680 |
|
&& turn.isSelected()) |
681 |
|
{ |
682 |
0 |
all.setSelected(true); |
683 |
|
} |
684 |
|
else |
685 |
|
{ |
686 |
0 |
all.setSelected(false); |
687 |
|
} |
688 |
|
} |
689 |
|
|
|
|
| 21.4% |
Uncovered Elements: 11 (14) |
Complexity: 3 |
Complexity Density: 0.3 |
|
690 |
2 |
public void syncState()... |
691 |
|
{ |
692 |
2 |
StructureFilterPanel sfp = aColChooser |
693 |
|
.getCurrentStructureFilterPanel(); |
694 |
2 |
if (sfp != null) |
695 |
|
{ |
696 |
0 |
alphaHelix.setSelected(sfp.alphaHelix.isSelected()); |
697 |
0 |
betaStrand.setSelected(sfp.betaStrand.isSelected()); |
698 |
0 |
turn.setSelected(sfp.turn.isSelected()); |
699 |
0 |
if (sfp.all.isSelected()) |
700 |
|
{ |
701 |
0 |
all.setSelected(true); |
702 |
0 |
alphaHelix.setSelected(true); |
703 |
0 |
betaStrand.setSelected(true); |
704 |
0 |
turn.setSelected(true); |
705 |
|
} |
706 |
|
} |
707 |
|
|
708 |
|
} |
709 |
|
} |
710 |
|
|
|
|
| 48.3% |
Uncovered Elements: 31 (60) |
Complexity: 14 |
Complexity Density: 0.33 |
|
711 |
|
public class SearchPanel extends JPanel |
712 |
|
{ |
713 |
|
private AnnotationColumnChooser aColChooser; |
714 |
|
|
715 |
|
private JCheckBox displayName = new JCheckBox(); |
716 |
|
|
717 |
|
private JCheckBox description = new JCheckBox(); |
718 |
|
|
719 |
|
private static final String FILTER_BY_ANN_CACHE_KEY = "CACHE.SELECT_FILTER_BY_ANNOT"; |
720 |
|
|
721 |
|
public JvCacheableInputBox<String> searchBox = new JvCacheableInputBox<>( |
722 |
|
FILTER_BY_ANN_CACHE_KEY); |
723 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (15) |
Complexity: 1 |
Complexity Density: 0.07 |
|
724 |
2 |
public SearchPanel(AnnotationColumnChooser aColChooser)... |
725 |
|
{ |
726 |
|
|
727 |
2 |
this.aColChooser = aColChooser; |
728 |
2 |
JvSwingUtils.jvInitComponent(this); |
729 |
2 |
this.setBorder(new TitledBorder( |
730 |
|
MessageManager.getString("label.search_filter"))); |
731 |
|
|
732 |
2 |
searchBox.setPrototypeDisplayValue("XXXXXXXXXXXXXXXXXXXXXXX"); |
733 |
2 |
searchBox.getComponent().setToolTipText( |
734 |
|
MessageManager.getString("info.enter_search_text_here")); |
735 |
2 |
searchBox.addKeyListener(new java.awt.event.KeyAdapter() |
736 |
|
{ |
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
737 |
0 |
@Override... |
738 |
|
public void keyPressed(KeyEvent e) |
739 |
|
{ |
740 |
0 |
if (e.getKeyCode() == KeyEvent.VK_ENTER) |
741 |
|
{ |
742 |
0 |
e.consume(); |
743 |
0 |
searchStringAction(); |
744 |
|
} |
745 |
|
} |
746 |
|
}); |
747 |
2 |
searchBox.addFocusListener(new FocusAdapter() |
748 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
749 |
0 |
@Override... |
750 |
|
public void focusLost(FocusEvent e) |
751 |
|
{ |
752 |
0 |
searchStringAction(); |
753 |
|
} |
754 |
|
}); |
755 |
|
|
756 |
2 |
JvSwingUtils.jvInitComponent(displayName, "label.label"); |
757 |
2 |
displayName.addActionListener(new ActionListener() |
758 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
759 |
0 |
@Override... |
760 |
|
public void actionPerformed(ActionEvent actionEvent) |
761 |
|
{ |
762 |
0 |
displayNameCheckboxAction(); |
763 |
|
} |
764 |
|
}); |
765 |
|
|
766 |
2 |
JvSwingUtils.jvInitComponent(description, "label.description"); |
767 |
2 |
description.addActionListener(new ActionListener() |
768 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
769 |
0 |
@Override... |
770 |
|
public void actionPerformed(ActionEvent actionEvent) |
771 |
|
{ |
772 |
0 |
descriptionCheckboxAction(); |
773 |
|
} |
774 |
|
}); |
775 |
|
|
776 |
2 |
syncState(); |
777 |
2 |
this.add(searchBox.getComponent()); |
778 |
2 |
this.add(displayName); |
779 |
2 |
this.add(description); |
780 |
|
} |
781 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
782 |
0 |
public void displayNameCheckboxAction()... |
783 |
|
{ |
784 |
0 |
aColChooser.setCurrentSearchPanel(this); |
785 |
0 |
aColChooser.updateView(); |
786 |
|
} |
787 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
788 |
0 |
public void descriptionCheckboxAction()... |
789 |
|
{ |
790 |
0 |
aColChooser.setCurrentSearchPanel(this); |
791 |
0 |
aColChooser.updateView(); |
792 |
|
} |
793 |
|
|
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
794 |
0 |
public void searchStringAction()... |
795 |
|
{ |
796 |
0 |
aColChooser.setCurrentSearchPanel(this); |
797 |
0 |
aColChooser.updateView(); |
798 |
0 |
updateSearchPanelToolTips(); |
799 |
0 |
searchBox.updateCache(); |
800 |
|
} |
801 |
|
|
|
|
| 40% |
Uncovered Elements: 6 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
802 |
4 |
public void syncState()... |
803 |
|
{ |
804 |
4 |
SearchPanel sp = aColChooser.getCurrentSearchPanel(); |
805 |
4 |
if (sp != null) |
806 |
|
{ |
807 |
0 |
description.setEnabled(sp.description.isEnabled()); |
808 |
0 |
description.setSelected(sp.description.isSelected()); |
809 |
|
|
810 |
0 |
displayName.setEnabled(sp.displayName.isEnabled()); |
811 |
0 |
displayName.setSelected(sp.displayName.isSelected()); |
812 |
|
|
813 |
0 |
searchBox.setSelectedItem(sp.searchBox.getUserInput()); |
814 |
|
} |
815 |
4 |
updateSearchPanelToolTips(); |
816 |
|
} |
817 |
|
|
|
|
| 77.8% |
Uncovered Elements: 2 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
818 |
4 |
public void updateSearchPanelToolTips()... |
819 |
|
{ |
820 |
4 |
String defaultTtip = MessageManager |
821 |
|
.getString("info.enter_search_text_to_enable"); |
822 |
4 |
String labelTtip = MessageManager.formatMessage( |
823 |
|
"info.search_in_annotation_label", |
824 |
|
annotations.getSelectedItem().toString()); |
825 |
4 |
String descTtip = MessageManager.formatMessage( |
826 |
|
"info.search_in_annotation_description", |
827 |
|
annotations.getSelectedItem().toString()); |
828 |
4 |
displayName.setToolTipText( |
829 |
4 |
displayName.isEnabled() ? labelTtip : defaultTtip); |
830 |
4 |
description.setToolTipText( |
831 |
4 |
description.isEnabled() ? descTtip : defaultTtip); |
832 |
|
} |
833 |
|
} |
834 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
835 |
0 |
@Override... |
836 |
|
public void ok_actionPerformed() |
837 |
|
{ |
838 |
0 |
saveCache(); |
839 |
0 |
super.ok_actionPerformed(); |
840 |
|
} |
841 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
842 |
0 |
@Override... |
843 |
|
public void cancel_actionPerformed() |
844 |
|
{ |
845 |
0 |
saveCache(); |
846 |
0 |
super.cancel_actionPerformed(); |
847 |
|
} |
848 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
849 |
1 |
private void saveCache()... |
850 |
|
{ |
851 |
1 |
gSearchPanel.searchBox.persistCache(); |
852 |
1 |
ngSearchPanel.searchBox.persistCache(); |
853 |
1 |
gSearchPanel.searchBox.updateCache(); |
854 |
1 |
ngSearchPanel.searchBox.updateCache(); |
855 |
|
} |
856 |
|
} |