import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.HashMap;
import java.util.Map;
import org.forester.archaeopteryx.AptxUtil;
private final static NHXParser.TAXONOMY_EXTRACTION TAXONOMY_EXTRACTION = APTX_CONFIG
.getTaxonomyExtraction();
+ private static Map<MainFrame, JalviewBinding> activeAptx = new HashMap<>();
+
public static MainFrame createInstanceFromCalculation(
// }
Phylogeny[] trees = PhylogenyMethods.readPhylogenies(parser, treeFile);
MainFrame[] aptxFrames = new MainFrame[trees.length];
- String treeTitle = treeFile.getName();
+
for (int i = 0; i < trees.length; i++)
{
{
PhylogenyMethods.transferInternalNodeNamesToConfidence(tree, "");
}
+ String treeTitle = treeFile.getName() + "[" + i + "]";
+ tree.setName(treeTitle);
aptxFrames[i] = createAptxFrame(tree, viewport, treeTitle);
}
final Map<SequenceI, PhylogenyNode> alignMappedToNodes,
final Map<PhylogenyNode, SequenceI> nodesMappedToAlign)
{
- return new JalviewBinding(aptxApp, jalviewAlignViewport,
+ JalviewBinding treeBinding = new JalviewBinding(aptxApp,
+ jalviewAlignViewport,
alignMappedToNodes, nodesMappedToAlign);
+ activeAptx.put(aptxApp, treeBinding);
+ return treeBinding;
}
}
+ public static Map<MainFrame, JalviewBinding> getAllAptxFrames()
+ {
+ return activeAptx;
+ }
}
import javax.swing.SwingUtilities;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
+import javax.swing.event.InternalFrameAdapter;
+import javax.swing.event.InternalFrameEvent;
import org.forester.archaeopteryx.MainFrame;
import org.forester.phylogeny.Phylogeny;
private int nrTreeGroups = 0;
+ private boolean applyToAllViews = false;
+
/**
*
* @param archaeopteryx
ssm.addSelectionListener(this);
treeView.addMouseListener(this);
PaintRefresher.Register(treeView, parentAvport.getSequenceSetId());
-
associatedPanels = PaintRefresher
.getAssociatedPanels(parentAvport.getSequenceSetId());
+ archaeopteryx.addInternalFrameListener(new InternalFrameAdapter()
+ {
+
+ @Override
+ public void internalFrameClosed(InternalFrameEvent e)
+ {
+ AptxInit.getAllAptxFrames().remove(archaeopteryx);
+ }
+
+ });
treeTabs.addChangeListener(new ChangeListener()
{
// of tree
{
- // int panelHeight = treeView.getHeight();
- // g.drawLine(x, 0, x, panelHeight);
-
float threshold = (x - rootX) / (furthestNodeX - rootX);
List<PhylogenyNode> foundNodes = getNodesAboveThreshold(threshold,
tree.getRoot());
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
import jalview.ext.archaeopteryx.AptxInit;
+import jalview.ext.archaeopteryx.JalviewBinding;
import jalview.ext.forester.io.SupportedTreeFileFilter;
import jalview.ext.forester.io.TreeParser;
import jalview.gui.ColourMenuHelper.ColourChangeListener;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.List;
+import java.util.Map;
import java.util.StringTokenizer;
import java.util.Vector;
import javax.swing.JScrollPane;
import javax.swing.SwingUtilities;
+import org.forester.archaeopteryx.MainFrame;
+
/**
* DOCUMENT ME!
*
}
}
+
/**
* Maintain the Order by->Displayed Tree menu. Creates a new menu item for a
* TreePanel with an appropriate <code>jalview.analysis.AlignmentSorter</code>
List<Component> comps = PaintRefresher.components
.get(viewport.getSequenceSetId());
List<TreePanel> treePanels = new ArrayList<>();
+
+ Map<MainFrame, JalviewBinding> aptxFrames = AptxInit.getAllAptxFrames();
+
for (Component comp : comps)
{
+ // old treepanels
if (comp instanceof TreePanel)
{
treePanels.add((TreePanel) comp);
}
+
}
- if (treePanels.size() < 1)
+ if (treePanels.isEmpty() && aptxFrames.isEmpty())
{
sortByTreeMenu.setVisible(false);
return;
sortByTreeMenu.setVisible(true);
+ for (Map.Entry<MainFrame, JalviewBinding> aptxFrameWithBinding : aptxFrames
+ .entrySet())
+ {
+ MainFrame aptxFrame = aptxFrameWithBinding.getKey();
+ JalviewBinding binding = aptxFrameWithBinding.getValue();
+
+ // future support for multiple tabs
+ // for (org.forester.archaeopteryx.TreePanel aptxTree : aptxFrame
+ // .getMainPanel().getTreePanels())
+ {
+ final JMenuItem item = new JMenuItem(
+ aptxFrame.getMainPanel().getCurrentTreePanel()
+ .getPhylogeny().getName());
+
+ item.addActionListener(new ActionListener()
+ {
+
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ // tp.sortByTree_actionPerformed();
+ // addHistoryItem(tp.sortAlignmentIn(alignPanel));
+ }
+
+ });
+ sortByTreeMenu.add(item);
+ }
+
+
+
+ }
+
+
+
+
+
+ // old treepanels
for (final TreePanel tp : treePanels)
{
final JMenuItem item = new JMenuItem(tp.getTitle());
@Override
public void actionPerformed(ActionEvent e)
{
- // adapt to Aptx
tp.sortByTree_actionPerformed();
addHistoryItem(tp.sortAlignmentIn(alignPanel));