2 * Jalview - A Sequence Alignment Editor and Viewer
\r
3 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
\r
5 * This program is free software; you can redistribute it and/or
\r
6 * modify it under the terms of the GNU General Public License
\r
7 * as published by the Free Software Foundation; either version 2
\r
8 * of the License, or (at your option) any later version.
\r
10 * This program is distributed in the hope that it will be useful,
\r
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 * GNU General Public License for more details.
\r
15 * You should have received a copy of the GNU General Public License
\r
16 * along with this program; if not, write to the Free Software
\r
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
\r
19 package jalview.gui;
\r
21 import jalview.datamodel.*;
\r
24 import java.awt.event.*;
\r
25 import java.awt.image.*;
\r
27 import javax.swing.*;
\r
34 * @version $Revision$
\r
36 public class AnnotationPanel extends JPanel implements MouseListener,
\r
37 MouseMotionListener, ActionListener, AdjustmentListener
\r
39 final String HELIX = "Helix";
\r
40 final String SHEET = "Sheet";
\r
41 final String LABEL = "Label";
\r
42 final String REMOVE = "Remove Annotation";
\r
43 final String COLOUR = "Colour";
\r
44 final Color HELIX_COLOUR = Color.red.darker();
\r
45 final Color SHEET_COLOUR = Color.green.darker().darker();
\r
47 /** DOCUMENT ME!! */
\r
51 BufferedImage image;
\r
55 boolean fastPaint = false;
\r
57 //Used For mouse Dragging and resizing graphs
\r
58 int graphStretch = -1;
\r
59 int graphStretchY = -1;
\r
60 int min; //used by mouseDragged to see if user
\r
61 int max; //used by mouseDragged to see if user
\r
62 boolean mouseDragging = false;
\r
64 boolean MAC = false;
\r
67 * Creates a new AnnotationPanel object.
\r
69 * @param ap DOCUMENT ME!
\r
71 public AnnotationPanel(AlignmentPanel ap)
\r
74 if(System.getProperty("os.name").startsWith("Mac"))
\r
77 ToolTipManager.sharedInstance().registerComponent(this);
\r
78 ToolTipManager.sharedInstance().setInitialDelay(0);
\r
79 ToolTipManager.sharedInstance().setDismissDelay(10000);
\r
82 this.setLayout(null);
\r
83 addMouseListener(this);
\r
84 addMouseMotionListener(this);
\r
85 ap.annotationScroller.getVerticalScrollBar().addAdjustmentListener(this);
\r
88 public AnnotationPanel(AlignViewport av)
\r
97 * @param evt DOCUMENT ME!
\r
99 public void adjustmentValueChanged(AdjustmentEvent evt)
\r
101 ap.alabels.setScrollOffset(-evt.getValue());
\r
107 public int adjustPanelHeight()
\r
109 // setHeight of panels
\r
111 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
\r
116 for (int i = 0; i < aa.length; i++)
\r
118 if (!aa[i].visible)
\r
127 aa[i].height += av.charHeight;
\r
130 if (aa[i].hasIcons)
\r
132 aa[i].height += 16;
\r
137 aa[i].height += aa[i].graphHeight;
\r
140 if (aa[i].height == 0)
\r
145 height += aa[i].height;
\r
153 this.setPreferredSize(new Dimension(1, height));
\r
163 * @param evt DOCUMENT ME!
\r
165 public void actionPerformed(ActionEvent evt)
\r
167 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
\r
168 Annotation[] anot = aa[activeRow].annotations;
\r
170 if (evt.getActionCommand().equals(REMOVE))
\r
172 for (int i = 0; i < av.getColumnSelection().size(); i++)
\r
174 anot[av.getColumnSelection().columnAt(i)] = null;
\r
177 else if (evt.getActionCommand().equals(LABEL))
\r
179 String label = JOptionPane.showInputDialog(this, "Enter Label ",
\r
180 "Enter label", JOptionPane.QUESTION_MESSAGE);
\r
187 if ((label.length() > 0) && !aa[activeRow].hasText)
\r
189 aa[activeRow].hasText = true;
\r
192 for (int i = 0; i < av.getColumnSelection().size(); i++)
\r
194 int index = av.getColumnSelection().columnAt(i);
\r
196 if (anot[index] == null)
\r
198 anot[index] = new Annotation(label, "", ' ', 0);
\r
201 anot[index].displayCharacter = label;
\r
204 else if (evt.getActionCommand().equals(COLOUR))
\r
206 Color col = JColorChooser.showDialog(this,
\r
207 "Choose foreground colour", Color.black);
\r
209 for (int i = 0; i < av.getColumnSelection().size(); i++)
\r
211 int index = av.getColumnSelection().columnAt(i);
\r
213 if (anot[index] == null)
\r
215 anot[index] = new Annotation("", "", ' ', 0);
\r
218 anot[index].colour = col;
\r
221 else // HELIX OR SHEET
\r
224 String symbol = "\u03B1";
\r
226 if (evt.getActionCommand().equals(HELIX))
\r
230 else if (evt.getActionCommand().equals(SHEET))
\r
236 if (!aa[activeRow].hasIcons)
\r
238 aa[activeRow].hasIcons = true;
\r
241 String label = JOptionPane.showInputDialog("Enter a label for the structure?",
\r
249 if ((label.length() > 0) && !aa[activeRow].hasText)
\r
251 aa[activeRow].hasText = true;
\r
254 for (int i = 0; i < av.getColumnSelection().size(); i++)
\r
256 int index = av.getColumnSelection().columnAt(i);
\r
258 if (anot[index] == null)
\r
260 anot[index] = new Annotation(label, "", type, 0);
\r
263 anot[index].secondaryStructure = type;
\r
264 anot[index].displayCharacter = label;
\r
268 adjustPanelHeight();
\r
277 * @param evt DOCUMENT ME!
\r
279 public void mousePressed(MouseEvent evt)
\r
283 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
\r
292 for (int i = 0; i < aa.length; i++)
\r
296 height += aa[i].height;
\r
299 if (evt.getY() < height)
\r
301 if (aa[i].editable)
\r
305 else if(aa[i].graph>0)
\r
309 graphStretchY = evt.getY();
\r
317 if (SwingUtilities.isRightMouseButton(evt))
\r
319 if (av.getColumnSelection() == null)
\r
324 JPopupMenu pop = new JPopupMenu("Structure type");
\r
325 JMenuItem item = new JMenuItem(HELIX);
\r
326 item.addActionListener(this);
\r
328 item = new JMenuItem(SHEET);
\r
329 item.addActionListener(this);
\r
331 item = new JMenuItem(LABEL);
\r
332 item.addActionListener(this);
\r
334 item = new JMenuItem(COLOUR);
\r
335 item.addActionListener(this);
\r
337 item = new JMenuItem(REMOVE);
\r
338 item.addActionListener(this);
\r
340 pop.show(this, evt.getX(), evt.getY());
\r
350 int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();
\r
355 if (av.getColumnSelection().contains(res))
\r
356 av.getColumnSelection().removeElement(res);
\r
359 av.getColumnSelection().addElement(res);
\r
360 SequenceGroup sg = new SequenceGroup();
\r
362 for (int i = 0; i < av.alignment.getSequences().size(); i++)
\r
364 sg.addSequence(av.alignment.getSequenceAt(i), false);
\r
367 sg.setStartRes(res);
\r
369 av.setSelectionGroup(sg);
\r
379 * @param evt DOCUMENT ME!
\r
381 public void mouseReleased(MouseEvent evt)
\r
384 graphStretchY = -1;
\r
385 mouseDragging = false;
\r
391 * @param evt DOCUMENT ME!
\r
393 public void mouseEntered(MouseEvent evt)
\r
396 ap.seqPanel.scrollCanvas(null);
\r
402 * @param evt DOCUMENT ME!
\r
404 public void mouseExited(MouseEvent evt)
\r
407 ap.seqPanel.scrollCanvas(evt);
\r
414 * @param evt DOCUMENT ME!
\r
416 public void mouseDragged(MouseEvent evt)
\r
418 if(graphStretch>-1)
\r
420 av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight += graphStretchY - evt.getY();
\r
421 if(av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight <10)
\r
422 av.alignment.getAlignmentAnnotation()[graphStretch].graphHeight = 10;
\r
423 graphStretchY = evt.getY();
\r
424 adjustPanelHeight();
\r
429 mouseDragging = true;
\r
431 int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();
\r
433 SequenceGroup sg = av.getSelectionGroup();
\r
447 if (!av.getColumnSelection().contains(res))
\r
449 av.getColumnSelection().addElement(res);
\r
452 if (res > sg.getStartRes())
\r
456 else if (res < sg.getStartRes())
\r
458 sg.setStartRes(res);
\r
461 for (int i = min; i <= max; i++)
\r
463 if ((i < sg.getStartRes()) || (i > sg.getEndRes()))
\r
465 av.getColumnSelection().removeElement(i);
\r
469 av.getColumnSelection().addElement(i);
\r
482 * @param evt DOCUMENT ME!
\r
484 public void mouseMoved(MouseEvent evt)
\r
486 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
\r
496 for (int i = 0; i < aa.length; i++)
\r
500 height += aa[i].height;
\r
503 if (evt.getY() < height)
\r
511 int res = (evt.getX() / av.getCharWidth()) + av.getStartRes();
\r
513 if(av.hasHiddenColumns)
\r
514 res = av.getColumnSelection().adjustForHiddenColumns(res);
\r
516 if (row > -1 && res<aa[row].annotations.length)
\r
518 if(aa[row].graphGroup>-1)
\r
520 StringBuffer tip = new StringBuffer("<html>");
\r
521 for (int gg = 0; gg < aa.length; gg++)
\r
523 if (aa[gg].graphGroup == aa[row].graphGroup && aa[gg].annotations[res]!=null)
\r
524 tip.append(aa[gg].label+" "+aa[gg].annotations[res].description+"<br>" );
\r
526 if(tip.length()!=6)
\r
528 tip.setLength(tip.length() - 4);
\r
529 this.setToolTipText(tip.toString() + "</html>");
\r
532 else if(aa[row].annotations[res] != null)
\r
533 this.setToolTipText(aa[row].annotations[res].description);
\r
535 if(aa[row].annotations[res]!=null)
\r
537 StringBuffer text = new StringBuffer("Sequence position " +
\r
539 aa[row].annotations[res].description);
\r
541 ap.alignFrame.statusBar.setText(text.toString());
\r
549 * @param evt DOCUMENT ME!
\r
551 public void mouseClicked(MouseEvent evt)
\r
558 * @param g DOCUMENT ME!
\r
560 public void paintComponent(Graphics g)
\r
562 g.setColor(Color.white);
\r
563 g.fillRect(0, 0, getWidth(), getHeight());
\r
567 || (getVisibleRect().width != g.getClipBounds().width)
\r
568 || (getVisibleRect().height != g.getClipBounds().height))
\r
570 g.drawImage(image, 0, 0, this);
\r
575 imgWidth = (av.endRes - av.startRes + 1) * av.charWidth;
\r
577 if (image == null || imgWidth != image.getWidth()
\r
578 || image.getHeight(this) != getHeight())
\r
580 image = new BufferedImage(imgWidth, ap.annotationPanel.getHeight(),
\r
581 BufferedImage.TYPE_INT_RGB);
\r
582 gg = (Graphics2D) image.getGraphics();
\r
585 gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
\r
586 RenderingHints.VALUE_ANTIALIAS_ON);
\r
588 gg.setFont(av.getFont());
\r
589 fm = gg.getFontMetrics();
\r
593 drawComponent(gg, av.startRes, av.endRes + 1);
\r
594 g.drawImage(image, 0, 0, this);
\r
600 * @param horizontal DOCUMENT ME!
\r
602 public void fastPaint(int horizontal)
\r
604 if ((horizontal == 0) || gg==null ||
\r
605 (av.alignment.getAlignmentAnnotation() == null) ||
\r
606 (av.alignment.getAlignmentAnnotation().length < 1))
\r
612 gg.copyArea(0, 0, imgWidth, getHeight(), -horizontal * av.charWidth, 0);
\r
614 int sr = av.startRes;
\r
615 int er = av.endRes + 1;
\r
618 if (horizontal > 0) // scrollbar pulled right, image to the left
\r
620 transX = (er - sr - horizontal) * av.charWidth;
\r
621 sr = er - horizontal;
\r
623 else if (horizontal < 0)
\r
625 er = sr - horizontal;
\r
628 gg.translate(transX, 0);
\r
630 drawComponent(gg, sr, er);
\r
632 gg.translate(-transX, 0);
\r
643 * @param g DOCUMENT ME!
\r
644 * @param startRes DOCUMENT ME!
\r
645 * @param endRes DOCUMENT ME!
\r
647 public void drawComponent(Graphics g, int startRes, int endRes)
\r
651 g.setFont(av.getFont());
\r
654 fm = g.getFontMetrics();
\r
657 g.setColor(Color.white);
\r
658 g.fillRect(0, 0, (endRes - startRes) * av.charWidth, getHeight());
\r
660 if ( (av.alignment.getAlignmentAnnotation() == null) ||
\r
661 (av.alignment.getAlignmentAnnotation().length < 1))
\r
663 g.setColor(Color.white);
\r
664 g.fillRect(0, 0, getWidth(), getHeight());
\r
665 g.setColor(Color.black);
\r
666 if(av.validCharWidth)
\r
667 g.drawString("Alignment has no annotations", 20, 15);
\r
672 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
\r
678 int iconOffset = av.charHeight / 2;
\r
679 boolean validRes = false;
\r
681 boolean [] graphGroupDrawn = new boolean[aa.length];
\r
685 for (int i = 0; i < aa.length; i++)
\r
687 AlignmentAnnotation row = aa[i];
\r
699 if(row.graphGroup>-1 && graphGroupDrawn[ row.graphGroup ] )
\r
702 // this is so that we draw the characters below the graph
\r
707 y -= av.charHeight;
\r
713 iconOffset = av.charHeight / 2;
\r
721 while (x < endRes-startRes)
\r
723 if (av.hasHiddenColumns)
\r
725 column = av.getColumnSelection().adjustForHiddenColumns(startRes+x);
\r
726 if (column > row.annotations.length-1)
\r
732 column = startRes+x;
\r
735 if ((row.annotations.length <= column) ||
\r
736 (row.annotations[column] == null))
\r
746 if (activeRow == i)
\r
748 g.setColor(Color.red);
\r
750 if (av.getColumnSelection() != null)
\r
752 for (int n = 0; n < av.getColumnSelection().size(); n++)
\r
754 int v = av.getColumnSelection().columnAt(n);
\r
758 g.fillRect(x * av.charWidth, y,
\r
759 av.charWidth, av.charHeight);
\r
765 if (av.validCharWidth && validRes &&
\r
766 (row.annotations[column].displayCharacter.length() > 0))
\r
769 int charOffset = (av.charWidth -
\r
770 fm.charWidth(row.annotations[column].displayCharacter.charAt(
\r
772 g.setColor(row.annotations[column].colour);
\r
774 if (column == 0 || row.graph>0)
\r
776 g.drawString(row.annotations[column].displayCharacter,
\r
777 x*av.charWidth+charOffset,
\r
778 y + iconOffset + 3);
\r
781 row.annotations[column - 1] == null
\r
782 ||(!row.annotations[column].displayCharacter.equals(
\r
783 row.annotations[column - 1].displayCharacter)
\r
785 (row.annotations[column].displayCharacter.length() <2 &&
\r
786 row.annotations[column].secondaryStructure==' ')))
\r
788 g.drawString(row.annotations[column].displayCharacter,
\r
789 x*av.charWidth+charOffset,
\r
790 y + iconOffset + 3);
\r
797 (row.annotations[column].secondaryStructure != lastSS))
\r
802 g.setColor(HELIX_COLOUR);
\r
805 //Off by 1 offset when drawing rects and ovals
\r
806 //to offscreen image on the MAC
\r
807 g.fillRoundRect(lastSSX, y + 4 + iconOffset,
\r
808 x*av.charWidth - lastSSX, 7, 8, 8);
\r
812 int sCol = (lastSSX / av.charWidth) + startRes;
\r
814 int x2 = x*av.charWidth;
\r
817 row.annotations[sCol-1]==null ||
\r
818 row.annotations[sCol-1].secondaryStructure!='H')
\r
820 g.fillArc(lastSSX, y+4+iconOffset, av.charWidth+1, 7, 90,180) ;
\r
821 x1 += av.charWidth/2;
\r
824 if(row.annotations[column]==null ||
\r
825 row.annotations[column].secondaryStructure!='H')
\r
827 g.fillArc(x*av.charWidth-av.charWidth,
\r
831 x2 -= av.charWidth/2;
\r
834 g.fillRect(x1, y+4+iconOffset, x2-x1+1, 7);
\r
838 g.setColor(SHEET_COLOUR);
\r
839 g.fillRect(lastSSX, y + 4 + iconOffset,
\r
840 x*av.charWidth - lastSSX - 4, 7);
\r
841 g.fillPolygon(new int[] { x*av.charWidth - 5,
\r
842 x*av.charWidth - 5,
\r
846 y + iconOffset, y + 14 + iconOffset,
\r
854 g.setColor(Color.gray);
\r
855 g.fillRect(lastSSX, y + 6 + iconOffset,
\r
856 x*av.charWidth - lastSSX, 2);
\r
863 lastSS = row.annotations[column].secondaryStructure;
\r
870 lastSSX = x*av.charWidth;
\r
877 if(column>=row.annotations.length)
\r
878 column = row.annotations.length-1;
\r
887 g.setColor(HELIX_COLOUR);
\r
890 //Off by 1 offset when drawing rects and ovals
\r
891 //to offscreen image on the MAC
\r
892 g.fillRoundRect(lastSSX, y + 4 + iconOffset,
\r
893 x*av.charWidth - lastSSX, 7, 8, 8);
\r
898 int sCol = (lastSSX / av.charWidth) + startRes;
\r
903 row.annotations[sCol-1]==null ||
\r
904 row.annotations[sCol-1].secondaryStructure!='H')
\r
906 g.fillArc(lastSSX, y+4+iconOffset, av.charWidth+1, 7, 90,180) ;
\r
907 x1 += av.charWidth/2;
\r
910 if(row.annotations[column]==null ||
\r
911 row.annotations[column].secondaryStructure!='H')
\r
913 g.fillArc(x-av.charWidth, y+4+iconOffset, av.charWidth, 7, 270,180);
\r
914 x2 -= av.charWidth/2;
\r
917 g.fillRect(x1, y+4+iconOffset, x2-x1+1, 7);
\r
922 g.setColor(SHEET_COLOUR);
\r
924 if (row.annotations[endRes] ==null
\r
925 || row.annotations[endRes].secondaryStructure != 'E')
\r
927 g.fillRect(lastSSX, y + 4 + iconOffset,
\r
928 x*av.charWidth - lastSSX - 4, 7);
\r
929 g.fillPolygon(new int[]
\r
930 {x*av.charWidth - 5,
\r
931 x*av.charWidth - 5,
\r
935 y + iconOffset, y + 14 + iconOffset,
\r
940 g.fillRect(lastSSX, y + 4 + iconOffset,
\r
941 x*av.charWidth - lastSSX, 7);
\r
947 g.setColor(Color.gray);
\r
948 if(!av.wrapAlignment || endRes==av.endRes)
\r
949 g.fillRect(lastSSX, y + 6 + iconOffset,
\r
950 x*av.charWidth - lastSSX, 2);
\r
958 if(row.graph == AlignmentAnnotation.LINE_GRAPH )
\r
960 if(row.graphGroup>-1 && !graphGroupDrawn[row.graphGroup])
\r
962 float groupmax=-999999, groupmin=9999999;
\r
963 for(int gg=0; gg<aa.length; gg++)
\r
965 if(aa[gg].graphGroup!=row.graphGroup)
\r
969 aa[gg].visible = false;
\r
971 if(aa[gg].graphMax>groupmax)
\r
972 groupmax = aa[gg].graphMax;
\r
973 if(aa[gg].graphMin<groupmin)
\r
974 groupmin = aa[gg].graphMin;
\r
977 for (int gg = 0; gg < aa.length; gg++)
\r
979 if (aa[gg].graphGroup == row.graphGroup)
\r
981 drawLineGraph(g, aa[gg], startRes, endRes, y,
\r
982 groupmin, groupmax,
\r
987 graphGroupDrawn[ row.graphGroup ] = true;
\r
990 drawLineGraph(g, row, startRes, endRes,
\r
991 y, row.graphMin, row.graphMax, row.graphHeight );
\r
993 else if(row.graph == AlignmentAnnotation.BAR_GRAPH )
\r
994 drawBarGraph(g, row, startRes, endRes,
\r
995 row.graphMin, row.graphMax, y);
\r
998 if (row.graph>0 && row.hasText)
\r
1000 y += av.charHeight;
\r
1005 y += aa[i].height;
\r
1010 public void drawLineGraph(Graphics g, AlignmentAnnotation aa,
\r
1011 int sRes, int eRes,
\r
1013 float min, float max,
\r
1016 if(sRes>aa.annotations.length)
\r
1022 //Adjustment for fastpaint to left
\r
1023 if(eRes<av.endRes)
\r
1026 eRes = Math.min(eRes, aa.annotations.length);
\r
1034 float range = max - min;
\r
1038 y2 = y - (int)((0-min / range)*graphHeight);
\r
1040 g.setColor(Color.gray);
\r
1041 g.drawLine(x-av.charWidth,y2,(eRes-sRes+1)*av.charWidth,y2);
\r
1043 eRes = Math.min(eRes, aa.annotations.length);
\r
1046 int aaMax = aa.annotations.length-1;
\r
1048 while( x < eRes - sRes )
\r
1050 column = sRes + x;
\r
1051 if(av.hasHiddenColumns)
\r
1053 column = av.getColumnSelection().adjustForHiddenColumns(column);
\r
1056 if (column > aaMax)
\r
1061 if(aa.annotations[column]==null || aa.annotations[column-1]==null)
\r
1068 g.setColor(aa.annotations[column].colour);
\r
1069 y1 = y - (int) (((aa.annotations[column-1].value-min) / range) * graphHeight);
\r
1070 y2 = y - (int) (((aa.annotations[column].value-min) / range) * graphHeight);
\r
1072 g.drawLine(x*av.charWidth-av.charWidth/2, y1, x*av.charWidth+av.charWidth/2, y2);
\r
1076 if(aa.threshold!=null)
\r
1078 g.setColor(aa.threshold.colour);
\r
1079 Graphics2D g2 = (Graphics2D)g;
\r
1080 g2.setStroke(new BasicStroke(1,
\r
1081 BasicStroke.CAP_SQUARE,
\r
1082 BasicStroke.JOIN_ROUND, 3f,
\r
1083 new float[] { 5f, 3f }, 0f));
\r
1085 y2 = (int)(y - ((aa.threshold.value-min) / range)*graphHeight);
\r
1086 g.drawLine(0,y2,(eRes-sRes)*av.charWidth,y2);
\r
1087 g2.setStroke(new BasicStroke());
\r
1091 public void drawBarGraph(Graphics g, AlignmentAnnotation aa,
\r
1092 int sRes, int eRes,
\r
1093 float min, float max,
\r
1096 if(sRes>aa.annotations.length)
\r
1099 eRes = Math.min(eRes, aa.annotations.length);
\r
1101 int x=0, y1=y, y2=y;
\r
1103 float range = max - min;
\r
1106 y2 = y - (int)((0-min / (range))*aa.graphHeight);
\r
1108 g.setColor(Color.gray);
\r
1110 g.drawLine(x,y2,(eRes-sRes)*av.charWidth,y2);
\r
1113 int aaMax = aa.annotations.length-1;
\r
1115 while( x < eRes-sRes )
\r
1117 column = sRes + x;
\r
1118 if(av.hasHiddenColumns)
\r
1120 column = av.getColumnSelection().adjustForHiddenColumns(column);
\r
1123 if(column > aaMax)
\r
1128 if (aa.annotations[column] == null)
\r
1134 g.setColor(aa.annotations[column].colour);
\r
1135 y1 = y - (int) (((aa.annotations[column].value-min) / (range)) * aa.graphHeight);
\r
1138 g.fillRect(x*av.charWidth, y2, av.charWidth, y1-y2 );
\r
1140 g.fillRect(x*av.charWidth, y1, av.charWidth, y2-y1 );
\r
1145 if(aa.threshold!=null)
\r
1147 g.setColor(aa.threshold.colour);
\r
1148 Graphics2D g2 = (Graphics2D)g;
\r
1149 g2.setStroke(new BasicStroke(1,
\r
1150 BasicStroke.CAP_SQUARE,
\r
1151 BasicStroke.JOIN_ROUND, 3f,
\r
1152 new float[] { 5f, 3f }, 0f));
\r
1154 y2 = (int)(y - ((aa.threshold.value-min) / range)*aa.graphHeight);
\r
1155 g.drawLine(0,y2,(eRes-sRes)*av.charWidth,y2);
\r
1156 g2.setStroke(new BasicStroke());
\r
1160 // used by overview window
\r
1161 public void drawGraph(Graphics g, AlignmentAnnotation aa, int width, int y, int sRes, int eRes)
\r
1163 eRes = Math.min(eRes, aa.annotations.length);
\r
1164 g.setColor(Color.white);
\r
1165 g.fillRect(0, 0, width, y);
\r
1166 g.setColor(new Color(0, 0, 180));
\r
1168 int x = 0, height;
\r
1170 for (int j = sRes; j < eRes; j++)
\r
1172 g.setColor(aa.annotations[j].colour);
\r
1174 height = (int) ((aa.annotations[j].value / aa.graphMax) * y);
\r
1178 g.fillRect(x, y - height, av.charWidth, height);
\r
1179 x += av.charWidth;
\r