1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.gui; |
22 |
|
|
23 |
|
import java.awt.Canvas; |
24 |
|
import java.awt.Color; |
25 |
|
import java.awt.Cursor; |
26 |
|
import java.awt.Dimension; |
27 |
|
import java.awt.Font; |
28 |
|
import java.awt.FontMetrics; |
29 |
|
import java.awt.Graphics; |
30 |
|
import java.awt.Graphics2D; |
31 |
|
import java.awt.RenderingHints; |
32 |
|
import java.awt.Toolkit; |
33 |
|
import java.awt.datatransfer.StringSelection; |
34 |
|
import java.awt.event.ActionEvent; |
35 |
|
import java.awt.event.ActionListener; |
36 |
|
import java.awt.event.MouseEvent; |
37 |
|
import java.awt.event.MouseListener; |
38 |
|
import java.awt.event.MouseMotionListener; |
39 |
|
import java.awt.geom.AffineTransform; |
40 |
|
import java.util.Arrays; |
41 |
|
import java.util.Collections; |
42 |
|
import java.util.Iterator; |
43 |
|
import java.util.List; |
44 |
|
import java.util.Locale; |
45 |
|
|
46 |
|
import javax.swing.JCheckBoxMenuItem; |
47 |
|
import javax.swing.JMenuItem; |
48 |
|
import javax.swing.JPanel; |
49 |
|
import javax.swing.JPopupMenu; |
50 |
|
import javax.swing.SwingUtilities; |
51 |
|
import javax.swing.ToolTipManager; |
52 |
|
|
53 |
|
import jalview.analysis.AlignSeq; |
54 |
|
import jalview.analysis.AlignmentUtils; |
55 |
|
import jalview.api.AlignCalcWorkerI; |
56 |
|
import jalview.bin.Cache; |
57 |
|
import jalview.bin.Jalview; |
58 |
|
import jalview.datamodel.Alignment; |
59 |
|
import jalview.datamodel.AlignmentAnnotation; |
60 |
|
import jalview.datamodel.Annotation; |
61 |
|
import jalview.datamodel.ContactMatrixI; |
62 |
|
import jalview.datamodel.GroupSet; |
63 |
|
import jalview.datamodel.HiddenColumns; |
64 |
|
import jalview.datamodel.Sequence; |
65 |
|
import jalview.datamodel.SequenceGroup; |
66 |
|
import jalview.datamodel.SequenceI; |
67 |
|
import jalview.io.FileFormat; |
68 |
|
import jalview.io.FormatAdapter; |
69 |
|
import jalview.util.Comparison; |
70 |
|
import jalview.util.Constants; |
71 |
|
import jalview.util.MessageManager; |
72 |
|
import jalview.util.ParseHtmlBodyAndLinks; |
73 |
|
import jalview.util.Platform; |
74 |
|
import jalview.workers.SecondaryStructureConsensusThread; |
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
|
80 |
|
|
|
|
| 31.8% |
Uncovered Elements: 617 (905) |
Complexity: 238 |
Complexity Density: 0.42 |
|
81 |
|
public class AnnotationLabels extends JPanel |
82 |
|
implements MouseListener, MouseMotionListener, ActionListener |
83 |
|
{ |
84 |
|
private static final String HTML_END_TAG = "</html>"; |
85 |
|
|
86 |
|
private static final String HTML_START_TAG = "<html>"; |
87 |
|
|
88 |
|
|
89 |
|
|
90 |
|
|
91 |
|
private static final int HEIGHT_ADJUSTER_WIDTH = 50; |
92 |
|
|
93 |
|
|
94 |
|
|
95 |
|
|
96 |
|
public static int HEIGHT_ADJUSTER_HEIGHT = 10; |
97 |
|
|
98 |
|
private static final Font font = new Font("Arial", Font.PLAIN, 11); |
99 |
|
|
100 |
|
private static final String TOGGLE_LABELSCALE = MessageManager |
101 |
|
.getString("label.scale_label_to_column"); |
102 |
|
|
103 |
|
private static final String ADDNEW = MessageManager |
104 |
|
.getString("label.add_new_row"); |
105 |
|
|
106 |
|
private static final String EDITNAME = MessageManager |
107 |
|
.getString("label.edit_label_description"); |
108 |
|
|
109 |
|
private static final String HIDE = MessageManager |
110 |
|
.getString("label.hide_row"); |
111 |
|
|
112 |
|
private static final String DELETE = MessageManager |
113 |
|
.getString("label.delete_row"); |
114 |
|
|
115 |
|
private static final String SHOWALL = MessageManager |
116 |
|
.getString("label.show_all_hidden_rows"); |
117 |
|
|
118 |
|
private static final String OUTPUT_TEXT = MessageManager |
119 |
|
.getString("label.export_annotation"); |
120 |
|
|
121 |
|
private static final String COPYCONS_SEQ = MessageManager |
122 |
|
.getString("label.copy_consensus_sequence"); |
123 |
|
|
124 |
|
private static final String ADJUST_ANNOTATION_LABELS_WIDTH_PREF = "ADJUST_ANNOTATION_LABELS_WIDTH"; |
125 |
|
|
126 |
|
private final boolean debugRedraw = false; |
127 |
|
|
128 |
|
private AlignmentPanel ap; |
129 |
|
|
130 |
|
AlignViewport av; |
131 |
|
|
132 |
|
private MouseEvent dragEvent; |
133 |
|
|
134 |
|
private int oldY; |
135 |
|
|
136 |
|
private int selectedRow; |
137 |
|
|
138 |
|
private int scrollOffset = 0; |
139 |
|
|
140 |
|
private boolean hasHiddenRows; |
141 |
|
|
142 |
|
private boolean resizePanel = false; |
143 |
|
|
144 |
|
private int annotationIdWidth = -1; |
145 |
|
|
146 |
|
public static final String RESIZE_MARGINS_MARK_PREF = "RESIZE_MARGINS_MARK"; |
147 |
|
|
148 |
|
|
149 |
|
|
150 |
|
|
151 |
|
@param |
152 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
153 |
479 |
public AnnotationLabels(AlignmentPanel ap)... |
154 |
|
{ |
155 |
479 |
this.ap = ap; |
156 |
479 |
av = ap.av; |
157 |
479 |
ToolTipManager.sharedInstance().registerComponent(this); |
158 |
|
|
159 |
479 |
addMouseListener(this); |
160 |
479 |
addMouseMotionListener(this); |
161 |
479 |
addMouseWheelListener(ap.getAnnotationPanel()); |
162 |
|
} |
163 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
164 |
275 |
public AnnotationLabels(AlignViewport av)... |
165 |
|
{ |
166 |
275 |
this.av = av; |
167 |
|
} |
168 |
|
|
169 |
|
|
170 |
|
|
171 |
|
|
172 |
|
@param |
173 |
|
|
174 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
175 |
909 |
public void setScrollOffset(int y)... |
176 |
|
{ |
177 |
909 |
scrollOffset = y; |
178 |
909 |
repaint(); |
179 |
|
} |
180 |
|
|
181 |
|
|
182 |
|
|
183 |
|
|
184 |
|
|
185 |
|
@param |
186 |
|
|
187 |
|
|
|
|
| 0% |
Uncovered Elements: 20 (20) |
Complexity: 5 |
Complexity Density: 0.42 |
|
188 |
0 |
void getSelectedRow(int y)... |
189 |
|
{ |
190 |
0 |
int height = 0; |
191 |
0 |
AlignmentAnnotation[] aa = ap.av.getAlignment() |
192 |
|
.getAlignmentAnnotation(); |
193 |
0 |
selectedRow = -2; |
194 |
0 |
if (aa != null) |
195 |
|
{ |
196 |
0 |
for (int i = 0; i < aa.length; i++) |
197 |
|
{ |
198 |
0 |
selectedRow = -1; |
199 |
0 |
if (!aa[i].visible) |
200 |
|
{ |
201 |
0 |
continue; |
202 |
|
} |
203 |
|
|
204 |
0 |
height += aa[i].height; |
205 |
|
|
206 |
0 |
if (y < height) |
207 |
|
{ |
208 |
0 |
selectedRow = i; |
209 |
|
|
210 |
0 |
break; |
211 |
|
} |
212 |
|
} |
213 |
|
} |
214 |
|
} |
215 |
|
|
216 |
|
|
217 |
|
|
218 |
|
|
219 |
|
@param |
220 |
|
|
221 |
|
|
|
|
| 0% |
Uncovered Elements: 57 (57) |
Complexity: 15 |
Complexity Density: 0.48 |
|
222 |
0 |
@Override... |
223 |
|
public void actionPerformed(ActionEvent evt) |
224 |
|
{ |
225 |
0 |
AlignmentAnnotation[] aa = ap.av.getAlignment() |
226 |
|
.getAlignmentAnnotation(); |
227 |
|
|
228 |
0 |
String action = evt.getActionCommand(); |
229 |
0 |
if (ADDNEW.equals(action)) |
230 |
|
{ |
231 |
|
|
232 |
|
|
233 |
|
|
234 |
0 |
AlignmentAnnotation newAnnotation = new AlignmentAnnotation(null, |
235 |
|
null, new Annotation[ap.av.getAlignment().getWidth()]); |
236 |
0 |
editLabelDescription(newAnnotation, true); |
237 |
|
} |
238 |
0 |
else if (EDITNAME.equals(action)) |
239 |
|
{ |
240 |
|
|
241 |
|
|
242 |
|
|
243 |
0 |
editLabelDescription(aa[selectedRow], false); |
244 |
|
} |
245 |
0 |
else if (HIDE.equals(action)) |
246 |
|
{ |
247 |
0 |
aa[selectedRow].visible = false; |
248 |
|
} |
249 |
0 |
else if (DELETE.equals(action)) |
250 |
|
{ |
251 |
0 |
ap.av.getAlignment().deleteAnnotation(aa[selectedRow]); |
252 |
0 |
ap.av.getCalcManager().removeWorkerForAnnotation(aa[selectedRow]); |
253 |
|
|
254 |
0 |
List<AlignCalcWorkerI> workers = ap.av.getCalcManager() |
255 |
|
.getRegisteredWorkersOfClass( |
256 |
|
SecondaryStructureConsensusThread.class); |
257 |
0 |
if (!workers.isEmpty()) |
258 |
|
{ |
259 |
|
|
260 |
0 |
ap.alignFrame.getViewport().getCalcManager() |
261 |
|
.startWorker(workers.remove(0)); |
262 |
|
|
263 |
|
} |
264 |
|
} |
265 |
0 |
else if (SHOWALL.equals(action)) |
266 |
|
{ |
267 |
0 |
for (int i = 0; i < aa.length; i++) |
268 |
|
{ |
269 |
0 |
if (!aa[i].visible && aa[i].annotations != null) |
270 |
|
{ |
271 |
0 |
aa[i].visible = true; |
272 |
|
} |
273 |
|
} |
274 |
|
} |
275 |
0 |
else if (OUTPUT_TEXT.equals(action)) |
276 |
|
{ |
277 |
0 |
new AnnotationExporter(ap).exportAnnotation(aa[selectedRow]); |
278 |
|
} |
279 |
0 |
else if (COPYCONS_SEQ.equals(action)) |
280 |
|
{ |
281 |
0 |
SequenceI cons = null; |
282 |
0 |
if (aa[selectedRow].groupRef != null) |
283 |
|
{ |
284 |
0 |
cons = aa[selectedRow].groupRef.getConsensusSeq(); |
285 |
|
} |
286 |
|
else |
287 |
|
{ |
288 |
0 |
cons = av.getConsensusSeq(); |
289 |
|
} |
290 |
0 |
if (cons != null) |
291 |
|
{ |
292 |
0 |
copy_annotseqtoclipboard(cons); |
293 |
|
} |
294 |
|
} |
295 |
0 |
else if (TOGGLE_LABELSCALE.equals(action)) |
296 |
|
{ |
297 |
0 |
aa[selectedRow].scaleColLabel = !aa[selectedRow].scaleColLabel; |
298 |
|
} |
299 |
|
|
300 |
0 |
ap.refresh(true); |
301 |
|
} |
302 |
|
|
303 |
|
|
304 |
|
|
305 |
|
|
306 |
|
|
307 |
|
|
308 |
|
@param |
309 |
|
@param |
310 |
|
|
|
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 4 |
Complexity Density: 0.29 |
|
311 |
0 |
void editLabelDescription(AlignmentAnnotation annotation, boolean addNew)... |
312 |
|
{ |
313 |
0 |
String name = MessageManager.getString("label.annotation_name"); |
314 |
0 |
String description = MessageManager |
315 |
|
.getString("label.annotation_description"); |
316 |
0 |
String title = MessageManager |
317 |
|
.getString("label.edit_annotation_name_description"); |
318 |
0 |
EditNameDialog dialog = new EditNameDialog(annotation.label, |
319 |
|
annotation.description, name, description); |
320 |
|
|
321 |
0 |
dialog.showDialog(ap.alignFrame, title, () -> { |
322 |
0 |
annotation.label = dialog.getName(); |
323 |
0 |
String text = dialog.getDescription(); |
324 |
0 |
if (text != null && text.length() == 0) |
325 |
|
{ |
326 |
0 |
text = null; |
327 |
|
} |
328 |
0 |
annotation.description = text; |
329 |
0 |
if (addNew) |
330 |
|
{ |
331 |
0 |
ap.av.getAlignment().addAnnotation(annotation); |
332 |
0 |
ap.av.getAlignment().setAnnotationIndex(annotation, 0); |
333 |
|
} |
334 |
0 |
ap.refresh(true); |
335 |
|
}); |
336 |
|
} |
337 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
338 |
0 |
@Override... |
339 |
|
public void mousePressed(MouseEvent evt) |
340 |
|
{ |
341 |
0 |
getSelectedRow(evt.getY() - getScrollOffset()); |
342 |
0 |
oldY = evt.getY(); |
343 |
0 |
if (evt.isPopupTrigger()) |
344 |
|
{ |
345 |
0 |
showPopupMenu(evt); |
346 |
|
} |
347 |
|
} |
348 |
|
|
349 |
|
|
350 |
|
|
351 |
|
|
352 |
|
@param |
353 |
|
|
|
|
| 0% |
Uncovered Elements: 74 (74) |
Complexity: 11 |
Complexity Density: 0.2 |
|
354 |
0 |
void showPopupMenu(MouseEvent evt)... |
355 |
|
{ |
356 |
0 |
evt.consume(); |
357 |
0 |
final AlignmentAnnotation[] aa = ap.av.getAlignment() |
358 |
|
.getAlignmentAnnotation(); |
359 |
|
|
360 |
0 |
JPopupMenu pop = new JPopupMenu( |
361 |
|
MessageManager.getString("label.annotations")); |
362 |
0 |
JMenuItem item = new JMenuItem(ADDNEW); |
363 |
0 |
item.addActionListener(this); |
364 |
0 |
pop.add(item); |
365 |
0 |
if (selectedRow < 0) |
366 |
|
{ |
367 |
0 |
if (hasHiddenRows) |
368 |
|
{ |
369 |
0 |
item = new JMenuItem(SHOWALL); |
370 |
0 |
item.addActionListener(this); |
371 |
0 |
pop.add(item); |
372 |
|
} |
373 |
0 |
pop.show(this, evt.getX(), evt.getY()); |
374 |
0 |
return; |
375 |
|
} |
376 |
0 |
item = new JMenuItem(EDITNAME); |
377 |
0 |
item.addActionListener(this); |
378 |
0 |
pop.add(item); |
379 |
0 |
item = new JMenuItem(HIDE); |
380 |
0 |
item.addActionListener(this); |
381 |
0 |
pop.add(item); |
382 |
|
|
383 |
0 |
if (selectedRow < aa.length) |
384 |
|
{ |
385 |
0 |
if (aa[selectedRow].sequenceRef != null) |
386 |
|
{ |
387 |
0 |
final String label = aa[selectedRow].label; |
388 |
0 |
JMenuItem hideType = new JMenuItem(); |
389 |
0 |
String text = MessageManager.getString("label.hide_all") + " " |
390 |
|
+ label; |
391 |
0 |
hideType.setText(text); |
392 |
0 |
hideType.addActionListener(new ActionListener() |
393 |
|
{ |
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
394 |
0 |
@Override... |
395 |
|
public void actionPerformed(ActionEvent e) |
396 |
|
{ |
397 |
0 |
AlignmentUtils.showOrHideSequenceAnnotations( |
398 |
|
ap.av.getAlignment(), Collections.singleton(label), |
399 |
|
null, false, false); |
400 |
0 |
ap.refresh(true); |
401 |
|
} |
402 |
|
}); |
403 |
0 |
pop.add(hideType); |
404 |
|
} |
405 |
|
} |
406 |
0 |
item = new JMenuItem(DELETE); |
407 |
0 |
item.addActionListener(this); |
408 |
0 |
pop.add(item); |
409 |
0 |
if (hasHiddenRows) |
410 |
|
{ |
411 |
0 |
item = new JMenuItem(SHOWALL); |
412 |
0 |
item.addActionListener(this); |
413 |
0 |
pop.add(item); |
414 |
|
} |
415 |
0 |
item = new JMenuItem(OUTPUT_TEXT); |
416 |
0 |
item.addActionListener(this); |
417 |
0 |
pop.add(item); |
418 |
|
|
419 |
|
|
420 |
0 |
if (selectedRow < aa.length) |
421 |
|
{ |
422 |
0 |
final String label = aa[selectedRow].label; |
423 |
0 |
if (!aa[selectedRow].autoCalculated) |
424 |
|
{ |
425 |
0 |
if (aa[selectedRow].graph == AlignmentAnnotation.NO_GRAPH) |
426 |
|
{ |
427 |
|
|
428 |
0 |
pop.addSeparator(); |
429 |
|
|
430 |
0 |
item = new JCheckBoxMenuItem(TOGGLE_LABELSCALE, |
431 |
|
aa[selectedRow].scaleColLabel); |
432 |
0 |
item.addActionListener(this); |
433 |
0 |
pop.add(item); |
434 |
|
} |
435 |
|
} |
436 |
0 |
else if (label.indexOf("Consensus") > -1) |
437 |
|
{ |
438 |
0 |
addConsensusMenuOptions(ap, aa[selectedRow], pop); |
439 |
|
|
440 |
0 |
final JMenuItem consclipbrd = new JMenuItem(COPYCONS_SEQ); |
441 |
0 |
consclipbrd.addActionListener(this); |
442 |
0 |
pop.add(consclipbrd); |
443 |
|
} |
444 |
|
|
445 |
0 |
addColourOrFilterByOptions(ap, aa[selectedRow], pop); |
446 |
|
|
447 |
0 |
if (aa[selectedRow].graph == AlignmentAnnotation.CONTACT_MAP) |
448 |
|
{ |
449 |
0 |
addContactMatrixOptions(ap, aa[selectedRow], pop); |
450 |
|
|
451 |
|
|
452 |
|
|
453 |
|
|
454 |
|
} |
455 |
|
} |
456 |
|
|
457 |
0 |
pop.show(this, evt.getX(), evt.getY()); |
458 |
|
} |
459 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 2 |
Complexity Density: 0.18 |
|
460 |
0 |
static void addColourOrFilterByOptions(final AlignmentPanel ap,... |
461 |
|
final AlignmentAnnotation alignmentAnnotation, |
462 |
|
final JPopupMenu pop) |
463 |
|
{ |
464 |
0 |
JMenuItem item; |
465 |
0 |
item = new JMenuItem( |
466 |
|
MessageManager.getString("label.colour_by_annotation")); |
467 |
0 |
item.addActionListener(new ActionListener() |
468 |
|
{ |
469 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
470 |
0 |
@Override... |
471 |
|
public void actionPerformed(ActionEvent e) |
472 |
|
{ |
473 |
0 |
AnnotationColourChooser.displayFor(ap.av, ap, alignmentAnnotation, |
474 |
|
false); |
475 |
|
}; |
476 |
|
}); |
477 |
0 |
pop.add(item); |
478 |
0 |
if (alignmentAnnotation.sequenceRef != null) |
479 |
|
{ |
480 |
0 |
item = new JMenuItem( |
481 |
|
MessageManager.getString("label.colour_by_annotation") + " (" |
482 |
|
+ MessageManager.getString("label.per_seq") + ")"); |
483 |
0 |
item.addActionListener(new ActionListener() |
484 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
485 |
0 |
@Override... |
486 |
|
public void actionPerformed(ActionEvent e) |
487 |
|
{ |
488 |
0 |
AnnotationColourChooser.displayFor(ap.av, ap, alignmentAnnotation, |
489 |
|
true); |
490 |
|
}; |
491 |
|
}); |
492 |
0 |
pop.add(item); |
493 |
|
} |
494 |
0 |
item = new JMenuItem( |
495 |
|
MessageManager.getString("action.select_by_annotation")); |
496 |
0 |
item.addActionListener(new ActionListener() |
497 |
|
{ |
498 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
499 |
0 |
@Override... |
500 |
|
public void actionPerformed(ActionEvent e) |
501 |
|
{ |
502 |
0 |
AnnotationColumnChooser.displayFor(ap.av, ap, alignmentAnnotation); |
503 |
|
}; |
504 |
|
}); |
505 |
0 |
pop.add(item); |
506 |
|
} |
507 |
|
|
|
|
| 0% |
Uncovered Elements: 27 (27) |
Complexity: 4 |
Complexity Density: 0.19 |
|
508 |
0 |
static void addContactMatrixOptions(final AlignmentPanel ap,... |
509 |
|
final AlignmentAnnotation alignmentAnnotation, |
510 |
|
final JPopupMenu pop) |
511 |
|
{ |
512 |
|
|
513 |
0 |
final ContactMatrixI cm = ap.av.getContactMatrix(alignmentAnnotation); |
514 |
0 |
JMenuItem item; |
515 |
0 |
if (cm != null) |
516 |
|
{ |
517 |
0 |
pop.addSeparator(); |
518 |
|
|
519 |
0 |
if (cm.hasGroups()) |
520 |
|
{ |
521 |
0 |
JCheckBoxMenuItem chitem = new JCheckBoxMenuItem( |
522 |
|
MessageManager.getString("action.show_groups_on_matrix")); |
523 |
0 |
chitem.setToolTipText(MessageManager |
524 |
|
.getString("action.show_groups_on_matrix_tooltip")); |
525 |
0 |
boolean showGroups = alignmentAnnotation |
526 |
|
.isShowGroupsForContactMatrix(); |
527 |
0 |
final AlignmentAnnotation sel_row = alignmentAnnotation; |
528 |
0 |
chitem.setState(showGroups); |
529 |
0 |
chitem.addActionListener(new ActionListener() |
530 |
|
{ |
531 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
532 |
0 |
@Override... |
533 |
|
public void actionPerformed(ActionEvent e) |
534 |
|
{ |
535 |
0 |
sel_row.setShowGroupsForContactMatrix(chitem.getState()); |
536 |
|
|
537 |
|
|
538 |
|
|
539 |
0 |
ap.alignmentChanged(); |
540 |
|
} |
541 |
|
}); |
542 |
0 |
pop.add(chitem); |
543 |
|
} |
544 |
0 |
if (cm.hasTree()) |
545 |
|
{ |
546 |
0 |
item = new JMenuItem( |
547 |
|
MessageManager.getString("action.show_tree_for_matrix")); |
548 |
0 |
item.setToolTipText(MessageManager |
549 |
|
.getString("action.show_tree_for_matrix_tooltip")); |
550 |
0 |
item.addActionListener(new ActionListener() |
551 |
|
{ |
552 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
553 |
0 |
@Override... |
554 |
|
public void actionPerformed(ActionEvent e) |
555 |
|
{ |
556 |
|
|
557 |
0 |
ap.alignFrame.showContactMapTree(alignmentAnnotation, cm); |
558 |
|
|
559 |
|
} |
560 |
|
}); |
561 |
0 |
pop.add(item); |
562 |
|
} |
563 |
|
else |
564 |
|
{ |
565 |
0 |
item = new JMenuItem( |
566 |
|
MessageManager.getString("action.cluster_matrix")); |
567 |
0 |
item.setToolTipText( |
568 |
|
MessageManager.getString("action.cluster_matrix_tooltip")); |
569 |
0 |
item.addActionListener(new ActionListener() |
570 |
|
{ |
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
571 |
0 |
@Override... |
572 |
|
public void actionPerformed(ActionEvent e) |
573 |
|
{ |
574 |
0 |
new Thread(new Runnable() |
575 |
|
{ |
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
|
576 |
0 |
@Override... |
577 |
|
public void run() |
578 |
|
{ |
579 |
0 |
final long progBar; |
580 |
0 |
ap.alignFrame.setProgressBar( |
581 |
|
MessageManager.formatMessage( |
582 |
|
"action.clustering_matrix_for", |
583 |
|
cm.getAnnotDescr(), 5f), |
584 |
|
progBar = System.currentTimeMillis()); |
585 |
0 |
cm.setGroupSet(GroupSet.makeGroups(cm, true)); |
586 |
0 |
cm.randomlyReColourGroups(); |
587 |
0 |
cm.transferGroupColorsTo(alignmentAnnotation); |
588 |
0 |
ap.alignmentChanged(); |
589 |
0 |
ap.alignFrame.showContactMapTree(alignmentAnnotation, cm); |
590 |
0 |
ap.alignFrame.setProgressBar(null, progBar); |
591 |
|
} |
592 |
|
}).start(); |
593 |
|
} |
594 |
|
}); |
595 |
0 |
pop.add(item); |
596 |
|
} |
597 |
|
} |
598 |
|
} |
599 |
|
|
600 |
|
|
601 |
|
|
602 |
|
|
603 |
|
|
604 |
|
|
605 |
|
|
606 |
|
|
607 |
|
@param |
608 |
|
@param |
609 |
|
@param |
610 |
|
|
|
|
| 0% |
Uncovered Elements: 28 (28) |
Complexity: 3 |
Complexity Density: 0.12 |
|
611 |
0 |
static void addConsensusMenuOptions(AlignmentPanel ap,... |
612 |
|
AlignmentAnnotation ann, JPopupMenu pop) |
613 |
|
{ |
614 |
0 |
pop.addSeparator(); |
615 |
|
|
616 |
0 |
final JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem( |
617 |
|
MessageManager.getString("label.ignore_gaps_consensus"), |
618 |
0 |
(ann.groupRef != null) ? ann.groupRef.getIgnoreGapsConsensus() |
619 |
|
: ap.av.isIgnoreGapsConsensus()); |
620 |
0 |
final AlignmentAnnotation aaa = ann; |
621 |
0 |
cbmi.addActionListener(new ActionListener() |
622 |
|
{ |
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
623 |
0 |
@Override... |
624 |
|
public void actionPerformed(ActionEvent e) |
625 |
|
{ |
626 |
0 |
if (aaa.groupRef != null) |
627 |
|
{ |
628 |
0 |
aaa.groupRef.setIgnoreGapsConsensus(cbmi.getState()); |
629 |
0 |
ap.getAnnotationPanel() |
630 |
|
.paint(ap.getAnnotationPanel().getGraphics()); |
631 |
|
} |
632 |
|
else |
633 |
|
{ |
634 |
0 |
ap.av.setIgnoreGapsConsensus(cbmi.getState(), ap); |
635 |
|
} |
636 |
0 |
ap.alignmentChanged(); |
637 |
|
} |
638 |
|
}); |
639 |
0 |
pop.add(cbmi); |
640 |
|
|
641 |
0 |
if (aaa.groupRef != null) |
642 |
|
{ |
643 |
|
|
644 |
|
|
645 |
|
|
646 |
0 |
final JCheckBoxMenuItem chist = new JCheckBoxMenuItem( |
647 |
|
MessageManager.getString("label.show_group_histogram"), |
648 |
|
ann.groupRef.isShowConsensusHistogram()); |
649 |
0 |
chist.addActionListener(new ActionListener() |
650 |
|
{ |
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
651 |
0 |
@Override... |
652 |
|
public void actionPerformed(ActionEvent e) |
653 |
|
{ |
654 |
0 |
aaa.groupRef.setShowConsensusHistogram(chist.getState()); |
655 |
0 |
ap.repaint(); |
656 |
|
} |
657 |
|
}); |
658 |
0 |
pop.add(chist); |
659 |
0 |
final JCheckBoxMenuItem cprofl = new JCheckBoxMenuItem( |
660 |
|
MessageManager.getString("label.show_group_logo"), |
661 |
|
ann.groupRef.isShowSequenceLogo()); |
662 |
0 |
cprofl.addActionListener(new ActionListener() |
663 |
|
{ |
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
664 |
0 |
@Override... |
665 |
|
public void actionPerformed(ActionEvent e) |
666 |
|
{ |
667 |
0 |
aaa.groupRef.setshowSequenceLogo(cprofl.getState()); |
668 |
0 |
ap.repaint(); |
669 |
|
} |
670 |
|
}); |
671 |
0 |
pop.add(cprofl); |
672 |
0 |
final JCheckBoxMenuItem cproflnorm = new JCheckBoxMenuItem( |
673 |
|
MessageManager.getString("label.normalise_group_logo"), |
674 |
|
ann.groupRef.isNormaliseSequenceLogo()); |
675 |
0 |
cproflnorm.addActionListener(new ActionListener() |
676 |
|
{ |
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
677 |
0 |
@Override... |
678 |
|
public void actionPerformed(ActionEvent e) |
679 |
|
{ |
680 |
0 |
aaa.groupRef.setNormaliseSequenceLogo(cproflnorm.getState()); |
681 |
|
|
682 |
0 |
aaa.groupRef.setshowSequenceLogo(true); |
683 |
0 |
ap.repaint(); |
684 |
|
} |
685 |
|
}); |
686 |
0 |
pop.add(cproflnorm); |
687 |
|
} |
688 |
|
else |
689 |
|
{ |
690 |
|
|
691 |
|
|
692 |
|
|
693 |
0 |
final JCheckBoxMenuItem chist = new JCheckBoxMenuItem( |
694 |
|
MessageManager.getString("label.show_histogram"), |
695 |
|
ap.av.isShowConsensusHistogram()); |
696 |
0 |
chist.addActionListener(new ActionListener() |
697 |
|
{ |
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
698 |
0 |
@Override... |
699 |
|
public void actionPerformed(ActionEvent e) |
700 |
|
{ |
701 |
0 |
ap.av.setShowConsensusHistogram(chist.getState()); |
702 |
0 |
ap.alignFrame.setMenusForViewport(); |
703 |
0 |
ap.repaint(); |
704 |
|
} |
705 |
|
}); |
706 |
0 |
pop.add(chist); |
707 |
0 |
final JCheckBoxMenuItem cprof = new JCheckBoxMenuItem( |
708 |
|
MessageManager.getString("label.show_logo"), |
709 |
|
ap.av.isShowSequenceLogo()); |
710 |
0 |
cprof.addActionListener(new ActionListener() |
711 |
|
{ |
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
712 |
0 |
@Override... |
713 |
|
public void actionPerformed(ActionEvent e) |
714 |
|
{ |
715 |
0 |
ap.av.setShowSequenceLogo(cprof.getState()); |
716 |
0 |
ap.alignFrame.setMenusForViewport(); |
717 |
0 |
ap.repaint(); |
718 |
|
} |
719 |
|
}); |
720 |
0 |
pop.add(cprof); |
721 |
0 |
final JCheckBoxMenuItem cprofnorm = new JCheckBoxMenuItem( |
722 |
|
MessageManager.getString("label.normalise_logo"), |
723 |
|
ap.av.isNormaliseSequenceLogo()); |
724 |
0 |
cprofnorm.addActionListener(new ActionListener() |
725 |
|
{ |
|
|
| 0% |
Uncovered Elements: 4 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
726 |
0 |
@Override... |
727 |
|
public void actionPerformed(ActionEvent e) |
728 |
|
{ |
729 |
0 |
ap.av.setShowSequenceLogo(true); |
730 |
0 |
ap.av.setNormaliseSequenceLogo(cprofnorm.getState()); |
731 |
0 |
ap.alignFrame.setMenusForViewport(); |
732 |
0 |
ap.repaint(); |
733 |
|
} |
734 |
|
}); |
735 |
0 |
pop.add(cprofnorm); |
736 |
|
} |
737 |
|
} |
738 |
|
|
739 |
|
|
740 |
|
|
741 |
|
|
742 |
|
@param |
743 |
|
|
|
|
| 0% |
Uncovered Elements: 23 (23) |
Complexity: 4 |
Complexity Density: 0.24 |
|
744 |
0 |
@Override... |
745 |
|
public void mouseReleased(MouseEvent evt) |
746 |
|
{ |
747 |
0 |
if (evt.isPopupTrigger()) |
748 |
|
{ |
749 |
0 |
showPopupMenu(evt); |
750 |
0 |
return; |
751 |
|
} |
752 |
|
|
753 |
0 |
int start = selectedRow; |
754 |
0 |
getSelectedRow(evt.getY() - getScrollOffset()); |
755 |
0 |
int end = selectedRow; |
756 |
|
|
757 |
|
|
758 |
|
|
759 |
|
|
760 |
0 |
if (start != end) |
761 |
|
{ |
762 |
|
|
763 |
0 |
AlignmentAnnotation startAA = ap.av.getAlignment() |
764 |
|
.getAlignmentAnnotation()[start]; |
765 |
0 |
if (end == -1) |
766 |
|
{ |
767 |
0 |
end = ap.av.getAlignment().getAlignmentAnnotation().length - 1; |
768 |
|
} |
769 |
0 |
AlignmentAnnotation endAA = ap.av.getAlignment() |
770 |
|
.getAlignmentAnnotation()[end]; |
771 |
|
|
772 |
0 |
ap.av.getAlignment().getAlignmentAnnotation()[end] = startAA; |
773 |
0 |
ap.av.getAlignment().getAlignmentAnnotation()[start] = endAA; |
774 |
|
} |
775 |
|
|
776 |
0 |
resizePanel = false; |
777 |
0 |
dragEvent = null; |
778 |
0 |
repaint(); |
779 |
0 |
ap.getAnnotationPanel().repaint(); |
780 |
|
} |
781 |
|
|
782 |
|
|
783 |
|
|
784 |
|
|
785 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 3 |
Complexity Density: 1 |
|
786 |
0 |
@Override... |
787 |
|
public void mouseExited(MouseEvent evt) |
788 |
|
{ |
789 |
0 |
if (resizePanel && dragEvent == null) |
790 |
|
{ |
791 |
0 |
resizePanel = false; |
792 |
0 |
repaint(); |
793 |
|
} |
794 |
|
} |
795 |
|
|
796 |
|
|
797 |
|
|
798 |
|
|
799 |
|
|
800 |
|
|
801 |
|
@param |
802 |
|
|
|
|
| 0% |
Uncovered Elements: 20 (20) |
Complexity: 4 |
Complexity Density: 0.29 |
|
803 |
0 |
@Override... |
804 |
|
public void mouseDragged(MouseEvent evt) |
805 |
|
{ |
806 |
0 |
dragEvent = evt; |
807 |
|
|
808 |
0 |
if (resizePanel) |
809 |
|
{ |
810 |
0 |
Dimension d = ap.annotationScroller.getPreferredSize(); |
811 |
0 |
int dif = evt.getY() - oldY; |
812 |
0 |
dif -= dif % ap.av.getCharHeight(); |
813 |
|
|
814 |
|
|
815 |
|
|
816 |
0 |
if (d.height - dif > ap.idPanelHolder.getHeight() |
817 |
|
- ap.getIdSpaceFillerPanel1().getHeight()) |
818 |
|
{ |
819 |
0 |
return; |
820 |
|
} |
821 |
|
|
822 |
0 |
if ((d.height - dif) > 20) |
823 |
|
{ |
824 |
0 |
ap.annotationScroller |
825 |
|
.setPreferredSize(new Dimension(d.width, d.height - dif)); |
826 |
0 |
d = ap.annotationSpaceFillerHolder.getPreferredSize(); |
827 |
0 |
ap.annotationSpaceFillerHolder |
828 |
|
.setPreferredSize(new Dimension(d.width, d.height - dif)); |
829 |
0 |
ap.paintAlignment(true, false); |
830 |
|
} |
831 |
|
|
832 |
0 |
ap.addNotify(); |
833 |
|
} |
834 |
|
else |
835 |
|
{ |
836 |
0 |
repaint(); |
837 |
|
} |
838 |
|
} |
839 |
|
|
840 |
|
|
841 |
|
|
842 |
|
|
843 |
|
@param |
844 |
|
|
|
|
| 0% |
Uncovered Elements: 11 (11) |
Complexity: 3 |
Complexity Density: 0.33 |
|
845 |
0 |
@Override... |
846 |
|
public void mouseMoved(MouseEvent evt) |
847 |
|
{ |
848 |
0 |
showOrHideAdjuster(evt); |
849 |
|
|
850 |
0 |
getSelectedRow(evt.getY() - getScrollOffset()); |
851 |
|
|
852 |
0 |
if (selectedRow > -1 && ap.av.getAlignment() |
853 |
|
.getAlignmentAnnotation().length > selectedRow) |
854 |
|
{ |
855 |
0 |
AlignmentAnnotation[] anns = ap.av.getAlignment() |
856 |
|
.getAlignmentAnnotation(); |
857 |
0 |
AlignmentAnnotation aa = anns[selectedRow]; |
858 |
|
|
859 |
0 |
String desc = getTooltip(aa); |
860 |
0 |
this.setToolTipText(desc); |
861 |
0 |
String msg = getStatusMessage(aa, anns); |
862 |
0 |
ap.alignFrame.setStatus(msg); |
863 |
|
} |
864 |
|
} |
865 |
|
|
866 |
|
|
867 |
|
|
868 |
|
|
869 |
|
|
870 |
|
|
871 |
|
@param |
872 |
|
@param |
873 |
|
@return |
874 |
|
|
|
|
| 83.8% |
Uncovered Elements: 6 (37) |
Complexity: 9 |
Complexity Density: 0.43 |
|
875 |
6 |
static String getStatusMessage(AlignmentAnnotation aa,... |
876 |
|
AlignmentAnnotation[] anns) |
877 |
|
{ |
878 |
6 |
if (aa == null) |
879 |
|
{ |
880 |
1 |
return null; |
881 |
|
} |
882 |
|
|
883 |
5 |
StringBuilder msg = new StringBuilder(32); |
884 |
5 |
if (aa.sequenceRef != null) |
885 |
|
{ |
886 |
3 |
msg.append(aa.sequenceRef.getName()).append(" : "); |
887 |
|
} |
888 |
|
|
889 |
5 |
if (aa.graphGroup == -1) |
890 |
|
{ |
891 |
2 |
msg.append(aa.label); |
892 |
2 |
if (aa.getNoOfSequencesIncluded() >= 0) |
893 |
|
{ |
894 |
0 |
msg.append(" ("); |
895 |
0 |
msg.append(MessageManager.getString("label.sequence_count")); |
896 |
0 |
msg.append(aa.getNoOfSequencesIncluded()); |
897 |
0 |
msg.append(")"); |
898 |
|
} |
899 |
|
} |
900 |
|
|
901 |
3 |
else if (anns != null) |
902 |
|
{ |
903 |
3 |
boolean first = true; |
904 |
9 |
for (int i = anns.length - 1; i >= 0; i--) |
905 |
|
{ |
906 |
6 |
if (anns[i].graphGroup == aa.graphGroup) |
907 |
|
{ |
908 |
5 |
if (!first) |
909 |
|
{ |
910 |
2 |
msg.append(", "); |
911 |
|
} |
912 |
5 |
msg.append(anns[i].label); |
913 |
5 |
first = false; |
914 |
|
} |
915 |
|
} |
916 |
|
} |
917 |
|
|
918 |
5 |
return msg.toString(); |
919 |
|
} |
920 |
|
|
921 |
|
|
922 |
|
|
923 |
|
|
924 |
|
|
925 |
|
|
926 |
|
|
927 |
|
@param |
928 |
|
@return |
929 |
|
|
|
|
| 91.9% |
Uncovered Elements: 3 (37) |
Complexity: 10 |
Complexity Density: 0.48 |
|
930 |
13 |
static String getTooltip(AlignmentAnnotation aa)... |
931 |
|
{ |
932 |
13 |
if (aa == null) |
933 |
|
{ |
934 |
1 |
return null; |
935 |
|
} |
936 |
12 |
StringBuilder tooltip = new StringBuilder(); |
937 |
12 |
if (aa.description != null && !aa.description.equals("New description")) |
938 |
|
{ |
939 |
|
|
940 |
|
|
941 |
|
|
942 |
10 |
String desc = aa.getDescription(true).trim(); |
943 |
10 |
if (aa.getNoOfSequencesIncluded() >= 0) |
944 |
|
{ |
945 |
0 |
desc += " (" + MessageManager.getString("label.sequence_count") |
946 |
|
+ aa.getNoOfSequencesIncluded() + ")"; |
947 |
|
} |
948 |
10 |
if (!desc.toLowerCase(Locale.ROOT).startsWith(HTML_START_TAG)) |
949 |
|
{ |
950 |
7 |
tooltip.append(HTML_START_TAG); |
951 |
7 |
desc = desc.replace("<", "<"); |
952 |
|
} |
953 |
3 |
else if (desc.toLowerCase(Locale.ROOT).endsWith(HTML_END_TAG)) |
954 |
|
{ |
955 |
3 |
desc = desc.substring(0, desc.length() - HTML_END_TAG.length()); |
956 |
|
} |
957 |
10 |
tooltip.append(desc); |
958 |
|
} |
959 |
|
else |
960 |
|
{ |
961 |
|
|
962 |
2 |
tooltip.append(HTML_START_TAG); |
963 |
|
} |
964 |
12 |
if (aa.hasScore()) |
965 |
|
{ |
966 |
5 |
if (tooltip.length() > HTML_START_TAG.length()) |
967 |
|
{ |
968 |
3 |
tooltip.append("<br/>"); |
969 |
|
} |
970 |
|
|
971 |
|
|
972 |
|
|
973 |
5 |
tooltip.append(" Score: ").append(String.valueOf(aa.score)); |
974 |
|
} |
975 |
|
|
976 |
12 |
if (tooltip.length() > HTML_START_TAG.length()) |
977 |
|
{ |
978 |
10 |
return tooltip.append(HTML_END_TAG).toString(); |
979 |
|
} |
980 |
|
|
981 |
|
|
982 |
|
|
983 |
|
|
984 |
2 |
return null; |
985 |
|
} |
986 |
|
|
987 |
|
|
988 |
|
|
989 |
|
|
990 |
|
|
991 |
|
@param |
992 |
|
|
|
|
| 0% |
Uncovered Elements: 9 (9) |
Complexity: 3 |
Complexity Density: 0.6 |
|
993 |
0 |
protected void showOrHideAdjuster(MouseEvent evt)... |
994 |
|
{ |
995 |
0 |
boolean was = resizePanel; |
996 |
0 |
resizePanel = evt.getY() < HEIGHT_ADJUSTER_HEIGHT |
997 |
|
&& evt.getX() < HEIGHT_ADJUSTER_WIDTH; |
998 |
|
|
999 |
0 |
if (resizePanel != was) |
1000 |
|
{ |
1001 |
0 |
setCursor(Cursor |
1002 |
0 |
.getPredefinedCursor(resizePanel ? Cursor.S_RESIZE_CURSOR |
1003 |
|
: Cursor.DEFAULT_CURSOR)); |
1004 |
0 |
repaint(); |
1005 |
|
} |
1006 |
|
} |
1007 |
|
|
|
|
| 0% |
Uncovered Elements: 70 (70) |
Complexity: 21 |
Complexity Density: 0.48 |
|
1008 |
0 |
@Override... |
1009 |
|
public void mouseClicked(MouseEvent evt) |
1010 |
|
{ |
1011 |
0 |
final AlignmentAnnotation[] aa = ap.av.getAlignment() |
1012 |
|
.getAlignmentAnnotation(); |
1013 |
0 |
if (!evt.isPopupTrigger() && SwingUtilities.isLeftMouseButton(evt)) |
1014 |
|
{ |
1015 |
0 |
if (selectedRow > -1 && selectedRow < aa.length) |
1016 |
|
{ |
1017 |
0 |
if (aa[selectedRow].groupRef != null) |
1018 |
|
{ |
1019 |
0 |
if (evt.getClickCount() >= 2) |
1020 |
|
{ |
1021 |
|
|
1022 |
|
|
1023 |
0 |
ap.getSeqPanel().ap.getIdPanel().highlightSearchResults(null); |
1024 |
|
|
1025 |
0 |
SequenceGroup sg = ap.av.getSelectionGroup(); |
1026 |
0 |
if (sg == null || sg == aa[selectedRow].groupRef |
1027 |
|
|| !(Platform.isControlDown(evt) || evt.isShiftDown())) |
1028 |
|
{ |
1029 |
0 |
if (Platform.isControlDown(evt) || evt.isShiftDown()) |
1030 |
|
{ |
1031 |
|
|
1032 |
0 |
ap.av.setSelectionGroup( |
1033 |
|
new SequenceGroup(aa[selectedRow].groupRef)); |
1034 |
|
} |
1035 |
|
else |
1036 |
|
{ |
1037 |
|
|
1038 |
0 |
ap.av.setSelectionGroup(aa[selectedRow].groupRef); |
1039 |
|
} |
1040 |
|
} |
1041 |
|
else |
1042 |
|
{ |
1043 |
|
|
1044 |
0 |
int remainToAdd = aa[selectedRow].groupRef.getSize(); |
1045 |
0 |
for (SequenceI sgs : aa[selectedRow].groupRef.getSequences()) |
1046 |
|
{ |
1047 |
0 |
if (jalview.util.Platform.isControlDown(evt)) |
1048 |
|
{ |
1049 |
0 |
sg.addOrRemove(sgs, --remainToAdd == 0); |
1050 |
|
} |
1051 |
|
else |
1052 |
|
{ |
1053 |
|
|
1054 |
|
|
1055 |
0 |
sg.addSequence(sgs, --remainToAdd == 0); |
1056 |
|
} |
1057 |
|
} |
1058 |
|
} |
1059 |
|
|
1060 |
0 |
ap.paintAlignment(false, false); |
1061 |
0 |
PaintRefresher.Refresh(ap, ap.av.getSequenceSetId()); |
1062 |
0 |
ap.av.sendSelection(); |
1063 |
|
} |
1064 |
|
else |
1065 |
|
{ |
1066 |
0 |
ap.getSeqPanel().ap.getIdPanel().highlightSearchResults( |
1067 |
|
aa[selectedRow].groupRef.getSequences(null)); |
1068 |
|
} |
1069 |
0 |
return; |
1070 |
|
} |
1071 |
0 |
else if (aa[selectedRow].sequenceRef != null) |
1072 |
|
{ |
1073 |
0 |
if (evt.getClickCount() == 1) |
1074 |
|
{ |
1075 |
0 |
ap.getSeqPanel().ap.getIdPanel() |
1076 |
|
.highlightSearchResults(Arrays.asList(new SequenceI[] |
1077 |
|
{ aa[selectedRow].sequenceRef })); |
1078 |
|
} |
1079 |
0 |
else if (evt.getClickCount() >= 2) |
1080 |
|
{ |
1081 |
0 |
ap.getSeqPanel().ap.getIdPanel().highlightSearchResults(null); |
1082 |
0 |
SequenceGroup sg = ap.av.getSelectionGroup(); |
1083 |
0 |
if (sg != null) |
1084 |
|
{ |
1085 |
|
|
1086 |
|
|
1087 |
|
|
1088 |
0 |
if (!(Platform.isControlDown(evt) || evt.isShiftDown())) |
1089 |
|
{ |
1090 |
0 |
sg = new SequenceGroup(sg); |
1091 |
0 |
sg.clear(); |
1092 |
0 |
sg.addSequence(aa[selectedRow].sequenceRef, false); |
1093 |
|
} |
1094 |
|
else |
1095 |
|
{ |
1096 |
0 |
if (Platform.isControlDown(evt)) |
1097 |
|
{ |
1098 |
0 |
sg.addOrRemove(aa[selectedRow].sequenceRef, true); |
1099 |
|
} |
1100 |
|
else |
1101 |
|
{ |
1102 |
|
|
1103 |
|
|
1104 |
0 |
sg.addSequence(aa[selectedRow].sequenceRef, true); |
1105 |
|
} |
1106 |
|
} |
1107 |
|
} |
1108 |
|
else |
1109 |
|
{ |
1110 |
0 |
sg = new SequenceGroup(); |
1111 |
0 |
sg.setStartRes(0); |
1112 |
0 |
sg.setEndRes(ap.av.getAlignment().getWidth() - 1); |
1113 |
0 |
sg.addSequence(aa[selectedRow].sequenceRef, false); |
1114 |
|
} |
1115 |
0 |
ap.av.setSelectionGroup(sg); |
1116 |
0 |
ap.paintAlignment(false, false); |
1117 |
0 |
PaintRefresher.Refresh(ap, ap.av.getSequenceSetId()); |
1118 |
0 |
ap.av.sendSelection(); |
1119 |
|
} |
1120 |
|
|
1121 |
|
} |
1122 |
|
} |
1123 |
0 |
return; |
1124 |
|
} |
1125 |
|
} |
1126 |
|
|
1127 |
|
|
1128 |
|
|
1129 |
|
|
1130 |
|
@param |
1131 |
|
|
1132 |
|
|
|
|
| 0% |
Uncovered Elements: 28 (28) |
Complexity: 5 |
Complexity Density: 0.25 |
|
1133 |
0 |
protected void copy_annotseqtoclipboard(SequenceI sq)... |
1134 |
|
{ |
1135 |
0 |
SequenceI[] seqs = new SequenceI[] { sq }; |
1136 |
0 |
String[] omitHidden = null; |
1137 |
0 |
SequenceI[] dseqs = new SequenceI[] { sq.getDatasetSequence() }; |
1138 |
0 |
if (dseqs[0] == null) |
1139 |
|
{ |
1140 |
0 |
dseqs[0] = new Sequence(sq); |
1141 |
0 |
dseqs[0].setSequence(AlignSeq.extractGaps(Comparison.GapChars, |
1142 |
|
sq.getSequenceAsString())); |
1143 |
|
|
1144 |
0 |
sq.setDatasetSequence(dseqs[0]); |
1145 |
|
} |
1146 |
0 |
Alignment ds = new Alignment(dseqs); |
1147 |
0 |
if (av.hasHiddenColumns()) |
1148 |
|
{ |
1149 |
0 |
Iterator<int[]> it = av.getAlignment().getHiddenColumns() |
1150 |
|
.getVisContigsIterator(0, sq.getLength() + 1, false); |
1151 |
0 |
omitHidden = new String[] { sq.getSequenceStringFromIterator(it) }; |
1152 |
|
} |
1153 |
|
|
1154 |
0 |
int[] alignmentStartEnd = new int[] { 0, ds.getWidth() - 1 }; |
1155 |
0 |
if (av.hasHiddenColumns()) |
1156 |
|
{ |
1157 |
0 |
alignmentStartEnd = av.getAlignment().getHiddenColumns() |
1158 |
|
.getVisibleStartAndEndIndex(av.getAlignment().getWidth()); |
1159 |
|
} |
1160 |
|
|
1161 |
0 |
String output = new FormatAdapter().formatSequences(FileFormat.Fasta, |
1162 |
|
seqs, omitHidden, alignmentStartEnd); |
1163 |
|
|
1164 |
0 |
Toolkit.getDefaultToolkit().getSystemClipboard() |
1165 |
|
.setContents(new StringSelection(output), Desktop.instance); |
1166 |
|
|
1167 |
0 |
HiddenColumns hiddenColumns = null; |
1168 |
|
|
1169 |
0 |
if (av.hasHiddenColumns()) |
1170 |
|
{ |
1171 |
0 |
hiddenColumns = new HiddenColumns( |
1172 |
|
av.getAlignment().getHiddenColumns()); |
1173 |
|
} |
1174 |
|
|
1175 |
0 |
Desktop.jalviewClipboard = new Object[] { seqs, ds, |
1176 |
|
|
1177 |
|
|
1178 |
|
|
1179 |
|
|
1180 |
|
hiddenColumns }; |
1181 |
|
} |
1182 |
|
|
1183 |
|
|
1184 |
|
|
1185 |
|
|
1186 |
|
@param |
1187 |
|
|
1188 |
|
|
|
|
| 81.8% |
Uncovered Elements: 2 (11) |
Complexity: 3 |
Complexity Density: 0.43 |
|
1189 |
2221 |
@Override... |
1190 |
|
public void paintComponent(Graphics g) |
1191 |
|
{ |
1192 |
|
|
1193 |
2221 |
int width = getWidth(); |
1194 |
2221 |
if (width == 0) |
1195 |
|
{ |
1196 |
0 |
width = ap.calculateIdWidth().width; |
1197 |
|
} |
1198 |
|
|
1199 |
2221 |
Graphics2D g2 = (Graphics2D) g; |
1200 |
2221 |
if (av.antiAlias) |
1201 |
|
{ |
1202 |
798 |
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, |
1203 |
|
RenderingHints.VALUE_ANTIALIAS_ON); |
1204 |
|
} |
1205 |
|
|
1206 |
2221 |
drawComponent(g2, true, width, true); |
1207 |
|
} |
1208 |
|
|
1209 |
|
|
1210 |
|
|
1211 |
|
|
1212 |
|
|
1213 |
|
@param |
1214 |
|
|
1215 |
|
@param |
1216 |
|
|
1217 |
|
|
1218 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1219 |
0 |
public void drawComponent(Graphics g, int width)... |
1220 |
|
{ |
1221 |
0 |
drawComponent(g, false, width, true); |
1222 |
|
} |
1223 |
|
|
1224 |
|
|
1225 |
|
|
1226 |
|
|
1227 |
|
|
1228 |
|
@param |
1229 |
|
|
1230 |
|
@param |
1231 |
|
|
1232 |
|
|
1233 |
|
@param |
1234 |
|
|
1235 |
|
|
|
|
| 92.1% |
Uncovered Elements: 3 (38) |
Complexity: 14 |
Complexity Density: 0.58 |
|
1236 |
2534 |
public void drawComponent(Graphics g, boolean clip, int givenWidth,... |
1237 |
|
boolean forGUI) |
1238 |
|
{ |
1239 |
2534 |
int width = givenWidth; |
1240 |
2534 |
IdwidthAdjuster iwa = null; |
1241 |
2534 |
if (ap != null) |
1242 |
|
{ |
1243 |
2259 |
iwa = ap.idwidthAdjuster; |
1244 |
2259 |
if (Cache.getDefault(ADJUST_ANNOTATION_LABELS_WIDTH_PREF, true) |
1245 |
|
|| Jalview.isHeadlessMode()) |
1246 |
|
{ |
1247 |
2259 |
Graphics2D g2d = (Graphics2D) g; |
1248 |
2259 |
Graphics dummy = g2d.create(); |
1249 |
2259 |
int newAnnotationIdWidth = drawLabels(dummy, clip, width, false, |
1250 |
|
forGUI, null, false); |
1251 |
2259 |
dummy.dispose(); |
1252 |
2259 |
Dimension d = ap.calculateDefaultAlignmentIdWidth(); |
1253 |
2259 |
int alignmentIdWidth = d.width; |
1254 |
2259 |
if (iwa != null && !iwa.manuallyAdjusted()) |
1255 |
|
{ |
1256 |
|
|
1257 |
|
|
1258 |
1100 |
boolean allowShrink = Cache.getDefault("ALLOW_SHRINK_ID_WIDTH", |
1259 |
|
false); |
1260 |
1100 |
width = Math.max(alignmentIdWidth, newAnnotationIdWidth); |
1261 |
1100 |
if (clip && width < givenWidth && !allowShrink) |
1262 |
|
{ |
1263 |
0 |
width = givenWidth; |
1264 |
|
} |
1265 |
|
} |
1266 |
1159 |
else if (newAnnotationIdWidth != annotationIdWidth |
1267 |
|
&& newAnnotationIdWidth > givenWidth |
1268 |
|
&& newAnnotationIdWidth > alignmentIdWidth) |
1269 |
|
{ |
1270 |
|
|
1271 |
|
|
1272 |
13 |
width = newAnnotationIdWidth; |
1273 |
13 |
annotationIdWidth = newAnnotationIdWidth; |
1274 |
|
} |
1275 |
|
|
1276 |
2259 |
if (width != ap.av.getIdWidth()) |
1277 |
|
{ |
1278 |
114 |
iwa.setWidth(width); |
1279 |
|
} |
1280 |
|
} |
1281 |
|
} |
1282 |
|
else |
1283 |
|
{ |
1284 |
275 |
int newAnnotationIdWidth = drawLabels(g, clip, width, false, forGUI, |
1285 |
|
null, false); |
1286 |
275 |
width = newAnnotationIdWidth < givenWidth ? givenWidth |
1287 |
|
: Math.min(newAnnotationIdWidth, givenWidth); |
1288 |
|
} |
1289 |
2534 |
drawLabels(g, clip, width, true, forGUI, null, false); |
1290 |
|
} |
1291 |
|
|
1292 |
|
|
1293 |
|
|
1294 |
|
|
1295 |
|
|
1296 |
|
|
1297 |
|
|
1298 |
|
@param |
1299 |
|
|
1300 |
|
|
1301 |
|
@param |
1302 |
|
|
1303 |
|
|
1304 |
|
@param |
1305 |
|
|
1306 |
|
@param |
1307 |
|
|
1308 |
|
@param |
1309 |
|
|
1310 |
|
|
1311 |
|
@param |
1312 |
|
|
1313 |
|
@param |
1314 |
|
|
1315 |
|
|
1316 |
|
@return |
1317 |
|
|
|
|
| 56.8% |
Uncovered Elements: 120 (278) |
Complexity: 90 |
Complexity Density: 0.56 |
|
1318 |
5150 |
public int drawLabels(Graphics g0, boolean clip, int width,... |
1319 |
|
boolean actuallyDraw, boolean forGUI, FontMetrics fmetrics, |
1320 |
|
boolean includeHidden) |
1321 |
|
{ |
1322 |
5150 |
if (clip) |
1323 |
|
{ |
1324 |
4442 |
clip = Cache.getDefault("MOVE_SEQUENCE_ID_WITH_VISIBLE_ANNOTATIONS", |
1325 |
|
true); |
1326 |
|
} |
1327 |
5150 |
Graphics g = null; |
1328 |
|
|
1329 |
5150 |
if (g0 != null) |
1330 |
|
{ |
1331 |
5074 |
if (!actuallyDraw) |
1332 |
|
{ |
1333 |
2540 |
Graphics2D g2d = (Graphics2D) g0; |
1334 |
2540 |
g = g2d.create(); |
1335 |
|
} |
1336 |
|
else |
1337 |
|
{ |
1338 |
2534 |
g = g0; |
1339 |
|
} |
1340 |
|
} |
1341 |
5150 |
int actualWidth = 0; |
1342 |
5150 |
if (g != null) |
1343 |
|
{ |
1344 |
5074 |
if (av.getFont().getSize() < 10) |
1345 |
|
{ |
1346 |
0 |
g.setFont(font); |
1347 |
|
} |
1348 |
|
else |
1349 |
|
{ |
1350 |
5074 |
g.setFont(av.getFont()); |
1351 |
|
} |
1352 |
|
} |
1353 |
|
|
1354 |
5150 |
FontMetrics fm = fmetrics == null ? g.getFontMetrics(g.getFont()) |
1355 |
|
: fmetrics; |
1356 |
5150 |
if (actuallyDraw) |
1357 |
|
{ |
1358 |
2534 |
g.setColor(Color.white); |
1359 |
2534 |
g.fillRect(0, 0, getWidth(), getHeight()); |
1360 |
|
|
1361 |
2534 |
if (!Cache.getDefault(RESIZE_MARGINS_MARK_PREF, false) |
1362 |
|
&& !av.getWrapAlignment() && forGUI) |
1363 |
|
{ |
1364 |
2221 |
g.setColor(Color.LIGHT_GRAY); |
1365 |
2221 |
g.drawLine(0, HEIGHT_ADJUSTER_HEIGHT / 4, HEIGHT_ADJUSTER_WIDTH / 4, |
1366 |
|
HEIGHT_ADJUSTER_HEIGHT / 4); |
1367 |
2221 |
g.drawLine(0, 3 * HEIGHT_ADJUSTER_HEIGHT / 4, |
1368 |
|
HEIGHT_ADJUSTER_WIDTH / 4, 3 * HEIGHT_ADJUSTER_HEIGHT / 4); |
1369 |
|
|
1370 |
|
} |
1371 |
|
} |
1372 |
|
|
1373 |
5150 |
if (actuallyDraw) |
1374 |
|
{ |
1375 |
2534 |
g.translate(0, getScrollOffset()); |
1376 |
2534 |
g.setColor(Color.black); |
1377 |
|
} |
1378 |
5150 |
SequenceI lastSeqRef = null; |
1379 |
5150 |
String lastLabel = null; |
1380 |
5150 |
String lastDescription = null; |
1381 |
5150 |
AlignmentAnnotation[] aa = av.getAlignment().getAlignmentAnnotation(); |
1382 |
5150 |
boolean isShowStructureProvider = av.isShowStructureProvider(); |
1383 |
5150 |
int fontHeight = g != null ? g.getFont().getSize() |
1384 |
|
: fm.getFont().getSize(); |
1385 |
5150 |
int y = 0; |
1386 |
5150 |
int x = 0; |
1387 |
5150 |
int graphExtras = 0; |
1388 |
5150 |
int offset = 0; |
1389 |
5150 |
Font baseFont = g != null ? g.getFont() : fm.getFont(); |
1390 |
5150 |
FontMetrics baseMetrics = fm; |
1391 |
5150 |
int ofontH = fontHeight; |
1392 |
5150 |
int sOffset = 0; |
1393 |
5150 |
int visHeight = 0; |
1394 |
5150 |
int[] visr = (ap != null && ap.getAnnotationPanel() != null) |
1395 |
|
? ap.getAnnotationPanel().getVisibleVRange() |
1396 |
|
: null; |
1397 |
5150 |
if (clip && visr != null) |
1398 |
|
{ |
1399 |
4442 |
sOffset = visr[0]; |
1400 |
4442 |
visHeight = visr[1]; |
1401 |
|
} |
1402 |
5150 |
boolean visible = true, before = false, after = false; |
1403 |
5150 |
if (aa != null) |
1404 |
|
{ |
1405 |
5150 |
hasHiddenRows = false; |
1406 |
5150 |
int olY = 0; |
1407 |
5150 |
int nexAA = 0; |
1408 |
33035 |
for (int i = 0; i < aa.length; i++) |
1409 |
|
{ |
1410 |
27885 |
visible = true; |
1411 |
27885 |
if (!aa[i].visible && !includeHidden) |
1412 |
|
{ |
1413 |
2408 |
hasHiddenRows = true; |
1414 |
2408 |
continue; |
1415 |
|
} |
1416 |
25477 |
olY = y; |
1417 |
|
|
1418 |
25477 |
for (nexAA = i + 1; nexAA < aa.length |
1419 |
|
&& (!aa[nexAA].visible && includeHidden); nexAA++) |
1420 |
0 |
; |
1421 |
25477 |
y += aa[i].height; |
1422 |
25477 |
if (clip) |
1423 |
|
{ |
1424 |
22152 |
if (y < sOffset) |
1425 |
|
{ |
1426 |
0 |
if (!before) |
1427 |
|
{ |
1428 |
0 |
if (debugRedraw) |
1429 |
|
{ |
1430 |
0 |
jalview.bin.Console.outPrintln("before vis: " + i); |
1431 |
|
} |
1432 |
0 |
before = true; |
1433 |
|
} |
1434 |
|
|
1435 |
0 |
continue; |
1436 |
|
} |
1437 |
22152 |
if (olY > visHeight) |
1438 |
|
{ |
1439 |
|
|
1440 |
1470 |
if (!after) |
1441 |
|
{ |
1442 |
702 |
if (debugRedraw) |
1443 |
|
{ |
1444 |
0 |
jalview.bin.Console.outPrintln( |
1445 |
|
"Scroll offset: " + sOffset + " after vis: " + i); |
1446 |
|
} |
1447 |
702 |
after = true; |
1448 |
|
} |
1449 |
|
|
1450 |
1470 |
continue; |
1451 |
|
} |
1452 |
|
} |
1453 |
24007 |
if (actuallyDraw && g != null) |
1454 |
|
{ |
1455 |
11854 |
g.setColor(Color.black); |
1456 |
|
} |
1457 |
24007 |
offset = -aa[i].height / 2; |
1458 |
|
|
1459 |
24007 |
if (aa[i].hasText) |
1460 |
|
{ |
1461 |
22198 |
offset += fm.getHeight() / 2; |
1462 |
22198 |
offset -= fm.getDescent(); |
1463 |
|
} |
1464 |
|
else |
1465 |
|
{ |
1466 |
1809 |
offset += fm.getDescent(); |
1467 |
|
} |
1468 |
24007 |
String label = aa[i].label; |
1469 |
24007 |
ParseHtmlBodyAndLinks phbDecription = new ParseHtmlBodyAndLinks( |
1470 |
|
aa[i].description, true, "\n"); |
1471 |
24007 |
String description = phbDecription.getNonHtmlContent(); |
1472 |
24007 |
boolean vertBar = false; |
1473 |
24007 |
if (lastLabel != null && lastLabel.equals(label) && |
1474 |
|
lastDescription != null && lastDescription.equals(description)) |
1475 |
|
{ |
1476 |
|
|
1477 |
0 |
label = aa[i].label; |
1478 |
|
} |
1479 |
24007 |
else if (lastLabel != null && lastLabel.equals(label)) |
1480 |
|
{ |
1481 |
|
|
1482 |
0 |
if(!(lastDescription != null && lastDescription.equals(description)) |
1483 |
|
&& (aa[i].sequenceRef == lastSeqRef)) { |
1484 |
0 |
label = description; |
1485 |
0 |
lastDescription = description; |
1486 |
|
} |
1487 |
|
} |
1488 |
|
else |
1489 |
|
{ |
1490 |
24007 |
if (nexAA < aa.length && label.equals(aa[nexAA].label)) |
1491 |
|
|
1492 |
|
{ |
1493 |
0 |
lastLabel = label; |
1494 |
|
|
1495 |
|
|
1496 |
0 |
if(!(lastDescription != null && lastDescription.equals(description))) { |
1497 |
0 |
if(aa[nexAA].sequenceRef == aa[i].sequenceRef) { |
1498 |
0 |
label = description; |
1499 |
|
} |
1500 |
0 |
lastDescription = description; |
1501 |
|
} |
1502 |
|
} |
1503 |
|
else |
1504 |
|
{ |
1505 |
24007 |
lastLabel = label; |
1506 |
24007 |
lastDescription = description; |
1507 |
|
} |
1508 |
|
} |
1509 |
24007 |
if (aa[i].sequenceRef != null) |
1510 |
|
{ |
1511 |
1271 |
if (aa[i].sequenceRef != lastSeqRef) |
1512 |
|
{ |
1513 |
359 |
label = aa[i].sequenceRef.getName() + " " + label; |
1514 |
|
|
1515 |
|
|
1516 |
|
} |
1517 |
|
else |
1518 |
|
{ |
1519 |
912 |
vertBar = true; |
1520 |
|
} |
1521 |
|
} |
1522 |
|
|
1523 |
24007 |
if (isShowStructureProvider && aa[i].hasIcons |
1524 |
|
&& Constants.SECONDARY_STRUCTURE_LABELS.keySet() |
1525 |
|
.contains(aa[i].label)) |
1526 |
|
{ |
1527 |
0 |
String ssSource = AlignmentUtils |
1528 |
|
.extractSSSourceFromAnnotationDescription(aa[i]); |
1529 |
0 |
if (ssSource != null && ssSource.length() > 0) |
1530 |
0 |
label += " (" + ssSource + ")"; |
1531 |
|
} |
1532 |
|
|
1533 |
24007 |
int labelWidth = fm.stringWidth(label) + 3; |
1534 |
24007 |
x = width - labelWidth; |
1535 |
|
|
1536 |
24007 |
if (aa[i].graphGroup > -1) |
1537 |
|
{ |
1538 |
0 |
int groupSize = 0; |
1539 |
|
|
1540 |
|
|
1541 |
0 |
for (int gg = 0; gg < aa.length; gg++) |
1542 |
|
{ |
1543 |
0 |
if (aa[gg].graphGroup == aa[i].graphGroup) |
1544 |
|
{ |
1545 |
0 |
groupSize++; |
1546 |
|
} |
1547 |
|
} |
1548 |
0 |
if (groupSize * (fontHeight + 8) < aa[i].height) |
1549 |
|
{ |
1550 |
0 |
graphExtras = (aa[i].height - (groupSize * (fontHeight + 8))) |
1551 |
|
/ 2; |
1552 |
|
} |
1553 |
|
else |
1554 |
|
{ |
1555 |
|
|
1556 |
0 |
float h = aa[i].height / (float) groupSize, s; |
1557 |
0 |
if (h < 9) |
1558 |
|
{ |
1559 |
0 |
visible = false; |
1560 |
|
} |
1561 |
|
else |
1562 |
|
{ |
1563 |
0 |
fontHeight = -8 + (int) h; |
1564 |
0 |
s = ((float) fontHeight) / (float) ofontH; |
1565 |
0 |
Font f = baseFont |
1566 |
|
.deriveFont(AffineTransform.getScaleInstance(s, s)); |
1567 |
0 |
Canvas c = new Canvas(); |
1568 |
0 |
fm = c.getFontMetrics(f); |
1569 |
0 |
if (actuallyDraw && g != null) |
1570 |
|
{ |
1571 |
0 |
g.setFont(f); |
1572 |
|
|
1573 |
0 |
graphExtras = (aa[i].height |
1574 |
|
- (groupSize * (fontHeight + 8))) / 2; |
1575 |
|
} |
1576 |
|
} |
1577 |
|
} |
1578 |
0 |
if (visible) |
1579 |
|
{ |
1580 |
0 |
for (int gg = 0; gg < aa.length; gg++) |
1581 |
|
{ |
1582 |
0 |
if (aa[gg].graphGroup == aa[i].graphGroup) |
1583 |
|
{ |
1584 |
0 |
labelWidth = fm.stringWidth(aa[gg].label) + 3; |
1585 |
0 |
x = width - labelWidth; |
1586 |
0 |
if (actuallyDraw && g != null) |
1587 |
|
{ |
1588 |
0 |
g.drawString(aa[gg].label, x, y - graphExtras); |
1589 |
|
|
1590 |
0 |
if (aa[gg]._linecolour != null) |
1591 |
|
{ |
1592 |
|
|
1593 |
0 |
g.setColor(aa[gg]._linecolour); |
1594 |
0 |
g.drawLine(x, y - graphExtras + 3, |
1595 |
|
x + fm.stringWidth(aa[gg].label), |
1596 |
|
y - graphExtras + 3); |
1597 |
|
} |
1598 |
|
|
1599 |
0 |
g.setColor(Color.black); |
1600 |
|
} |
1601 |
0 |
graphExtras += fontHeight + 8; |
1602 |
|
} |
1603 |
|
} |
1604 |
|
} |
1605 |
0 |
if (actuallyDraw && g != null) |
1606 |
|
{ |
1607 |
0 |
g.setFont(baseFont); |
1608 |
|
} |
1609 |
0 |
fm = baseMetrics; |
1610 |
0 |
fontHeight = ofontH; |
1611 |
|
} |
1612 |
|
else |
1613 |
|
{ |
1614 |
24007 |
if (actuallyDraw && g != null) |
1615 |
|
{ |
1616 |
11854 |
if (vertBar) |
1617 |
|
{ |
1618 |
443 |
g.drawLine(width - 3, y + offset - fontHeight, width - 3, |
1619 |
|
(int) (y - 1.5 * aa[i].height - offset - fontHeight)); |
1620 |
|
|
1621 |
|
|
1622 |
|
} |
1623 |
11854 |
if(label.contains("Secondary Structure Consensus")) { |
1624 |
|
|
1625 |
|
|
1626 |
0 |
String[] lines = label.split("(?<=Secondary Structure Consensus)", 2); |
1627 |
|
|
1628 |
|
|
1629 |
0 |
int lineHeight = g.getFontMetrics().getHeight(); |
1630 |
0 |
labelWidth = Math.max(fm.stringWidth(lines[0]), fm.stringWidth(lines[1])) + 3; |
1631 |
|
|
1632 |
0 |
x = width - labelWidth; |
1633 |
0 |
for (int k = 0; k < lines.length; k++) { |
1634 |
|
|
1635 |
0 |
g.drawString(lines[k].trim(), x, y + offset +(k * lineHeight)); |
1636 |
|
} |
1637 |
|
} |
1638 |
|
else { |
1639 |
11854 |
g.drawString(label, x, y + offset); |
1640 |
|
} |
1641 |
|
} |
1642 |
|
} |
1643 |
24007 |
lastSeqRef = aa[i].sequenceRef; |
1644 |
|
|
1645 |
24007 |
if (labelWidth > actualWidth) |
1646 |
|
{ |
1647 |
7432 |
actualWidth = labelWidth; |
1648 |
|
} |
1649 |
|
} |
1650 |
|
} |
1651 |
|
|
1652 |
5150 |
if (!resizePanel && dragEvent != null && aa != null && selectedRow > -1 |
1653 |
|
&& selectedRow < aa.length) |
1654 |
|
{ |
1655 |
0 |
if (actuallyDraw && g != null) |
1656 |
|
{ |
1657 |
0 |
g.setColor(Color.lightGray); |
1658 |
0 |
g.drawString( |
1659 |
0 |
(aa[selectedRow].sequenceRef == null ? "" |
1660 |
|
: aa[selectedRow].sequenceRef.getName()) |
1661 |
|
+ aa[selectedRow].label, |
1662 |
|
dragEvent.getX(), dragEvent.getY() - getScrollOffset()); |
1663 |
|
} |
1664 |
|
} |
1665 |
|
|
1666 |
5150 |
if (!av.getWrapAlignment() && ((aa == null) || (aa.length < 1))) |
1667 |
|
{ |
1668 |
0 |
if (actuallyDraw && g != null) |
1669 |
|
{ |
1670 |
0 |
g.drawString(MessageManager.getString("label.right_click"), 2, 8); |
1671 |
0 |
g.drawString(MessageManager.getString("label.to_add_annotation"), 2, |
1672 |
|
18); |
1673 |
|
} |
1674 |
|
} |
1675 |
|
|
1676 |
5150 |
return actualWidth; |
1677 |
|
} |
1678 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1679 |
9372 |
public int getScrollOffset()... |
1680 |
|
{ |
1681 |
9372 |
return scrollOffset; |
1682 |
|
} |
1683 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
1684 |
0 |
@Override... |
1685 |
|
public void mouseEntered(MouseEvent e) |
1686 |
|
{ |
1687 |
|
} |
1688 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
1689 |
38 |
public void drawComponentNotGUI(Graphics idGraphics, int idWidth)... |
1690 |
|
{ |
1691 |
38 |
drawComponent(idGraphics, false, idWidth, false); |
1692 |
|
} |
1693 |
|
} |