package jalview.ext.archaeopteryx;
import jalview.analysis.TreeBuilder;
-import jalview.datamodel.SequenceI;
import jalview.ext.forester.UtilityMethods;
import jalview.ext.treeviewer.LoadedTreeAssociationI;
+import jalview.ext.treeviewer.LoadedTreeSequenceAssociation;
import jalview.ext.treeviewer.TreeBuilderI;
import jalview.ext.treeviewer.TreeFrameI;
import jalview.ext.treeviewer.TreeI;
-import jalview.ext.treeviewer.TreeNodeI;
-import jalview.ext.treeviewer.TreeViewerBindingI;
-import jalview.ext.treeviewer.LoadedTreeSequenceAssociation;
+import jalview.ext.treeviewer.TreeViewerUtils;
import jalview.gui.Desktop;
import jalview.gui.JvOptionPane;
import jalview.util.MessageManager;
import jalview.viewmodel.AlignmentViewport;
-import java.awt.Dimension;
import java.io.File;
import java.io.FileNotFoundException;
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;
import org.forester.archaeopteryx.Configuration;
private final static NHXParser.TAXONOMY_EXTRACTION TAXONOMY_EXTRACTION = APTX_CONFIG
.getTaxonomyExtraction();
- private static Map<TreeFrameI, TreeViewerBindingI> activeAptx = new HashMap<>();
+
jalviewTree);
bindAptxNodes.associateLeavesToSequences();
- bindNodesToJalviewSequences(aptxApp, jalviewAlignport,
+ TreeViewerUtils.associateNodesWithJalviewSequences(aptxApp, jalviewAlignport,
bindAptxNodes.getAlignmentWithNodes(),
bindAptxNodes.getNodesWithAlignment());
- bindTreeViewFrameToJalview(aptxApp);
+ TreeViewerUtils.addTreeViewFrameToJalview(aptxApp);
// adaptAptxGui(aptxApp); //moved to AptxFrame
return aptxApp;
jalviewTree);
bindAptxNodes.associateLeavesToSequences();
- bindNodesToJalviewSequences(aptxApp, jalviewAlignport,
+ TreeViewerUtils.associateNodesWithJalviewSequences(aptxApp, jalviewAlignport,
bindAptxNodes.getAlignmentWithNodes(),
bindAptxNodes.getNodesWithAlignment());
- bindTreeViewFrameToJalview(aptxApp);
+ TreeViewerUtils.addTreeViewFrameToJalview(aptxApp);
// adaptAptxGui(aptxApp); //moved to AptxFrame
return aptxApp;
}
- protected static TreeViewerBindingI bindNodesToJalviewSequences(
- final TreeFrameI aptxApp,
- final AlignmentViewport jalviewAlignViewport,
- final Map<SequenceI, TreeNodeI> alignMappedToNodes,
- final Map<TreeNodeI, SequenceI> nodesMappedToAlign)
- {
- TreeViewerBindingI treeBinding = new JalviewBinding(aptxApp,
- jalviewAlignViewport,
- alignMappedToNodes, nodesMappedToAlign);
- activeAptx.put(aptxApp, treeBinding);
- return treeBinding;
- }
-
-
- protected static TreeFrameI bindTreeViewFrameToJalview(
- final TreeFrameI aptxApp)
- {
- int width = 400;
- int height = 550;
- aptxApp.setMinimumSize(new Dimension(width, height));
- // aptxApp.setFont(Desktop.instance.getFont());
- // aptxApp.getMainPanel().setFont(Desktop.instance.getFont());
- String frameTitle = MessageManager.getString("label.aptx_title");
- File treeFile = aptxApp.getTreePanel().getTreeFile();
- if (treeFile != null)
- {
- frameTitle += MessageManager.formatMessage("label.aptx_title_append",
- new String[]
- { treeFile.getAbsolutePath() });
- }
- aptxApp.addFrameToJalview(frameTitle, true, width, height, true,
- true);
- return aptxApp;
-
- }
-
private static boolean validateConfig(Configuration aptxConfig)
{
if (aptxConfig == null || aptxConfig.isCouldReadConfigFile() == false)
}
-
- public static Map<TreeFrameI, TreeViewerBindingI> getAllAptxFrames()
- {
- return activeAptx;
- }
-
-
}
import jalview.ext.treeviewer.TreeNodeI;
import jalview.ext.treeviewer.TreePanelI;
import jalview.ext.treeviewer.TreeViewerBindingI;
+import jalview.ext.treeviewer.TreeViewerUtils;
import jalview.ext.treeviewer.LoadedTreeSequenceAssociation;
import jalview.gui.AlignViewport;
import jalview.gui.AlignmentPanel;
@Override
public void internalFrameClosed(InternalFrameEvent e)
{
- AptxInit.getAllAptxFrames().remove(aptxFrame);
+ TreeViewerUtils.getActiveTreeViews().remove(aptxFrame);
ssm.removeSelectionListener(JalviewBinding.this);
}
bindAptxNodes.associateLeavesToSequences();
sequencesBoundToNodes = bindAptxNodes.getAlignmentWithNodes();
nodesBoundToSequences = bindAptxNodes.getNodesWithAlignment();
- AptxInit.bindNodesToJalviewSequences(aptxFrame, parentAvport,
+ TreeViewerUtils.associateNodesWithJalviewSequences(aptxFrame, parentAvport,
sequencesBoundToNodes, nodesBoundToSequences);
--- /dev/null
+package jalview.ext.treeviewer;
+
+import jalview.datamodel.SequenceI;
+import jalview.ext.archaeopteryx.JalviewBinding;
+import jalview.util.MessageManager;
+import jalview.viewmodel.AlignmentViewport;
+
+import java.awt.Dimension;
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+public class TreeViewerUtils
+{
+ private static Map<TreeFrameI, TreeViewerBindingI> activeViews = new HashMap<>();
+
+ public static TreeViewerBindingI associateNodesWithJalviewSequences(
+ final TreeFrameI treeFrame,
+ final AlignmentViewport jalviewAlignViewport,
+ final Map<SequenceI, TreeNodeI> alignMappedToNodes,
+ final Map<TreeNodeI, SequenceI> nodesMappedToAlign)
+ {
+ TreeViewerBindingI treeBinding = new JalviewBinding(treeFrame,
+ jalviewAlignViewport,
+ alignMappedToNodes, nodesMappedToAlign);
+ activeViews.put(treeFrame, treeBinding);
+ return treeBinding;
+ }
+
+ public static TreeFrameI addTreeViewFrameToJalview(
+ final TreeFrameI treeFrame)
+ {
+ int width = 400;
+ int height = 550;
+ treeFrame.setMinimumSize(new Dimension(width, height));
+ // aptxApp.setFont(Desktop.instance.getFont());
+ // aptxApp.getMainPanel().setFont(Desktop.instance.getFont());
+ String frameTitle = MessageManager.getString("label.aptx_title");
+ File treeFile = treeFrame.getTreePanel().getTreeFile();
+ if (treeFile != null)
+ {
+ frameTitle += MessageManager.formatMessage("label.aptx_title_append",
+ new String[]
+ { treeFile.getAbsolutePath() });
+ }
+ treeFrame.addFrameToJalview(frameTitle, true, width, height, true,
+ true);
+ return treeFrame;
+
+ }
+
+ public static Map<TreeFrameI, TreeViewerBindingI> getActiveTreeViews()
+ {
+ return activeViews;
+ }
+
+}