From f7ef599318242d5d63dbe1e9679224534f7b6aa3 Mon Sep 17 00:00:00 2001 From: kjvdheide Date: Wed, 22 Nov 2017 13:21:37 +0000 Subject: [PATCH] JAL-2847 small things, filled in actionperformeds --- src/jalview/ext/archaeopteryx/AptxInit.java | 6 ++- src/jalview/ext/archaeopteryx/JalviewBinding.java | 8 ++-- .../ext/forester/io/TreeDatabaseMenuBuilder.java | 40 ++++++++++++++++++++ src/jalview/gui/AlignFrame.java | 21 +++++----- src/jalview/jbgui/GAlignFrame.java | 3 -- 5 files changed, 58 insertions(+), 20 deletions(-) create mode 100644 src/jalview/ext/forester/io/TreeDatabaseMenuBuilder.java diff --git a/src/jalview/ext/archaeopteryx/AptxInit.java b/src/jalview/ext/archaeopteryx/AptxInit.java index 4a49734..e58a38d 100644 --- a/src/jalview/ext/archaeopteryx/AptxInit.java +++ b/src/jalview/ext/archaeopteryx/AptxInit.java @@ -132,13 +132,13 @@ public final class AptxInit AlignmentViewport viewport) throws FileNotFoundException, IOException, RuntimeException { - + String treeTitle = treeUrl.getFile(); Phylogeny[] trees = AptxUtil.readPhylogeniesFromUrl(treeUrl, VALIDATE_PHYLOXML_XSD, REPLACE_NHX_UNDERSCORES, INTERNAL_NUMBERS_AS_CONFIDENCE, TAXONOMY_EXTRACTION, MIDPOINT_REROOT); MainFrame aptxApp = Archaeopteryx.createApplication(trees, APTX_CONFIG, - null); + treeTitle); for (Phylogeny tree : trees) { @@ -158,6 +158,7 @@ public final class AptxInit + public static MainFrame createAptxFrame( final Phylogeny[] aptxTrees) { @@ -194,4 +195,5 @@ public final class AptxInit } + } diff --git a/src/jalview/ext/archaeopteryx/JalviewBinding.java b/src/jalview/ext/archaeopteryx/JalviewBinding.java index deadfe4..3f69299 100644 --- a/src/jalview/ext/archaeopteryx/JalviewBinding.java +++ b/src/jalview/ext/archaeopteryx/JalviewBinding.java @@ -100,11 +100,13 @@ public final class JalviewBinding * Resend the selection to the tree view when tabs get switched, this * has to be buried in invokeLater as Forester first resets the tree * view on switching tabs, without invokeLater this would get called - * before Forester resets which would nullify the selection + * before Forester resets which would nullify the selection. */ public void run() { parentAvport.sendSelection(); + // PaintRefresher.Refresh(treeView, + // parentAvport.getSequenceSetId()); } }); @@ -212,7 +214,7 @@ public final class JalviewBinding { treeSelectionChanged(matchingSequence); parentAvport.sendSelection(); - PaintRefresher.Refresh(treeView, parentAvport.getSequenceSetId()); + PaintRefresher.Refresh(treeView, parentAvport.getSequenceSetId()); // redundant? } } @@ -234,7 +236,7 @@ public final class JalviewBinding } } parentAvport.sendSelection(); - PaintRefresher.Refresh(treeView, parentAvport.getSequenceSetId()); + PaintRefresher.Refresh(treeView, parentAvport.getSequenceSetId()); // redundant? } /** diff --git a/src/jalview/ext/forester/io/TreeDatabaseMenuBuilder.java b/src/jalview/ext/forester/io/TreeDatabaseMenuBuilder.java new file mode 100644 index 0000000..45415d1 --- /dev/null +++ b/src/jalview/ext/forester/io/TreeDatabaseMenuBuilder.java @@ -0,0 +1,40 @@ +package jalview.ext.forester.io; + +import javax.swing.JMenu; +import javax.swing.JMenuItem; + +import org.forester.archaeopteryx.webservices.PhylogeniesWebserviceClient; +import org.forester.archaeopteryx.webservices.WebservicesManager; + +public class TreeDatabaseMenuBuilder +{ + final WebservicesManager webservicesManager; + + JMenuItem[] treeDatabaseMenuItems; + + public TreeDatabaseMenuBuilder() + + { + webservicesManager = WebservicesManager + .getInstance(); + + } + + public JMenu fillMenu(JMenu treeDbMenu) { + treeDatabaseMenuItems = new JMenuItem[webservicesManager + .getAvailablePhylogeniesWebserviceClients().size()]; + + for (int i = 0; i < treeDatabaseMenuItems.length; ++i) + { + final PhylogeniesWebserviceClient client = webservicesManager + .getAvailablePhylogeniesWebserviceClient(i); + treeDatabaseMenuItems[i] = new JMenuItem( + client.getMenuName()); + treeDbMenu.add(treeDatabaseMenuItems[i]); + + } + return treeDbMenu; + + } + +} diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 427cb00..deb8d11 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -3898,46 +3898,41 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } @Override - protected void loadTreeDbItem_actionPerformed(ActionEvent e) - { - chooseTreeDb(); - } - - @Override protected void loadTreeBaseStudy_actionPerformed(ActionEvent e) { - // TODO Auto-generated method stub + chooseTreeDb(); } @Override protected void loadTreeOfLife_actionPerformed(ActionEvent e) { - // TODO Auto-generated method stub + chooseTreeDb(); } @Override protected void loadTreeFam_actionPerformed(ActionEvent e) { - // TODO Auto-generated method stub + chooseTreeDb(); } @Override protected void loadTreePfam_actionPerformed(ActionEvent e) { - // TODO Auto-generated method stub + chooseTreeDb(); } @Override protected void loadTreeBase_actionPerformed(ActionEvent e) { - // TODO Auto-generated method stub + chooseTreeDb(); } + public void chooseTreeFile() { // Pick the tree file @@ -3960,7 +3955,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { String filePath = chooser.getSelectedFile().getPath(); Cache.setProperty("LAST_DIRECTORY", filePath); - + + TreeParser treeParser = new TreeParser(filePath); treeParser.loadTree(viewport); @@ -4038,6 +4034,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { + } public TreePanel showNewickTree(NewickFile nf, String treeTitle) diff --git a/src/jalview/jbgui/GAlignFrame.java b/src/jalview/jbgui/GAlignFrame.java index a202ed0..9b0c6a8 100755 --- a/src/jalview/jbgui/GAlignFrame.java +++ b/src/jalview/jbgui/GAlignFrame.java @@ -2507,10 +2507,7 @@ public class GAlignFrame extends JInternalFrame } - protected void loadTreeDbItem_actionPerformed(ActionEvent e) - { - } /** * Template method to handle the 'load T-Coffee scores' menu event. -- 1.7.10.2