{
for (int i = 0; i < aa.length; i++)
{
- if (!aa[i].visible)
+ if (!aa[i].visible && aa[i].annotations!=null)
{
dif += aa[i].height;
aa[i].visible = true;
ap,
new AlignmentAnnotation[]
{aa[selectedRow]},
- null
+ null, null
);
}
else if (evt.getActionCommand().equals(COPYCONS_SEQ))
annotation.label = dialog.getName();
String text = dialog.getDescription();
- if (text.length() == 0)
+ if (text!=null && text.length() == 0)
{
text = null;
}
getSelectedRow(evt.getY() - scrollOffset);
+
if (selectedRow > -1
&& ap.av.alignment.getAlignmentAnnotation().length > selectedRow)
{
- String desc = ap.av.alignment.
- getAlignmentAnnotation()[selectedRow].description;
+ AlignmentAnnotation aa = ap.av.alignment.
+ getAlignmentAnnotation()[selectedRow];
- if (desc != null && !desc.equals("New description"))
+ StringBuffer desc = new StringBuffer("<html>");
+
+ if (aa.description != null && !aa.description.equals("New description"))
{
- setToolTipText(ap.av.alignment.
- getAlignmentAnnotation()[selectedRow].description);
+ desc.append(aa.description+"<br>");
+ }
+ if(aa.hasScore())
+ {
+ desc.append("Score: "+aa.score);
}
+ if(desc.length()!=6)
+ {
+ desc.append("</html>");
+ this.setToolTipText(desc.toString());
+ }
+ else
+ this.setToolTipText(null);
}
- repaint();
+
}
/**
AlignmentAnnotation[] aa = av.alignment.getAlignmentAnnotation();
int fontHeight = g.getFont().getSize();
- int y = fontHeight;
+ int y = 0;
int x = 0;
int graphExtras = 0;
+ int offset =0;
if (aa != null)
{
for (int i = 0; i < aa.length; i++)
{
+ g.setColor(Color.black);
+
if (!aa[i].visible)
{
continue;
}
- x = width - fm.stringWidth(aa[i].label) - 3;
- if (aa[i].graph > 0 && aa[i].graphHeight > 0)
- {
- graphExtras = y;
+ y += aa[i].height;
- y += (aa[i].height / 3);
+ offset = -aa[i].height/2;
- if (aa[i].graphGroup < 0)
- {
- graphExtras = y + fontHeight;
- }
+ if(aa[i].hasText)
+ {
+ offset += fm.getHeight()/2;
+ offset -= fm.getDescent();
}
+ else
+ offset += fm.getDescent();
+
+ x = width - fm.stringWidth(aa[i].label) - 3;
if (aa[i].graphGroup > -1)
{
if (groupSize * (fontHeight + 8) < aa[i].height)
{
- graphExtras += (aa[i].height - (groupSize * (fontHeight + 8))) / 2;
+ graphExtras = (aa[i].height - (groupSize * (fontHeight + 8))) / 2;
}
for (int gg = 0; gg < aa.length; gg++)
if (aa[gg].graphGroup == aa[i].graphGroup)
{
x = width - fm.stringWidth(aa[gg].label) - 3;
- g.drawString(aa[gg].label, x, graphExtras);
+ g.drawString(aa[gg].label, x,y - graphExtras);
if (aa[gg].annotations[0] != null)
{
g.setColor(aa[gg].annotations[0].colour);
}
- g.drawLine(x, graphExtras + 3,
+ g.drawLine(x, y - graphExtras - 3,
x + fm.stringWidth(aa[gg].label),
- graphExtras + 3);
+ y - graphExtras - 3);
g.setColor(Color.black);
graphExtras += fontHeight + 8;
}
else
{
- g.drawString(aa[i].label, x, y);
- }
-
- if (aa[i].graph > 0)
- {
- /* if (aa[i].graphLines != null)
- {
- for (int gl = 0; gl < aa[i].graphLines.size(); gl++)
- {
- x = width - fm.stringWidth(aa[i].getGraphLine(gl).label) - 3;
- g.drawString(aa[i].getGraphLine(gl).label, x, graphExtras);
- g.setColor(aa[i].getGraphLine(gl).colour);
- Graphics2D g2 = (Graphics2D) g;
- g2.setStroke(new BasicStroke(1,
- BasicStroke.CAP_SQUARE,
- BasicStroke.JOIN_ROUND, 3f,
- new float[]
- {5f, 3f}, 0f));
-
- graphExtras += 3;
-
- g.drawLine(x, graphExtras,
- x+fm.stringWidth(aa[i].label),
- graphExtras);
- g2.setStroke(new BasicStroke());
- }
- }*/
- y += ( (2 * aa[i].height) / 3);
- }
- else
- {
- y += aa[i].height;
+ g.drawString(aa[i].label, x, y +offset);
}
}
}