1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.appletgui; |
22 |
|
|
23 |
|
import jalview.schemes.AnnotationColourGradient; |
24 |
|
import jalview.util.MessageManager; |
25 |
|
|
26 |
|
import java.awt.Button; |
27 |
|
import java.awt.Checkbox; |
28 |
|
import java.awt.Choice; |
29 |
|
import java.awt.Frame; |
30 |
|
import java.awt.Panel; |
31 |
|
import java.awt.Scrollbar; |
32 |
|
import java.awt.TextField; |
33 |
|
import java.awt.event.ActionEvent; |
34 |
|
|
35 |
|
@SuppressWarnings("serial") |
|
|
| 0% |
Uncovered Elements: 62 (62) |
Complexity: 20 |
Complexity Density: 0.51 |
|
36 |
|
public abstract class AnnotationRowFilter extends Panel |
37 |
|
{ |
38 |
|
protected AlignViewport av; |
39 |
|
|
40 |
|
protected AlignmentPanel ap; |
41 |
|
|
42 |
|
protected int[] annmap; |
43 |
|
|
44 |
|
protected boolean enableSeqAss = false; |
45 |
|
|
46 |
|
private jalview.datamodel.AlignmentAnnotation currentAnnotation; |
47 |
|
|
48 |
|
protected boolean adjusting = false; |
49 |
|
|
50 |
|
protected Checkbox currentColours = new Checkbox(); |
51 |
|
|
52 |
|
protected Panel minColour = new Panel(); |
53 |
|
|
54 |
|
protected Panel maxColour = new Panel(); |
55 |
|
|
56 |
|
protected Checkbox seqAssociated = new Checkbox(); |
57 |
|
|
58 |
|
protected Checkbox thresholdIsMin = new Checkbox(); |
59 |
|
|
60 |
|
protected Scrollbar slider = new Scrollbar(Scrollbar.HORIZONTAL); |
61 |
|
|
62 |
|
protected Checkbox percentThreshold = new Checkbox(); |
63 |
|
|
64 |
|
protected TextField thresholdValue = new TextField(20); |
65 |
|
|
66 |
|
protected Frame frame; |
67 |
|
|
68 |
|
protected Button ok = new Button(); |
69 |
|
|
70 |
|
protected Button cancel = new Button(); |
71 |
|
|
72 |
|
|
73 |
|
|
74 |
|
|
75 |
|
|
76 |
|
protected boolean sliderDragging = false; |
77 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
78 |
0 |
public AnnotationRowFilter(AlignViewport av, final AlignmentPanel ap)... |
79 |
|
{ |
80 |
0 |
this.av = av; |
81 |
0 |
this.ap = ap; |
82 |
|
} |
83 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
84 |
0 |
public AnnotationRowFilter()... |
85 |
|
{ |
86 |
|
|
87 |
|
} |
88 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
89 |
0 |
protected int getSelectedThresholdItem(int indexValue)... |
90 |
|
{ |
91 |
0 |
int selectedThresholdItem = -1; |
92 |
0 |
if (indexValue == 1) |
93 |
|
{ |
94 |
0 |
selectedThresholdItem = AnnotationColourGradient.ABOVE_THRESHOLD; |
95 |
|
} |
96 |
0 |
else if (indexValue == 2) |
97 |
|
{ |
98 |
0 |
selectedThresholdItem = AnnotationColourGradient.BELOW_THRESHOLD; |
99 |
|
} |
100 |
0 |
return selectedThresholdItem; |
101 |
|
} |
102 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
103 |
0 |
public void modelChanged()... |
104 |
|
{ |
105 |
0 |
seqAssociated.setEnabled(enableSeqAss); |
106 |
|
} |
107 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
108 |
0 |
public void ok_actionPerformed(ActionEvent e)... |
109 |
|
{ |
110 |
0 |
updateView(); |
111 |
0 |
frame.setVisible(false); |
112 |
|
} |
113 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
114 |
0 |
public void cancel_actionPerformed(ActionEvent e)... |
115 |
|
{ |
116 |
0 |
reset(); |
117 |
0 |
ap.paintAlignment(true, true); |
118 |
0 |
frame.setVisible(false); |
119 |
|
} |
120 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
121 |
0 |
public void thresholdCheck_actionPerformed(ActionEvent e)... |
122 |
|
{ |
123 |
0 |
updateView(); |
124 |
|
} |
125 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
126 |
0 |
public void annotations_actionPerformed(ActionEvent e)... |
127 |
|
{ |
128 |
0 |
updateView(); |
129 |
|
} |
130 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
131 |
0 |
public void threshold_actionPerformed(ActionEvent e)... |
132 |
|
{ |
133 |
0 |
updateView(); |
134 |
|
} |
135 |
|
|
136 |
|
|
137 |
|
|
138 |
|
|
139 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 2 |
Complexity Density: 0.22 |
|
140 |
0 |
protected void setThresholdValueText()... |
141 |
|
{ |
142 |
0 |
boolean oldadj = adjusting; |
143 |
0 |
adjusting = true; |
144 |
0 |
if (percentThreshold.getState()) |
145 |
|
{ |
146 |
0 |
double scl = slider.getMaximum() - slider.getMinimum(); |
147 |
0 |
scl = (slider.getValue() - slider.getMinimum()) / scl; |
148 |
0 |
thresholdValue.setText(100f * scl + ""); |
149 |
|
} |
150 |
|
else |
151 |
|
{ |
152 |
0 |
thresholdValue.setText((slider.getValue() / 1000f) + ""); |
153 |
|
} |
154 |
0 |
thresholdValue.setCaretPosition(0); |
155 |
0 |
adjusting = oldadj; |
156 |
|
} |
157 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.43 |
|
158 |
0 |
public void thresholdValue_actionPerformed(ActionEvent e)... |
159 |
|
{ |
160 |
0 |
try |
161 |
|
{ |
162 |
0 |
float f = Float.parseFloat(thresholdValue.getText()); |
163 |
0 |
if (percentThreshold.getState()) |
164 |
|
{ |
165 |
0 |
int pos = slider.getMinimum() |
166 |
|
+ (int) ((slider.getMaximum() - slider.getMinimum()) * f |
167 |
|
/ 100f); |
168 |
0 |
slider.setValue(pos); |
169 |
|
} |
170 |
|
else |
171 |
|
{ |
172 |
0 |
slider.setValue((int) (f * 1000)); |
173 |
|
} |
174 |
0 |
valueChanged(false); |
175 |
|
} catch (NumberFormatException ex) |
176 |
|
{ |
177 |
|
} |
178 |
|
} |
179 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
180 |
0 |
protected void percentageValue_actionPerformed()... |
181 |
|
{ |
182 |
0 |
setThresholdValueText(); |
183 |
|
} |
184 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
185 |
0 |
protected void populateThresholdComboBox(Choice threshold)... |
186 |
|
{ |
187 |
0 |
threshold.addItem(MessageManager |
188 |
|
.getString("label.threshold_feature_no_threshold")); |
189 |
0 |
threshold.addItem(MessageManager |
190 |
|
.getString("label.threshold_feature_above_threshold")); |
191 |
0 |
threshold.addItem(MessageManager |
192 |
|
.getString("label.threshold_feature_below_threshold")); |
193 |
|
} |
194 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
195 |
0 |
public jalview.datamodel.AlignmentAnnotation getCurrentAnnotation()... |
196 |
|
{ |
197 |
0 |
return currentAnnotation; |
198 |
|
} |
199 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
200 |
0 |
public void setCurrentAnnotation(... |
201 |
|
jalview.datamodel.AlignmentAnnotation currentAnnotation) |
202 |
|
{ |
203 |
0 |
this.currentAnnotation = currentAnnotation; |
204 |
|
} |
205 |
|
|
206 |
|
public abstract void valueChanged(boolean updateAllAnnotation); |
207 |
|
|
208 |
|
public abstract void updateView(); |
209 |
|
|
210 |
|
public abstract void reset(); |
211 |
|
} |