in progress
authorcmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Thu, 3 Nov 2011 05:19:40 +0000 (05:19 +0000)
committercmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Thu, 3 Nov 2011 05:19:40 +0000 (05:19 +0000)
22 files changed:
forester/java/src/org/forester/archaeopteryx/AptxUtil.java [moved from forester/java/src/org/forester/archaeopteryx/Util.java with 91% similarity]
forester/java/src/org/forester/archaeopteryx/Archaeopteryx.java
forester/java/src/org/forester/archaeopteryx/ArchaeopteryxA.java
forester/java/src/org/forester/archaeopteryx/ArchaeopteryxE.java
forester/java/src/org/forester/archaeopteryx/Configuration.java
forester/java/src/org/forester/archaeopteryx/ControlPanel.java
forester/java/src/org/forester/archaeopteryx/FontChooser.java
forester/java/src/org/forester/archaeopteryx/MainFrame.java
forester/java/src/org/forester/archaeopteryx/MainFrameApplet.java
forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java
forester/java/src/org/forester/archaeopteryx/MainPanel.java
forester/java/src/org/forester/archaeopteryx/NodeEditPanel.java
forester/java/src/org/forester/archaeopteryx/Options.java
forester/java/src/org/forester/archaeopteryx/PdfExporter.java
forester/java/src/org/forester/archaeopteryx/TreeColorSet.java
forester/java/src/org/forester/archaeopteryx/TreePanel.java
forester/java/src/org/forester/archaeopteryx/UrlTreeReader.java
forester/java/src/org/forester/archaeopteryx/tools/ImageLoader.java
forester/java/src/org/forester/archaeopteryx/tools/PhyloInferenceDialog.java
forester/java/src/org/forester/archaeopteryx/tools/PhylogeneticInferrer.java
forester/java/src/org/forester/io/parsers/FastaParser.java
forester/java/src/org/forester/tools/PhylogenyDecorator.java

@@ -80,7 +80,7 @@ import org.forester.util.DescriptiveStatistics;
 import org.forester.util.ForesterUtil;
 import org.forester.ws.uniprot.UniProtTaxonomy;
 
-public final class Util {
+public final class AptxUtil {
 
     private final static String[] AVAILABLE_FONT_FAMILIES_SORTED = GraphicsEnvironment.getLocalGraphicsEnvironment()
                                                                          .getAvailableFontFamilyNames();
@@ -122,6 +122,21 @@ public final class Util {
         return false;
     }
 
+    public static void writePhylogenyToGraphicsFileNonInteractive( final File intree,
+                                                                   final File outfile,
+                                                                   final int width,
+                                                                   final int height,
+                                                                   final GraphicsExportType type,
+                                                                   final Configuration config ) throws IOException {
+        final PhylogenyParser parser = ParserUtils.createParserDependingOnFileType( intree, true );
+        Phylogeny[] phys = null;
+        phys = PhylogenyMethods.readPhylogenies( parser, intree );
+        final MainFrameApplication mf = MainFrameApplication.createInstance( phys, config );
+        AptxUtil.writePhylogenyToGraphicsFileNonInteractive( outfile, width, height, mf.getMainPanel()
+                .getCurrentTreePanel(), mf.getMainPanel().getControlPanel(), type, mf.getOptions() );
+        mf.end();
+    }
+
     /**
      * Returns true if at least one branch has a length larger than zero.
      * 
@@ -276,9 +291,9 @@ public final class Util {
                 }
             }
         }
-        first = Util.normalizeCharForRGB( first );
-        second = Util.normalizeCharForRGB( second );
-        third = Util.normalizeCharForRGB( third );
+        first = AptxUtil.normalizeCharForRGB( first );
+        second = AptxUtil.normalizeCharForRGB( second );
+        third = AptxUtil.normalizeCharForRGB( third );
         if ( ( first > 235 ) && ( second > 235 ) && ( third > 235 ) ) {
             first = 0;
         }
@@ -301,7 +316,7 @@ public final class Util {
             if ( !n.isExternal() && !n.isCollapse() && ( n.getNumberOfDescendants() > 1 ) ) {
                 final Set<Taxonomy> taxs = PhylogenyMethods.obtainDistinctTaxonomies( n );
                 if ( ( taxs != null ) && ( taxs.size() == 1 ) ) {
-                    Util.collapseSubtree( n, true );
+                    AptxUtil.collapseSubtree( n, true );
                     if ( !n.getNodeData().isHasTaxonomy() ) {
                         n.getNodeData().setTaxonomy( ( Taxonomy ) n.getAllExternalDescendants().get( 0 ).getNodeData()
                                 .getTaxonomy().copy() );
@@ -697,13 +712,13 @@ public final class Util {
                                                                       final ControlPanel atv_control,
                                                                       final Configuration configuration ) {
         if ( ( t != null ) && !t.isEmpty() ) {
-            if ( !Util.isHasAtLeastOneBranchLengthLargerThanZero( t ) ) {
+            if ( !AptxUtil.isHasAtLeastOneBranchLengthLargerThanZero( t ) ) {
                 atv_control.setDrawPhylogram( false );
                 atv_control.setDrawPhylogramEnabled( false );
             }
             if ( configuration.doGuessCheckOption( Configuration.display_as_phylogram ) ) {
                 if ( atv_control.getDisplayAsPhylogramCb() != null ) {
-                    if ( Util.isHasAtLeastOneBranchLengthLargerThanZero( t ) ) {
+                    if ( AptxUtil.isHasAtLeastOneBranchLengthLargerThanZero( t ) ) {
                         atv_control.setDrawPhylogram( true );
                         atv_control.setDrawPhylogramEnabled( true );
                     }
@@ -714,7 +729,7 @@ public final class Util {
             }
             if ( configuration.doGuessCheckOption( Configuration.write_confidence_values ) ) {
                 if ( atv_control.getWriteConfidenceCb() != null ) {
-                    if ( Util.isHasAtLeastOneBranchWithSupportValues( t ) ) {
+                    if ( AptxUtil.isHasAtLeastOneBranchWithSupportValues( t ) ) {
                         atv_control.setCheckbox( Configuration.write_confidence_values, true );
                     }
                     else {
@@ -724,7 +739,7 @@ public final class Util {
             }
             if ( configuration.doGuessCheckOption( Configuration.write_events ) ) {
                 if ( atv_control.getShowEventsCb() != null ) {
-                    if ( Util.isHasAtLeastNodeWithEvent( t ) ) {
+                    if ( AptxUtil.isHasAtLeastNodeWithEvent( t ) ) {
                         atv_control.setCheckbox( Configuration.write_events, true );
                     }
                     else {
@@ -775,7 +790,7 @@ public final class Util {
 
     final static void openWebsite( final String url, final boolean is_applet, final JApplet applet ) throws IOException {
         try {
-            Util.launchWebBrowser( new URI( url ), is_applet, applet, Constants.PRG_NAME );
+            AptxUtil.launchWebBrowser( new URI( url ), is_applet, applet, Constants.PRG_NAME );
         }
         catch ( final Exception e ) {
             throw new IOException( e );
@@ -915,6 +930,56 @@ public final class Util {
         return msg;
     }
 
+    public final static void writePhylogenyToGraphicsFileNonInteractive( final File outfile,
+                                                                         final int width,
+                                                                         final int height,
+                                                                         final TreePanel tree_panel,
+                                                                         final ControlPanel ac,
+                                                                         final GraphicsExportType type,
+                                                                         final Options options ) throws IOException {
+        tree_panel.setParametersForPainting( width, height, true );
+        tree_panel.resetPreferredSize();
+        tree_panel.repaint();
+        final RenderingHints rendering_hints = new RenderingHints( RenderingHints.KEY_RENDERING,
+                                                                   RenderingHints.VALUE_RENDER_QUALITY );
+        rendering_hints.put( RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY );
+        if ( options.isAntialiasPrint() ) {
+            rendering_hints.put( RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON );
+            rendering_hints.put( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON );
+        }
+        else {
+            rendering_hints.put( RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF );
+            rendering_hints.put( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF );
+        }
+        final Phylogeny phylogeny = tree_panel.getPhylogeny();
+        if ( ( phylogeny == null ) || phylogeny.isEmpty() ) {
+            return;
+        }
+        if ( outfile.isDirectory() ) {
+            throw new IOException( "\"" + outfile + "\" is a directory" );
+        }
+        //Rectangle visible = null;
+        final BufferedImage buffered_img = new BufferedImage( width, height, BufferedImage.TYPE_INT_RGB );
+        final Graphics2D g2d = buffered_img.createGraphics();
+        g2d.setRenderingHints( rendering_hints );
+        final int x = 0;
+        final int y = 0;
+        //if ( options.isGraphicsExportVisibleOnly() ) {
+        //    g2d = ( Graphics2D ) g2d.create( -visible.x, -visible.y, visible.width, visible.height );
+        //    g2d.setClip( null );
+        //    x = visible.x;
+        //    y = visible.y;
+        //}
+        tree_panel.paintPhylogeny( g2d, false, true, width, height, x, y );
+        if ( type == GraphicsExportType.TIFF ) {
+            writeToTiff( outfile, buffered_img );
+        }
+        else {
+            ImageIO.write( buffered_img, type.toString(), outfile );
+        }
+        g2d.dispose();
+    }
+
     final static String writePhylogenyToGraphicsByteArrayOutputStream( final ByteArrayOutputStream baos,
                                                                        int width,
                                                                        int height,
@@ -1033,7 +1098,7 @@ public final class Util {
     // }
     // br.close();
     // }
-    static enum GraphicsExportType {
+    public static enum GraphicsExportType {
         GIF( "gif" ), JPG( "jpg" ), PDF( "pdf" ), PNG( "png" ), TIFF( "tif" ), BMP( "bmp" );
 
         private final String _suffix;
index eddc919..46ac48c 100644 (file)
@@ -68,7 +68,7 @@ public final class Archaeopteryx {
         try {
             int filename_index = 0;
             if ( args.length == 0 ) {
-                conf = new Configuration( null, false, false );
+                conf = new Configuration( null, false, false, true );
             }
             else if ( args.length > 0 ) {
                 // check for a config file
@@ -79,7 +79,7 @@ public final class Archaeopteryx {
                 if ( args[ 0 ].startsWith( "-open" ) ) {
                     filename_index += 1;
                 }
-                conf = new Configuration( config_filename, false, false );
+                conf = new Configuration( config_filename, false, false, true );
                 if ( args.length > filename_index ) {
                     f = new File( args[ filename_index ] );
                     final String err = ForesterUtil.isReadableFile( f );
@@ -129,10 +129,10 @@ public final class Archaeopteryx {
             MainFrameApplication.createInstance( phylogenies, conf, title );
         }
         catch ( final Exception ex ) {
-            Util.unexpectedException( ex );
+            AptxUtil.unexpectedException( ex );
         }
         catch ( final Error err ) {
-            Util.unexpectedError( err );
+            AptxUtil.unexpectedError( err );
         }
     }
 }
\ No newline at end of file
index fd82f35..b4e3801 100644 (file)
@@ -54,7 +54,7 @@ public class ArchaeopteryxA extends JApplet {
 
     @Override
     public void destroy() {
-        Util.printAppletMessage( NAME, "going to be destroyed" );
+        AptxUtil.printAppletMessage( NAME, "going to be destroyed" );
         if ( getMainFrameApplet() != null ) {
             getMainFrameApplet().close();
         }
@@ -81,7 +81,7 @@ public class ArchaeopteryxA extends JApplet {
         boolean has_exception = false;
         setName( NAME );
         setUrlString( getParameter( Constants.APPLET_PARAM_NAME_FOR_URL_OF_TREE_TO_LOAD ) );
-        Util.printAppletMessage( NAME, "URL of phylogenies to load: \"" + getUrlString() + "\"" );
+        AptxUtil.printAppletMessage( NAME, "URL of phylogenies to load: \"" + getUrlString() + "\"" );
         setBackground( background_color );
         setForeground( font_color );
         setFont( font );
@@ -98,8 +98,8 @@ public class ArchaeopteryxA extends JApplet {
             repaint();
         }
         final String config_filename = getParameter( Constants.APPLET_PARAM_NAME_FOR_CONFIG_FILE_URL );
-        Util.printAppletMessage( NAME, "URL for configuration file is: " + config_filename );
-        final Configuration configuration = new Configuration( config_filename, true, true );
+        AptxUtil.printAppletMessage( NAME, "URL for configuration file is: " + config_filename );
+        final Configuration configuration = new Configuration( config_filename, true, true, true );
         try {
             if ( configuration.isUseNativeUI() ) {
                 UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() );
@@ -111,9 +111,13 @@ public class ArchaeopteryxA extends JApplet {
             _mainframe_applet = new MainFrameApplet( this, configuration );
             URL url = null;
             url = new URL( getUrlString() );
-            final Phylogeny[] phys = Util.readPhylogeniesFromUrl( url, configuration.isValidatePhyloXmlAgainstSchema() );
-            Util.addPhylogeniesToTabs( phys, new File( url.getFile() ).getName(), getUrlString(), getMainFrameApplet()
-                    .getConfiguration(), getMainFrameApplet().getMainPanel() );
+            final Phylogeny[] phys = AptxUtil.readPhylogeniesFromUrl( url,
+                                                                      configuration.isValidatePhyloXmlAgainstSchema() );
+            AptxUtil.addPhylogeniesToTabs( phys,
+                                           new File( url.getFile() ).getName(),
+                                           getUrlString(),
+                                           getMainFrameApplet().getConfiguration(),
+                                           getMainFrameApplet().getMainPanel() );
             getMainFrameApplet().getMainPanel().getControlPanel().showWholeAll();
             getMainFrameApplet().getMainPanel().getControlPanel().showWhole();
             setVisible( true );
@@ -130,7 +134,7 @@ public class ArchaeopteryxA extends JApplet {
         if ( !has_exception ) {
             setMessage1( NAME + " is now ready!" );
             repaint();
-            Util.printAppletMessage( NAME, "successfully initialized" );
+            AptxUtil.printAppletMessage( NAME, "successfully initialized" );
         }
         KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner();
         getMainFrameApplet().requestFocus();
@@ -183,6 +187,6 @@ public class ArchaeopteryxA extends JApplet {
         getMainFrameApplet().requestFocus();
         getMainFrameApplet().requestFocusInWindow();
         getMainFrameApplet().requestFocus();
-        Util.printAppletMessage( NAME, "started" );
+        AptxUtil.printAppletMessage( NAME, "started" );
     }
 }
index 54d8418..a24176c 100644 (file)
@@ -27,10 +27,10 @@ import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
 
 import org.apache.commons.codec.binary.Base64;
+import org.forester.archaeopteryx.AptxUtil.GraphicsExportType;
 import org.forester.archaeopteryx.Options.CLADOGRAM_TYPE;
 import org.forester.archaeopteryx.Options.NODE_LABEL_DIRECTION;
 import org.forester.archaeopteryx.Options.PHYLOGENY_GRAPHICS_TYPE;
-import org.forester.archaeopteryx.Util.GraphicsExportType;
 import org.forester.phylogeny.Phylogeny;
 import org.forester.phylogeny.data.SequenceRelation;
 import org.forester.util.ForesterConstants;
@@ -277,7 +277,7 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
         }
         else if ( o == _website_item ) {
             try {
-                Util.openWebsite( Constants.APTX_WEB_SITE, true, this );
+                AptxUtil.openWebsite( Constants.APTX_WEB_SITE, true, this );
             }
             catch ( final IOException e1 ) {
                 ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );
@@ -285,7 +285,7 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
         }
         else if ( o == _phyloxml_website_item ) {
             try {
-                Util.openWebsite( Constants.PHYLOXML_WEB_SITE, true, this );
+                AptxUtil.openWebsite( Constants.PHYLOXML_WEB_SITE, true, this );
             }
             catch ( final IOException e1 ) {
                 ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );
@@ -293,7 +293,7 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
         }
         else if ( o == _aptx_ref_item ) {
             try {
-                Util.openWebsite( Constants.APTX_REFERENCE_URL, true, this );
+                AptxUtil.openWebsite( Constants.APTX_REFERENCE_URL, true, this );
             }
             catch ( final IOException e1 ) {
                 ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );
@@ -301,7 +301,7 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
         }
         else if ( o == _phyloxml_ref_item ) {
             try {
-                Util.openWebsite( Constants.PHYLOXML_REFERENCE_URL, true, this );
+                AptxUtil.openWebsite( Constants.PHYLOXML_REFERENCE_URL, true, this );
             }
             catch ( final IOException e1 ) {
                 ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );
@@ -350,13 +350,13 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
     public String getCurrentPhylogenyGraphicsAsBase64EncodedString( final String format ) {
         final ByteArrayOutputStream baos = new ByteArrayOutputStream();
         try {
-            Util.writePhylogenyToGraphicsByteArrayOutputStream( baos,
-                                                                _main_panel.getWidth(),
-                                                                _main_panel.getHeight(),
-                                                                getCurrentTreePanel(),
-                                                                getCurrentTreePanel().getControlPanel(),
-                                                                GraphicsExportType.valueOf( format ),
-                                                                getOptions() );
+            AptxUtil.writePhylogenyToGraphicsByteArrayOutputStream( baos,
+                                                                    _main_panel.getWidth(),
+                                                                    _main_panel.getHeight(),
+                                                                    getCurrentTreePanel(),
+                                                                    getCurrentTreePanel().getControlPanel(),
+                                                                    GraphicsExportType.valueOf( format ),
+                                                                    getOptions() );
         }
         catch ( final IOException ioe ) {
             ForesterUtil.printErrorMessage( NAME, ioe.toString() );
@@ -640,7 +640,7 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
 
     @Override
     public void destroy() {
-        Util.printAppletMessage( NAME, "going to be destroyed " );
+        AptxUtil.printAppletMessage( NAME, "going to be destroyed " );
         removeTextFrame();
         if ( getMainPanel() != null ) {
             getMainPanel().terminate();
@@ -674,15 +674,15 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
     @Override
     public void init() {
         final String config_filename = getParameter( Constants.APPLET_PARAM_NAME_FOR_CONFIG_FILE_URL );
-        Util.printAppletMessage( NAME, "URL for configuration file is: " + config_filename );
-        final Configuration configuration = new Configuration( config_filename, true, true );
+        AptxUtil.printAppletMessage( NAME, "URL for configuration file is: " + config_filename );
+        final Configuration configuration = new Configuration( config_filename, true, true, true );
         setConfiguration( configuration );
         setOptions( Options.createInstance( configuration ) );
         setupUI();
         URL phys_url = null;
         Phylogeny[] phys = null;
         final String phys_url_string = getParameter( Constants.APPLET_PARAM_NAME_FOR_URL_OF_TREE_TO_LOAD );
-        Util.printAppletMessage( NAME, "URL for phylogenies is " + phys_url_string );
+        AptxUtil.printAppletMessage( NAME, "URL for phylogenies is " + phys_url_string );
         // Get URL to tree file
         if ( phys_url_string != null ) {
             try {
@@ -698,7 +698,7 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
         // Load the tree from URL
         if ( phys_url != null ) {
             try {
-                phys = Util.readPhylogeniesFromUrl( phys_url, getConfiguration().isValidatePhyloXmlAgainstSchema() );
+                phys = AptxUtil.readPhylogeniesFromUrl( phys_url, getConfiguration().isValidatePhyloXmlAgainstSchema() );
             }
             catch ( final Exception e ) {
                 ForesterUtil.printErrorMessage( NAME, e.toString() );
@@ -718,7 +718,7 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
             return;
         }
         else {
-            Util.printAppletMessage( NAME, "loaded " + phys.length + " phylogenies from: " + phys_url );
+            AptxUtil.printAppletMessage( NAME, "loaded " + phys.length + " phylogenies from: " + phys_url );
         }
         setVisible( false );
         setMainPanel( new MainPanelApplets( getConfiguration(), this ) );
@@ -752,23 +752,23 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
             }
         } );
         if ( getConfiguration().isUseTabbedDisplay() ) {
-            Util.printAppletMessage( NAME, "using tabbed display" );
-            Util.addPhylogeniesToTabs( phys,
-                                       new File( phys_url.getFile() ).getName(),
-                                       phys_url.toString(),
-                                       getConfiguration(),
-                                       getMainPanel() );
+            AptxUtil.printAppletMessage( NAME, "using tabbed display" );
+            AptxUtil.addPhylogeniesToTabs( phys,
+                                           new File( phys_url.getFile() ).getName(),
+                                           phys_url.toString(),
+                                           getConfiguration(),
+                                           getMainPanel() );
         }
         else {
-            Util.printAppletMessage( NAME, "not using tabbed display" );
-            Util.addPhylogenyToPanel( phys, getConfiguration(), getMainPanel() );
+            AptxUtil.printAppletMessage( NAME, "not using tabbed display" );
+            AptxUtil.addPhylogenyToPanel( phys, getConfiguration(), getMainPanel() );
         }
         validate();
         setName( NAME );
         getMainPanel().getControlPanel().showWholeAll();
         getMainPanel().getControlPanel().showWhole();
         System.gc();
-        Util.printAppletMessage( NAME, "successfully initialized" );
+        AptxUtil.printAppletMessage( NAME, "successfully initialized" );
         /* GUILHEM_BEG */
         getCurrentTreePanel().getControlPanel().getSequenceRelationTypeBox().removeAllItems();
         for( final SequenceRelation.SEQUENCE_RELATION_TYPE type : getMainPanel().getCurrentPhylogeny()
@@ -828,7 +828,7 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
 
     private void removeBranchColors() {
         if ( getMainPanel().getCurrentPhylogeny() != null ) {
-            Util.removeBranchColors( getMainPanel().getCurrentPhylogeny() );
+            AptxUtil.removeBranchColors( getMainPanel().getCurrentPhylogeny() );
         }
     }
 
@@ -925,19 +925,19 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
             }
         }
         catch ( final UnsupportedLookAndFeelException e ) {
-            Util.dieWithSystemError( "UnsupportedLookAndFeelException: " + e.toString() );
+            AptxUtil.dieWithSystemError( "UnsupportedLookAndFeelException: " + e.toString() );
         }
         catch ( final ClassNotFoundException e ) {
-            Util.dieWithSystemError( "ClassNotFoundException: " + e.toString() );
+            AptxUtil.dieWithSystemError( "ClassNotFoundException: " + e.toString() );
         }
         catch ( final InstantiationException e ) {
-            Util.dieWithSystemError( "InstantiationException: " + e.toString() );
+            AptxUtil.dieWithSystemError( "InstantiationException: " + e.toString() );
         }
         catch ( final IllegalAccessException e ) {
-            Util.dieWithSystemError( "IllegalAccessException: " + e.toString() );
+            AptxUtil.dieWithSystemError( "IllegalAccessException: " + e.toString() );
         }
         catch ( final Exception e ) {
-            Util.dieWithSystemError( e.toString() );
+            AptxUtil.dieWithSystemError( e.toString() );
         }
     }
 
@@ -949,7 +949,7 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
         requestFocus();
         requestFocusInWindow();
         requestFocus();
-        Util.printAppletMessage( NAME, "started" );
+        AptxUtil.printAppletMessage( NAME, "started" );
     }
 
     void switchColors() {
index c516041..72c5753 100644 (file)
@@ -54,9 +54,6 @@ import org.forester.util.ForesterUtil;
 
 public final class Configuration {
 
-    public enum UI {
-        NATIVE, CROSSPLATFORM, NIMBUS, UNKNOWN
-    }
     static final String                     VALIDATE_AGAINST_PHYLOXML_XSD_SCHEMA                   = "validate_against_phyloxml_xsd_schema";
     private static final String             WEB_LINK_KEY                                           = "web_link";
     private static final String             DISPLAY_COLOR_KEY                                      = "display_color";
@@ -155,7 +152,7 @@ public final class Configuration {
     final static String                     display_options[][]                                    = {
             { "Phylogram", "display", "?" }, { "Node Name", "display", "yes" }, { "Taxonomy Code", "display", "yes" },
             { "Annotation", "nodisplay", "no" }, { "Confidence Value", "display", "?" }, { "Event", "display", "?" },
-            { "Taxonomy Colorize", "display", "yes" }, { "Colorize Branches", "display", "no" },
+            { "Taxonomy Colorize", "display", "no" }, { "Colorize Branches", "display", "no" },
             { "Use Branch-Widths", "display", "no" }, { "Show Custom Nodes", "display", "yes" },
             { "Domains", "nodisplay", "no" }, { "Binary Characters", "nodisplay", "no" },
             { "Binary Char Counts", "nodisplay", "no" }, { "Prot/Gene Name", "display", "yes" },
@@ -208,7 +205,7 @@ public final class Configuration {
     private static String                   DEFAULT_FONT_FAMILY                                    = "";
     static {
         for( final String font_name : Constants.DEFAULT_FONT_CHOICES ) {
-            if ( Arrays.binarySearch( Util.getAvailableFontFamiliesSorted(), font_name ) >= 0 ) {
+            if ( Arrays.binarySearch( AptxUtil.getAvailableFontFamiliesSorted(), font_name ) >= 0 ) {
                 DEFAULT_FONT_FAMILY = font_name;
                 break;
             }
@@ -218,7 +215,11 @@ public final class Configuration {
         }
     }
 
-    public Configuration( final String cf, final boolean is_url, final boolean is_applet ) {
+    public Configuration() {
+        this( null, false, false, false );
+    }
+
+    public Configuration( final String cf, final boolean is_url, final boolean is_applet, final boolean verbose ) {
         if ( ForesterUtil.isEmpty( cf ) ) {
             config_filename = default_config_filename;
         }
@@ -264,13 +265,17 @@ public final class Configuration {
                     bf.close();
                 }
                 catch ( final Exception e ) {
-                    ForesterUtil.printWarningMessage( Constants.PRG_NAME, "failed to read configuration from ["
-                            + config_filename + "]: " + e );
+                    if ( verbose ) {
+                        ForesterUtil.printWarningMessage( Constants.PRG_NAME, "failed to read configuration from ["
+                                + config_filename + "]: " + e );
+                    }
                 }
             }
             else {
-                ForesterUtil.printWarningMessage( Constants.PRG_NAME, "cannot find or open configuration file ["
-                        + config_filename + "]" );
+                if ( verbose ) {
+                    ForesterUtil.printWarningMessage( Constants.PRG_NAME, "cannot find or open configuration file ["
+                            + config_filename + "]" );
+                }
             }
         }
     }
@@ -290,38 +295,6 @@ public final class Configuration {
         }
     }
 
-    Color getGuiBackgroundColor() {
-        return _gui_background_color;
-    }
-
-    Color getGuiCheckboxTextColor() {
-        return _gui_checkbox_text_color;
-    }
-
-    Color getGuiCheckboxAndButtonActiveColor() {
-        return _gui_checkbox_and_button_active_color;
-    }
-
-    Color getGuiButtonTextColor() {
-        return _gui_button_text_color;
-    }
-
-    Color getGuiButtonBackgroundColor() {
-        return _gui_button_background_color;
-    }
-
-    Color getGuiMenuBackgroundColor() {
-        return _gui_menu_background_color;
-    }
-
-    Color getGuiMenuTextColor() {
-        return _gui_menu_text_color;
-    }
-
-    Color getGuiButtonBorderColor() {
-        return _gui_button_border_color;
-    }
-
     boolean displaySequenceRelations() {
         return _display_sequence_relations;
     }
@@ -446,10 +419,26 @@ public final class Configuration {
         return clickto_options[ which ][ 0 ];
     }
 
+    public int getDefaultBootstrapSamples() {
+        return _default_bootstrap_samples;
+    }
+
     int getDefaultDisplayClicktoOption() {
         return default_clickto;
     }
 
+    public NodeFill getDefaultNodeFill() {
+        return _default_node_fill;
+    }
+
+    public NodeShape getDefaultNodeShape() {
+        return _default_node_shape;
+    }
+
+    public short getDefaultNodeShapeSize() {
+        return _default_node_shape_size;
+    }
+
     SortedMap<String, Color> getDisplayColors() {
         return _display_colors;
     }
@@ -465,6 +454,14 @@ public final class Configuration {
         return _domain_colors;
     }
 
+    public Color getDomainStructureBaseColor() {
+        return _domain_structure_base_color;
+    }
+
+    public Color getDomainStructureFontColor() {
+        return _domain_structure_font_color;
+    }
+
     int getGraphicsExportX() {
         return _graphics_export_x;
     }
@@ -473,8 +470,36 @@ public final class Configuration {
         return _graphics_export_y;
     }
 
-    public int getDefaultBootstrapSamples() {
-        return _default_bootstrap_samples;
+    Color getGuiBackgroundColor() {
+        return _gui_background_color;
+    }
+
+    Color getGuiButtonBackgroundColor() {
+        return _gui_button_background_color;
+    }
+
+    Color getGuiButtonBorderColor() {
+        return _gui_button_border_color;
+    }
+
+    Color getGuiButtonTextColor() {
+        return _gui_button_text_color;
+    }
+
+    Color getGuiCheckboxAndButtonActiveColor() {
+        return _gui_checkbox_and_button_active_color;
+    }
+
+    Color getGuiCheckboxTextColor() {
+        return _gui_checkbox_text_color;
+    }
+
+    Color getGuiMenuBackgroundColor() {
+        return _gui_menu_background_color;
+    }
+
+    Color getGuiMenuTextColor() {
+        return _gui_menu_text_color;
     }
 
     double getMinConfidenceValue() {
@@ -536,6 +561,10 @@ public final class Configuration {
         return _weblinks;
     }
 
+    public boolean isAbbreviateScientificTaxonNames() {
+        return _abbreviate_scientific_names;
+    }
+
     boolean isAntialiasScreen() {
         return _antialias_screen;
     }
@@ -544,6 +573,10 @@ public final class Configuration {
         return _background_color_gradient;
     }
 
+    public boolean isColorLabelsSameAsParentBranch() {
+        return _color_labels_same_as_parent_branch;
+    }
+
     /**
      * Convenience method.
      * 
@@ -585,6 +618,14 @@ public final class Configuration {
         return _show_branch_length_values;
     }
 
+    public boolean isShowDefaultNodeShapes() {
+        return _show_default_node_shapes;
+    }
+
+    public boolean isShowDomainLabels() {
+        return _show_domain_labels;
+    }
+
     boolean isShowOverview() {
         return _show_overview;
     }
@@ -593,8 +634,12 @@ public final class Configuration {
         return _show_scale;
     }
 
+    public boolean isTaxonomyColorizeNodeShapes() {
+        return _taxonomy_colorize_node_shapes;
+    }
+
     final boolean isUseNativeUI() {
-        if ( ( _ui == UI.UNKNOWN ) && Util.isMac() && Util.isJava15() ) {
+        if ( ( _ui == UI.UNKNOWN ) && AptxUtil.isMac() && AptxUtil.isJava15() ) {
             _ui = UI.NATIVE;
         }
         return _ui == UI.NATIVE;
@@ -680,13 +725,17 @@ public final class Configuration {
         final String[] fonts = font_str.split( ",+" );
         for( String font : fonts ) {
             font = font.replace( '_', ' ' ).trim();
-            if ( Arrays.binarySearch( Util.getAvailableFontFamiliesSorted(), font ) >= 0 ) {
+            if ( Arrays.binarySearch( AptxUtil.getAvailableFontFamiliesSorted(), font ) >= 0 ) {
                 setBaseFontFamilyName( font );
                 break;
             }
         }
     }
 
+    public void putDisplayColors( final String key, final Color color ) {
+        getDisplayColors().put( key, color );
+    }
+
     /**
      * read each line of config file, process non-comment lines
      * @throws IOException 
@@ -708,6 +757,10 @@ public final class Configuration {
         } while ( line != null );
     }
 
+    public void setAbbreviateScientificTaxonNames( final boolean abbreviate_scientific_names ) {
+        _abbreviate_scientific_names = abbreviate_scientific_names;
+    }
+
     private void setAntialiasScreen( final boolean antialias_screen ) {
         _antialias_screen = antialias_screen;
     }
@@ -716,35 +769,43 @@ public final class Configuration {
         _background_color_gradient = background_color_gradient;
     }
 
-    private void setBaseFontFamilyName( final String base_font_family_name ) {
+    public void setBaseFontFamilyName( final String base_font_family_name ) {
         _base_font_family_name = base_font_family_name;
     }
 
-    private void setBaseFontSize( final int base_font_size ) {
+    public void setBaseFontSize( final int base_font_size ) {
         _base_font_size = base_font_size;
     }
 
-    private void setShowDomainLabels( final boolean show_domain_labels ) {
-        _show_domain_labels = show_domain_labels;
+    private void setCladogramType( final CLADOGRAM_TYPE cladogram_type ) {
+        _cladogram_type = cladogram_type;
     }
 
-    private void setAbbreviateScientificTaxonNames( final boolean abbreviate_scientific_names ) {
-        _abbreviate_scientific_names = abbreviate_scientific_names;
+    public void setColorLabelsSameAsParentBranch( final boolean color_labels_same_as_parent_branch ) {
+        _color_labels_same_as_parent_branch = color_labels_same_as_parent_branch;
     }
 
-    private void setColorLabelsSameAsParentBranch( final boolean color_labels_same_as_parent_branch ) {
-        _color_labels_same_as_parent_branch = color_labels_same_as_parent_branch;
+    private void setDefaultBootstrapSamples( final int default_bootstrap_samples ) {
+        _default_bootstrap_samples = default_bootstrap_samples;
     }
 
-    private void setCladogramType( final CLADOGRAM_TYPE cladogram_type ) {
-        _cladogram_type = cladogram_type;
+    public void setDefaultNodeFill( final NodeFill default_node_fill ) {
+        _default_node_fill = default_node_fill;
+    }
+
+    public void setDefaultNodeShape( final NodeShape default_node_shape ) {
+        _default_node_shape = default_node_shape;
     }
 
-    void setDisplayColors( final SortedMap<String, Color> display_colors ) {
+    public void setDefaultNodeShapeSize( final short default_node_shape_size ) {
+        _default_node_shape_size = default_node_shape_size;
+    }
+
+    public void setDisplayColors( final SortedMap<String, Color> display_colors ) {
         _display_colors = display_colors;
     }
 
-    private void setDisplaySequenceRelations( final boolean display_sequence_relations ) {
+    public void setDisplaySequenceRelations( final boolean display_sequence_relations ) {
         _display_sequence_relations = display_sequence_relations;
     }
 
@@ -752,7 +813,7 @@ public final class Configuration {
         _editable = editable;
     }
 
-    private void setExtractPfamTaxonomyCodesInNhParsing( final boolean nh_parsing_extract_pfam_taxonomy_codes ) {
+    public void setExtractPfamTaxonomyCodesInNhParsing( final boolean nh_parsing_extract_pfam_taxonomy_codes ) {
         _nh_parsing_extract_pfam_taxonomy_codes = nh_parsing_extract_pfam_taxonomy_codes;
     }
 
@@ -764,10 +825,6 @@ public final class Configuration {
         _graphics_export_y = graphics_export_y;
     }
 
-    private void setDefaultBootstrapSamples( final int default_bootstrap_samples ) {
-        _default_bootstrap_samples = default_bootstrap_samples;
-    }
-
     private void setInternalNumberAreConfidenceForNhParsing( final boolean internal_number_are_confidence_for_nh_parsing ) {
         _internal_number_are_confidence_for_nh_parsing = internal_number_are_confidence_for_nh_parsing;
     }
@@ -1276,7 +1333,7 @@ public final class Configuration {
                                                       "configuration key [function_color] is deprecated" );
                 }
                 else if ( key.equals( DISPLAY_COLOR_KEY ) ) {
-                    getDisplayColors().put( ( String ) st.nextElement(), Color.decode( ( String ) st.nextElement() ) );
+                    putDisplayColors( ( String ) st.nextElement(), Color.decode( ( String ) st.nextElement() ) );
                 }
                 else if ( key.equals( WEB_LINK_KEY ) ) {
                     if ( st.countTokens() == 3 ) {
@@ -1301,19 +1358,19 @@ public final class Configuration {
         }
     }
 
-    private void setMinConfidenceValue( final double min_confidence_value ) {
+    public void setMinConfidenceValue( final double min_confidence_value ) {
         _min_confidence_value = min_confidence_value;
     }
 
-    void setNodeLabelDirection( final NODE_LABEL_DIRECTION node_label_direction ) {
+    public void setNodeLabelDirection( final NODE_LABEL_DIRECTION node_label_direction ) {
         _node_label_direction = node_label_direction;
     }
 
-    private void setNumberOfDigitsAfterCommaForBranchLengthValue( final short _number_of_digits_after_comma_for_branch_length_values ) {
+    public void setNumberOfDigitsAfterCommaForBranchLengthValue( final short _number_of_digits_after_comma_for_branch_length_values ) {
         this._number_of_digits_after_comma_for_branch_length_values = _number_of_digits_after_comma_for_branch_length_values;
     }
 
-    private void setNumberOfDigitsAfterCommaForConfidenceValues( final short _number_of_digits_after_comma_for_confidence_values ) {
+    public void setNumberOfDigitsAfterCommaForConfidenceValues( final short _number_of_digits_after_comma_for_confidence_values ) {
         this._number_of_digits_after_comma_for_confidence_values = _number_of_digits_after_comma_for_confidence_values;
     }
 
@@ -1329,30 +1386,42 @@ public final class Configuration {
         _ov_placement = ov_placement;
     }
 
-    void setPhylogenyGraphicsType( final PHYLOGENY_GRAPHICS_TYPE phylogeny_graphics_type ) {
+    public void setPhylogenyGraphicsType( final PHYLOGENY_GRAPHICS_TYPE phylogeny_graphics_type ) {
         _phylogeny_graphics_type = phylogeny_graphics_type;
     }
 
-    private void setPrintLineWidth( final float print_line_width ) {
+    public void setPrintLineWidth( final float print_line_width ) {
         _print_line_width = print_line_width;
     }
 
-    private void setReplaceUnderscoresInNhParsing( final boolean nh_parsing_replace_underscores ) {
+    public void setReplaceUnderscoresInNhParsing( final boolean nh_parsing_replace_underscores ) {
         _nh_parsing_replace_underscores = nh_parsing_replace_underscores;
     }
 
-    private void setShowBranchLengthValues( final boolean show_branch_length_values ) {
+    public void setShowBranchLengthValues( final boolean show_branch_length_values ) {
         _show_branch_length_values = show_branch_length_values;
     }
 
+    public void setShowDefaultNodeShapes( final boolean show_default_node_shapes ) {
+        _show_default_node_shapes = show_default_node_shapes;
+    }
+
+    public void setShowDomainLabels( final boolean show_domain_labels ) {
+        _show_domain_labels = show_domain_labels;
+    }
+
     private void setShowOverview( final boolean show_overview ) {
         _show_overview = show_overview;
     }
 
-    private void setShowScale( final boolean show_scale ) {
+    public void setShowScale( final boolean show_scale ) {
         _show_scale = show_scale;
     }
 
+    public void setTaxonomyColorizeNodeShapes( final boolean taxonomy_colorize_node_shapes ) {
+        _taxonomy_colorize_node_shapes = taxonomy_colorize_node_shapes;
+    }
+
     private void setValidatePhyloXmlAgainstSchema( final boolean validate_against_phyloxml_xsd_schema ) {
         _validate_against_phyloxml_xsd_schema = validate_against_phyloxml_xsd_schema;
     }
@@ -1369,63 +1438,7 @@ public final class Configuration {
         TRUE, FALSE, UNKNOWN
     }
 
-    public Color getDomainStructureFontColor() {
-        return _domain_structure_font_color;
-    }
-
-    public Color getDomainStructureBaseColor() {
-        return _domain_structure_base_color;
-    }
-
-    public boolean isColorLabelsSameAsParentBranch() {
-        return _color_labels_same_as_parent_branch;
-    }
-
-    public boolean isShowDomainLabels() {
-        return _show_domain_labels;
-    }
-
-    public boolean isAbbreviateScientificTaxonNames() {
-        return _abbreviate_scientific_names;
-    }
-
-    public NodeShape getDefaultNodeShape() {
-        return _default_node_shape;
-    }
-
-    private void setDefaultNodeShape( final NodeShape default_node_shape ) {
-        _default_node_shape = default_node_shape;
-    }
-
-    private void setDefaultNodeFill( final NodeFill default_node_fill ) {
-        _default_node_fill = default_node_fill;
-    }
-
-    public NodeFill getDefaultNodeFill() {
-        return _default_node_fill;
-    }
-
-    private void setDefaultNodeShapeSize( final short default_node_shape_size ) {
-        _default_node_shape_size = default_node_shape_size;
-    }
-
-    public short getDefaultNodeShapeSize() {
-        return _default_node_shape_size;
-    }
-
-    private void setTaxonomyColorizeNodeShapes( final boolean taxonomy_colorize_node_shapes ) {
-        _taxonomy_colorize_node_shapes = taxonomy_colorize_node_shapes;
-    }
-
-    public boolean isTaxonomyColorizeNodeShapes() {
-        return _taxonomy_colorize_node_shapes;
-    }
-
-    public boolean isShowDefaultNodeShapes() {
-        return _show_default_node_shapes;
-    }
-
-    private void setShowDefaultNodeShapes( final boolean show_default_node_shapes ) {
-        _show_default_node_shapes = show_default_node_shapes;
+    public enum UI {
+        NATIVE, CROSSPLATFORM, NIMBUS, UNKNOWN
     }
 }
index 5509327..4945ec2 100644 (file)
@@ -275,10 +275,10 @@ final class ControlPanel extends JPanel implements ActionListener {
             tp.requestFocus();
         }
         catch ( final Exception ex ) {
-            Util.unexpectedException( ex );
+            AptxUtil.unexpectedException( ex );
         }
         catch ( final Error err ) {
-            Util.unexpectedError( err );
+            AptxUtil.unexpectedError( err );
         }
     }
 
@@ -330,7 +330,7 @@ final class ControlPanel extends JPanel implements ActionListener {
         _zoom_in_y.setToolTipText( "To zoom in vertically [Shift+Up]" );
         _zoom_out_x.setToolTipText( "To zoom out horizontally [Shift+Left]" );
         _zoom_out_y.setToolTipText( "To zoom out vertically [Shift+Down]" );
-        if ( getConfiguration().isUseNativeUI() && Util.isMac() ) {
+        if ( getConfiguration().isUseNativeUI() && AptxUtil.isMac() ) {
             _zoom_out_x.setPreferredSize( new Dimension( 55, 10 ) );
             _zoom_in_x.setPreferredSize( new Dimension( 55, 10 ) );
         }
index 9c9eedd..bf900af 100644 (file)
@@ -49,7 +49,7 @@ public class FontChooser extends JDialog implements ActionListener, ListSelectio
     private String                _type;
     private int                   _style;
     private int                   _size;
-    private final JList           _font_list        = new JList( Util.getAvailableFontFamiliesSorted() );
+    private final JList           _font_list        = new JList( AptxUtil.getAvailableFontFamiliesSorted() );
     private final JList           _style_list       = new JList( STYLE );
     private final JList           _size_list        = new JList( SIZE );
     private final JTextField      _fonts_tf         = new JTextField();
index 38cb108..0410fed 100644 (file)
@@ -403,7 +403,7 @@ public abstract class MainFrame extends JFrame implements ActionListener {
         }
         else if ( o == _website_item ) {
             try {
-                Util.openWebsite( Constants.APTX_WEB_SITE, is_applet, applet );
+                AptxUtil.openWebsite( Constants.APTX_WEB_SITE, is_applet, applet );
             }
             catch ( final IOException e1 ) {
                 ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );
@@ -411,7 +411,7 @@ public abstract class MainFrame extends JFrame implements ActionListener {
         }
         else if ( o == _phyloxml_website_item ) {
             try {
-                Util.openWebsite( Constants.PHYLOXML_WEB_SITE, is_applet, applet );
+                AptxUtil.openWebsite( Constants.PHYLOXML_WEB_SITE, is_applet, applet );
             }
             catch ( final IOException e1 ) {
                 ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );
@@ -419,7 +419,7 @@ public abstract class MainFrame extends JFrame implements ActionListener {
         }
         else if ( o == _aptx_ref_item ) {
             try {
-                Util.openWebsite( Constants.APTX_REFERENCE_URL, is_applet, applet );
+                AptxUtil.openWebsite( Constants.APTX_REFERENCE_URL, is_applet, applet );
             }
             catch ( final IOException e1 ) {
                 ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );
@@ -427,7 +427,7 @@ public abstract class MainFrame extends JFrame implements ActionListener {
         }
         else if ( o == _phyloxml_ref_item ) {
             try {
-                Util.openWebsite( Constants.PHYLOXML_REFERENCE_URL, is_applet, applet );
+                AptxUtil.openWebsite( Constants.PHYLOXML_REFERENCE_URL, is_applet, applet );
             }
             catch ( final IOException e1 ) {
                 ForesterUtil.printErrorMessage( Constants.PRG_NAME, e1.toString() );
@@ -645,7 +645,7 @@ public abstract class MainFrame extends JFrame implements ActionListener {
 
     void colorRank() {
         if ( _mainpanel.getCurrentTreePanel() != null ) {
-            final String[] ranks = Util.getAllPossibleRanks();
+            final String[] ranks = AptxUtil.getAllPossibleRanks();
             final String rank = ( String ) JOptionPane
                     .showInputDialog( this,
                                       "What rank should the colorization be based on",
@@ -762,7 +762,7 @@ public abstract class MainFrame extends JFrame implements ActionListener {
         return _jmenubar;
     }
 
-    Options getOptions() {
+    public Options getOptions() {
         return _options;
     }
 
@@ -811,7 +811,7 @@ public abstract class MainFrame extends JFrame implements ActionListener {
 
     private void removeBranchColors() {
         if ( getMainPanel().getCurrentPhylogeny() != null ) {
-            Util.removeBranchColors( getMainPanel().getCurrentPhylogeny() );
+            AptxUtil.removeBranchColors( getMainPanel().getCurrentPhylogeny() );
         }
     }
 
@@ -1021,7 +1021,7 @@ public abstract class MainFrame extends JFrame implements ActionListener {
         if ( ( _mainpanel.getCurrentPhylogeny() == null ) || _mainpanel.getCurrentPhylogeny().isEmpty() ) {
             return;
         }
-        _textframe = TextFrame.instantiate( Util.crateBasicInformation( _mainpanel.getCurrentPhylogeny() ) );
+        _textframe = TextFrame.instantiate( AptxUtil.crateBasicInformation( _mainpanel.getCurrentPhylogeny() ) );
     }
 
     void viewAsNexus() {
@@ -1312,7 +1312,7 @@ public abstract class MainFrame extends JFrame implements ActionListener {
         if ( ( current_tree_panel == null ) || ( current_tree_panel.getPhylogeny() == null ) ) {
             mi.setEnabled( true );
         }
-        else if ( Util.isHasAtLeastOneBranchWithSupportValues( current_tree_panel.getPhylogeny() ) ) {
+        else if ( AptxUtil.isHasAtLeastOneBranchWithSupportValues( current_tree_panel.getPhylogeny() ) ) {
             mi.setEnabled( true );
         }
         else {
index c67d836..cf9a672 100644 (file)
@@ -84,7 +84,7 @@ public final class MainFrameApplet extends MainFrame {
         // Load the tree from URL
         if ( url != null ) {
             try {
-                phys = Util.readPhylogeniesFromUrl( url, getConfiguration().isValidatePhyloXmlAgainstSchema() );
+                phys = AptxUtil.readPhylogeniesFromUrl( url, getConfiguration().isValidatePhyloXmlAgainstSchema() );
             }
             catch ( final Exception e ) {
                 ForesterUtil.printErrorMessage( ArchaeopteryxA.NAME, e.toString() );
@@ -100,7 +100,7 @@ public final class MainFrameApplet extends MainFrame {
                     + "] are null or empty", "Failed to read phylogenies", JOptionPane.ERROR_MESSAGE );
         }
         else {
-            Util.printAppletMessage( ArchaeopteryxA.NAME, "loaded " + phys.length + " phylogenies from: " + url );
+            AptxUtil.printAppletMessage( ArchaeopteryxA.NAME, "loaded " + phys.length + " phylogenies from: " + url );
         }
         _mainpanel = new MainPanelApplets( _configuration, this );
         // build the menu bar
index ae302bd..5053d83 100644 (file)
@@ -59,10 +59,10 @@ import javax.swing.event.ChangeListener;
 import javax.swing.filechooser.FileFilter;
 import javax.swing.plaf.synth.SynthLookAndFeel;
 
+import org.forester.archaeopteryx.AptxUtil.GraphicsExportType;
 import org.forester.archaeopteryx.Options.CLADOGRAM_TYPE;
 import org.forester.archaeopteryx.Options.NODE_LABEL_DIRECTION;
 import org.forester.archaeopteryx.Options.PHYLOGENY_GRAPHICS_TYPE;
-import org.forester.archaeopteryx.Util.GraphicsExportType;
 import org.forester.archaeopteryx.tools.AncestralTaxonomyInferrer;
 import org.forester.archaeopteryx.tools.GoAnnotation;
 import org.forester.archaeopteryx.tools.PhyloInferenceDialog;
@@ -264,19 +264,19 @@ public final class MainFrameApplication extends MainFrame {
             //UIManager.setLookAndFeel( "com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel" );
         }
         catch ( final UnsupportedLookAndFeelException e ) {
-            Util.dieWithSystemError( "unsupported look and feel: " + e.toString() );
+            AptxUtil.dieWithSystemError( "unsupported look and feel: " + e.toString() );
         }
         catch ( final ClassNotFoundException e ) {
-            Util.dieWithSystemError( "class not found exception: " + e.toString() );
+            AptxUtil.dieWithSystemError( "class not found exception: " + e.toString() );
         }
         catch ( final InstantiationException e ) {
-            Util.dieWithSystemError( "instantiation exception: " + e.toString() );
+            AptxUtil.dieWithSystemError( "instantiation exception: " + e.toString() );
         }
         catch ( final IllegalAccessException e ) {
-            Util.dieWithSystemError( "illegal access exception: " + e.toString() );
+            AptxUtil.dieWithSystemError( "illegal access exception: " + e.toString() );
         }
         catch ( final Exception e ) {
-            Util.dieWithSystemError( e.toString() );
+            AptxUtil.dieWithSystemError( e.toString() );
         }
         // hide until everything is ready
         setVisible( false );
@@ -409,7 +409,7 @@ public final class MainFrameApplication extends MainFrame {
         // addKeyListener( this );
         setVisible( true );
         if ( ( phys != null ) && ( phys.length > 0 ) ) {
-            Util.addPhylogeniesToTabs( phys, title, null, _configuration, _mainpanel );
+            AptxUtil.addPhylogeniesToTabs( phys, title, null, _configuration, _mainpanel );
             validate();
             getMainPanel().getControlPanel().showWholeAll();
             getMainPanel().getControlPanel().showWhole();
@@ -420,9 +420,54 @@ public final class MainFrameApplication extends MainFrame {
         System.gc();
     }
 
+    private MainFrameApplication( final Phylogeny[] phys, final Configuration config ) {
+        _configuration = config;
+        if ( _configuration == null ) {
+            throw new IllegalArgumentException( "configuration is null" );
+        }
+        setVisible( false );
+        setOptions( Options.createInstance( _configuration ) );
+        _mainpanel = new MainPanel( _configuration, this );
+        _open_filechooser = null;
+        _open_filechooser_for_species_tree = null;
+        _save_filechooser = null;
+        _writetopdf_filechooser = null;
+        _writetographics_filechooser = null;
+        _msa_filechooser = null;
+        _seqs_filechooser = null;
+        _values_filechooser = null;
+        _jmenubar = new JMenuBar();
+        buildFileMenu();
+        buildTypeMenu();
+        _contentpane = getContentPane();
+        _contentpane.setLayout( new BorderLayout() );
+        _contentpane.add( _mainpanel, BorderLayout.CENTER );
+        // App is this big
+        setSize( MainFrameApplication.FRAME_X_SIZE, MainFrameApplication.FRAME_Y_SIZE );
+        // The window listener
+        setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE );
+        addWindowListener( new WindowAdapter() {
+
+            @Override
+            public void windowClosing( final WindowEvent e ) {
+                exit();
+            }
+        } );
+        //   setVisible( true );
+        if ( ( phys != null ) && ( phys.length > 0 ) ) {
+            AptxUtil.addPhylogeniesToTabs( phys, "", null, _configuration, _mainpanel );
+            validate();
+            getMainPanel().getControlPanel().showWholeAll();
+            getMainPanel().getControlPanel().showWhole();
+        }
+        //activateSaveAllIfNeeded();
+        // ...and its children
+        _contentpane.repaint();
+    }
+
     private MainFrameApplication( final Phylogeny[] phys, final String config_file, final String title ) {
         // Reads the config file (false, false => not url, not applet):
-        this( phys, new Configuration( config_file, false, false ), title );
+        this( phys, new Configuration( config_file, false, false, true ), title );
     }
 
     @Override
@@ -590,10 +635,10 @@ public final class MainFrameApplication extends MainFrame {
             _contentpane.repaint();
         }
         catch ( final Exception ex ) {
-            Util.unexpectedException( ex );
+            AptxUtil.unexpectedException( ex );
         }
         catch ( final Error err ) {
-            Util.unexpectedError( err );
+            AptxUtil.unexpectedError( err );
         }
     }
 
@@ -660,15 +705,15 @@ public final class MainFrameApplication extends MainFrame {
         _save_all_item.setEnabled( false );
         _file_jmenu.addSeparator();
         _file_jmenu.add( _write_to_pdf_item = new JMenuItem( "Export to PDF file ..." ) );
-        if ( Util.canWriteFormat( "tif" ) || Util.canWriteFormat( "tiff" ) || Util.canWriteFormat( "TIF" ) ) {
+        if ( AptxUtil.canWriteFormat( "tif" ) || AptxUtil.canWriteFormat( "tiff" ) || AptxUtil.canWriteFormat( "TIF" ) ) {
             _file_jmenu.add( _write_to_tif_item = new JMenuItem( "Export to TIFF file..." ) );
         }
         _file_jmenu.add( _write_to_png_item = new JMenuItem( "Export to PNG file..." ) );
         _file_jmenu.add( _write_to_jpg_item = new JMenuItem( "Export to JPG file..." ) );
-        if ( Util.canWriteFormat( "gif" ) ) {
+        if ( AptxUtil.canWriteFormat( "gif" ) ) {
             _file_jmenu.add( _write_to_gif_item = new JMenuItem( "Export to GIF file..." ) );
         }
-        if ( Util.canWriteFormat( "bmp" ) ) {
+        if ( AptxUtil.canWriteFormat( "bmp" ) ) {
             _file_jmenu.add( _write_to_bmp_item = new JMenuItem( "Export to BMP file..." ) );
         }
         _file_jmenu.addSeparator();
@@ -1293,6 +1338,13 @@ public final class MainFrameApplication extends MainFrame {
         System.exit( 0 );
     }
 
+    public void end() {
+        _mainpanel.terminate();
+        _contentpane.removeAll();
+        setVisible( false );
+        dispose();
+    }
+
     private void extractTaxCodeFromNodeNames() {
         if ( getCurrentTreePanel() != null ) {
             final Phylogeny phy = getCurrentTreePanel().getPhylogeny();
@@ -1414,7 +1466,7 @@ public final class MainFrameApplication extends MainFrame {
         phy.setRoot( node );
         phy.setRooted( true );
         phys[ 0 ] = phy;
-        Util.addPhylogeniesToTabs( phys, "", "", getConfiguration(), getMainPanel() );
+        AptxUtil.addPhylogeniesToTabs( phys, "", "", getConfiguration(), getMainPanel() );
         _mainpanel.getControlPanel().showWhole();
         _mainpanel.getCurrentTreePanel().setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR );
         _mainpanel.getOptions().setPhylogenyGraphicsType( PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR );
@@ -1773,11 +1825,11 @@ public final class MainFrameApplication extends MainFrame {
                                 }
                             }
                         }
-                        Util.addPhylogeniesToTabs( phys,
-                                                   file.getName(),
-                                                   file.getAbsolutePath(),
-                                                   getConfiguration(),
-                                                   getMainPanel() );
+                        AptxUtil.addPhylogeniesToTabs( phys,
+                                                       file.getName(),
+                                                       file.getAbsolutePath(),
+                                                       getConfiguration(),
+                                                       getMainPanel() );
                         _mainpanel.getControlPanel().showWhole();
                         if ( nhx_or_nexus && one_desc ) {
                             JOptionPane
@@ -2077,11 +2129,11 @@ public final class MainFrameApplication extends MainFrame {
                         PhylogenyMethods.transferInternalNodeNamesToConfidence( phy );
                     }
                 }
-                Util.addPhylogeniesToTabs( phys,
-                                           new File( url.getFile() ).getName(),
-                                           new File( url.getFile() ).toString(),
-                                           getConfiguration(),
-                                           getMainPanel() );
+                AptxUtil.addPhylogeniesToTabs( phys,
+                                               new File( url.getFile() ).getName(),
+                                               new File( url.getFile() ).toString(),
+                                               getConfiguration(),
+                                               getMainPanel() );
                 _mainpanel.getControlPanel().showWhole();
             }
         }
@@ -2305,20 +2357,20 @@ public final class MainFrameApplication extends MainFrame {
         return exception;
     }
 
-    private void writePhylogenyToGraphicsFile( final String file_name, final GraphicsExportType type ) {
+    void writePhylogenyToGraphicsFile( final String file_name, final GraphicsExportType type ) {
         _mainpanel.getCurrentTreePanel().setParametersForPainting( _mainpanel.getCurrentTreePanel().getWidth(),
                                                                    _mainpanel.getCurrentTreePanel().getHeight(),
                                                                    true );
         String file_written_to = "";
         boolean error = false;
         try {
-            file_written_to = Util.writePhylogenyToGraphicsFile( file_name,
-                                                                 _mainpanel.getCurrentTreePanel().getWidth(),
-                                                                 _mainpanel.getCurrentTreePanel().getHeight(),
-                                                                 _mainpanel.getCurrentTreePanel(),
-                                                                 _mainpanel.getControlPanel(),
-                                                                 type,
-                                                                 getOptions() );
+            file_written_to = AptxUtil.writePhylogenyToGraphicsFile( file_name,
+                                                                     _mainpanel.getCurrentTreePanel().getWidth(),
+                                                                     _mainpanel.getCurrentTreePanel().getHeight(),
+                                                                     _mainpanel.getCurrentTreePanel(),
+                                                                     _mainpanel.getControlPanel(),
+                                                                     type,
+                                                                     getOptions() );
         }
         catch ( final IOException e ) {
             error = true;
@@ -2530,6 +2582,10 @@ public final class MainFrameApplication extends MainFrame {
         return new MainFrameApplication( phys, config, title );
     }
 
+    public static MainFrameApplication createInstance( final Phylogeny[] phys, final Configuration config ) {
+        return new MainFrameApplication( phys, config );
+    }
+
     static MainFrame createInstance( final Phylogeny[] phys, final String config_file_name, final String title ) {
         return new MainFrameApplication( phys, config_file_name, title );
     }
index 141488a..59fda58 100644 (file)
@@ -207,7 +207,7 @@ public class MainPanel extends JPanel implements ComponentListener {
         return _configuration;
     }
 
-    ControlPanel getControlPanel() {
+    public ControlPanel getControlPanel() {
         return _control_panel;
     }
 
index 5a777ca..ee5fda2 100644 (file)
@@ -565,7 +565,7 @@ class NodeEditPanel extends JPanel {
     }
 
     private List<Point> obtainPoints() {
-        Util.ensurePresenceOfDistribution( getMyNode() );
+        AptxUtil.ensurePresenceOfDistribution( getMyNode() );
         Distribution d = getMyNode().getNodeData().getDistribution();
         if ( d.getPoints() == null ) {
             d = new Distribution( d.getDesc(), new ArrayList<Point>(), d.getPolygons() );
@@ -731,7 +731,7 @@ class NodeEditPanel extends JPanel {
                 }
                 break;
             case TAXONOMY_CODE:
-                Util.ensurePresenceOfTaxonomy( getMyNode() );
+                AptxUtil.ensurePresenceOfTaxonomy( getMyNode() );
                 try {
                     getMyNode().getNodeData().getTaxonomy().setTaxonomyCode( value );
                 }
@@ -741,15 +741,15 @@ class NodeEditPanel extends JPanel {
                 }
                 break;
             case TAXONOMY_SCIENTIFIC_NAME:
-                Util.ensurePresenceOfTaxonomy( getMyNode() );
+                AptxUtil.ensurePresenceOfTaxonomy( getMyNode() );
                 getMyNode().getNodeData().getTaxonomy().setScientificName( value );
                 break;
             case TAXONOMY_COMMON_NAME:
-                Util.ensurePresenceOfTaxonomy( getMyNode() );
+                AptxUtil.ensurePresenceOfTaxonomy( getMyNode() );
                 getMyNode().getNodeData().getTaxonomy().setCommonName( value );
                 break;
             case TAXONOMY_RANK:
-                Util.ensurePresenceOfTaxonomy( getMyNode() );
+                AptxUtil.ensurePresenceOfTaxonomy( getMyNode() );
                 try {
                     getMyNode().getNodeData().getTaxonomy().setRank( value.toLowerCase() );
                 }
@@ -759,7 +759,7 @@ class NodeEditPanel extends JPanel {
                 }
                 break;
             case TAXONOMY_AUTHORITY:
-                Util.ensurePresenceOfTaxonomy( getMyNode() );
+                AptxUtil.ensurePresenceOfTaxonomy( getMyNode() );
                 getMyNode().getNodeData().getTaxonomy().setAuthority( value );
                 break;
             case TAXONOMY_URI: {
@@ -777,7 +777,7 @@ class NodeEditPanel extends JPanel {
                     }
                 }
                 if ( uri != null ) {
-                    Util.ensurePresenceOfTaxonomy( getMyNode() );
+                    AptxUtil.ensurePresenceOfTaxonomy( getMyNode() );
                 }
                 addUri( mtn, uri, number, getMyNode().getNodeData().getTaxonomy() );
                 break;
@@ -788,7 +788,7 @@ class NodeEditPanel extends JPanel {
                 }
                 else if ( getMyNode().getNodeData().getTaxonomy().getSynonyms().size() == number ) {
                     if ( !ForesterUtil.isEmpty( value ) ) {
-                        Util.ensurePresenceOfTaxonomy( getMyNode() );
+                        AptxUtil.ensurePresenceOfTaxonomy( getMyNode() );
                         getMyNode().getNodeData().getTaxonomy().getSynonyms().add( value );
                     }
                 }
@@ -797,7 +797,7 @@ class NodeEditPanel extends JPanel {
                 }
                 break;
             case TAXONOMY_ID_VALUE:
-                Util.ensurePresenceOfTaxonomy( getMyNode() );
+                AptxUtil.ensurePresenceOfTaxonomy( getMyNode() );
                 if ( getMyNode().getNodeData().getTaxonomy().getIdentifier() == null ) {
                     getMyNode().getNodeData().getTaxonomy().setIdentifier( new Identifier( value ) );
                 }
@@ -807,7 +807,7 @@ class NodeEditPanel extends JPanel {
                 }
                 break;
             case TAXONOMY_ID_PROVIDER:
-                Util.ensurePresenceOfTaxonomy( getMyNode() );
+                AptxUtil.ensurePresenceOfTaxonomy( getMyNode() );
                 if ( getMyNode().getNodeData().getTaxonomy().getIdentifier() == null ) {
                     getMyNode().getNodeData().getTaxonomy().setIdentifier( new Identifier( "", value ) );
                 }
@@ -817,19 +817,19 @@ class NodeEditPanel extends JPanel {
                 }
                 break;
             case SEQ_LOCATION:
-                Util.ensurePresenceOfSequence( getMyNode() );
+                AptxUtil.ensurePresenceOfSequence( getMyNode() );
                 getMyNode().getNodeData().getSequence().setLocation( value );
                 break;
             case SEQ_MOL_SEQ:
-                Util.ensurePresenceOfSequence( getMyNode() );
+                AptxUtil.ensurePresenceOfSequence( getMyNode() );
                 getMyNode().getNodeData().getSequence().setMolecularSequence( value );
                 break;
             case SEQ_NAME:
-                Util.ensurePresenceOfSequence( getMyNode() );
+                AptxUtil.ensurePresenceOfSequence( getMyNode() );
                 getMyNode().getNodeData().getSequence().setName( value );
                 break;
             case SEQ_SYMBOL:
-                Util.ensurePresenceOfSequence( getMyNode() );
+                AptxUtil.ensurePresenceOfSequence( getMyNode() );
                 try {
                     getMyNode().getNodeData().getSequence().setSymbol( value );
                 }
@@ -839,7 +839,7 @@ class NodeEditPanel extends JPanel {
                 }
                 break;
             case SEQ_TYPE:
-                Util.ensurePresenceOfSequence( getMyNode() );
+                AptxUtil.ensurePresenceOfSequence( getMyNode() );
                 try {
                     getMyNode().getNodeData().getSequence().setType( value.toLowerCase() );
                 }
@@ -849,7 +849,7 @@ class NodeEditPanel extends JPanel {
                 }
                 break;
             case SEQ_ACC_SOURCE:
-                Util.ensurePresenceOfSequence( getMyNode() );
+                AptxUtil.ensurePresenceOfSequence( getMyNode() );
                 if ( getMyNode().getNodeData().getSequence().getAccession() == null ) {
                     getMyNode().getNodeData().getSequence().setAccession( new Accession( "", value ) );
                 }
@@ -859,7 +859,7 @@ class NodeEditPanel extends JPanel {
                 }
                 break;
             case SEQ_ACC_VALUE:
-                Util.ensurePresenceOfSequence( getMyNode() );
+                AptxUtil.ensurePresenceOfSequence( getMyNode() );
                 if ( getMyNode().getNodeData().getSequence().getAccession() == null ) {
                     getMyNode().getNodeData().getSequence().setAccession( new Accession( value, "" ) );
                 }
@@ -883,7 +883,7 @@ class NodeEditPanel extends JPanel {
                     }
                 }
                 if ( uri != null ) {
-                    Util.ensurePresenceOfSequence( getMyNode() );
+                    AptxUtil.ensurePresenceOfSequence( getMyNode() );
                 }
                 addUri( mtn, uri, number, getMyNode().getNodeData().getSequence() );
                 break;
@@ -925,23 +925,23 @@ class NodeEditPanel extends JPanel {
                 getMyNode().getNodeData().getEvent().setGeneLosses( parsePositiveInt( mtn, value ) );
                 break;
             case DATE_DESCRIPTION:
-                Util.ensurePresenceOfDate( getMyNode() );
+                AptxUtil.ensurePresenceOfDate( getMyNode() );
                 getMyNode().getNodeData().getDate().setDesc( value );
                 break;
             case DATE_MAX:
-                Util.ensurePresenceOfDate( getMyNode() );
+                AptxUtil.ensurePresenceOfDate( getMyNode() );
                 getMyNode().getNodeData().getDate().setMax( parseBigDecimal( mtn, value ) );
                 break;
             case DATE_MIN:
-                Util.ensurePresenceOfDate( getMyNode() );
+                AptxUtil.ensurePresenceOfDate( getMyNode() );
                 getMyNode().getNodeData().getDate().setMin( parseBigDecimal( mtn, value ) );
                 break;
             case DATE_UNIT:
-                Util.ensurePresenceOfDate( getMyNode() );
+                AptxUtil.ensurePresenceOfDate( getMyNode() );
                 getMyNode().getNodeData().getDate().setUnit( value );
                 break;
             case DATE_VALUE:
-                Util.ensurePresenceOfDate( getMyNode() );
+                AptxUtil.ensurePresenceOfDate( getMyNode() );
                 getMyNode().getNodeData().getDate().setValue( parseBigDecimal( mtn, value ) );
                 break;
             case DIST_ALT: {
@@ -960,7 +960,7 @@ class NodeEditPanel extends JPanel {
                 break;
             }
             case DIST_DESC: {
-                Util.ensurePresenceOfDistribution( getMyNode() );
+                AptxUtil.ensurePresenceOfDistribution( getMyNode() );
                 final Distribution d = getMyNode().getNodeData().getDistribution();
                 getMyNode().getNodeData().setDistribution( new Distribution( value, d.getPoints(), d.getPolygons() ) );
                 break;
index 083a6b1..594c9ab 100644 (file)
@@ -154,7 +154,7 @@ final public class Options {
         _editable = true;
         _background_color_gradient = false;
         _show_default_node_shapes = false;
-        if ( Util.isUsOrCanada() ) {
+        if ( AptxUtil.isUsOrCanada() ) {
             _print_size_x = Constants.US_LETTER_SIZE_X;
             _print_size_y = Constants.US_LETTER_SIZE_Y;
         }
@@ -498,11 +498,11 @@ final public class Options {
         return instance;
     }
 
-    static enum CLADOGRAM_TYPE {
+    public static enum CLADOGRAM_TYPE {
         NON_LINED_UP, EXT_NODE_SUM_DEP, TOTAL_NODE_SUM_DEP;
     }
 
-    static enum NODE_LABEL_DIRECTION {
+    public static enum NODE_LABEL_DIRECTION {
         HORIZONTAL, RADIAL;
     }
 
@@ -528,7 +528,7 @@ final public class Options {
         }
     }
 
-    static enum PHYLOGENY_GRAPHICS_TYPE {
+    public static enum PHYLOGENY_GRAPHICS_TYPE {
         RECTANGULAR, TRIANGULAR, EURO_STYLE, ROUNDED, CONVEX, CURVED, UNROOTED, CIRCULAR;
     }
 }
index 28fdfa9..b1c7feb 100644 (file)
@@ -92,10 +92,10 @@ final class PdfExporter {
         document.open();
         final DefaultFontMapper mapper = new DefaultFontMapper();
         FontFactory.registerDirectories();
-        if ( Util.isWindows() ) {
+        if ( AptxUtil.isWindows() ) {
             mapper.insertDirectory( "C:\\WINDOWS\\Fonts\\" );
         }
-        else if ( Util.isMac() ) {
+        else if ( AptxUtil.isMac() ) {
             mapper.insertDirectory( "/Library/Fonts/" );
             mapper.insertDirectory( "/System/Library/Fonts/" );
         }
@@ -111,7 +111,7 @@ final class PdfExporter {
             tree_panel.paintPhylogeny( g2, true, false, width, height, 0, 0 );
         }
         catch ( final Exception e ) {
-            Util.unexpectedException( e );
+            AptxUtil.unexpectedException( e );
         }
         finally {
             try {
index f822bf1..2abad1d 100644 (file)
@@ -34,15 +34,32 @@ import org.forester.util.ForesterUtil;
 /*
  * Maintains the color schemes and a set of colors for drawing a tree.
  */
-final class TreeColorSet {
-
-    static final String[]   SCHEME_NAMES   = { "Default", "Black", "Black & White", "Silver", "The Matrix",
-            "White & Blue", "Cyan", "Clockwork", "Blue", "Blue & White", "Neon" };
-    static final String[]   COLOR_FIELDS   = { "Background", "Background Gradient Bottom", "Sequence", "Taxonomy",
-            "Confidence", "Branch Length", "Branch", "Node Box", "Collapsed", "Matching Nodes", "Duplication",
-            "Speciation", "Duplication or Specation", "Domains", "Binary Domain Combinations", "Annotation", "Overview" };
+public final class TreeColorSet {
+
+    public static final String OVERVIEW                   = "Overview";
+    public static final String ANNOTATION                 = "Annotation";
+    public static final String BINARY_DOMAIN_COMBINATIONS = "Binary Domain Combinations";
+    public static final String DOMAINS                    = "Domains";
+    public static final String DUPLICATION_OR_SPECATION   = "Duplication or Specation";
+    public static final String SPECIATION                 = "Speciation";
+    public static final String DUPLICATION                = "Duplication";
+    public static final String MATCHING_NODES             = "Matching Nodes";
+    public static final String COLLAPSED                  = "Collapsed";
+    public static final String NODE_BOX                   = "Node Box";
+    public static final String BRANCH                     = "Branch";
+    public static final String BRANCH_LENGTH              = "Branch Length";
+    public static final String CONFIDENCE                 = "Confidence";
+    public static final String TAXONOMY                   = "Taxonomy";
+    public static final String SEQUENCE                   = "Sequence";
+    public static final String BACKGROUND_GRADIENT_BOTTOM = "Background Gradient Bottom";
+    public static final String BACKGROUND                 = "Background";
+    static final String[]      SCHEME_NAMES               = { "Default", "Black", "Black & White", "Silver",
+            "The Matrix", "White & Blue", "Cyan", "Clockwork", "Blue", "Blue & White", "Neon" };
+    static final String[]      COLOR_FIELDS               = { BACKGROUND, BACKGROUND_GRADIENT_BOTTOM, SEQUENCE,
+            TAXONOMY, CONFIDENCE, BRANCH_LENGTH, BRANCH, NODE_BOX, COLLAPSED, MATCHING_NODES, DUPLICATION, SPECIATION,
+            DUPLICATION_OR_SPECATION, DOMAINS, BINARY_DOMAIN_COMBINATIONS, ANNOTATION, OVERVIEW };
     // All the color sets; better be the same # of sets as there are names!
-    private final Color[][] _color_schemes = { { new Color( 0, 0, 0 ), // background_color
+    private final Color[][]    _color_schemes             = { { new Color( 0, 0, 0 ), // background_color
             new Color( 0, 100, 100 ), // background_color_gradient_bottom
             new Color( 220, 220, 220 ), // sequence  __ Default (same as Black)
             new Color( 180, 180, 180 ), // taxonomy
@@ -58,7 +75,7 @@ final class TreeColorSet {
             new Color( 123, 104, 238 ), // domains_color  
             new Color( 65, 105, 255 ), // binary_domain_combinations_color  
             new Color( 173, 255, 47 ) // annotation
-            , new Color( 130, 130, 130 )  // overview
+            , new Color( 130, 130, 130 )                 // overview
             }, { new Color( 0, 0, 0 ), // background_color
             new Color( 0, 255, 255 ), // background_color_gradient_bottom    
             new Color( 220, 220, 220 ), // sequence  __ Black
@@ -229,27 +246,27 @@ final class TreeColorSet {
             new Color( 27, 255, 0 ), // binary_domain_combinations_color
             new Color( 27, 255, 0 ) // annotation
             , new Color( 77, 77, 255 ) // ov
-            }                             };
+            }                                            };
     // Color schemes:
-    private int             _color_scheme;
+    private int                _color_scheme;
     // The drawing colors
-    private Color           seq_color;
-    private Color           taxonomy_color;
-    private Color           bootstrap_color;
-    private Color           branch_length_color;
-    private Color           branch_color;
-    private Color           box_color;
-    private Color           background_color;
-    private Color           background_color_gradient_bottom;
-    private Color           dup_box_color;
-    private Color           spec_box_color;
-    private Color           collapse_fill_color;
-    private Color           found_color;
-    private Color           duplication_or_specation_color;
-    private Color           domains_color;
-    private Color           binary_domain_combinations_color;
-    private Color           annotation_color;
-    private Color           ov_color;
+    private Color              seq_color;
+    private Color              taxonomy_color;
+    private Color              bootstrap_color;
+    private Color              branch_length_color;
+    private Color              branch_color;
+    private Color              box_color;
+    private Color              background_color;
+    private Color              background_color_gradient_bottom;
+    private Color              dup_box_color;
+    private Color              spec_box_color;
+    private Color              collapse_fill_color;
+    private Color              found_color;
+    private Color              duplication_or_specation_color;
+    private Color              domains_color;
+    private Color              binary_domain_combinations_color;
+    private Color              annotation_color;
+    private Color              ov_color;
 
     private TreeColorSet() {
         // Hidden constructor.
index 32de234..3aa861c 100644 (file)
@@ -267,7 +267,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
         _main_panel = tjp;
         _configuration = configuration;
         _phylogeny = t;
-        _phy_has_branch_lengths = Util.isHasAtLeastOneBranchLengthLargerThanZero( _phylogeny );
+        _phy_has_branch_lengths = AptxUtil.isHasAtLeastOneBranchLengthLargerThanZero( _phylogeny );
         init();
         // if ( !_phylogeny.isEmpty() ) {
         _phylogeny.recalculateNumberOfExternalDescendants( true );
@@ -664,7 +664,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
         // Look in species hash
         Color c = getControlPanel().getSpeciesColors().get( species );
         if ( c == null ) {
-            c = Util.calculateColorFromString( species );
+            c = AptxUtil.calculateColorFromString( species );
             getControlPanel().getSpeciesColors().put( species, c );
         }
         return c;
@@ -693,7 +693,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
         }
         if ( !node.isExternal() && !node.isRoot() ) {
             final boolean collapse = !node.isCollapse();
-            Util.collapseSubtree( node, collapse );
+            AptxUtil.collapseSubtree( node, collapse );
             updateSetOfCollapsedExternalNodes( _phylogeny );
             _phylogeny.recalculateNumberOfExternalDescendants( true );
             resetNodeIdToDistToLeafMap();
@@ -711,7 +711,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
             return;
         }
         setWaitCursor();
-        Util.collapseSpeciesSpecificSubtrees( _phylogeny );
+        AptxUtil.collapseSpeciesSpecificSubtrees( _phylogeny );
         updateSetOfCollapsedExternalNodes( _phylogeny );
         _phylogeny.recalculateNumberOfExternalDescendants( true );
         resetNodeIdToDistToLeafMap();
@@ -767,8 +767,8 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
             return;
         }
         setWaitCursor();
-        Util.removeBranchColors( _phylogeny );
-        Util.colorPhylogenyAccordingToConfidenceValues( _phylogeny, this );
+        AptxUtil.removeBranchColors( _phylogeny );
+        AptxUtil.colorPhylogenyAccordingToConfidenceValues( _phylogeny, this );
         _control_panel.setColorBranches( true );
         if ( _control_panel.getColorBranchesCb() != null ) {
             _control_panel.getColorBranchesCb().setSelected( true );
@@ -782,8 +782,8 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
             return;
         }
         setWaitCursor();
-        Util.removeBranchColors( _phylogeny );
-        final int colorizations = Util.colorPhylogenyAccordingToRanks( _phylogeny, rank, this );
+        AptxUtil.removeBranchColors( _phylogeny );
+        final int colorizations = AptxUtil.colorPhylogenyAccordingToRanks( _phylogeny, rank, this );
         if ( colorizations > 0 ) {
             _control_panel.setColorBranches( true );
             if ( _control_panel.getColorBranchesCb() != null ) {
@@ -1342,7 +1342,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
             return;
         }
         setWaitCursor();
-        Util.inferCommonPartOfScientificNames( _phylogeny );
+        AptxUtil.inferCommonPartOfScientificNames( _phylogeny );
         setArrowCursor();
         repaint();
     }
@@ -2117,7 +2117,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
             uri_str = url + URLEncoder.encode( seq.getAccession().getValue(), ForesterConstants.UTF8 );
         }
         catch ( final UnsupportedEncodingException e ) {
-            Util.showErrorMessage( this, e.toString() );
+            AptxUtil.showErrorMessage( this, e.toString() );
             e.printStackTrace();
         }
         if ( !ForesterUtil.isEmpty( uri_str ) ) {
@@ -2126,14 +2126,14 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
                 if ( isApplet() ) {
                     applet = obtainApplet();
                 }
-                Util.launchWebBrowser( new URI( uri_str ), isApplet(), applet, "_aptx_seq" );
+                AptxUtil.launchWebBrowser( new URI( uri_str ), isApplet(), applet, "_aptx_seq" );
             }
             catch ( final IOException e ) {
-                Util.showErrorMessage( this, e.toString() );
+                AptxUtil.showErrorMessage( this, e.toString() );
                 e.printStackTrace();
             }
             catch ( final URISyntaxException e ) {
-                Util.showErrorMessage( this, e.toString() );
+                AptxUtil.showErrorMessage( this, e.toString() );
                 e.printStackTrace();
             }
         }
@@ -2157,7 +2157,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
                 uri_str = weblink.getUrl() + URLEncoder.encode( tax.getIdentifier().getValue(), ForesterConstants.UTF8 );
             }
             catch ( final UnsupportedEncodingException e ) {
-                Util.showErrorMessage( this, e.toString() );
+                AptxUtil.showErrorMessage( this, e.toString() );
                 e.printStackTrace();
             }
         }
@@ -2167,7 +2167,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
                 uri_str = new URI( tax.getIdentifier().getValue() ).toString();
             }
             catch ( final URISyntaxException e ) {
-                Util.showErrorMessage( this, e.toString() );
+                AptxUtil.showErrorMessage( this, e.toString() );
                 uri_str = null;
                 e.printStackTrace();
             }
@@ -2178,7 +2178,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
                         + URLEncoder.encode( tax.getScientificName(), ForesterConstants.UTF8 );
             }
             catch ( final UnsupportedEncodingException e ) {
-                Util.showErrorMessage( this, e.toString() );
+                AptxUtil.showErrorMessage( this, e.toString() );
                 e.printStackTrace();
             }
         }
@@ -2188,7 +2188,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
                         + URLEncoder.encode( tax.getTaxonomyCode(), ForesterConstants.UTF8 );
             }
             catch ( final UnsupportedEncodingException e ) {
-                Util.showErrorMessage( this, e.toString() );
+                AptxUtil.showErrorMessage( this, e.toString() );
                 e.printStackTrace();
             }
         }
@@ -2198,7 +2198,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
                         + URLEncoder.encode( tax.getCommonName(), ForesterConstants.UTF8 );
             }
             catch ( final UnsupportedEncodingException e ) {
-                Util.showErrorMessage( this, e.toString() );
+                AptxUtil.showErrorMessage( this, e.toString() );
                 e.printStackTrace();
             }
         }
@@ -2208,14 +2208,14 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
                 if ( isApplet() ) {
                     applet = obtainApplet();
                 }
-                Util.launchWebBrowser( new URI( uri_str ), isApplet(), applet, "_aptx_tax" );
+                AptxUtil.launchWebBrowser( new URI( uri_str ), isApplet(), applet, "_aptx_tax" );
             }
             catch ( final IOException e ) {
-                Util.showErrorMessage( this, e.toString() );
+                AptxUtil.showErrorMessage( this, e.toString() );
                 e.printStackTrace();
             }
             catch ( final URISyntaxException e ) {
-                Util.showErrorMessage( this, e.toString() );
+                AptxUtil.showErrorMessage( this, e.toString() );
                 e.printStackTrace();
             }
         }
@@ -2828,7 +2828,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
             if ( ( to_pdf || to_graphics_file ) && getOptions().isPrintBlackAndWhite() ) {
                 outline_color = Color.BLACK;
             }
-            else if ( getControlPanel().isEvents() && Util.isHasAssignedEvent( node ) ) {
+            else if ( getControlPanel().isEvents() && AptxUtil.isHasAssignedEvent( node ) ) {
                 final Event event = node.getNodeData().getEvent();
                 if ( event.isDuplication() ) {
                     outline_color = getTreeColorSet().getDuplicationBoxColor();
@@ -4391,7 +4391,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
      * @param x
      * @param y
      */
-    final void setParametersForPainting( final int x, final int y, final boolean recalc_longest_ext_node_info ) {
+    public final void setParametersForPainting( final int x, final int y, final boolean recalc_longest_ext_node_info ) {
         // updateStyle(); not needed?
         if ( ( _phylogeny != null ) && !_phylogeny.isEmpty() ) {
             initNodeData();
@@ -4924,7 +4924,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
             return;
         }
         setWaitCursor();
-        Util.colorPhylogenyAccordingToExternalTaxonomy( _phylogeny, this );
+        AptxUtil.colorPhylogenyAccordingToExternalTaxonomy( _phylogeny, this );
         _control_panel.setColorBranches( true );
         if ( _control_panel.getColorBranchesCb() != null ) {
             _control_panel.getColorBranchesCb().setSelected( true );
index 572a24c..838ce62 100644 (file)
@@ -213,7 +213,7 @@ public class UrlTreeReader implements Runnable {
                             my_name_for_file = new String( sb.toString().replaceAll( " ", "_" ) );
                         }
                         _main_frame.getMainPanel().getCurrentTreePanel().setTreeFile( new File( my_name_for_file ) );
-                        Util.lookAtSomeTreePropertiesForAptxControlSettings( phylogeny, _main_frame.getMainPanel()
+                        AptxUtil.lookAtSomeTreePropertiesForAptxControlSettings( phylogeny, _main_frame.getMainPanel()
                                 .getControlPanel(), _main_frame.getConfiguration() );
                         _main_frame.getMainPanel().getControlPanel().showWhole();
                     }
index f3e9aa9..777dacf 100644 (file)
@@ -34,9 +34,9 @@ import java.util.List;
 
 import javax.imageio.ImageIO;
 
+import org.forester.archaeopteryx.AptxUtil;
 import org.forester.archaeopteryx.Constants;
 import org.forester.archaeopteryx.TreePanel;
-import org.forester.archaeopteryx.Util;
 import org.forester.phylogeny.PhylogenyNode;
 import org.forester.phylogeny.data.Taxonomy;
 import org.forester.phylogeny.data.Uri;
@@ -89,11 +89,11 @@ public class ImageLoader implements Runnable {
                                 bi = ImageIO.read( uri.getValue().toURL() );
                             }
                             catch ( final MalformedURLException e ) {
-                                Util.printWarningMessage( Constants.PRG_NAME, "\"" + uri.getValue()
+                                AptxUtil.printWarningMessage( Constants.PRG_NAME, "\"" + uri.getValue()
                                         + "\": Malformed URL Exception: " + e.getLocalizedMessage() );
                             }
                             catch ( final IOException e ) {
-                                Util.printWarningMessage( Constants.PRG_NAME, "\"" + uri.getValue()
+                                AptxUtil.printWarningMessage( Constants.PRG_NAME, "\"" + uri.getValue()
                                         + "\": IO Exception: " + e.getLocalizedMessage() );
                             }
                             if ( bi != null ) {
index 767a417..fbfd4c2 100644 (file)
@@ -45,8 +45,8 @@ import javax.swing.JTextField;
 import javax.swing.border.Border;
 import javax.swing.border.LineBorder;
 
+import org.forester.archaeopteryx.AptxUtil;
 import org.forester.archaeopteryx.MainFrameApplication;
-import org.forester.archaeopteryx.Util;
 import org.forester.evoinference.distance.PairwiseDistanceCalculator.PWD_DISTANCE_METHOD;
 import org.forester.sequence.Sequence;
 import org.forester.util.BasicDescriptiveStatistics;
@@ -213,7 +213,7 @@ public class PhyloInferenceDialog extends JDialog implements ActionListener {
         bootstrap_pnl.setLayout( new FlowLayout() );
         bootstrap_pnl.add( _bootstrap_cb = new JCheckBox( "Perform Bootstrap Resampling" ) );
         bootstrap_pnl.add( new JLabel( "Number of Bootstrap Samples:" ) );
-        bootstrap_pnl.add( _bootstrap_tf = new JFormattedTextField( Util.createMaskFormatter( "###" ) ) );
+        bootstrap_pnl.add( _bootstrap_tf = new JFormattedTextField( AptxUtil.createMaskFormatter( "###" ) ) );
         _bootstrap_tf.setColumns( 4 );
         // TODO see
         // http://download.oracle.com/javase/tutorial/uiswing/components/formattedtextfield.html
index c5fa04d..a44fe96 100644 (file)
@@ -31,9 +31,11 @@ import java.io.FileWriter;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.regex.Matcher;
 
 import javax.swing.JOptionPane;
 
+import org.forester.archaeopteryx.AptxUtil;
 import org.forester.archaeopteryx.MainFrameApplication;
 import org.forester.evoinference.distance.NeighborJoining;
 import org.forester.evoinference.distance.PairwiseDistanceCalculator;
@@ -49,6 +51,9 @@ import org.forester.msa.MsaInferrer;
 import org.forester.msa.MsaTools;
 import org.forester.msa.ResampleableMsa;
 import org.forester.phylogeny.Phylogeny;
+import org.forester.phylogeny.PhylogenyNode;
+import org.forester.phylogeny.data.Accession;
+import org.forester.phylogeny.iterators.PhylogenyNodeIterator;
 import org.forester.sequence.Sequence;
 import org.forester.tools.ConfidenceAssessor;
 import org.forester.util.ForesterUtil;
@@ -147,7 +152,7 @@ public class PhylogeneticInferrer implements Runnable {
         }
         final NeighborJoining nj = new NeighborJoining();
         final Phylogeny phy = nj.execute( m );
-        FastaParser.extractFastaInformation( phy );
+        PhylogeneticInferrer.extractFastaInformation( phy );
         return phy;
     }
 
@@ -258,4 +263,36 @@ public class PhylogeneticInferrer implements Runnable {
             }
         }
     }
+
+    public static void extractFastaInformation( final Phylogeny phy ) {
+        for( final PhylogenyNodeIterator iter = phy.iteratorExternalForward(); iter.hasNext(); ) {
+            final PhylogenyNode node = iter.next();
+            if ( !ForesterUtil.isEmpty( node.getName() ) ) {
+                final Matcher name_m = FastaParser.FASTA_DESC_LINE.matcher( node.getName() );
+                if ( name_m.lookingAt() ) {
+                    System.out.println();
+                    // System.out.println( name_m.group( 1 ) );
+                    // System.out.println( name_m.group( 2 ) );
+                    // System.out.println( name_m.group( 3 ) );
+                    // System.out.println( name_m.group( 4 ) );
+                    final String acc_source = name_m.group( 1 );
+                    final String acc = name_m.group( 2 );
+                    final String seq_name = name_m.group( 3 );
+                    final String tax_sn = name_m.group( 4 );
+                    if ( !ForesterUtil.isEmpty( acc_source ) && !ForesterUtil.isEmpty( acc ) ) {
+                        AptxUtil.ensurePresenceOfSequence( node );
+                        node.getNodeData().getSequence( 0 ).setAccession( new Accession( acc, acc_source ) );
+                    }
+                    if ( !ForesterUtil.isEmpty( seq_name ) ) {
+                        AptxUtil.ensurePresenceOfSequence( node );
+                        node.getNodeData().getSequence( 0 ).setName( seq_name );
+                    }
+                    if ( !ForesterUtil.isEmpty( tax_sn ) ) {
+                        AptxUtil.ensurePresenceOfTaxonomy( node );
+                        node.getNodeData().getTaxonomy( 0 ).setScientificName( tax_sn );
+                    }
+                }
+            }
+        }
+    }
 }
index b99a4d4..5f42df8 100644 (file)
@@ -38,17 +38,11 @@ import java.util.List;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import org.forester.archaeopteryx.Util;
 import org.forester.msa.BasicMsa;
 import org.forester.msa.Msa;
 import org.forester.msa.MsaFormatException;
-import org.forester.phylogeny.Phylogeny;
-import org.forester.phylogeny.PhylogenyNode;
-import org.forester.phylogeny.data.Accession;
-import org.forester.phylogeny.iterators.PhylogenyNodeIterator;
 import org.forester.sequence.BasicSequence;
 import org.forester.sequence.Sequence;
-import org.forester.util.ForesterUtil;
 
 public class FastaParser {
 
@@ -56,7 +50,7 @@ public class FastaParser {
     private static final Pattern SEQ_REGEX       = Pattern.compile( "^\\s*(.+)" );
     private static final Pattern ANYTHING_REGEX  = Pattern.compile( "[\\d\\s]+" );
     //>gi|71834668|ref|NP_001025424.1| Bcl2 [Danio rerio]
-    private static final Pattern FASTA_DESC_LINE = Pattern
+    public static final Pattern  FASTA_DESC_LINE = Pattern
                                                          .compile( ">?\\s*([^|]+)\\|([^|]+)\\S*\\s+(.+)\\s+\\[(.+)\\]" );
 
     public static void main( final String[] args ) {
@@ -186,36 +180,4 @@ public class FastaParser {
         }
         return line;
     }
-
-    public static void extractFastaInformation( final Phylogeny phy ) {
-        for( final PhylogenyNodeIterator iter = phy.iteratorExternalForward(); iter.hasNext(); ) {
-            final PhylogenyNode node = iter.next();
-            if ( !ForesterUtil.isEmpty( node.getName() ) ) {
-                final Matcher name_m = FASTA_DESC_LINE.matcher( node.getName() );
-                if ( name_m.lookingAt() ) {
-                    System.out.println();
-                    // System.out.println( name_m.group( 1 ) );
-                    // System.out.println( name_m.group( 2 ) );
-                    // System.out.println( name_m.group( 3 ) );
-                    // System.out.println( name_m.group( 4 ) );
-                    final String acc_source = name_m.group( 1 );
-                    final String acc = name_m.group( 2 );
-                    final String seq_name = name_m.group( 3 );
-                    final String tax_sn = name_m.group( 4 );
-                    if ( !ForesterUtil.isEmpty( acc_source ) && !ForesterUtil.isEmpty( acc ) ) {
-                        Util.ensurePresenceOfSequence( node );
-                        node.getNodeData().getSequence( 0 ).setAccession( new Accession( acc, acc_source ) );
-                    }
-                    if ( !ForesterUtil.isEmpty( seq_name ) ) {
-                        Util.ensurePresenceOfSequence( node );
-                        node.getNodeData().getSequence( 0 ).setName( seq_name );
-                    }
-                    if ( !ForesterUtil.isEmpty( tax_sn ) ) {
-                        Util.ensurePresenceOfTaxonomy( node );
-                        node.getNodeData().getTaxonomy( 0 ).setScientificName( tax_sn );
-                    }
-                }
-            }
-        }
-    }
 }
index 24bbaf2..6f62d8b 100644 (file)
@@ -32,7 +32,7 @@ import java.util.Map;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import org.forester.archaeopteryx.Util;
+import org.forester.archaeopteryx.AptxUtil;
 import org.forester.io.parsers.nhx.NHXFormatException;
 import org.forester.phylogeny.Phylogeny;
 import org.forester.phylogeny.PhylogenyNode;
@@ -91,63 +91,63 @@ public final class PhylogenyDecorator {
                     }
                     if ( new_values != null ) {
                         if ( new_values.containsKey( TP_TAXONOMY_CODE ) ) {
-                            Util.ensurePresenceOfTaxonomy( node );
+                            AptxUtil.ensurePresenceOfTaxonomy( node );
                             node.getNodeData().getTaxonomy().setTaxonomyCode( new_values.get( TP_TAXONOMY_CODE ) );
                         }
                         if ( new_values.containsKey( TP_TAXONOMY_ID )
                                 && new_values.containsKey( TP_TAXONOMY_ID_PROVIDER ) ) {
-                            Util.ensurePresenceOfTaxonomy( node );
+                            AptxUtil.ensurePresenceOfTaxonomy( node );
                             node.getNodeData()
                                     .getTaxonomy()
                                     .setIdentifier( new Identifier( new_values.get( TP_TAXONOMY_ID ),
                                                                     new_values.get( TP_TAXONOMY_ID_PROVIDER ) ) );
                         }
                         else if ( new_values.containsKey( TP_TAXONOMY_ID ) ) {
-                            Util.ensurePresenceOfTaxonomy( node );
+                            AptxUtil.ensurePresenceOfTaxonomy( node );
                             node.getNodeData().getTaxonomy()
                                     .setIdentifier( new Identifier( new_values.get( TP_TAXONOMY_ID ) ) );
                         }
                         if ( new_values.containsKey( TP_TAXONOMY_SN ) ) {
-                            Util.ensurePresenceOfTaxonomy( node );
+                            AptxUtil.ensurePresenceOfTaxonomy( node );
                             node.getNodeData().getTaxonomy().setScientificName( new_values.get( TP_TAXONOMY_SN ) );
                         }
                         if ( new_values.containsKey( TP_TAXONOMY_CN ) ) {
-                            Util.ensurePresenceOfTaxonomy( node );
+                            AptxUtil.ensurePresenceOfTaxonomy( node );
                             node.getNodeData().getTaxonomy().setCommonName( new_values.get( TP_TAXONOMY_CN ) );
                         }
                         if ( new_values.containsKey( TP_TAXONOMY_SYN ) ) {
-                            Util.ensurePresenceOfTaxonomy( node );
+                            AptxUtil.ensurePresenceOfTaxonomy( node );
                             node.getNodeData().getTaxonomy().getSynonyms().add( new_values.get( TP_TAXONOMY_SYN ) );
                         }
                         if ( new_values.containsKey( TP_SEQ_ACCESSION )
                                 && new_values.containsKey( TP_SEQ_ACCESSION_SOURCE ) ) {
-                            Util.ensurePresenceOfSequence( node );
+                            AptxUtil.ensurePresenceOfSequence( node );
                             node.getNodeData()
                                     .getSequence()
                                     .setAccession( new Accession( new_values.get( TP_SEQ_ACCESSION ),
                                                                   new_values.get( TP_SEQ_ACCESSION_SOURCE ) ) );
                         }
                         if ( new_values.containsKey( TP_SEQ_ANNOTATION_DESC ) ) {
-                            Util.ensurePresenceOfSequence( node );
+                            AptxUtil.ensurePresenceOfSequence( node );
                             final Annotation ann = new Annotation( "?" );
                             ann.setDesc( new_values.get( TP_SEQ_ANNOTATION_DESC ) );
                             node.getNodeData().getSequence().addAnnotation( ann );
                         }
                         if ( new_values.containsKey( TP_SEQ_ANNOTATION_REF ) ) {
-                            Util.ensurePresenceOfSequence( node );
+                            AptxUtil.ensurePresenceOfSequence( node );
                             final Annotation ann = new Annotation( new_values.get( TP_SEQ_ANNOTATION_REF ) );
                             node.getNodeData().getSequence().addAnnotation( ann );
                         }
                         if ( new_values.containsKey( TP_SEQ_SYMBOL ) ) {
-                            Util.ensurePresenceOfSequence( node );
+                            AptxUtil.ensurePresenceOfSequence( node );
                             node.getNodeData().getSequence().setSymbol( new_values.get( TP_SEQ_SYMBOL ) );
                         }
                         if ( new_values.containsKey( TP_SEQ_NAME ) ) {
-                            Util.ensurePresenceOfSequence( node );
+                            AptxUtil.ensurePresenceOfSequence( node );
                             node.getNodeData().getSequence().setName( new_values.get( TP_SEQ_NAME ) );
                         }
                         if ( new_values.containsKey( TP_SEQ_MOL_SEQ ) ) {
-                            Util.ensurePresenceOfSequence( node );
+                            AptxUtil.ensurePresenceOfSequence( node );
                             node.getNodeData().getSequence().setMolecularSequence( new_values.get( TP_SEQ_MOL_SEQ ) );
                         }
                         if ( new_values.containsKey( TP_NODE_NAME ) ) {
@@ -275,14 +275,14 @@ public final class PhylogenyDecorator {
                                 if ( PhylogenyDecorator.VERBOSE ) {
                                     System.out.println( name + ": " + new_value );
                                 }
-                                Util.ensurePresenceOfTaxonomy( node );
+                                AptxUtil.ensurePresenceOfTaxonomy( node );
                                 node.getNodeData().getTaxonomy().setTaxonomyCode( new_value );
                                 break;
                             case TAXONOMY_SCIENTIFIC_NAME:
                                 if ( PhylogenyDecorator.VERBOSE ) {
                                     System.out.println( name + ": " + new_value );
                                 }
-                                Util.ensurePresenceOfTaxonomy( node );
+                                AptxUtil.ensurePresenceOfTaxonomy( node );
                                 node.getNodeData().getTaxonomy().setScientificName( new_value );
                                 break;
                             case SEQUENCE_NAME:
@@ -415,7 +415,7 @@ public final class PhylogenyDecorator {
     private static void extractBracketedScientificNames( final PhylogenyNode node, final String new_value ) {
         final int i = new_value.lastIndexOf( "[" );
         final String scientific_name = new_value.substring( i + 1, new_value.length() - 1 );
-        Util.ensurePresenceOfTaxonomy( node );
+        AptxUtil.ensurePresenceOfTaxonomy( node );
         node.getNodeData().getTaxonomy().setScientificName( scientific_name );
     }