scrollPane = scroller;
addMouseListener(this);
addMouseMotionListener(this);
+
ToolTipManager.sharedInstance().registerComponent(this);
}
+ public void clearSelectedLeaves()
+ {
+ Vector<BinaryNode> leaves = tp.getTree()
+ .findLeaves(tp.getTree().getTopNode());
+ if (tp.isColumnWise())
+ {
+ markColumnsFor(getAssociatedPanels(), leaves, Color.white, true);
+ }
+ else
+ {
+ for (AlignmentPanel ap : getAssociatedPanels())
+ {
+ SequenceGroup selected = ap.av.getSelectionGroup();
+ if (selected != null)
+ {
+ {
+ for (int i = 0; i < leaves.size(); i++)
+ {
+ SequenceI seq = (SequenceI) leaves.elementAt(i).element();
+ if (selected.contains(seq))
+ {
+ selected.addOrRemove(seq, false);
+ }
+ }
+ selected.recalcConservation();
+ }
+ }
+ ap.av.sendSelection();
+ }
+ }
+ PaintRefresher.Refresh(tp, av.getSequenceSetId());
+ repaint();
+ }
/**
* DOCUMENT ME!
*
Vector<BinaryNode> leaves = tree.findLeaves(highlightNode);
if (tp.isColumnWise())
{
- markColumnsFor(getAssociatedPanels(), leaves, Color.red);
+ markColumnsFor(getAssociatedPanels(), leaves, Color.red,false);
}
else
{
if (aa != null)
{
ContactMatrixI cm = av.getContactMatrix(aa);
+ // generally, we assume cm has 1:1 mapping to annotation row - probably wrong
+ // but.. if
if (cm instanceof MappableContactMatrixI)
{
+ int[] pos;
+ // use the mappable's mapping - always the case for PAE Matrices so good
+ // for 2.11.3
MappableContactMatrixI mcm = (MappableContactMatrixI) cm;
- int pos[]=mcm.getMappedPositionsFor(rseq, colm);
- if (pos!=null)
+ pos = mcm.getMappedPositionsFor(rseq, colm + 1);
+ // finally, look up the position of the column
+ if (pos != null)
{
- offp=rseq.findIndex(pos[0])-1;
- } else {
- offp=-2;
+ offp = rseq.findIndex(pos[0]);
}
+ } else {
+ offp = colm;
}
}
- if (offp==-1)
+ if (offp<=0)
{
- // assume a direct mapping to reference or column number
- offp = (rseq != null) ? rseq.findIndex(rseq.getStart() + colm)
- : colm;
+ return false;
}
+ offp-=2;
if (!av.hasHiddenColumns())
{
return cs.contains(offp);
}
- if (hc.isVisible(offp - 1))
+ if (hc.isVisible(offp))
{
- return cs.contains(offp - 1);
+ return cs.contains(offp);
// return cs.contains(hc.absoluteToVisibleColumn(offp));
}
return false;
}
private void markColumnsFor(AlignmentPanel[] aps, Vector<BinaryNode> l,
- Color col)
+ Color col, boolean clearSelected)
{
SequenceI rseq = tp.assocAnnotation.sequenceRef;
if (av == null || av.getAlignment() == null)
offp = (rseq != null) ? rseq.findIndex(rseq.getStart() + colm)
: colm;
}
- if (!av.hasHiddenColumns() || hc.isVisible(offp - 1))
+ if (!av.hasHiddenColumns() || hc.isVisible(offp))
{
- if (cs.contains(offp - 1))
+ if (clearSelected || cs.contains(offp))
{
- cs.removeElement(offp - 1);
+ cs.removeElement(offp);
}
else
{
- cs.addElement(offp - 1);
+ cs.addElement(offp);
}
}
}
+ PaintRefresher.Refresh(tp, av.getSequenceSetId());
}
public void createSeqGroupFor(AlignmentPanel[] aps, Vector<BinaryNode> l,