@Override
public void mouseClicked(MouseEvent evt)
{
- if (highlightNode != null)
+ if (highlightNode == null)
{
- if (evt.isPopupTrigger())
- {
- Color col = JColorChooser.showDialog(this,
- MessageManager.getString("label.select_subtree_colour"),
- highlightNode.color);
- if (col != null)
- {
- setColor(highlightNode, col);
- }
- }
- else if (evt.getClickCount() > 1)
+ return;
+ }
+ if (evt.isPopupTrigger())
+ {
+ chooseSubtreeColour();
+ }
+ else if (evt.getClickCount() > 1)
+ {
+ tree.swapNodes(highlightNode);
+ tree.reCount(tree.getTopNode());
+ tree.findHeight(tree.getTopNode());
+ }
+ else
+ {
+ Vector leaves = new Vector();
+ tree.findLeaves(highlightNode, leaves);
+
+ for (int i = 0; i < leaves.size(); i++)
{
- tree.swapNodes(highlightNode);
- tree.reCount(tree.getTopNode());
- tree.findHeight(tree.getTopNode());
+ SequenceI seq = (SequenceI) ((SequenceNode) leaves.elementAt(i))
+ .element();
+ treeSelectionChanged(seq);
}
- else
- {
- Vector leaves = new Vector();
- tree.findLeaves(highlightNode, leaves);
+ av.sendSelection();
+ }
- for (int i = 0; i < leaves.size(); i++)
- {
- SequenceI seq = (SequenceI) ((SequenceNode) leaves.elementAt(i))
- .element();
- treeSelectionChanged(seq);
- }
- av.sendSelection();
- }
+ PaintRefresher.Refresh(tp, av.getSequenceSetId());
+ repaint();
+ }
- PaintRefresher.Refresh(tp, av.getSequenceSetId());
+ /**
+ * Offer the user the option to choose a colour for the highlighted node and
+ * its children; this colour is also applied to the corresponding sequence ids
+ * in the alignment
+ */
+ void chooseSubtreeColour()
+ {
+ Color col = JColorChooser.showDialog(this,
+ MessageManager.getString("label.select_subtree_colour"),
+ highlightNode.color);
+ if (col != null)
+ {
+ setColor(highlightNode, col);
+ PaintRefresher.Refresh(tp, ap.av.getSequenceSetId());
repaint();
}
}
public void mousePressed(MouseEvent e)
{
av.setCurrentTree(tree);
+ if (highlightNode != null && e.isPopupTrigger())
+ {
+ chooseSubtreeColour();
+ return;
+ }
int x = e.getX();
int y = e.getY();
.getCodingComplement();
if (codingComplement != null)
{
- if (codingComplement != null)
+ SequenceGroup mappedGroup = MappingUtils.mapSequenceGroup(sg, av,
+ codingComplement);
+ if (mappedGroup.getSequences().size() > 0)
{
- SequenceGroup mappedGroup = MappingUtils.mapSequenceGroup(sg,
- av, codingComplement);
- if (mappedGroup.getSequences().size() > 0)
+ codingComplement.getAlignment().addGroup(mappedGroup);
+ for (SequenceI seq : mappedGroup.getSequences())
{
- codingComplement.getAlignment().addGroup(mappedGroup);
- for (SequenceI seq : mappedGroup.getSequences())
- {
- codingComplement.setSequenceColour(seq, col.brighter());
- }
+ codingComplement.setSequenceColour(seq, col.brighter());
}
}
}
{
((AlignViewport) codingComplement).getAlignPanel()
.updateAnnotation();
-
}
-
}
-
}
/**