| 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.datamodel.AlignmentAnnotation; |
| 24 |
|
import jalview.datamodel.SequenceGroup; |
| 25 |
|
import jalview.schemes.AnnotationColourGradient; |
| 26 |
|
import jalview.schemes.ColourSchemeI; |
| 27 |
|
import jalview.util.MessageManager; |
| 28 |
|
|
| 29 |
|
import java.awt.BorderLayout; |
| 30 |
|
import java.awt.Button; |
| 31 |
|
import java.awt.Checkbox; |
| 32 |
|
import java.awt.Choice; |
| 33 |
|
import java.awt.Color; |
| 34 |
|
import java.awt.Dimension; |
| 35 |
|
import java.awt.FlowLayout; |
| 36 |
|
import java.awt.Font; |
| 37 |
|
import java.awt.Frame; |
| 38 |
|
import java.awt.Panel; |
| 39 |
|
import java.awt.Scrollbar; |
| 40 |
|
import java.awt.TextField; |
| 41 |
|
import java.awt.event.ActionEvent; |
| 42 |
|
import java.awt.event.ActionListener; |
| 43 |
|
import java.awt.event.AdjustmentEvent; |
| 44 |
|
import java.awt.event.AdjustmentListener; |
| 45 |
|
import java.awt.event.ItemEvent; |
| 46 |
|
import java.awt.event.ItemListener; |
| 47 |
|
import java.awt.event.MouseEvent; |
| 48 |
|
import java.awt.event.MouseListener; |
| 49 |
|
import java.util.HashMap; |
| 50 |
|
import java.util.Map; |
| 51 |
|
import java.util.Vector; |
| 52 |
|
|
| |
|
| 0% |
Uncovered Elements: 308 (308) |
Complexity: 62 |
Complexity Density: 0.28 |
|
| 53 |
|
public class AnnotationColourChooser extends Panel implements |
| 54 |
|
ActionListener, AdjustmentListener, ItemListener, MouseListener |
| 55 |
|
{ |
| 56 |
|
Frame frame; |
| 57 |
|
|
| 58 |
|
AlignViewport av; |
| 59 |
|
|
| 60 |
|
AlignmentPanel ap; |
| 61 |
|
|
| 62 |
|
ColourSchemeI oldcs; |
| 63 |
|
|
| 64 |
|
Map<SequenceGroup, ColourSchemeI> oldgroupColours; |
| 65 |
|
|
| 66 |
|
|
| 67 |
|
|
| 68 |
|
|
| 69 |
|
|
| 70 |
|
private Map<AlignmentAnnotation, String> annotationLabels; |
| 71 |
|
|
| 72 |
|
AlignmentAnnotation currentAnnotation; |
| 73 |
|
|
| 74 |
|
boolean adjusting = false; |
| 75 |
|
|
| |
|
| 0% |
Uncovered Elements: 64 (64) |
Complexity: 12 |
Complexity Density: 0.23 |
|
| 76 |
0 |
public AnnotationColourChooser(AlignViewport av, AlignmentPanel ap)... |
| 77 |
|
{ |
| 78 |
0 |
try |
| 79 |
|
{ |
| 80 |
0 |
jbInit(); |
| 81 |
|
} catch (Exception ex) |
| 82 |
|
{ |
| 83 |
|
} |
| 84 |
|
|
| 85 |
0 |
oldcs = av.getGlobalColourScheme(); |
| 86 |
0 |
if (av.getAlignment().getGroups() != null) |
| 87 |
|
{ |
| 88 |
0 |
oldgroupColours = new HashMap<>(); |
| 89 |
0 |
for (SequenceGroup sg : ap.av.getAlignment().getGroups()) |
| 90 |
|
{ |
| 91 |
0 |
oldgroupColours.put(sg, sg.getColourScheme()); |
| 92 |
|
} |
| 93 |
|
} |
| 94 |
0 |
this.av = av; |
| 95 |
0 |
this.ap = ap; |
| 96 |
|
|
| 97 |
0 |
slider.addAdjustmentListener(this); |
| 98 |
0 |
slider.addMouseListener(this); |
| 99 |
|
|
| 100 |
0 |
AlignmentAnnotation[] anns = av.getAlignment().getAlignmentAnnotation(); |
| 101 |
0 |
if (anns == null) |
| 102 |
|
{ |
| 103 |
0 |
return; |
| 104 |
|
} |
| 105 |
|
|
| 106 |
0 |
setDefaultMinMax(); |
| 107 |
|
|
| 108 |
0 |
adjusting = true; |
| 109 |
0 |
if (oldcs instanceof AnnotationColourGradient) |
| 110 |
|
{ |
| 111 |
0 |
AnnotationColourGradient acg = (AnnotationColourGradient) oldcs; |
| 112 |
0 |
currentColours.setState( |
| 113 |
|
acg.isPredefinedColours() || acg.getBaseColour() != null); |
| 114 |
0 |
if (!acg.isPredefinedColours() && acg.getBaseColour() == null) |
| 115 |
|
{ |
| 116 |
0 |
minColour.setBackground(acg.getMinColour()); |
| 117 |
0 |
maxColour.setBackground(acg.getMaxColour()); |
| 118 |
|
} |
| 119 |
|
|
| 120 |
|
} |
| 121 |
|
|
| 122 |
0 |
Vector<String> list = getAnnotationItems(); |
| 123 |
|
|
| 124 |
0 |
for (int i = 0; i < list.size(); i++) |
| 125 |
|
{ |
| 126 |
0 |
annotations.addItem(list.elementAt(i).toString()); |
| 127 |
|
} |
| 128 |
|
|
| 129 |
0 |
threshold.addItem(MessageManager |
| 130 |
|
.getString("label.threshold_feature_no_threshold")); |
| 131 |
0 |
threshold.addItem(MessageManager |
| 132 |
|
.getString("label.threshold_feature_above_threshold")); |
| 133 |
0 |
threshold.addItem(MessageManager |
| 134 |
|
.getString("label.threshold_feature_below_threshold")); |
| 135 |
|
|
| 136 |
0 |
if (oldcs instanceof AnnotationColourGradient) |
| 137 |
|
{ |
| 138 |
0 |
AnnotationColourGradient acg = (AnnotationColourGradient) oldcs; |
| 139 |
0 |
String label = annotationLabels.get(acg.getAnnotation()); |
| 140 |
0 |
annotations.select(label); |
| 141 |
0 |
switch (acg.getAboveThreshold()) |
| 142 |
|
{ |
| 143 |
0 |
case AnnotationColourGradient.NO_THRESHOLD: |
| 144 |
0 |
threshold.select(0); |
| 145 |
0 |
break; |
| 146 |
0 |
case AnnotationColourGradient.ABOVE_THRESHOLD: |
| 147 |
0 |
threshold.select(1); |
| 148 |
0 |
break; |
| 149 |
0 |
case AnnotationColourGradient.BELOW_THRESHOLD: |
| 150 |
0 |
threshold.select(1); |
| 151 |
0 |
break; |
| 152 |
0 |
default: |
| 153 |
0 |
throw new Error(MessageManager.getString( |
| 154 |
|
"error.implementation_error_dont_know_threshold_annotationcolourgradient")); |
| 155 |
|
} |
| 156 |
0 |
thresholdIsMin.setState(acg.isThresholdIsMinMax()); |
| 157 |
0 |
thresholdValue.setText("" + acg.getAnnotationThreshold()); |
| 158 |
|
} |
| 159 |
|
|
| 160 |
0 |
adjusting = false; |
| 161 |
|
|
| 162 |
0 |
changeColour(); |
| 163 |
|
|
| 164 |
0 |
frame = new Frame(); |
| 165 |
0 |
frame.add(this); |
| 166 |
0 |
jalview.bin.JalviewLite.addFrame(frame, |
| 167 |
|
MessageManager.getString("label.colour_by_annotation"), 560, |
| 168 |
|
175); |
| 169 |
0 |
validate(); |
| 170 |
|
} |
| 171 |
|
|
| 172 |
|
|
| 173 |
|
|
| 174 |
|
|
| 175 |
|
|
| 176 |
|
@return |
| 177 |
|
|
| |
|
| 0% |
Uncovered Elements: 25 (25) |
Complexity: 5 |
Complexity Density: 0.29 |
|
| 178 |
0 |
protected Vector<String> getAnnotationItems()... |
| 179 |
|
{ |
| 180 |
|
|
| 181 |
|
|
| 182 |
|
|
| 183 |
0 |
annotationLabels = new HashMap<>(); |
| 184 |
0 |
Vector<String> list = new Vector<>(); |
| 185 |
0 |
AlignmentAnnotation[] anns = av.getAlignment().getAlignmentAnnotation(); |
| 186 |
0 |
if (anns == null) |
| 187 |
|
{ |
| 188 |
0 |
return list; |
| 189 |
|
} |
| 190 |
0 |
int index = 1; |
| 191 |
0 |
for (int i = 0; i < anns.length; i++) |
| 192 |
|
{ |
| 193 |
0 |
String label = anns[i].label; |
| 194 |
0 |
if (anns[i].sequenceRef != null) |
| 195 |
|
{ |
| 196 |
|
|
| 197 |
|
|
| 198 |
|
|
| 199 |
|
|
| 200 |
0 |
label = label + "_" + anns[i].sequenceRef.getName(); |
| 201 |
|
} |
| 202 |
0 |
if (!list.contains(label)) |
| 203 |
|
{ |
| 204 |
0 |
list.addElement(label); |
| 205 |
0 |
annotationLabels.put(anns[i], label); |
| 206 |
|
} |
| 207 |
|
else |
| 208 |
|
{ |
| 209 |
0 |
label = label + "_" + (index++); |
| 210 |
0 |
list.addElement(label); |
| 211 |
0 |
annotationLabels.put(anns[i], label); |
| 212 |
|
} |
| 213 |
|
} |
| 214 |
0 |
return list; |
| 215 |
|
} |
| 216 |
|
|
| |
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 217 |
0 |
private void setDefaultMinMax()... |
| 218 |
|
{ |
| 219 |
0 |
minColour.setBackground(av.applet.getDefaultColourParameter( |
| 220 |
|
"ANNOTATIONCOLOUR_MIN", Color.orange)); |
| 221 |
0 |
maxColour.setBackground(av.applet |
| 222 |
|
.getDefaultColourParameter("ANNOTATIONCOLOUR_MAX", Color.red)); |
| 223 |
|
|
| 224 |
|
} |
| 225 |
|
|
| |
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 226 |
0 |
public AnnotationColourChooser()... |
| 227 |
|
{ |
| 228 |
0 |
try |
| 229 |
|
{ |
| 230 |
0 |
jbInit(); |
| 231 |
|
} catch (Exception ex) |
| 232 |
|
{ |
| 233 |
0 |
ex.printStackTrace(); |
| 234 |
|
} |
| 235 |
|
} |
| 236 |
|
|
| |
|
| 0% |
Uncovered Elements: 55 (55) |
Complexity: 1 |
Complexity Density: 0.02 |
|
| 237 |
0 |
private void jbInit() throws Exception... |
| 238 |
|
{ |
| 239 |
0 |
minColour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); |
| 240 |
0 |
minColour.setLabel(MessageManager.getString("label.min_colour")); |
| 241 |
0 |
minColour.addActionListener(this); |
| 242 |
|
|
| 243 |
0 |
maxColour.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); |
| 244 |
0 |
maxColour.setLabel(MessageManager.getString("label.max_colour")); |
| 245 |
0 |
maxColour.addActionListener(this); |
| 246 |
|
|
| 247 |
0 |
thresholdIsMin.addItemListener(this); |
| 248 |
0 |
ok.setLabel(MessageManager.getString("action.ok")); |
| 249 |
0 |
ok.addActionListener(this); |
| 250 |
|
|
| 251 |
0 |
cancel.setLabel(MessageManager.getString("action.cancel")); |
| 252 |
0 |
cancel.addActionListener(this); |
| 253 |
|
|
| 254 |
0 |
defColours.setLabel(MessageManager.getString("action.set_defaults")); |
| 255 |
0 |
defColours.addActionListener(this); |
| 256 |
|
|
| 257 |
0 |
annotations.addItemListener(this); |
| 258 |
|
|
| 259 |
0 |
thresholdValue.addActionListener(this); |
| 260 |
0 |
slider.setBackground(Color.white); |
| 261 |
0 |
slider.setPreferredSize(new Dimension(193, 21)); |
| 262 |
0 |
slider.setEnabled(false); |
| 263 |
0 |
thresholdValue.setPreferredSize(new Dimension(79, 22)); |
| 264 |
0 |
thresholdValue.setEnabled(false); |
| 265 |
0 |
thresholdValue.setColumns(5); |
| 266 |
0 |
currentColours.setFont(new java.awt.Font("Verdana", Font.PLAIN, 11)); |
| 267 |
0 |
currentColours.setLabel( |
| 268 |
|
MessageManager.getString("label.use_original_colours")); |
| 269 |
0 |
currentColours.addItemListener(this); |
| 270 |
|
|
| 271 |
0 |
thresholdIsMin.setBackground(Color.white); |
| 272 |
0 |
thresholdIsMin |
| 273 |
|
.setLabel(MessageManager.getString("label.threshold_minmax")); |
| 274 |
|
|
| 275 |
0 |
this.setLayout(borderLayout1); |
| 276 |
|
|
| 277 |
0 |
jPanel1.setBackground(Color.white); |
| 278 |
|
|
| 279 |
0 |
jPanel2.setLayout(new FlowLayout()); |
| 280 |
0 |
jPanel2.setBackground(Color.white); |
| 281 |
0 |
threshold.addItemListener(this); |
| 282 |
0 |
jPanel3.setLayout(new FlowLayout()); |
| 283 |
0 |
jPanel3.setBackground(Color.white); |
| 284 |
0 |
Panel jPanel4 = new Panel(); |
| 285 |
0 |
jPanel4.setLayout(new BorderLayout()); |
| 286 |
0 |
jPanel4.setBackground(Color.white); |
| 287 |
|
|
| 288 |
0 |
jPanel1.add(ok); |
| 289 |
0 |
jPanel1.add(cancel); |
| 290 |
|
|
| 291 |
0 |
jPanel2.add(annotations); |
| 292 |
0 |
jPanel2.add(currentColours); |
| 293 |
0 |
jPanel2.add(minColour); |
| 294 |
0 |
jPanel2.add(maxColour); |
| 295 |
|
|
| 296 |
0 |
jPanel4.add(thresholdIsMin, BorderLayout.WEST); |
| 297 |
0 |
jPanel4.add(slider, BorderLayout.CENTER); |
| 298 |
0 |
jPanel4.add(thresholdValue, BorderLayout.EAST); |
| 299 |
|
|
| 300 |
0 |
Panel jPanel34 = new Panel(); |
| 301 |
0 |
jPanel34.setLayout(new BorderLayout()); |
| 302 |
0 |
jPanel34.setBackground(Color.white); |
| 303 |
0 |
jPanel34.add(jPanel2, BorderLayout.NORTH); |
| 304 |
0 |
jPanel34.add(threshold, BorderLayout.WEST); |
| 305 |
0 |
jPanel3.add(defColours); |
| 306 |
0 |
jPanel34.add(jPanel3, BorderLayout.EAST); |
| 307 |
0 |
jPanel34.add(jPanel4, BorderLayout.SOUTH); |
| 308 |
|
|
| 309 |
0 |
this.add(jPanel34, java.awt.BorderLayout.CENTER); |
| 310 |
0 |
this.add(jPanel1, java.awt.BorderLayout.SOUTH); |
| 311 |
|
|
| 312 |
|
} |
| 313 |
|
|
| 314 |
|
Choice annotations = new Choice(); |
| 315 |
|
|
| 316 |
|
Button minColour = new Button(); |
| 317 |
|
|
| 318 |
|
Button maxColour = new Button(); |
| 319 |
|
|
| 320 |
|
Button ok = new Button(); |
| 321 |
|
|
| 322 |
|
Button cancel = new Button(); |
| 323 |
|
|
| 324 |
|
Button defColours = new Button(); |
| 325 |
|
|
| 326 |
|
Panel jPanel1 = new Panel(); |
| 327 |
|
|
| 328 |
|
Panel jPanel2 = new Panel(); |
| 329 |
|
|
| 330 |
|
Choice threshold = new Choice(); |
| 331 |
|
|
| 332 |
|
FlowLayout flowLayout1 = new FlowLayout(); |
| 333 |
|
|
| 334 |
|
Panel jPanel3 = new Panel(); |
| 335 |
|
|
| 336 |
|
Scrollbar slider = new Scrollbar(Scrollbar.HORIZONTAL); |
| 337 |
|
|
| 338 |
|
TextField thresholdValue = new TextField(20); |
| 339 |
|
|
| 340 |
|
Checkbox currentColours = new Checkbox(); |
| 341 |
|
|
| 342 |
|
BorderLayout borderLayout1 = new BorderLayout(); |
| 343 |
|
|
| 344 |
|
Checkbox thresholdIsMin = new Checkbox(); |
| 345 |
|
|
| |
|
| 0% |
Uncovered Elements: 30 (30) |
Complexity: 8 |
Complexity Density: 0.44 |
|
| 346 |
0 |
@Override... |
| 347 |
|
public void actionPerformed(ActionEvent evt) |
| 348 |
|
{ |
| 349 |
0 |
if (evt.getSource() == thresholdValue) |
| 350 |
|
{ |
| 351 |
0 |
try |
| 352 |
|
{ |
| 353 |
0 |
float f = Float.valueOf(thresholdValue.getText()).floatValue(); |
| 354 |
0 |
slider.setValue((int) (f * 1000)); |
| 355 |
0 |
adjustmentValueChanged(null); |
| 356 |
|
} catch (NumberFormatException ex) |
| 357 |
|
{ |
| 358 |
|
} |
| 359 |
|
} |
| 360 |
0 |
else if (evt.getSource() == minColour) |
| 361 |
|
{ |
| 362 |
0 |
minColour_actionPerformed(null); |
| 363 |
|
} |
| 364 |
0 |
else if (evt.getSource() == maxColour) |
| 365 |
|
{ |
| 366 |
0 |
maxColour_actionPerformed(null); |
| 367 |
|
} |
| 368 |
0 |
else if (evt.getSource() == defColours) |
| 369 |
|
{ |
| 370 |
0 |
defColour_actionPerformed(); |
| 371 |
|
} |
| 372 |
0 |
else if (evt.getSource() == ok) |
| 373 |
|
{ |
| 374 |
0 |
frame.setVisible(false); |
| 375 |
|
} |
| 376 |
0 |
else if (evt.getSource() == cancel) |
| 377 |
|
{ |
| 378 |
0 |
reset(); |
| 379 |
0 |
ap.paintAlignment(true, true); |
| 380 |
0 |
frame.setVisible(false); |
| 381 |
|
} |
| 382 |
|
|
| 383 |
|
else |
| 384 |
|
{ |
| 385 |
0 |
changeColour(); |
| 386 |
|
} |
| 387 |
|
} |
| 388 |
|
|
| |
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
| 389 |
0 |
@Override... |
| 390 |
|
public void itemStateChanged(ItemEvent evt) |
| 391 |
|
{ |
| 392 |
0 |
if (evt.getSource() == currentColours) |
| 393 |
|
{ |
| 394 |
0 |
if (currentColours.getState()) |
| 395 |
|
{ |
| 396 |
0 |
reset(); |
| 397 |
|
} |
| 398 |
|
|
| 399 |
0 |
maxColour.setEnabled(!currentColours.getState()); |
| 400 |
0 |
minColour.setEnabled(!currentColours.getState()); |
| 401 |
|
|
| 402 |
|
} |
| 403 |
|
|
| 404 |
0 |
changeColour(); |
| 405 |
|
} |
| 406 |
|
|
| |
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 4 |
Complexity Density: 0.67 |
|
| 407 |
0 |
@Override... |
| 408 |
|
public void adjustmentValueChanged(AdjustmentEvent evt) |
| 409 |
|
{ |
| 410 |
0 |
if (!adjusting) |
| 411 |
|
{ |
| 412 |
0 |
thresholdValue.setText((slider.getValue() / 1000f) + ""); |
| 413 |
0 |
if (currentColours.getState() && !(av |
| 414 |
|
.getGlobalColourScheme() instanceof AnnotationColourGradient)) |
| 415 |
|
{ |
| 416 |
0 |
changeColour(); |
| 417 |
|
} |
| 418 |
|
|
| 419 |
0 |
currentAnnotation.threshold.value = slider.getValue() / 1000f; |
| 420 |
0 |
ap.paintAlignment(false, false); |
| 421 |
|
} |
| 422 |
|
} |
| 423 |
|
|
| |
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 424 |
0 |
public void minColour_actionPerformed(Color newCol)... |
| 425 |
|
{ |
| 426 |
0 |
if (newCol != null) |
| 427 |
|
{ |
| 428 |
0 |
minColour.setBackground(newCol); |
| 429 |
0 |
minColour.repaint(); |
| 430 |
0 |
changeColour(); |
| 431 |
|
} |
| 432 |
|
else |
| 433 |
|
{ |
| 434 |
0 |
new UserDefinedColours(this, "Min Colour", minColour.getBackground()); |
| 435 |
|
} |
| 436 |
|
|
| 437 |
|
} |
| 438 |
|
|
| |
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 439 |
0 |
public void maxColour_actionPerformed(Color newCol)... |
| 440 |
|
{ |
| 441 |
0 |
if (newCol != null) |
| 442 |
|
{ |
| 443 |
0 |
maxColour.setBackground(newCol); |
| 444 |
0 |
maxColour.repaint(); |
| 445 |
0 |
changeColour(); |
| 446 |
|
} |
| 447 |
|
else |
| 448 |
|
{ |
| 449 |
0 |
new UserDefinedColours(this, "Max Colour", maxColour.getBackground()); |
| 450 |
|
} |
| 451 |
|
} |
| 452 |
|
|
| |
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
| 453 |
0 |
public void defColour_actionPerformed()... |
| 454 |
|
{ |
| 455 |
0 |
setDefaultMinMax(); |
| 456 |
0 |
minColour.repaint(); |
| 457 |
0 |
maxColour.repaint(); |
| 458 |
0 |
changeColour(); |
| 459 |
|
} |
| 460 |
|
|
| |
|
| 0% |
Uncovered Elements: 65 (65) |
Complexity: 14 |
Complexity Density: 0.33 |
|
| 461 |
0 |
void changeColour()... |
| 462 |
|
{ |
| 463 |
|
|
| 464 |
0 |
if (adjusting) |
| 465 |
|
{ |
| 466 |
0 |
return; |
| 467 |
|
} |
| 468 |
|
|
| 469 |
0 |
currentAnnotation = av.getAlignment() |
| 470 |
|
.getAlignmentAnnotation()[annotations.getSelectedIndex()]; |
| 471 |
|
|
| 472 |
0 |
int aboveThreshold = -1; |
| 473 |
0 |
if (threshold.getSelectedIndex() == 1) |
| 474 |
|
{ |
| 475 |
0 |
aboveThreshold = AnnotationColourGradient.ABOVE_THRESHOLD; |
| 476 |
|
} |
| 477 |
0 |
else if (threshold.getSelectedIndex() == 2) |
| 478 |
|
{ |
| 479 |
0 |
aboveThreshold = AnnotationColourGradient.BELOW_THRESHOLD; |
| 480 |
|
} |
| 481 |
|
|
| 482 |
0 |
slider.setEnabled(true); |
| 483 |
0 |
thresholdValue.setEnabled(true); |
| 484 |
0 |
thresholdIsMin.setEnabled(true); |
| 485 |
|
|
| 486 |
0 |
if (aboveThreshold == AnnotationColourGradient.NO_THRESHOLD) |
| 487 |
|
{ |
| 488 |
0 |
slider.setEnabled(false); |
| 489 |
0 |
thresholdValue.setEnabled(false); |
| 490 |
0 |
thresholdIsMin.setEnabled(false); |
| 491 |
0 |
thresholdValue.setText(""); |
| 492 |
|
} |
| 493 |
0 |
else if (aboveThreshold != AnnotationColourGradient.NO_THRESHOLD |
| 494 |
|
&& currentAnnotation.threshold == null) |
| 495 |
|
{ |
| 496 |
0 |
currentAnnotation.setThreshold(new jalview.datamodel.GraphLine( |
| 497 |
|
(currentAnnotation.graphMax - currentAnnotation.graphMin) |
| 498 |
|
/ 2f, |
| 499 |
|
"Threshold", Color.black)); |
| 500 |
|
} |
| 501 |
|
|
| 502 |
0 |
if (aboveThreshold != AnnotationColourGradient.NO_THRESHOLD) |
| 503 |
|
{ |
| 504 |
0 |
adjusting = true; |
| 505 |
|
|
| 506 |
0 |
slider.setMinimum((int) (currentAnnotation.graphMin * 1000)); |
| 507 |
0 |
slider.setMaximum((int) (currentAnnotation.graphMax * 1000)); |
| 508 |
0 |
slider.setValue((int) (currentAnnotation.threshold.value * 1000)); |
| 509 |
0 |
thresholdValue.setText(currentAnnotation.threshold.value + ""); |
| 510 |
0 |
slider.setEnabled(true); |
| 511 |
0 |
thresholdValue.setEnabled(true); |
| 512 |
0 |
adjusting = false; |
| 513 |
|
} |
| 514 |
|
|
| 515 |
0 |
AnnotationColourGradient acg = null; |
| 516 |
0 |
if (currentColours.getState()) |
| 517 |
|
{ |
| 518 |
|
} |
| 519 |
|
else |
| 520 |
|
{ |
| 521 |
0 |
acg = new AnnotationColourGradient(currentAnnotation, |
| 522 |
|
minColour.getBackground(), maxColour.getBackground(), |
| 523 |
|
aboveThreshold); |
| 524 |
|
} |
| 525 |
|
|
| 526 |
0 |
if (currentAnnotation.graphMin == 0f |
| 527 |
|
&& currentAnnotation.graphMax == 0f) |
| 528 |
|
{ |
| 529 |
0 |
acg.setPredefinedColours(true); |
| 530 |
|
} |
| 531 |
|
|
| 532 |
0 |
acg.setThresholdIsMinMax(thresholdIsMin.getState()); |
| 533 |
|
|
| 534 |
0 |
av.setGlobalColourScheme(acg); |
| 535 |
|
|
| 536 |
|
|
| 537 |
0 |
if (av.getAlignment().getGroups() != null) |
| 538 |
|
{ |
| 539 |
0 |
for (SequenceGroup sg : ap.av.getAlignment().getGroups()) |
| 540 |
|
{ |
| 541 |
0 |
if (sg.getColourScheme() == null) |
| 542 |
|
{ |
| 543 |
0 |
continue; |
| 544 |
|
} |
| 545 |
|
|
| 546 |
0 |
if (currentColours.getState()) |
| 547 |
|
{ |
| 548 |
0 |
sg.setColourScheme(new AnnotationColourGradient(currentAnnotation, |
| 549 |
|
sg.getColourScheme(), aboveThreshold)); |
| 550 |
|
} |
| 551 |
|
else |
| 552 |
|
{ |
| 553 |
0 |
sg.setColourScheme(new AnnotationColourGradient(currentAnnotation, |
| 554 |
|
minColour.getBackground(), maxColour.getBackground(), |
| 555 |
|
aboveThreshold)); |
| 556 |
|
} |
| 557 |
|
} |
| 558 |
|
} |
| 559 |
|
|
| 560 |
|
|
| 561 |
0 |
ap.alignmentChanged(); |
| 562 |
0 |
ap.paintAlignment(true, true); |
| 563 |
|
} |
| 564 |
|
|
| |
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
| 565 |
0 |
void reset()... |
| 566 |
|
{ |
| 567 |
0 |
av.setGlobalColourScheme(oldcs); |
| 568 |
0 |
if (av.getAlignment().getGroups() != null) |
| 569 |
|
{ |
| 570 |
0 |
for (SequenceGroup sg : ap.av.getAlignment().getGroups()) |
| 571 |
|
{ |
| 572 |
0 |
sg.setColourScheme(oldgroupColours.get(sg)); |
| 573 |
|
} |
| 574 |
|
} |
| 575 |
0 |
ap.paintAlignment(true, true); |
| 576 |
|
} |
| 577 |
|
|
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 578 |
0 |
@Override... |
| 579 |
|
public void mouseClicked(MouseEvent evt) |
| 580 |
|
{ |
| 581 |
|
} |
| 582 |
|
|
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 583 |
0 |
@Override... |
| 584 |
|
public void mousePressed(MouseEvent evt) |
| 585 |
|
{ |
| 586 |
|
} |
| 587 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 588 |
0 |
@Override... |
| 589 |
|
public void mouseReleased(MouseEvent evt) |
| 590 |
|
{ |
| 591 |
0 |
ap.paintAlignment(true, true); |
| 592 |
|
} |
| 593 |
|
|
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 594 |
0 |
@Override... |
| 595 |
|
public void mouseEntered(MouseEvent evt) |
| 596 |
|
{ |
| 597 |
|
} |
| 598 |
|
|
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 599 |
0 |
@Override... |
| 600 |
|
public void mouseExited(MouseEvent evt) |
| 601 |
|
{ |
| 602 |
|
} |
| 603 |
|
|
| 604 |
|
} |