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 MAC = new jalview.util.Platform().isAMac();
76 ToolTipManager.sharedInstance().registerComponent(this);
77 ToolTipManager.sharedInstance().setInitialDelay(0);
78 ToolTipManager.sharedInstance().setDismissDelay(10000);
82 addMouseListener(this);
83 addMouseMotionListener(this);
84 ap.annotationScroller.getVerticalScrollBar().addAdjustmentListener(this);
87 public AnnotationPanel(AlignViewport av)
95 * @param evt DOCUMENT ME!
97 public void adjustmentValueChanged(AdjustmentEvent evt)
99 ap.alabels.setScrollOffset( -evt.getValue());
105 public int adjustPanelHeight()
107 // setHeight of panels
108 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
113 for (int i = 0; i < aa.length; i++)
124 aa[i].height += av.charHeight;
134 aa[i].height += aa[i].graphHeight;
137 if (aa[i].height == 0)
142 height += aa[i].height;
150 this.setPreferredSize(new Dimension(1, height));
158 * @param evt DOCUMENT ME!
160 public void actionPerformed(ActionEvent evt)
162 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
163 Annotation[] anot = aa[activeRow].annotations;
165 if (anot.length < av.getColumnSelection().getMax())
167 Annotation[] temp = new Annotation[av.getColumnSelection().getMax() + 2];
168 System.arraycopy(anot, 0, temp, 0, anot.length);
170 aa[activeRow].annotations = anot;
173 if (evt.getActionCommand().equals(REMOVE))
175 for (int i = 0; i < av.getColumnSelection().size(); i++)
177 anot[av.getColumnSelection().columnAt(i)] = null;
180 else if (evt.getActionCommand().equals(LABEL))
182 String exMesg = collectAnnotVals(anot, av.getColumnSelection(), LABEL);
183 String label = JOptionPane.showInputDialog(this,"Enter label",exMesg);
190 if ( (label.length() > 0) && !aa[activeRow].hasText)
192 aa[activeRow].hasText = true;
195 for (int i = 0; i < av.getColumnSelection().size(); i++)
197 int index = av.getColumnSelection().columnAt(i);
199 if(!av.colSel.isVisible(index))
202 if (anot[index] == null)
204 anot[index] = new Annotation(label, "", ' ', 0); // TODO: verify that null exceptions aren't raised elsewhere.
206 anot[index].displayCharacter = label;
210 else if (evt.getActionCommand().equals(COLOUR))
212 Color col = JColorChooser.showDialog(this,
213 "Choose foreground colour",
216 for (int i = 0; i < av.getColumnSelection().size(); i++)
218 int index = av.getColumnSelection().columnAt(i);
220 if(!av.colSel.isVisible(index))
223 if (anot[index] == null)
225 anot[index] = new Annotation("", "", ' ', 0);
228 anot[index].colour = col;
231 else // HELIX OR SHEET
234 String symbol = "\u03B1";
236 if (evt.getActionCommand().equals(HELIX))
240 else if (evt.getActionCommand().equals(SHEET))
246 if (!aa[activeRow].hasIcons)
248 aa[activeRow].hasIcons = true;
251 String label = JOptionPane.showInputDialog(
252 "Enter a label for the structure?",
260 if ( (label.length() > 0) && !aa[activeRow].hasText)
262 aa[activeRow].hasText = true;
265 for (int i = 0; i < av.getColumnSelection().size(); i++)
267 int index = av.getColumnSelection().columnAt(i);
269 if(!av.colSel.isVisible(index))
272 if (anot[index] == null)
274 anot[index] = new Annotation(label, "", type, 0);
277 anot[index].secondaryStructure = type;
278 anot[index].displayCharacter = label;
288 private String collectAnnotVals(Annotation[] anot, ColumnSelection columnSelection,
291 String collatedInput="";
293 for (int i = 0; i < columnSelection.size(); i++)
295 int index = columnSelection.columnAt(i);
296 // always check for current display state - just in case
297 if(!av.colSel.isVisible(index))
300 if (anot[index] != null)
302 if (label2.equals(HELIX) || label2.equals(SHEET) || label2.equals(LABEL))
304 tlabel = anot[index].description;
307 if (label2.equals(HELIX) || label2.equals(SHEET))
309 tlabel = ""+anot[index].secondaryStructure;
311 tlabel = ""+anot[index].displayCharacter;
315 if (tlabel!=null && !tlabel.equals(last))
321 collatedInput+=tlabel;
325 return collatedInput;
331 * @param evt DOCUMENT ME!
333 public void mousePressed(MouseEvent evt)
336 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
345 for (int i = 0; i < aa.length; i++)
349 height += aa[i].height;
352 if (evt.getY() < height)
358 else if (aa[i].graph > 0)
362 graphStretchY = evt.getY();
369 if (SwingUtilities.isRightMouseButton(evt) && activeRow != -1)
371 if (av.getColumnSelection() == null)
376 JPopupMenu pop = new JPopupMenu("Structure type");
377 JMenuItem item = new JMenuItem(HELIX);
378 item.addActionListener(this);
380 item = new JMenuItem(SHEET);
381 item.addActionListener(this);
383 item = new JMenuItem(LABEL);
384 item.addActionListener(this);
386 item = new JMenuItem(COLOUR);
387 item.addActionListener(this);
389 item = new JMenuItem(REMOVE);
390 item.addActionListener(this);
392 pop.show(this, evt.getX(), evt.getY());
402 ap.scalePanel.mousePressed(evt);
409 * @param evt DOCUMENT ME!
411 public void mouseReleased(MouseEvent evt)
415 mouseDragging = false;
416 ap.scalePanel.mouseReleased(evt);
422 * @param evt DOCUMENT ME!
424 public void mouseEntered(MouseEvent evt)
426 ap.scalePanel.mouseEntered(evt);
432 * @param evt DOCUMENT ME!
434 public void mouseExited(MouseEvent evt)
436 ap.scalePanel.mouseExited(evt);
442 * @param evt DOCUMENT ME!
444 public void mouseDragged(MouseEvent evt)
446 if (graphStretch > -1)
448 av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight +=
449 graphStretchY - evt.getY();
450 if (av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight < 0)
452 av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight = 0;
454 graphStretchY = evt.getY();
456 ap.paintAlignment(true);
460 ap.scalePanel.mouseDragged(evt);
467 * @param evt DOCUMENT ME!
469 public void mouseMoved(MouseEvent evt)
471 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
475 this.setToolTipText(null);
482 for (int i = 0; i < aa.length; i++)
486 height += aa[i].height;
489 if (evt.getY() < height)
499 this.setToolTipText(null);
503 int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();
505 if (av.hasHiddenColumns)
507 res = av.getColumnSelection().adjustForHiddenColumns(res);
510 if (aa[row].annotations != null
512 && res < (int) aa[row].annotations.length)
514 if (aa[row].graphGroup > -1)
516 StringBuffer tip = new StringBuffer("<html>");
517 for (int gg = 0; gg < aa.length; gg++)
519 if (aa[gg].graphGroup == aa[row].graphGroup && aa[gg].annotations[res] != null)
521 tip.append(aa[gg].label + " " + aa[gg].annotations[res].description +
525 if (tip.length() != 6)
527 tip.setLength(tip.length() - 4);
528 this.setToolTipText(tip.toString() + "</html>");
531 else if (aa[row].annotations[res] != null
532 && aa[row].annotations[res].description != null)
534 this.setToolTipText(aa[row].annotations[res].description);
537 if (aa[row].annotations[res] != null)
539 StringBuffer text = new StringBuffer("Sequence position " +
542 if (aa[row].annotations[res].description != null)
544 text.append(" " + aa[row].annotations[res].description);
547 ap.alignFrame.statusBar.setText(text.toString());
552 this.setToolTipText(null);
559 * @param evt DOCUMENT ME!
561 public void mouseClicked(MouseEvent evt)
568 * @param g DOCUMENT ME!
570 public void paintComponent(Graphics g)
572 g.setColor(Color.white);
573 g.fillRect(0, 0, getWidth(), getHeight());
578 || (getVisibleRect().width != g.getClipBounds().width)
579 || (getVisibleRect().height != g.getClipBounds().height))
581 g.drawImage(image, 0, 0, this);
586 imgWidth = (av.endRes - av.startRes + 1) * av.charWidth;
589 if (image == null || imgWidth != image.getWidth()
590 || image.getHeight(this) != getHeight())
592 image = new BufferedImage(imgWidth, ap.annotationPanel.getHeight(),
593 BufferedImage.TYPE_INT_RGB);
594 gg = (Graphics2D) image.getGraphics();
598 gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
599 RenderingHints.VALUE_ANTIALIAS_ON);
602 gg.setFont(av.getFont());
603 fm = gg.getFontMetrics();
604 gg.setColor(Color.white);
605 gg.fillRect(0, 0, imgWidth, image.getHeight());
608 drawComponent(gg, av.startRes, av.endRes + 1);
609 g.drawImage(image, 0, 0, this);
612 * non-Thread safe repaint
614 * @param horizontal repaint with horizontal shift in alignment
616 public void fastPaint(int horizontal)
619 if ( (horizontal == 0)
621 || av.alignment.getAlignmentAnnotation() == null
622 || av.alignment.getAlignmentAnnotation().length < 1
623 || av.updatingConsensus
624 || av.updatingConservation)
629 gg.copyArea(0, 0, imgWidth, getHeight(), -horizontal * av.charWidth, 0);
631 int sr = av.startRes;
632 int er = av.endRes + 1;
635 if (horizontal > 0) // scrollbar pulled right, image to the left
637 transX = (er - sr - horizontal) * av.charWidth;
638 sr = er - horizontal;
640 else if (horizontal < 0)
642 er = sr - horizontal;
645 gg.translate(transX, 0);
647 drawComponent(gg, sr, er);
649 gg.translate( -transX, 0);
659 * @param g DOCUMENT ME!
660 * @param startRes DOCUMENT ME!
661 * @param endRes DOCUMENT ME!
663 public void drawComponent(Graphics g, int startRes, int endRes)
665 if (av.updatingConsensus || av.updatingConservation)
671 //We'll keep a record of the old image,
672 //and draw a faded image until the calculation
674 if (fadedImage == null
675 || fadedImage.getWidth() != imgWidth
676 || fadedImage.getHeight() != image.getHeight())
678 fadedImage = new BufferedImage(
679 imgWidth, image.getHeight(),
680 BufferedImage.TYPE_INT_RGB);
682 Graphics2D fadedG = (Graphics2D) fadedImage.getGraphics();
684 fadedG.setColor(Color.white);
685 fadedG.fillRect(0, 0, imgWidth, image.getHeight());
688 AlphaComposite.getInstance(
689 AlphaComposite.SRC_OVER, .3f));
690 fadedG.drawImage(image, 0, 0, this);
700 g.setColor(Color.white);
701 g.fillRect(0, 0, (endRes - startRes) * av.charWidth, getHeight());
703 g.setFont(av.getFont());
706 fm = g.getFontMetrics();
709 if ( (av.alignment.getAlignmentAnnotation() == null) ||
710 (av.alignment.getAlignmentAnnotation().length < 1))
712 g.setColor(Color.white);
713 g.fillRect(0, 0, getWidth(), getHeight());
714 g.setColor(Color.black);
715 if (av.validCharWidth)
717 g.drawString("Alignment has no annotations", 20, 15);
723 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
730 boolean validRes = false;
732 boolean[] graphGroupDrawn = new boolean[aa.length];
735 for (int i = 0; i < aa.length; i++)
737 AlignmentAnnotation row = aa[i];
749 if (row.graphGroup > -1 && graphGroupDrawn[row.graphGroup])
754 // this is so that we draw the characters below the graph
759 iconOffset =av.charHeight -fm.getDescent();
763 else if (row.hasText)
765 iconOffset = av.charHeight -fm.getDescent();
774 if (av.updatingConsensus && aa[i] == av.consensus)
778 g.drawImage(fadedImage,
779 0, y - row.height, imgWidth, y,
780 0, y - row.height, imgWidth, y, this);
781 g.setColor(Color.black);
782 // g.drawString("Calculating Consensus....",20, y-row.height/2);
786 else if (av.updatingConservation && aa[i].label.equals("Conservation"))
790 g.drawImage(fadedImage,
791 0, y - row.height, imgWidth, y,
792 0, y - row.height, imgWidth, y, this);
794 g.setColor(Color.black);
795 // g.drawString("Calculating Conservation.....",20, y-row.height/2);
799 else if (av.updatingConservation && aa[i].label.equals("Quality"))
803 g.drawImage(fadedImage,
804 0, y - row.height, imgWidth, y,
805 0, y - row.height, imgWidth, y, this);
806 g.setColor(Color.black);
807 /// g.drawString("Calculating Quality....",20, y-row.height/2);
815 while (x < endRes - startRes)
817 if (av.hasHiddenColumns)
819 column = av.getColumnSelection().adjustForHiddenColumns(startRes + x);
820 if (column > row.annotations.length - 1)
827 column = startRes + x;
830 if ( (row.annotations==null)
831 || (row.annotations.length <= column)
832 || (row.annotations[column] == null))
843 g.setColor(Color.red);
845 if (av.getColumnSelection() != null)
847 for (int n = 0; n < av.getColumnSelection().size(); n++)
849 int v = av.getColumnSelection().columnAt(n);
853 g.fillRect(x * av.charWidth, y,
854 av.charWidth, av.charHeight);
860 if (av.validCharWidth && validRes
861 && row.annotations[column].displayCharacter != null
862 && (row.annotations[column].displayCharacter.length() > 0))
865 int charOffset = (av.charWidth -
866 fm.charWidth(row.annotations[column].
867 displayCharacter.charAt(
870 if (row.annotations[column].colour == null)
871 g.setColor(Color.black);
873 g.setColor(row.annotations[column].colour);
875 if (column == 0 || row.graph > 0)
877 g.drawString(row.annotations[column].displayCharacter,
878 (x * av.charWidth) + charOffset,
882 row.annotations[column - 1] == null
883 || (!row.annotations[column].displayCharacter.equals(
884 row.annotations[column - 1].displayCharacter)
886 (row.annotations[column].displayCharacter.length() < 2 &&
887 row.annotations[column].secondaryStructure == ' ')))
889 g.drawString(row.annotations[column].displayCharacter,
890 x * av.charWidth + charOffset,
898 (row.annotations[column].secondaryStructure != lastSS))
903 g.setColor(HELIX_COLOUR);
906 //Off by 1 offset when drawing rects and ovals
907 //to offscreen image on the MAC
908 g.fillRoundRect(lastSSX, y + 4 + iconOffset,
909 (x * av.charWidth) - lastSSX, 7, 8, 8);
913 int sCol = (lastSSX / av.charWidth) + startRes;
915 int x2 = (x * av.charWidth);
918 row.annotations[sCol - 1] == null ||
919 row.annotations[sCol - 1].secondaryStructure != 'H')
921 g.fillArc(lastSSX, y + 4 + iconOffset, av.charWidth, 8, 90,
923 x1 += av.charWidth / 2;
926 if (row.annotations[column] == null ||
927 row.annotations[column].secondaryStructure != 'H')
929 g.fillArc( (x * av.charWidth) - av.charWidth,
930 y + 4 + iconOffset, av.charWidth, 8, 270, 180);
931 x2 -= av.charWidth / 2;
934 g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 8);
938 g.setColor(SHEET_COLOUR);
939 g.fillRect(lastSSX, y + 4 + iconOffset,
940 (x * av.charWidth) - lastSSX - 4, 7);
941 g.fillPolygon(new int[]
942 { (x * av.charWidth) - 4,
943 (x * av.charWidth) - 4,
947 y + iconOffset, y + 14 + iconOffset,
954 g.setColor(Color.gray);
955 g.fillRect(lastSSX, y + 6 + iconOffset,
956 (x * av.charWidth) - lastSSX, 2);
963 lastSS = row.annotations[column].secondaryStructure;
970 lastSSX = (x * av.charWidth);
978 if (column >= row.annotations.length)
980 column = row.annotations.length - 1;
990 g.setColor(HELIX_COLOUR);
993 //Off by 1 offset when drawing rects and ovals
994 //to offscreen image on the MAC
995 g.fillRoundRect(lastSSX, y + 4 + iconOffset,
996 (x * av.charWidth) - lastSSX, 7, 8, 8);
1000 int sCol = (lastSSX / av.charWidth) + startRes;
1002 int x2 = (x * av.charWidth);
1005 row.annotations[sCol - 1] == null ||
1006 row.annotations[sCol - 1].secondaryStructure != 'H')
1008 g.fillArc(lastSSX, y + 4 + iconOffset, av.charWidth, 8, 90, 180);
1009 x1 += av.charWidth / 2;
1012 if (row.annotations[column] == null ||
1013 row.annotations[column].secondaryStructure != 'H')
1015 g.fillArc( (x * av.charWidth) - av.charWidth,
1016 y + 4 + iconOffset, av.charWidth, 8, 270,
1018 x2 -= av.charWidth / 2;
1021 g.fillRect(x1, y + 4 + iconOffset, x2 - x1, 8);
1026 g.setColor(SHEET_COLOUR);
1028 if (row.annotations[endRes] == null
1029 || row.annotations[endRes].secondaryStructure != 'E')
1031 g.fillRect(lastSSX, y + 4 + iconOffset,
1032 (x * av.charWidth) - lastSSX - 4, 7);
1033 g.fillPolygon(new int[]
1034 { (x * av.charWidth) - 4,
1035 (x * av.charWidth) - 4,
1036 (x * av.charWidth)},
1039 y + iconOffset, y + 14 + iconOffset,
1045 g.fillRect(lastSSX, y + 4 + iconOffset,
1046 (x + 1) * av.charWidth - lastSSX, 7);
1051 g.setColor(Color.gray);
1052 g.fillRect(lastSSX, y + 6 + iconOffset,
1053 (x * av.charWidth) - lastSSX, 2);
1059 if (row.graph > 0 && row.graphHeight > 0)
1061 if (row.graph == AlignmentAnnotation.LINE_GRAPH)
1063 if (row.graphGroup > -1 && !graphGroupDrawn[row.graphGroup])
1065 float groupmax = -999999, groupmin = 9999999;
1066 for (int gg = 0; gg < aa.length; gg++)
1068 if (aa[gg].graphGroup != row.graphGroup)
1075 aa[gg].visible = false;
1078 if (aa[gg].graphMax > groupmax)
1080 groupmax = aa[gg].graphMax;
1082 if (aa[gg].graphMin < groupmin)
1084 groupmin = aa[gg].graphMin;
1088 for (int gg = 0; gg < aa.length; gg++)
1090 if (aa[gg].graphGroup == row.graphGroup)
1092 drawLineGraph(g, aa[gg], startRes, endRes, y,
1098 graphGroupDrawn[row.graphGroup] = true;
1102 drawLineGraph(g, row, startRes, endRes,
1103 y, row.graphMin, row.graphMax, row.graphHeight);
1106 else if (row.graph == AlignmentAnnotation.BAR_GRAPH)
1108 drawBarGraph(g, row, startRes, endRes,
1109 row.graphMin, row.graphMax, y);
1113 if (row.graph > 0 && row.hasText)
1125 public void drawLineGraph(Graphics g, AlignmentAnnotation aa,
1128 float min, float max,
1131 if (sRes > aa.annotations.length)
1138 //Adjustment for fastpaint to left
1139 if (eRes < av.endRes)
1144 eRes = Math.min(eRes, aa.annotations.length);
1152 float range = max - min;
1157 y2 = y - (int) ( (0 - min / range) * graphHeight);
1160 g.setColor(Color.gray);
1161 g.drawLine(x - av.charWidth, y2, (eRes - sRes + 1) * av.charWidth, y2);
1163 eRes = Math.min(eRes, aa.annotations.length);
1166 int aaMax = aa.annotations.length - 1;
1168 while (x < eRes - sRes)
1171 if (av.hasHiddenColumns)
1173 column = av.getColumnSelection().adjustForHiddenColumns(column);
1181 if (aa.annotations[column] == null || aa.annotations[column - 1] == null)
1187 if (aa.annotations[column].colour == null)
1188 g.setColor(Color.black);
1190 g.setColor(aa.annotations[column].colour);
1193 (int) ( ( (aa.annotations[column - 1].value - min) / range) * graphHeight);
1195 (int) ( ( (aa.annotations[column].value - min) / range) * graphHeight);
1197 g.drawLine(x * av.charWidth - av.charWidth / 2, y1,
1198 x * av.charWidth + av.charWidth / 2, y2);
1202 if (aa.threshold != null)
1204 g.setColor(aa.threshold.colour);
1205 Graphics2D g2 = (Graphics2D) g;
1206 g2.setStroke(new BasicStroke(1,
1207 BasicStroke.CAP_SQUARE,
1208 BasicStroke.JOIN_ROUND, 3f,
1212 y2 = (int) (y - ( (aa.threshold.value - min) / range) * graphHeight);
1213 g.drawLine(0, y2, (eRes - sRes) * av.charWidth, y2);
1214 g2.setStroke(new BasicStroke());
1218 public void drawBarGraph(Graphics g, AlignmentAnnotation aa,
1220 float min, float max,
1223 if (sRes > aa.annotations.length)
1228 eRes = Math.min(eRes, aa.annotations.length);
1230 int x = 0, y1 = y, y2 = y;
1232 float range = max - min;
1236 y2 = y - (int) ( (0 - min / (range)) * aa.graphHeight);
1239 g.setColor(Color.gray);
1241 g.drawLine(x, y2, (eRes - sRes) * av.charWidth, y2);
1244 int aaMax = aa.annotations.length - 1;
1246 while (x < eRes - sRes)
1249 if (av.hasHiddenColumns)
1251 column = av.getColumnSelection().adjustForHiddenColumns(column);
1259 if (aa.annotations[column] == null)
1265 if (aa.annotations[column].colour == null)
1266 g.setColor(Color.black);
1268 g.setColor(aa.annotations[column].colour);
1271 (int) ( ( (aa.annotations[column].value - min) / (range)) * aa.graphHeight);
1275 g.fillRect(x * av.charWidth, y2, av.charWidth, y1 - y2);
1279 g.fillRect(x * av.charWidth, y1, av.charWidth, y2 - y1);
1285 if (aa.threshold != null)
1287 g.setColor(aa.threshold.colour);
1288 Graphics2D g2 = (Graphics2D) g;
1289 g2.setStroke(new BasicStroke(1,
1290 BasicStroke.CAP_SQUARE,
1291 BasicStroke.JOIN_ROUND, 3f,
1295 y2 = (int) (y - ( (aa.threshold.value - min) / range) * aa.graphHeight);
1296 g.drawLine(0, y2, (eRes - sRes) * av.charWidth, y2);
1297 g2.setStroke(new BasicStroke());
1301 // used by overview window
1302 public void drawGraph(Graphics g, AlignmentAnnotation aa, int width, int y,
1305 eRes = Math.min(eRes, aa.annotations.length);
1306 g.setColor(Color.white);
1307 g.fillRect(0, 0, width, y);
1308 g.setColor(new Color(0, 0, 180));
1312 for (int j = sRes; j < eRes; j++)
1314 if (aa.annotations[j] != null)
1316 if (aa.annotations[j].colour == null)
1317 g.setColor(Color.black);
1319 g.setColor(aa.annotations[j].colour);
1321 height = (int) ( (aa.annotations[j].value / aa.graphMax) * y);
1327 g.fillRect(x, y - height, av.charWidth, height);