public final class JalviewBinding
implements ExternalTreeViewerBindingI<PhylogenyNode>
{
- private final MainFrame aptxFrame;
+ private org.forester.archaeopteryx.TreePanel treeView;
- private org.forester.archaeopteryx.TreePanel currentTreeView;
-
- private final AlignmentViewport parentAvport;
+ private AlignmentViewport parentAvport;
private JTabbedPane treeTabs;
final Map<PhylogenyNode, SequenceI> nodesMappedToAlign)
{
// deal with/prohibit null values here as that will cause problems
- aptxFrame = archaeopteryx;
parentAvport = jalviewAlignmentViewport;
sequencesBoundToNodes = alignMappedToNodes;
nodesBoundToSequences = nodesMappedToAlign;
- treeTabs = aptxFrame.getMainPanel().getTabbedPane();
+ treeView = archaeopteryx.getMainPanel().getCurrentTreePanel();
+ treeTabs = archaeopteryx.getMainPanel().getTabbedPane();
ssm = parentAvport.getStructureSelectionManager();
// archaeopteryx.getMainPanel().getControlPanel().setColorBranches(true);
ssm.addSelectionListener(this);
-
- int tabCount = treeTabs.getTabCount();
-
- for (int i = 0; i < tabCount; i++)
- {
- // roundabout way to select each tree because getComponentAt(i) requires
- // casting to TreePanel which doesn't work
- treeTabs.setSelectedIndex(i);
- currentTreeView = aptxFrame.getMainPanel().getCurrentTreePanel();
- currentTreeView.addMouseListener(this);
- PaintRefresher.Register(currentTreeView,
- parentAvport.getSequenceSetId());
- }
+ treeView.addMouseListener(this);
+ PaintRefresher.Register(treeView, parentAvport.getSequenceSetId());
treeTabs.addChangeListener(new ChangeListener()
*/
public void run()
{
- currentTreeView = aptxFrame.getMainPanel()
- .getCurrentTreePanel();
parentAvport.sendSelection();
+ // PaintRefresher.Refresh(treeView,
+ // parentAvport.getSequenceSetId());
}
});
*/
public void run()
{
-
- final PhylogenyNode node = currentTreeView.findNode(e.getX(),
- e.getY());
+ final PhylogenyNode node = treeView.findNode(e.getX(), e.getY());
if (node != null)
{
if ((e.getModifiers() & InputEvent.SHIFT_MASK) == 0) // clear previous
// selection if shift
// IS NOT pressed
{
-
parentAvport.setSelectionGroup(null);
}
if (source == parentAvport) // check if source is alignment from where the
// tree originates
{
- currentTreeView.setFoundNodes0(
+ treeView.setFoundNodes0(
new HashSet<Long>(seqsel.getSequences().size()));
for (SequenceI selectedSequence : seqsel.getSequences())
PhylogenyNode matchingNode = sequencesBoundToNodes.get(selectedSequence);
if (matchingNode != null)
{
- currentTreeView.getFoundNodes0().add(matchingNode.getId());
+ treeView.getFoundNodes0().add(matchingNode.getId());
}
}
- aptxFrame.repaint();
+ treeView.repaint();
}
public void partitionTree(final MouseEvent e)
{
int x = e.getX();
- int lineLength = currentTreeView.getHeight();
+ int lineLength = treeView.getHeight();
- Phylogeny tree = currentTreeView.getPhylogeny();
+ Phylogeny tree = treeView.getPhylogeny();
double treeHeight = tree.calculateHeight(true);
if (treeHeight != 0)
{
- int viewWidth = currentTreeView.getWidth();
+ int viewWidth = treeView.getWidth();
// treeView.validate();
if (matchingSequence != null)
{
long nodeId = nodeToMatch.getId();
- addOrRemoveInSet(currentTreeView.getFoundNodes0(), nodeId);
+ addOrRemoveInSet(treeView.getFoundNodes0(), nodeId);
treeSelectionChanged(matchingSequence);
parentAvport.sendSelection();
if (matchingSequence != null)
{
long nodeId = childNode.getId();
- addOrRemoveInSet(currentTreeView.getFoundNodes0(), nodeId);
+ addOrRemoveInSet(treeView.getFoundNodes0(), nodeId);
treeSelectionChanged(matchingSequence);
return parentAvport;
}
- public org.forester.archaeopteryx.TreePanel getTreeView()
+ public void setParentAvport(final AlignmentViewport parentAvport)
{
- return currentTreeView;
+ this.parentAvport = parentAvport;
}
-
}
-