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
649 g.setFont(av.getFont());
\r
652 fm = g.getFontMetrics();
\r
655 g.setColor(Color.white);
\r
656 g.fillRect(0, 0, (endRes - startRes) * av.charWidth, getHeight());
\r
658 if ( (av.alignment.getAlignmentAnnotation() == null) ||
\r
659 (av.alignment.getAlignmentAnnotation().length < 1))
\r
661 g.setColor(Color.white);
\r
662 g.fillRect(0, 0, getWidth(), getHeight());
\r
663 g.setColor(Color.black);
\r
664 if(av.validCharWidth)
\r
665 g.drawString("Alignment has no annotations", 20, 15);
\r
670 AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
\r
676 int iconOffset = av.charHeight / 2;
\r
677 boolean validRes = false;
\r
679 boolean [] graphGroupDrawn = new boolean[aa.length];
\r
683 for (int i = 0; i < aa.length; i++)
\r
685 AlignmentAnnotation row = aa[i];
\r
697 if(row.graphGroup>-1 && graphGroupDrawn[ row.graphGroup ] )
\r
700 // this is so that we draw the characters below the graph
\r
705 y -= av.charHeight;
\r
711 iconOffset = av.charHeight / 2;
\r
719 while (x < endRes-startRes)
\r
721 if (av.hasHiddenColumns)
\r
723 column = av.getColumnSelection().adjustForHiddenColumns(startRes+x);
\r
724 if (column > row.annotations.length-1)
\r
730 column = startRes+x;
\r
733 if ((row.annotations.length <= column) ||
\r
734 (row.annotations[column] == null))
\r
744 if (activeRow == i)
\r
746 g.setColor(Color.red);
\r
748 if (av.getColumnSelection() != null)
\r
750 for (int n = 0; n < av.getColumnSelection().size(); n++)
\r
752 int v = av.getColumnSelection().columnAt(n);
\r
756 g.fillRect(x * av.charWidth, y,
\r
757 av.charWidth, av.charHeight);
\r
763 if (av.validCharWidth && validRes &&
\r
764 (row.annotations[column].displayCharacter.length() > 0))
\r
767 int charOffset = (av.charWidth -
\r
768 fm.charWidth(row.annotations[column].displayCharacter.charAt(
\r
770 g.setColor(row.annotations[column].colour);
\r
772 if (column == 0 || row.graph>0)
\r
774 g.drawString(row.annotations[column].displayCharacter,
\r
775 (x*av.charWidth)+charOffset,
\r
776 y + iconOffset + 3);
\r
779 row.annotations[column - 1] == null
\r
780 ||(!row.annotations[column].displayCharacter.equals(
\r
781 row.annotations[column - 1].displayCharacter)
\r
783 (row.annotations[column].displayCharacter.length() <2 &&
\r
784 row.annotations[column].secondaryStructure==' ')))
\r
786 g.drawString(row.annotations[column].displayCharacter,
\r
787 x*av.charWidth+charOffset,
\r
788 y + iconOffset + 3);
\r
795 (row.annotations[column].secondaryStructure != lastSS))
\r
800 g.setColor(HELIX_COLOUR);
\r
803 //Off by 1 offset when drawing rects and ovals
\r
804 //to offscreen image on the MAC
\r
805 g.fillRoundRect(lastSSX, y + 4 + iconOffset,
\r
806 x*av.charWidth - lastSSX, 7, 8, 8);
\r
810 int sCol = (lastSSX / av.charWidth) + startRes;
\r
812 int x2 = x*av.charWidth;
\r
815 row.annotations[sCol-1]==null ||
\r
816 row.annotations[sCol-1].secondaryStructure!='H')
\r
818 g.fillArc(lastSSX, y+4+iconOffset, av.charWidth+1, 7, 90,180) ;
\r
819 x1 += av.charWidth/2;
\r
822 if(row.annotations[column]==null ||
\r
823 row.annotations[column].secondaryStructure!='H')
\r
825 g.fillArc(x*av.charWidth-av.charWidth,
\r
829 x2 -= av.charWidth/2;
\r
832 g.fillRect(x1, y+4+iconOffset, x2-x1+1, 7);
\r
836 g.setColor(SHEET_COLOUR);
\r
837 g.fillRect(lastSSX, y + 4 + iconOffset,
\r
838 x*av.charWidth - lastSSX - 4, 7);
\r
839 g.fillPolygon(new int[] { x*av.charWidth - 5,
\r
840 x*av.charWidth - 5,
\r
844 y + iconOffset, y + 14 + iconOffset,
\r
852 g.setColor(Color.gray);
\r
853 g.fillRect(lastSSX, y + 6 + iconOffset,
\r
854 x*av.charWidth - lastSSX, 2);
\r
861 lastSS = row.annotations[column].secondaryStructure;
\r
868 lastSSX = x*av.charWidth;
\r
875 if(column>=row.annotations.length)
\r
876 column = row.annotations.length-1;
\r
885 g.setColor(HELIX_COLOUR);
\r
888 //Off by 1 offset when drawing rects and ovals
\r
889 //to offscreen image on the MAC
\r
890 g.fillRoundRect(lastSSX, y + 4 + iconOffset,
\r
891 x*av.charWidth - lastSSX, 7, 8, 8);
\r
896 int sCol = (lastSSX / av.charWidth) + startRes;
\r
901 row.annotations[sCol-1]==null ||
\r
902 row.annotations[sCol-1].secondaryStructure!='H')
\r
904 g.fillArc(lastSSX, y+4+iconOffset, av.charWidth+1, 7, 90,180) ;
\r
905 x1 += av.charWidth/2;
\r
908 if(row.annotations[column]==null ||
\r
909 row.annotations[column].secondaryStructure!='H')
\r
911 g.fillArc(x-av.charWidth, y+4+iconOffset, av.charWidth, 7, 270,180);
\r
912 x2 -= av.charWidth/2;
\r
915 g.fillRect(x1, y+4+iconOffset, x2-x1+1, 7);
\r
920 g.setColor(SHEET_COLOUR);
\r
922 if (row.annotations[endRes] ==null
\r
923 || row.annotations[endRes].secondaryStructure != 'E')
\r
925 g.fillRect(lastSSX, y + 4 + iconOffset,
\r
926 x*av.charWidth - lastSSX - 4, 7);
\r
927 g.fillPolygon(new int[]
\r
928 {x*av.charWidth - 5,
\r
929 x*av.charWidth - 5,
\r
933 y + iconOffset, y + 14 + iconOffset,
\r
938 g.fillRect(lastSSX, y + 4 + iconOffset,
\r
939 x*av.charWidth - lastSSX, 7);
\r
945 g.setColor(Color.gray);
\r
946 if(!av.wrapAlignment || endRes==av.endRes)
\r
947 g.fillRect(lastSSX, y + 6 + iconOffset,
\r
948 x*av.charWidth - lastSSX, 2);
\r
956 if(row.graph == AlignmentAnnotation.LINE_GRAPH )
\r
958 if(row.graphGroup>-1 && !graphGroupDrawn[row.graphGroup])
\r
960 float groupmax=-999999, groupmin=9999999;
\r
961 for(int gg=0; gg<aa.length; gg++)
\r
963 if(aa[gg].graphGroup!=row.graphGroup)
\r
967 aa[gg].visible = false;
\r
969 if(aa[gg].graphMax>groupmax)
\r
970 groupmax = aa[gg].graphMax;
\r
971 if(aa[gg].graphMin<groupmin)
\r
972 groupmin = aa[gg].graphMin;
\r
975 for (int gg = 0; gg < aa.length; gg++)
\r
977 if (aa[gg].graphGroup == row.graphGroup)
\r
979 drawLineGraph(g, aa[gg], startRes, endRes, y,
\r
980 groupmin, groupmax,
\r
985 graphGroupDrawn[ row.graphGroup ] = true;
\r
988 drawLineGraph(g, row, startRes, endRes,
\r
989 y, row.graphMin, row.graphMax, row.graphHeight );
\r
991 else if(row.graph == AlignmentAnnotation.BAR_GRAPH )
\r
992 drawBarGraph(g, row, startRes, endRes,
\r
993 row.graphMin, row.graphMax, y);
\r
996 if (row.graph>0 && row.hasText)
\r
998 y += av.charHeight;
\r
1003 y += aa[i].height;
\r
1008 public void drawLineGraph(Graphics g, AlignmentAnnotation aa,
\r
1009 int sRes, int eRes,
\r
1011 float min, float max,
\r
1014 if(sRes>aa.annotations.length)
\r
1020 //Adjustment for fastpaint to left
\r
1021 if(eRes<av.endRes)
\r
1024 eRes = Math.min(eRes, aa.annotations.length);
\r
1032 float range = max - min;
\r
1036 y2 = y - (int)((0-min / range)*graphHeight);
\r
1038 g.setColor(Color.gray);
\r
1039 g.drawLine(x-av.charWidth,y2,(eRes-sRes+1)*av.charWidth,y2);
\r
1041 eRes = Math.min(eRes, aa.annotations.length);
\r
1044 int aaMax = aa.annotations.length-1;
\r
1046 while( x < eRes - sRes )
\r
1048 column = sRes + x;
\r
1049 if(av.hasHiddenColumns)
\r
1051 column = av.getColumnSelection().adjustForHiddenColumns(column);
\r
1054 if (column > aaMax)
\r
1059 if(aa.annotations[column]==null || aa.annotations[column-1]==null)
\r
1066 g.setColor(aa.annotations[column].colour);
\r
1067 y1 = y - (int) (((aa.annotations[column-1].value-min) / range) * graphHeight);
\r
1068 y2 = y - (int) (((aa.annotations[column].value-min) / range) * graphHeight);
\r
1070 g.drawLine(x*av.charWidth-av.charWidth/2, y1, x*av.charWidth+av.charWidth/2, y2);
\r
1074 if(aa.threshold!=null)
\r
1076 g.setColor(aa.threshold.colour);
\r
1077 Graphics2D g2 = (Graphics2D)g;
\r
1078 g2.setStroke(new BasicStroke(1,
\r
1079 BasicStroke.CAP_SQUARE,
\r
1080 BasicStroke.JOIN_ROUND, 3f,
\r
1081 new float[] { 5f, 3f }, 0f));
\r
1083 y2 = (int)(y - ((aa.threshold.value-min) / range)*graphHeight);
\r
1084 g.drawLine(0,y2,(eRes-sRes)*av.charWidth,y2);
\r
1085 g2.setStroke(new BasicStroke());
\r
1089 public void drawBarGraph(Graphics g, AlignmentAnnotation aa,
\r
1090 int sRes, int eRes,
\r
1091 float min, float max,
\r
1094 if(sRes>aa.annotations.length)
\r
1097 eRes = Math.min(eRes, aa.annotations.length);
\r
1099 int x=0, y1=y, y2=y;
\r
1101 float range = max - min;
\r
1104 y2 = y - (int)((0-min / (range))*aa.graphHeight);
\r
1106 g.setColor(Color.gray);
\r
1108 g.drawLine(x,y2,(eRes-sRes)*av.charWidth,y2);
\r
1111 int aaMax = aa.annotations.length-1;
\r
1113 while( x < eRes-sRes )
\r
1115 column = sRes + x;
\r
1116 if(av.hasHiddenColumns)
\r
1118 column = av.getColumnSelection().adjustForHiddenColumns(column);
\r
1121 if(column > aaMax)
\r
1126 if (aa.annotations[column] == null)
\r
1132 g.setColor(aa.annotations[column].colour);
\r
1133 y1 = y - (int) (((aa.annotations[column].value-min) / (range)) * aa.graphHeight);
\r
1136 g.fillRect(x*av.charWidth, y2, av.charWidth, y1-y2 );
\r
1138 g.fillRect(x*av.charWidth, y1, av.charWidth, y2-y1 );
\r
1143 if(aa.threshold!=null)
\r
1145 g.setColor(aa.threshold.colour);
\r
1146 Graphics2D g2 = (Graphics2D)g;
\r
1147 g2.setStroke(new BasicStroke(1,
\r
1148 BasicStroke.CAP_SQUARE,
\r
1149 BasicStroke.JOIN_ROUND, 3f,
\r
1150 new float[] { 5f, 3f }, 0f));
\r
1152 y2 = (int)(y - ((aa.threshold.value-min) / range)*aa.graphHeight);
\r
1153 g.drawLine(0,y2,(eRes-sRes)*av.charWidth,y2);
\r
1154 g2.setStroke(new BasicStroke());
\r
1158 // used by overview window
\r
1159 public void drawGraph(Graphics g, AlignmentAnnotation aa, int width, int y, int sRes, int eRes)
\r
1161 eRes = Math.min(eRes, aa.annotations.length);
\r
1162 g.setColor(Color.white);
\r
1163 g.fillRect(0, 0, width, y);
\r
1164 g.setColor(new Color(0, 0, 180));
\r
1166 int x = 0, height;
\r
1168 for (int j = sRes; j < eRes; j++)
\r
1170 g.setColor(aa.annotations[j].colour);
\r
1172 height = (int) ((aa.annotations[j].value / aa.graphMax) * y);
\r
1176 g.fillRect(x, y - height, av.charWidth, height);
\r
1177 x += av.charWidth;
\r