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