+ else
+ {
+ int seq = Math.max(0, pos.seqIndex);
+ if (seq < av.getAlignment().getHeight())
+ {
+ SequenceI sequence = av.getAlignment().getSequenceAt(seq);
+ StringBuilder tip = new StringBuilder(64);
+ tip.append(sequence.getDisplayId(true)).append(" ");
+ IdColumn col = locateColumnFor(e);
+ if (col != null)
+ {
+ // tooltip for column
+ tip.append(getTooltipFor(col, sequence));
+ }
+ else
+ {
+ seqAnnotReport.createTooltipAnnotationReport(tip, sequence,
+ av.isShowDBRefs(), av.isShowNPFeats(), sp.seqCanvas.fr);
+ }
+ setToolTipText(JvSwingUtils.wrapTooltip(true, tip.toString()));
+
+ StringBuilder text = new StringBuilder();
+ text.append("Sequence ").append(String.valueOf(seq + 1))
+ .append(" ID: ").append(sequence.getName());
+ alignPanel.alignFrame.setStatus(text.toString());
+ }
+ }
+ }
+
+ private Object getTooltipFor(IdColumn col, SequenceI seq)
+ {
+ ColumnCell cell = av.getIdColumns().getCellFor(seq, col);
+ if (cell != null)
+ {
+ return "" + col.getLabel() + ": " + cell.label;
+ }
+ return "";
+ }
+
+ private IdColumn locateColumnFor(MouseEvent e)
+ {
+ // TODO COMBINE SAME CODE IN IDCANVAS!!!
+
+ IdColumns id_cols = av.getIdColumns();
+ List<IdColumn> visible = id_cols.getVisible();
+ /**
+ * width of an idColumn
+ */
+ int colWid = 20;
+ int panelWidth = Math.max(idCanvas.getWidth() / 2,
+ idCanvas.getWidth() - (colWid * visible.size()));
+ int p = 0;
+ while (panelWidth < idCanvas.getWidth() && p < visible.size())
+ {
+
+ if (e.getX() >= panelWidth && e.getX() < panelWidth + colWid)
+ return visible.get(p);
+ p++;
+ panelWidth += colWid;
+ }
+ return null;