From 7bf767decd23672a1b5eb67974c99f58c54f788f Mon Sep 17 00:00:00 2001 From: kjvdheide Date: Fri, 17 Nov 2017 13:07:27 +0000 Subject: [PATCH] JAL-2805 couple of method name changes --- src/jalview/ext/archaeopteryx/AptxBinding.java | 74 +++++++++++++++++ .../ext/forester/io/ExternalTreeParserI.java | 2 +- .../ext/forester/io/ForesterTreeParser.java | 86 +++++++++++++++++++- src/jalview/gui/AlignFrame.java | 2 +- 4 files changed, 161 insertions(+), 3 deletions(-) diff --git a/src/jalview/ext/archaeopteryx/AptxBinding.java b/src/jalview/ext/archaeopteryx/AptxBinding.java index d82f660..24f75bc 100644 --- a/src/jalview/ext/archaeopteryx/AptxBinding.java +++ b/src/jalview/ext/archaeopteryx/AptxBinding.java @@ -225,6 +225,80 @@ public final class AptxBinding this.parentAvport = parentAvport; } + // av.setCurrentTree(tree); + // + // /* + // * isPopupTrigger is set for mousePressed (Mac) + // * or mouseReleased (Windows) + // */ + // if (e.isPopupTrigger()) + // { + // if (highlightNode != null) + // { + // chooseSubtreeColour(); + // } + // return; + // } + // + // /* + // * defer right-click handling on Windows to + // * mouseClicked; note isRightMouseButton + // * also matches Cmd-click on Mac which should do + // * nothing here + // */ + // if (SwingUtilities.isRightMouseButton(e)) + // { + // return; + // } + // + // int x = e.getX(); + // int y = e.getY(); + // + // Object ob = findElement(x, y); + // + // if (ob instanceof SequenceI) + // { + // treeSelectionChanged((Sequence) ob); + // PaintRefresher.Refresh(tp, ap.av.getSequenceSetId()); + // repaint(); + // av.sendSelection(); + // return; + // } + // else if (!(ob instanceof SequenceNode)) + // { + // // Find threshold + // if (tree.getMaxHeight() != 0) + // { + // threshold = (float) (x - offx) + // / (float) (getWidth() - labelLength - (2 * offx)); + // + // List groups = tree.groupNodes(threshold); + // setColor(tree.getTopNode(), Color.black); + // + // AlignmentPanel[] aps = getAssociatedPanels(); + // + // // TODO push calls below into a single AlignViewportI method? + // // see also AlignViewController.deleteGroups + // for (int a = 0; a < aps.length; a++) + // { + // aps[a].av.setSelectionGroup(null); + // aps[a].av.getAlignment().deleteAllGroups(); + // aps[a].av.clearSequenceColours(); + // if (aps[a].av.getCodingComplement() != null) + // { + // aps[a].av.getCodingComplement().setSelectionGroup(null); + // aps[a].av.getCodingComplement().getAlignment() + // .deleteAllGroups(); + // aps[a].av.getCodingComplement().clearSequenceColours(); + // } + // } + // colourGroups(groups); + // } + // + // PaintRefresher.Refresh(tp, ap.av.getSequenceSetId()); + // repaint(); + // } + } diff --git a/src/jalview/ext/forester/io/ExternalTreeParserI.java b/src/jalview/ext/forester/io/ExternalTreeParserI.java index e1210d1..7804fb8 100644 --- a/src/jalview/ext/forester/io/ExternalTreeParserI.java +++ b/src/jalview/ext/forester/io/ExternalTreeParserI.java @@ -14,5 +14,5 @@ import javax.swing.JInternalFrame; */ public interface ExternalTreeParserI { - public F loadTree(AlignmentViewport viewport); + public F loadTreeFile(AlignmentViewport viewport); } diff --git a/src/jalview/ext/forester/io/ForesterTreeParser.java b/src/jalview/ext/forester/io/ForesterTreeParser.java index 85960e0..411f5a2 100644 --- a/src/jalview/ext/forester/io/ForesterTreeParser.java +++ b/src/jalview/ext/forester/io/ForesterTreeParser.java @@ -52,7 +52,7 @@ public class ForesterTreeParser implements ExternalTreeParserI } @Override - public MainFrame loadTree(AlignmentViewport viewport) + public MainFrame loadTreeFile(AlignmentViewport viewport) { String[] AptxArgs = new String[] { "-c", "_aptx_jalview_configuration_file", filePath }; @@ -72,6 +72,90 @@ public class ForesterTreeParser implements ExternalTreeParserI } + // + // void readPhylogeniesFromURL() { + // URL url = null; + // Phylogeny[] phys = null; + // final String message = "Please enter a complete URL, for example + // \"http://purl.org/phylo/treebase/phylows/study/TB2:S15480?format=nexus\""; + // final String url_string = JOptionPane + // .showInputDialog( this, + // message, + // "Use URL/webservice to obtain a phylogeny", + // JOptionPane.QUESTION_MESSAGE ); + // boolean nhx_or_nexus = false; + // if ( ( url_string != null ) && ( url_string.length() > 0 ) ) { + // try { + // url = new URL( url_string ); + // PhylogenyParser parser = null; + // if ( url.getHost().toLowerCase().indexOf( "tolweb" ) >= 0 ) { + // parser = new TolParser(); + // } + // else { + // parser = ParserUtils + // .createParserDependingOnUrlContents( url, + // getConfiguration().isValidatePhyloXmlAgainstSchema() ); + // } + // if ( parser instanceof NexusPhylogeniesParser ) { + // nhx_or_nexus = true; + // } + // else if ( parser instanceof NHXParser ) { + // nhx_or_nexus = true; + // } + // if ( _mainpanel.getCurrentTreePanel() != null ) { + // _mainpanel.getCurrentTreePanel().setWaitCursor(); + // } + // else { + // _mainpanel.setWaitCursor(); + // } + // final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance(); + // phys = factory.create( url.openStream(), parser ); + // } + // catch ( final MalformedURLException e ) { + // JOptionPane.showMessageDialog( this, + // "Malformed URL: " + url + "\n" + e.getLocalizedMessage(), + // "Malformed URL", + // JOptionPane.ERROR_MESSAGE ); + // } + // catch ( final IOException e ) { + // JOptionPane.showMessageDialog( this, + // "Could not read from " + url + "\n" + // + ForesterUtil.wordWrap( e.getLocalizedMessage(), 80 ), + // "Failed to read URL", + // JOptionPane.ERROR_MESSAGE ); + // } + // catch ( final Exception e ) { + // JOptionPane.showMessageDialog( this, + // ForesterUtil.wordWrap( e.getLocalizedMessage(), 80 ), + // "Unexpected Exception", + // JOptionPane.ERROR_MESSAGE ); + // } + // finally { + // if ( _mainpanel.getCurrentTreePanel() != null ) { + // _mainpanel.getCurrentTreePanel().setArrowCursor(); + // } + // else { + // _mainpanel.setArrowCursor(); + // } + // } + // if ( ( phys != null ) && ( phys.length > 0 ) ) { + // if ( nhx_or_nexus && + // getOptions().isInternalNumberAreConfidenceForNhParsing() ) { + // for( final Phylogeny phy : phys ) { + // PhylogenyMethods.transferInternalNodeNamesToConfidence( phy, "" ); + // } + // } + // AptxUtil.addPhylogeniesToTabs( phys, + // new File( url.getFile() ).getName(), + // new File( url.getFile() ).toString(), + // getConfiguration(), + // getMainPanel() ); + // _mainpanel.getControlPanel().showWhole(); + // } + // } + // activateSaveAllIfNeeded(); + // System.gc(); + // } } diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 21b602f..1c19eb1 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -3905,7 +3905,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, { ExternalTreeParserI treeParser = new ForesterTreeParser( filePath); - treeParser.loadTree(viewport); + treeParser.loadTreeFile(viewport); -- 1.7.10.2