import java.awt.*;
import java.awt.event.*;
+import java.util.Vector;
import jalview.datamodel.*;
import jalview.util.UrlLink;
int seq = alignPanel.seqPanel.findSeq(e);
SequenceI sequence = av.getAlignment().getSequenceAt(seq);
+
+ // look for non-pos features
+ StringBuffer tooltiptext = new StringBuffer();
+
- if (sequence.getDescription() == null)
+ if (sequence.getDescription() != null)
{
+ tooltiptext.append(sequence.getDescription());
+ tooltiptext.append("\n");
+ }
+
+ SequenceFeature sf[] = sequence.getSequenceFeatures();
+ for (int sl=0;sf!=null && sl<sf.length;sl++)
+ {
+ if (sf[sl].begin==sf[sl].end && sf[sl].begin==0)
+ {
+ boolean nl=false;
+ if (sf[sl].getFeatureGroup()!=null) { tooltiptext.append(sf[sl].getFeatureGroup()); nl=true;};
+ if (sf[sl].getType()!=null) { tooltiptext.append(" "); tooltiptext.append(sf[sl].getType()); nl=true;};
+ if (sf[sl].getDescription()!=null) { tooltiptext.append(" "); tooltiptext.append(sf[sl].getDescription()); nl=true;};
+ if (sf[sl].getScore()!=Float.NaN && sf[sl].getScore()!=0f) { tooltiptext.append(" Score = "); tooltiptext.append(sf[sl].getScore()); nl=true;};
+ if (sf[sl].getStatus()!=null && sf[sl].getStatus().length()>0) { tooltiptext.append(" ("); tooltiptext.append(sf[sl].getStatus()); tooltiptext.append(")");nl=true;};
+ if (nl) {tooltiptext.append("\n"); }
+ }
+ }
+
+ if (tooltiptext.length()==0)
+ {
+ // nothing to display - so clear tooltip if one is visible
if (tooltip != null)
{
tooltip.setVisible(false);
}
tooltip = null;
+ tooltiptext = null;
return;
}
-
if (tooltip == null)
{
tooltip = new Tooltip(sequence.getDisplayId(true) + "\n"
- + sequence.getDescription(), idCanvas);
+ + tooltiptext.toString(), idCanvas);
}
else
{
tooltip.setTip(sequence.getDisplayId(true) + "\n"
- + sequence.getDescription());
+ + tooltiptext.toString());
}
+ tooltiptext=null;
}
public void mouseDragged(MouseEvent e)
if ((e.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK)
{
- APopupMenu popup = new APopupMenu(alignPanel, (Sequence) av
- .getAlignment().getSequenceAt(seq), links);
+ Sequence sq = (Sequence) av
+ .getAlignment().getSequenceAt(seq);
+ // build a new links menu based on the current links + any non-positional features
+ Vector nlinks = new Vector();
+ for (int l=0,lSize=links.size();l<lSize; l++)
+ {
+ nlinks.addElement(links.elementAt(l));
+ }
+ SequenceFeature sf[] = sq.getSequenceFeatures();
+ for (int sl=0;sf!=null && sl<sf.length;sl++)
+ {
+ if (sf[sl].begin==sf[sl].end && sf[sl].begin==0)
+ {
+ if (sf[sl].links!=null && sf[sl].links.size()>0)
+ {
+ for (int l=0, lSize=sf[sl].links.size(); l<lSize; l++)
+ {
+ nlinks.addElement(sf[sl].links.elementAt(l));
+ }
+ }
+ }
+ }
+
+ APopupMenu popup = new APopupMenu(alignPanel, sq, nlinks);
this.add(popup);
popup.show(this, e.getX(), e.getY());
return;