work on data buffer for aLeaves MAFFT suite + clean up
[jalview.git] / forester / java / src / org / forester / archaeopteryx / ArchaeopteryxA.java
index fd82f35..d6f9f06 100644 (file)
@@ -54,22 +54,30 @@ 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();
         }
     }
 
-    private MainFrameApplet getMainFrameApplet() {
-        return _mainframe_applet;
+    /**
+     * This method returns the current external node data which
+     * has been selected by the user by clicking the "Return ..."
+     * menu item. This method is expected to be called from Javascript or
+     * something like it.
+     * 
+     * @return current external node data as String
+     */
+    public String getCurrentExternalNodesDataBuffer() {
+        return getMainFrameApplet().getCurrentTreePanel().getCurrentExternalNodesDataBufferAsString();
     }
 
-    private String getMessage1() {
-        return _message_1;
+    public int getCurrentExternalNodesDataBufferCounter() {
+        return getMainFrameApplet().getCurrentTreePanel().getCurrentExternalNodesDataBufferChangeCounter();
     }
 
-    private String getMessage2() {
-        return _message_2;
+    public int getCurrentExternalNodesDataBufferLength() {
+        return getMainFrameApplet().getCurrentTreePanel().getCurrentExternalNodesDataBufferAsString().length();
     }
 
     public String getUrlString() {
@@ -81,7 +89,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 +106,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 +119,14 @@ 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(), configuration.isReplaceUnderscoresInNhParsing(), configuration
+                    .isInternalNumberAreConfidenceForNhParsing(), configuration.getTaxonomyExtraction() );
+            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 +143,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();
@@ -165,6 +178,27 @@ public class ArchaeopteryxA extends JApplet {
         g.drawString( getMessage1(), 10, 40 );
     }
 
+    @Override
+    public void start() {
+        getMainFrameApplet().getMainPanel().validate();
+        getMainFrameApplet().requestFocus();
+        getMainFrameApplet().requestFocusInWindow();
+        getMainFrameApplet().requestFocus();
+        AptxUtil.printAppletMessage( NAME, "started" );
+    }
+
+    private MainFrameApplet getMainFrameApplet() {
+        return _mainframe_applet;
+    }
+
+    private String getMessage1() {
+        return _message_1;
+    }
+
+    private String getMessage2() {
+        return _message_2;
+    }
+
     private void setMessage1( final String message_1 ) {
         _message_1 = message_1;
     }
@@ -176,13 +210,4 @@ public class ArchaeopteryxA extends JApplet {
     private void setUrlString( final String url_string ) {
         _url_string = url_string;
     }
-
-    @Override
-    public void start() {
-        getMainFrameApplet().getMainPanel().validate();
-        getMainFrameApplet().requestFocus();
-        getMainFrameApplet().requestFocusInWindow();
-        getMainFrameApplet().requestFocus();
-        Util.printAppletMessage( NAME, "started" );
-    }
 }