X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Farchaeopteryx%2FArchaeopteryxA.java;h=d204f5f12bf7131d1de92c56e5eabc7b0e952bdc;hb=9351f2c2e8af0c3bf1280f9696f1459db2819005;hp=c508eda1998c86024142b31ed5ef6fa2dc93148c;hpb=0bcaf88108ac7d33e5a76df7fa49bf22d01c6798;p=jalview.git diff --git a/forester/java/src/org/forester/archaeopteryx/ArchaeopteryxA.java b/forester/java/src/org/forester/archaeopteryx/ArchaeopteryxA.java index c508eda..d204f5f 100644 --- a/forester/java/src/org/forester/archaeopteryx/ArchaeopteryxA.java +++ b/forester/java/src/org/forester/archaeopteryx/ArchaeopteryxA.java @@ -35,7 +35,6 @@ import java.net.URL; import javax.swing.JApplet; import javax.swing.UIManager; -import org.forester.io.parsers.nhx.NHXParser.TAXONOMY_EXTRACTION; import org.forester.phylogeny.Phylogeny; import org.forester.util.ForesterUtil; @@ -61,13 +60,15 @@ public class ArchaeopteryxA extends JApplet { getMainFrameApplet().close(); } } + + /** * This method returns the current external node data which * has been selected by the user by clicking the "Return ..." * menu item. This method is expected to be called from Javascript or * something like it. - * + * * @return current external node data as String */ public String getCurrentExternalNodesDataBuffer() { @@ -97,7 +98,7 @@ public class ArchaeopteryxA extends JApplet { setTreeUrlStr( getParameter( Constants.APPLET_PARAM_NAME_FOR_URL_OF_TREE_TO_LOAD ) ); setSpeciesTreeUrlStr( getParameter( Constants.APPLET_PARAM_NAME_FOR_URL_OF_SPECIES_TREE_TO_LOAD ) ); if ( !ForesterUtil.isEmpty( getTreeUrlStr() ) ) { - AptxUtil.printAppletMessage( NAME, "URL of tree(s) to load: \"" + getTreeUrlStr() + "\"" ); + AptxUtil.printAppletMessage( NAME, "URL of tree(s) to load: " + getTreeUrlStr() ); } else { ForesterUtil.printErrorMessage( NAME, "no URL for tree(s) to load!" ); @@ -108,7 +109,7 @@ public class ArchaeopteryxA extends JApplet { repaint(); } if ( !ForesterUtil.isEmpty( getSpeciesTreeUrlStr() ) ) { - AptxUtil.printAppletMessage( NAME, "URL of species tree to load: \"" + getSpeciesTreeUrlStr() + "\"" ); + AptxUtil.printAppletMessage( NAME, "URL of species tree to load: " + getSpeciesTreeUrlStr() ); } setBackground( background_color ); setForeground( font_color ); @@ -136,40 +137,28 @@ public class ArchaeopteryxA extends JApplet { UIManager.setLookAndFeel( UIManager.getCrossPlatformLookAndFeelClassName() ); } setVisible( false ); - _mainframe_applet = new MainFrameApplet( this, configuration ); + _mainframe_applet = new MainFrameApplet( this, configuration, getSpeciesTreeUrlStr() ); final URL tree_url = new URL( getTreeUrlStr() ); final Phylogeny[] phys = AptxUtil.readPhylogeniesFromUrl( tree_url, configuration .isValidatePhyloXmlAgainstSchema(), configuration.isReplaceUnderscoresInNhParsing(), configuration - .isInternalNumberAreConfidenceForNhParsing(), configuration.getTaxonomyExtraction() ); + .isInternalNumberAreConfidenceForNhParsing(), configuration.getTaxonomyExtraction(), configuration + .isMidpointReroot() ); + if ( phys == null ) { + ForesterUtil.printErrorMessage( NAME, "phylogenies from [" + tree_url + "] are null" ); + } + else if ( phys.length < 1 ) { + ForesterUtil.printErrorMessage( NAME, "phylogenies from [" + tree_url + "] are empty" ); + } + else { + AptxUtil.printAppletMessage( NAME, "loaded " + phys.length + " phylogenies from: " + tree_url ); + } + AptxUtil.printAppletMessage( ArchaeopteryxA.NAME, "loaded " + phys.length + " phylogenies from: " + + tree_url ); AptxUtil.addPhylogeniesToTabs( phys, new File( tree_url.getFile() ).getName(), getTreeUrlStr(), getMainFrameApplet().getConfiguration(), getMainFrameApplet().getMainPanel() ); - if ( !ForesterUtil.isEmpty( getSpeciesTreeUrlStr() ) ) { - final URL species_tree_url = new URL( getSpeciesTreeUrlStr() ); - final Phylogeny[] species_trees = AptxUtil - .readPhylogeniesFromUrl( species_tree_url, - configuration.isValidatePhyloXmlAgainstSchema(), - configuration.isReplaceUnderscoresInNhParsing(), - false, - TAXONOMY_EXTRACTION.NO ); - if ( ( species_trees != null ) && ( species_trees.length > 0 ) ) { - AptxUtil.printAppletMessage( NAME, "successfully read species tree" ); - if ( species_trees[ 0 ].isEmpty() ) { - ForesterUtil.printErrorMessage( NAME, "species tree is empty" ); - } - else if ( !species_trees[ 0 ].isRooted() ) { - ForesterUtil.printErrorMessage( NAME, "species tree is not rooted" ); - } - else { - getMainFrameApplet().setSpeciesTree( species_trees[ 0 ] ); - } - } - else { - ForesterUtil.printErrorMessage( NAME, "failed to read species tree from " + getSpeciesTreeUrlStr() ); - } - } getMainFrameApplet().getMainPanel().getControlPanel().showWholeAll(); getMainFrameApplet().getMainPanel().getControlPanel().showWhole(); setVisible( true ); @@ -208,7 +197,7 @@ public class ArchaeopteryxA extends JApplet { /** * Prints message when initialization is finished. Called automatically. - * + * * @param g * Graphics */