2 * Jalview - A Sequence Alignment Editor and Viewer
3 * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 import java.awt.event.*;
23 import java.awt.image.*;
26 import jalview.datamodel.*;
34 public class AnnotationPanel
35 extends JPanel implements MouseListener,
36 MouseMotionListener, ActionListener, AdjustmentListener
38 final String HELIX = "Helix";
39 final String SHEET = "Sheet";
40 final String LABEL = "Label";
41 final String REMOVE = "Remove Annotation";
42 final String COLOUR = "Colour";
43 final Color HELIX_COLOUR = Color.red.darker();
44 final Color SHEET_COLOUR = Color.green.darker().darker();
51 BufferedImage fadedImage;
55 boolean fastPaint = false;
57 //Used For mouse Dragging and resizing graphs
58 int graphStretch = -1;
59 int graphStretchY = -1;
60 int min; //used by mouseDragged to see if user
61 int max; //used by mouseDragged to see if user
62 boolean mouseDragging = false;
67 * Creates a new AnnotationPanel object.
69 * @param ap DOCUMENT ME!
71 public AnnotationPanel(AlignmentPanel ap)
74 if (System.getProperty("os.name").startsWith("Mac"))
79 ToolTipManager.sharedInstance().registerComponent(this);
80 ToolTipManager.sharedInstance().setInitialDelay(0);
81 ToolTipManager.sharedInstance().setDismissDelay(10000);
85 addMouseListener(this);
86 addMouseMotionListener(this);
87 ap.annotationScroller.getVerticalScrollBar().addAdjustmentListener(this);
90 public AnnotationPanel(AlignViewport av)
98 * @param evt DOCUMENT ME!
100 public void adjustmentValueChanged(AdjustmentEvent evt)
102 ap.alabels.setScrollOffset( -evt.getValue());
108 public int adjustPanelHeight()
110 // setHeight of panels
111 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
116 for (int i = 0; i < aa.length; i++)
127 aa[i].height += av.charHeight;
137 aa[i].height += aa[i].graphHeight;
140 if (aa[i].height == 0)
145 height += aa[i].height;
153 this.setPreferredSize(new Dimension(1, height));
161 * @param evt DOCUMENT ME!
163 public void actionPerformed(ActionEvent evt)
165 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
166 Annotation[] anot = aa[activeRow].annotations;
168 if (anot.length < av.getColumnSelection().getMax())
170 Annotation[] temp = new Annotation[av.getColumnSelection().getMax() + 2];
171 System.arraycopy(anot, 0, temp, 0, anot.length);
173 aa[activeRow].annotations = anot;
176 if (evt.getActionCommand().equals(REMOVE))
178 for (int i = 0; i < av.getColumnSelection().size(); i++)
180 anot[av.getColumnSelection().columnAt(i)] = null;
183 else if (evt.getActionCommand().equals(LABEL))
185 String exMesg = collectAnnotVals(anot, av.getColumnSelection(), LABEL);
186 String label = JOptionPane.showInputDialog(this,"Enter label",exMesg);
193 if ( (label.length() > 0) && !aa[activeRow].hasText)
195 aa[activeRow].hasText = true;
198 for (int i = 0; i < av.getColumnSelection().size(); i++)
200 int index = av.getColumnSelection().columnAt(i);
202 if(!av.colSel.isVisible(index))
205 if (anot[index] == null)
207 anot[index] = new Annotation(label, "", ' ', 0); // TODO: verify that null exceptions aren't raised elsewhere.
209 anot[index].displayCharacter = label;
213 else if (evt.getActionCommand().equals(COLOUR))
215 Color col = JColorChooser.showDialog(this,
216 "Choose foreground colour",
219 for (int i = 0; i < av.getColumnSelection().size(); i++)
221 int index = av.getColumnSelection().columnAt(i);
223 if(!av.colSel.isVisible(index))
226 if (anot[index] == null)
228 anot[index] = new Annotation("", "", ' ', 0);
231 anot[index].colour = col;
234 else // HELIX OR SHEET
237 String symbol = "\u03B1";
239 if (evt.getActionCommand().equals(HELIX))
243 else if (evt.getActionCommand().equals(SHEET))
249 if (!aa[activeRow].hasIcons)
251 aa[activeRow].hasIcons = true;
254 String label = JOptionPane.showInputDialog(
255 "Enter a label for the structure?",
263 if ( (label.length() > 0) && !aa[activeRow].hasText)
265 aa[activeRow].hasText = true;
268 for (int i = 0; i < av.getColumnSelection().size(); i++)
270 int index = av.getColumnSelection().columnAt(i);
272 if(!av.colSel.isVisible(index))
275 if (anot[index] == null)
277 anot[index] = new Annotation(label, "", type, 0);
280 anot[index].secondaryStructure = type;
281 anot[index].displayCharacter = label;
291 private String collectAnnotVals(Annotation[] anot, ColumnSelection columnSelection,
294 String collatedInput="";
296 for (int i = 0; i < columnSelection.size(); i++)
298 int index = columnSelection.columnAt(i);
299 // always check for current display state - just in case
300 if(!av.colSel.isVisible(index))
303 if (anot[index] != null)
305 if (label2.equals(HELIX) || label2.equals(SHEET) || label2.equals(LABEL))
307 tlabel = anot[index].description;
310 if (label2.equals(HELIX) || label2.equals(SHEET))
312 tlabel = ""+anot[index].secondaryStructure;
314 tlabel = ""+anot[index].displayCharacter;
318 if (tlabel!=null && !tlabel.equals(last))
324 collatedInput+=tlabel;
328 return collatedInput;
334 * @param evt DOCUMENT ME!
336 public void mousePressed(MouseEvent evt)
339 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
348 for (int i = 0; i < aa.length; i++)
352 height += aa[i].height;
355 if (evt.getY() < height)
361 else if (aa[i].graph > 0)
365 graphStretchY = evt.getY();
372 if (SwingUtilities.isRightMouseButton(evt) && activeRow != -1)
374 if (av.getColumnSelection() == null)
379 JPopupMenu pop = new JPopupMenu("Structure type");
380 JMenuItem item = new JMenuItem(HELIX);
381 item.addActionListener(this);
383 item = new JMenuItem(SHEET);
384 item.addActionListener(this);
386 item = new JMenuItem(LABEL);
387 item.addActionListener(this);
389 item = new JMenuItem(COLOUR);
390 item.addActionListener(this);
392 item = new JMenuItem(REMOVE);
393 item.addActionListener(this);
395 pop.show(this, evt.getX(), evt.getY());
405 ap.scalePanel.mousePressed(evt);
412 * @param evt DOCUMENT ME!
414 public void mouseReleased(MouseEvent evt)
418 mouseDragging = false;
419 ap.scalePanel.mouseReleased(evt);
425 * @param evt DOCUMENT ME!
427 public void mouseEntered(MouseEvent evt)
429 ap.scalePanel.mouseEntered(evt);
435 * @param evt DOCUMENT ME!
437 public void mouseExited(MouseEvent evt)
439 ap.scalePanel.mouseExited(evt);
445 * @param evt DOCUMENT ME!
447 public void mouseDragged(MouseEvent evt)
449 if (graphStretch > -1)
451 av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight +=
452 graphStretchY - evt.getY();
453 if (av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight < 0)
455 av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight = 0;
457 graphStretchY = evt.getY();
459 ap.paintAlignment(true);
463 ap.scalePanel.mouseDragged(evt);
470 * @param evt DOCUMENT ME!
472 public void mouseMoved(MouseEvent evt)
474 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
478 this.setToolTipText(null);
485 for (int i = 0; i < aa.length; i++)
489 height += aa[i].height;
492 if (evt.getY() < height)
502 this.setToolTipText(null);
506 int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();
508 if (av.hasHiddenColumns)
510 res = av.getColumnSelection().adjustForHiddenColumns(res);
513 if (aa[row].annotations != null
515 && res < (int) aa[row].annotations.length)
517 if (aa[row].graphGroup > -1)
519 StringBuffer tip = new StringBuffer("<html>");
520 for (int gg = 0; gg < aa.length; gg++)
522 if (aa[gg].graphGroup == aa[row].graphGroup && aa[gg].annotations[res] != null)
524 tip.append(aa[gg].label + " " + aa[gg].annotations[res].description +
528 if (tip.length() != 6)
530 tip.setLength(tip.length() - 4);
531 this.setToolTipText(tip.toString() + "</html>");
534 else if (aa[row].annotations[res] != null
535 && aa[row].annotations[res].description != null)
537 this.setToolTipText(aa[row].annotations[res].description);
540 if (aa[row].annotations[res] != null)
542 StringBuffer text = new StringBuffer("Sequence position " +
545 if (aa[row].annotations[res].description != null)
547 text.append(" " + aa[row].annotations[res].description);
550 ap.alignFrame.statusBar.setText(text.toString());
555 this.setToolTipText(null);
562 * @param evt DOCUMENT ME!
564 public void mouseClicked(MouseEvent evt)
571 * @param g DOCUMENT ME!
573 public void paintComponent(Graphics g)
575 g.setColor(Color.white);
576 g.fillRect(0, 0, getWidth(), getHeight());
581 || (getVisibleRect().width != g.getClipBounds().width)
582 || (getVisibleRect().height != g.getClipBounds().height))
584 g.drawImage(image, 0, 0, this);
589 imgWidth = (av.endRes - av.startRes + 1) * av.charWidth;
592 if (image == null || imgWidth != image.getWidth()
593 || image.getHeight(this) != getHeight())
595 image = new BufferedImage(imgWidth, ap.annotationPanel.getHeight(),
596 BufferedImage.TYPE_INT_RGB);
597 gg = (Graphics2D) image.getGraphics();
601 gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
602 RenderingHints.VALUE_ANTIALIAS_ON);
605 gg.setFont(av.getFont());
606 fm = gg.getFontMetrics();
607 gg.setColor(Color.white);
608 gg.fillRect(0, 0, imgWidth, image.getHeight());
611 drawComponent(gg, av.startRes, av.endRes + 1);
612 g.drawImage(image, 0, 0, this);
618 * @param horizontal DOCUMENT ME!
620 public void fastPaint(int horizontal)
622 if ( (horizontal == 0)
624 || av.alignment.getAlignmentAnnotation() == null
625 || av.alignment.getAlignmentAnnotation().length < 1
626 || av.updatingConsensus
627 || av.updatingConservation)
633 gg.copyArea(0, 0, imgWidth, getHeight(), -horizontal * av.charWidth, 0);
635 int sr = av.startRes;
636 int er = av.endRes + 1;
639 if (horizontal > 0) // scrollbar pulled right, image to the left
641 transX = (er - sr - horizontal) * av.charWidth;
642 sr = er - horizontal;
644 else if (horizontal < 0)
646 er = sr - horizontal;
649 gg.translate(transX, 0);
651 drawComponent(gg, sr, er);
653 gg.translate( -transX, 0);
664 * @param g DOCUMENT ME!
665 * @param startRes DOCUMENT ME!
666 * @param endRes DOCUMENT ME!
668 public void drawComponent(Graphics g, int startRes, int endRes)
670 if (av.updatingConsensus || av.updatingConservation)
676 //We'll keep a record of the old image,
677 //and draw a faded image until the calculation
679 if (fadedImage == null
680 || fadedImage.getWidth() != imgWidth
681 || fadedImage.getHeight() != image.getHeight())
683 fadedImage = new BufferedImage(
684 imgWidth, image.getHeight(),
685 BufferedImage.TYPE_INT_RGB);
687 Graphics2D fadedG = (Graphics2D) fadedImage.getGraphics();
689 fadedG.setColor(Color.white);
690 fadedG.fillRect(0, 0, imgWidth, image.getHeight());
693 AlphaComposite.getInstance(
694 AlphaComposite.SRC_OVER, .3f));
695 fadedG.drawImage(image, 0, 0, this);
705 g.setColor(Color.white);
706 g.fillRect(0, 0, (endRes - startRes) * av.charWidth, getHeight());
708 g.setFont(av.getFont());
711 fm = g.getFontMetrics();
714 if ( (av.alignment.getAlignmentAnnotation() == null) ||
715 (av.alignment.getAlignmentAnnotation().length < 1))
717 g.setColor(Color.white);
718 g.fillRect(0, 0, getWidth(), getHeight());
719 g.setColor(Color.black);
720 if (av.validCharWidth)
722 g.drawString("Alignment has no annotations", 20, 15);
728 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
735 boolean validRes = false;
737 boolean[] graphGroupDrawn = new boolean[aa.length];
740 for (int i = 0; i < aa.length; i++)
742 AlignmentAnnotation row = aa[i];
754 if (row.graphGroup > -1 && graphGroupDrawn[row.graphGroup])
759 // this is so that we draw the characters below the graph
764 iconOffset =av.charHeight -fm.getDescent();
768 else if (row.hasText)
770 iconOffset = av.charHeight -fm.getDescent();
779 if (av.updatingConsensus && aa[i] == av.consensus)
783 g.drawImage(fadedImage,
784 0, y - row.height, imgWidth, y,
785 0, y - row.height, imgWidth, y, this);
786 g.setColor(Color.black);
787 // g.drawString("Calculating Consensus....",20, y-row.height/2);
791 else if (av.updatingConservation && aa[i].label.equals("Conservation"))
795 g.drawImage(fadedImage,
796 0, y - row.height, imgWidth, y,
797 0, y - row.height, imgWidth, y, this);
799 g.setColor(Color.black);
800 // g.drawString("Calculating Conservation.....",20, y-row.height/2);
804 else if (av.updatingConservation && aa[i].label.equals("Quality"))
808 g.drawImage(fadedImage,
809 0, y - row.height, imgWidth, y,
810 0, y - row.height, imgWidth, y, this);
811 g.setColor(Color.black);
812 /// g.drawString("Calculating Quality....",20, y-row.height/2);
820 while (x < endRes - startRes)
822 if (av.hasHiddenColumns)
824 column = av.getColumnSelection().adjustForHiddenColumns(startRes + x);
825 if (column > row.annotations.length - 1)
832 column = startRes + x;
835 if ( (row.annotations==null)
836 || (row.annotations.length <= column)
837 || (row.annotations[column] == null))
848 g.setColor(Color.red);
850 if (av.getColumnSelection() != null)
852 for (int n = 0; n < av.getColumnSelection().size(); n++)
854 int v = av.getColumnSelection().columnAt(n);
858 g.fillRect(x * av.charWidth, y,
859 av.charWidth, av.charHeight);
865 if (av.validCharWidth && validRes
866 && row.annotations[column].displayCharacter != null
867 && (row.annotations[column].displayCharacter.length() > 0))
870 int charOffset = (av.charWidth -
871 fm.charWidth(row.annotations[column].
872 displayCharacter.charAt(
875 if (row.annotations[column].colour == null)
876 g.setColor(Color.black);
878 g.setColor(row.annotations[column].colour);
880 if (column == 0 || row.graph > 0)
882 g.drawString(row.annotations[column].displayCharacter,
883 (x * av.charWidth) + charOffset,
887 row.annotations[column - 1] == null
888 || (!row.annotations[column].displayCharacter.equals(
889 row.annotations[column - 1].displayCharacter)
891 (row.annotations[column].displayCharacter.length() < 2 &&
892 row.annotations[column].secondaryStructure == ' ')))
894 g.drawString(row.annotations[column].displayCharacter,
895 x * av.charWidth + charOffset,
903 (row.annotations[column].secondaryStructure != lastSS))
908 g.setColor(HELIX_COLOUR);
911 //Off by 1 offset when drawing rects and ovals
912 //to offscreen image on the MAC
913 g.fillRoundRect(lastSSX, y + 4 + iconOffset,
914 (x * av.charWidth) - lastSSX, 7, 8, 8);
918 int sCol = (lastSSX / av.charWidth) + startRes;
920 int x2 = (x * av.charWidth);
923 row.annotations[sCol - 1] == null ||
924 row.annotations[sCol - 1].secondaryStructure != 'H')
926 g.fillArc(lastSSX, y + 4 + iconOffset, av.charWidth, 8, 90,
928 x1 += av.charWidth / 2;
931 if (row.annotations[column] == null ||
932 row.annotations[column].secondaryStructure != 'H')
934 g.fillArc( (x * av.charWidth) - av.charWidth,
935 y + 4 + iconOffset, av.charWidth, 8, 270, 180);
936 x2 -= av.charWidth / 2;
939 g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 8);
943 g.setColor(SHEET_COLOUR);
944 g.fillRect(lastSSX, y + 4 + iconOffset,
945 (x * av.charWidth) - lastSSX - 4, 7);
946 g.fillPolygon(new int[]
947 { (x * av.charWidth) - 4,
948 (x * av.charWidth) - 4,
952 y + iconOffset, y + 14 + iconOffset,
959 g.setColor(Color.gray);
960 g.fillRect(lastSSX, y + 6 + iconOffset,
961 (x * av.charWidth) - lastSSX, 2);
968 lastSS = row.annotations[column].secondaryStructure;
975 lastSSX = (x * av.charWidth);
983 if (column >= row.annotations.length)
985 column = row.annotations.length - 1;
995 g.setColor(HELIX_COLOUR);
998 //Off by 1 offset when drawing rects and ovals
999 //to offscreen image on the MAC
1000 g.fillRoundRect(lastSSX, y + 4 + iconOffset,
1001 (x * av.charWidth) - lastSSX, 7, 8, 8);
1005 int sCol = (lastSSX / av.charWidth) + startRes;
1007 int x2 = (x * av.charWidth);
1010 row.annotations[sCol - 1] == null ||
1011 row.annotations[sCol - 1].secondaryStructure != 'H')
1013 g.fillArc(lastSSX, y + 4 + iconOffset, av.charWidth, 8, 90, 180);
1014 x1 += av.charWidth / 2;
1017 if (row.annotations[column] == null ||
1018 row.annotations[column].secondaryStructure != 'H')
1020 g.fillArc( (x * av.charWidth) - av.charWidth,
1021 y + 4 + iconOffset, av.charWidth, 8, 270,
1023 x2 -= av.charWidth / 2;
1026 g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 8);
1031 g.setColor(SHEET_COLOUR);
1033 if (row.annotations[endRes] == null
1034 || row.annotations[endRes].secondaryStructure != 'E')
1036 g.fillRect(lastSSX, y + 4 + iconOffset,
1037 (x * av.charWidth) - lastSSX - 4, 7);
1038 g.fillPolygon(new int[]
1039 { (x * av.charWidth) - 4,
1040 (x * av.charWidth) - 4,
1041 (x * av.charWidth)},
1044 y + iconOffset, y + 14 + iconOffset,
1050 g.fillRect(lastSSX, y + 4 + iconOffset,
1051 (x + 1) * av.charWidth - lastSSX, 7);
1056 g.setColor(Color.gray);
1057 g.fillRect(lastSSX, y + 6 + iconOffset,
1058 (x * av.charWidth) - lastSSX, 2);
1064 if (row.graph > 0 && row.graphHeight > 0)
1066 if (row.graph == AlignmentAnnotation.LINE_GRAPH)
1068 if (row.graphGroup > -1 && !graphGroupDrawn[row.graphGroup])
1070 float groupmax = -999999, groupmin = 9999999;
1071 for (int gg = 0; gg < aa.length; gg++)
1073 if (aa[gg].graphGroup != row.graphGroup)
1080 aa[gg].visible = false;
1083 if (aa[gg].graphMax > groupmax)
1085 groupmax = aa[gg].graphMax;
1087 if (aa[gg].graphMin < groupmin)
1089 groupmin = aa[gg].graphMin;
1093 for (int gg = 0; gg < aa.length; gg++)
1095 if (aa[gg].graphGroup == row.graphGroup)
1097 drawLineGraph(g, aa[gg], startRes, endRes, y,
1103 graphGroupDrawn[row.graphGroup] = true;
1107 drawLineGraph(g, row, startRes, endRes,
1108 y, row.graphMin, row.graphMax, row.graphHeight);
1111 else if (row.graph == AlignmentAnnotation.BAR_GRAPH)
1113 drawBarGraph(g, row, startRes, endRes,
1114 row.graphMin, row.graphMax, y);
1118 if (row.graph > 0 && row.hasText)
1130 public void drawLineGraph(Graphics g, AlignmentAnnotation aa,
1133 float min, float max,
1136 if (sRes > aa.annotations.length)
1143 //Adjustment for fastpaint to left
1144 if (eRes < av.endRes)
1149 eRes = Math.min(eRes, aa.annotations.length);
1157 float range = max - min;
1162 y2 = y - (int) ( (0 - min / range) * graphHeight);
1165 g.setColor(Color.gray);
1166 g.drawLine(x - av.charWidth, y2, (eRes - sRes + 1) * av.charWidth, y2);
1168 eRes = Math.min(eRes, aa.annotations.length);
1171 int aaMax = aa.annotations.length - 1;
1173 while (x < eRes - sRes)
1176 if (av.hasHiddenColumns)
1178 column = av.getColumnSelection().adjustForHiddenColumns(column);
1186 if (aa.annotations[column] == null || aa.annotations[column - 1] == null)
1192 if (aa.annotations[column].colour == null)
1193 g.setColor(Color.black);
1195 g.setColor(aa.annotations[column].colour);
1198 (int) ( ( (aa.annotations[column - 1].value - min) / range) * graphHeight);
1200 (int) ( ( (aa.annotations[column].value - min) / range) * graphHeight);
1202 g.drawLine(x * av.charWidth - av.charWidth / 2, y1,
1203 x * av.charWidth + av.charWidth / 2, y2);
1207 if (aa.threshold != null)
1209 g.setColor(aa.threshold.colour);
1210 Graphics2D g2 = (Graphics2D) g;
1211 g2.setStroke(new BasicStroke(1,
1212 BasicStroke.CAP_SQUARE,
1213 BasicStroke.JOIN_ROUND, 3f,
1217 y2 = (int) (y - ( (aa.threshold.value - min) / range) * graphHeight);
1218 g.drawLine(0, y2, (eRes - sRes) * av.charWidth, y2);
1219 g2.setStroke(new BasicStroke());
1223 public void drawBarGraph(Graphics g, AlignmentAnnotation aa,
1225 float min, float max,
1228 if (sRes > aa.annotations.length)
1233 eRes = Math.min(eRes, aa.annotations.length);
1235 int x = 0, y1 = y, y2 = y;
1237 float range = max - min;
1241 y2 = y - (int) ( (0 - min / (range)) * aa.graphHeight);
1244 g.setColor(Color.gray);
1246 g.drawLine(x, y2, (eRes - sRes) * av.charWidth, y2);
1249 int aaMax = aa.annotations.length - 1;
1251 while (x < eRes - sRes)
1254 if (av.hasHiddenColumns)
1256 column = av.getColumnSelection().adjustForHiddenColumns(column);
1264 if (aa.annotations[column] == null)
1270 if (aa.annotations[column].colour == null)
1271 g.setColor(Color.black);
1273 g.setColor(aa.annotations[column].colour);
1276 (int) ( ( (aa.annotations[column].value - min) / (range)) * aa.graphHeight);
1280 g.fillRect(x * av.charWidth, y2, av.charWidth, y1 - y2);
1284 g.fillRect(x * av.charWidth, y1, av.charWidth, y2 - y1);
1290 if (aa.threshold != null)
1292 g.setColor(aa.threshold.colour);
1293 Graphics2D g2 = (Graphics2D) g;
1294 g2.setStroke(new BasicStroke(1,
1295 BasicStroke.CAP_SQUARE,
1296 BasicStroke.JOIN_ROUND, 3f,
1300 y2 = (int) (y - ( (aa.threshold.value - min) / range) * aa.graphHeight);
1301 g.drawLine(0, y2, (eRes - sRes) * av.charWidth, y2);
1302 g2.setStroke(new BasicStroke());
1306 // used by overview window
1307 public void drawGraph(Graphics g, AlignmentAnnotation aa, int width, int y,
1310 eRes = Math.min(eRes, aa.annotations.length);
1311 g.setColor(Color.white);
1312 g.fillRect(0, 0, width, y);
1313 g.setColor(new Color(0, 0, 180));
1317 for (int j = sRes; j < eRes; j++)
1319 if (aa.annotations[j] != null)
1321 if (aa.annotations[j].colour == null)
1322 g.setColor(Color.black);
1324 g.setColor(aa.annotations[j].colour);
1326 height = (int) ( (aa.annotations[j].value / aa.graphMax) * y);
1332 g.fillRect(x, y - height, av.charWidth, height);