if (av.showAnnotation && (endSeq == av.alignment.getHeight()))\r
{\r
pg.translate(-idWidth, (endSeq - startSeq) * av.charHeight +3);\r
- alabels.drawComponent((Graphics2D) pg);\r
+ alabels.drawComponent((Graphics2D) pg, idWidth);\r
pg.translate(idWidth, 0);\r
annotationPanel.drawComponent((Graphics2D) pg, startRes, endRes +\r
1);\r
{\r
\r
int annotationHeight = 0;\r
+ AnnotationLabels labels = null;\r
if (av.showAnnotation)\r
+ {\r
annotationHeight = annotationPanel.adjustPanelHeight();\r
+ labels = new AnnotationLabels(av);\r
+ }\r
\r
int hgap = av.charHeight;\r
if (av.scaleAboveWrapped)\r
pg.setClip(0, pi * pheight, pwidth, pheight);\r
\r
int ypos = hgap;\r
+ Font italic = new Font(av.getFont().getName(), Font.ITALIC,\r
+ av.getFont().getSize());\r
+ pg.setFont(italic);\r
+\r
\r
do\r
{\r
- for (int i = 0; i < av.alignment.getHeight(); i++)\r
- {\r
- SequenceI s = av.alignment.getSequenceAt(i);\r
- String string = s.getName();\r
+ for (int i = 0; i < av.alignment.getHeight(); i++)\r
+ {\r
+ SequenceI s = av.alignment.getSequenceAt(i);\r
+ String string = s.getName();\r
\r
- if (av.getShowFullId())\r
- {\r
- string = s.getDisplayId();\r
- }\r
+ if (av.getShowFullId())\r
+ {\r
+ string = s.getDisplayId();\r
+ }\r
\r
- pg.drawString(string, 0,\r
- ((i * av.charHeight) + ypos + av.charHeight) -\r
- (av.charHeight / 5));\r
+ pg.drawString(string, 0,\r
+ ( (i * av.charHeight) + ypos + av.charHeight) -\r
+ (av.charHeight / 5));\r
+ }\r
+ if (labels != null)\r
+ {\r
+ pg.translate(0,\r
+ ypos +\r
+ (av.getAlignment().getHeight() * av.charHeight));\r
+\r
+ pg.setFont(av.getFont());\r
+ labels.drawComponent( pg, idWidth );\r
+ pg.setFont(italic);\r
+ pg.translate(0,\r
+ -ypos -\r
+ (av.getAlignment().getHeight() * av.charHeight));\r
}\r
\r
ypos += cHeight;\r
boolean active = false;\r
Image image;\r
AlignmentPanel ap;\r
+ AlignViewport av;\r
boolean resizing = false;\r
int oldY;\r
int mouseX;\r
int selectedRow = 0;\r
int scrollOffset = 0;\r
\r
+\r
/**\r
* Creates a new AnnotationLabels object.\r
*\r
public AnnotationLabels(AlignmentPanel ap)\r
{\r
this.ap = ap;\r
+ av = ap.av;\r
\r
java.net.URL url = getClass().getResource("/images/idwidth.gif");\r
Image temp = null;\r
addMouseMotionListener(this);\r
}\r
\r
+ public AnnotationLabels(AlignViewport av)\r
+ {\r
+ this.av = av;\r
+ }\r
+\r
/**\r
* DOCUMENT ME!\r
*\r
*\r
* @param g1 DOCUMENT ME!\r
*/\r
- public void paintComponent(Graphics g1)\r
+ public void paintComponent(Graphics g)\r
{\r
- Graphics2D g = (Graphics2D) g1;\r
- g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
+\r
+ int width = getWidth();\r
+ if(width==0)\r
+ width = ap.calculateIdWidth().width + 4;\r
+\r
+ Graphics2D g2 = (Graphics2D) g;\r
+ g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
RenderingHints.VALUE_ANTIALIAS_ON);\r
\r
- drawComponent(g);\r
+ drawComponent(g2, width);\r
+\r
}\r
\r
/**\r
*\r
* @param g DOCUMENT ME!\r
*/\r
- public void drawComponent(Graphics2D g)\r
+ public void drawComponent(Graphics g, int width)\r
{\r
FontMetrics fm = g.getFontMetrics(g.getFont());\r
g.setColor(Color.white);\r
g.translate(0, scrollOffset);\r
g.setColor(Color.black);\r
\r
- AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation();\r
+ AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();\r
int y = g.getFont().getSize();\r
int x = 0;\r
- int width = getWidth();\r
- if(width==0)\r
- width = ap.calculateIdWidth().width + 4;\r
+\r
\r
if (aa != null)\r
{\r
* @param startRes DOCUMENT ME!\r
* @param endRes DOCUMENT ME!\r
*/\r
- public void drawComponent(Graphics2D g, int startRes, int endRes)\r
+ public void drawComponent(Graphics g, int startRes, int endRes)\r
{\r
+ g.setFont(av.getFont());\r
+\r
if (fm == null)\r
fm = g.getFontMetrics();\r
\r
- if(fm==null)\r
- fm = g.getFontMetrics();\r
\r
g.setColor(Color.white);\r
g.fillRect(0, 0, (endRes - startRes) * av.charWidth, getHeight());\r
//Fill in the background\r
gg.setColor(Color.white);\r
gg.fillRect(0, 0, getWidth(), imgHeight);\r
- gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
- RenderingHints.VALUE_ANTIALIAS_ON);\r
\r
- Font italic = new Font(av.getFont().getName(), Font.ITALIC,\r
- av.getFont().getSize());\r
- gg.setFont(italic);\r
\r
drawIds(av.getStartSeq(), av.endSeq);\r
\r
*/\r
void drawIds(int starty, int endy)\r
{\r
+ Font italic = new Font(av.getFont().getName(), Font.ITALIC,\r
+ av.getFont().getSize());\r
+ gg.setFont(italic);\r
+ gg.setRenderingHint(RenderingHints.KEY_ANTIALIASING,\r
+ RenderingHints.VALUE_ANTIALIAS_ON);\r
+\r
Color currentColor = Color.white;\r
Color currentTextColor = Color.black;\r
\r
if (av.getWrapAlignment())\r
{\r
int annotationHeight = 0;\r
+ AnnotationLabels labels = null;\r
\r
if(av.showAnnotation)\r
{\r
AnnotationPanel ap = new AnnotationPanel(av);\r
annotationHeight = ap.adjustPanelHeight();\r
+ labels = new AnnotationLabels(av);\r
}\r
\r
int hgap = av.charHeight;\r
SequenceI s = av.alignment.getSequenceAt(i);\r
drawIdString(gg, s, i, 0, ypos);\r
}\r
+\r
+ if(labels!=null)\r
+ {\r
+ gg.setFont(av.getFont());\r
+ gg.translate(0, ypos+(av.getAlignment().getHeight() * av.charHeight));\r
+ labels.drawComponent(gg, getWidth());\r
+ gg.translate(0, -ypos-(av.getAlignment().getHeight() * av.charHeight));\r
+ gg.setFont(italic);\r
+ }\r
}\r
}\r
else\r