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