work on data buffer for aLeaves MAFFT suite + clean up
authorcmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Mon, 10 Dec 2012 22:51:02 +0000 (22:51 +0000)
committercmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Mon, 10 Dec 2012 22:51:02 +0000 (22:51 +0000)
forester/java/src/org/forester/archaeopteryx/ArchaeopteryxA.java
forester/java/src/org/forester/archaeopteryx/ArchaeopteryxE.java
forester/java/src/org/forester/archaeopteryx/MainFrame.java
forester/java/src/org/forester/archaeopteryx/TreePanel.java

index dad1425..d6f9f06 100644 (file)
@@ -60,16 +60,24 @@ public class ArchaeopteryxA extends JApplet {
         }
     }
 
-    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() {
@@ -170,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;
     }
@@ -181,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();
-        AptxUtil.printAppletMessage( NAME, "started" );
-    }
 }
index 576d952..b1b6d9f 100644 (file)
@@ -53,8 +53,8 @@ import org.forester.util.ForesterUtil;
 // </applet>
 public class ArchaeopteryxE extends JApplet implements ActionListener {
 
-    private final static String         NAME                                 = "ArchaeopteryxE";
-    private static final long           serialVersionUID                     = -1220055577935759443L;
+    private final static String         NAME             = "ArchaeopteryxE";
+    private static final long           serialVersionUID = -1220055577935759443L;
     private Configuration               _configuration;
     private MainPanelApplets            _main_panel;
     private JMenuBar                    _jmenubar;
@@ -121,10 +121,10 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
     private JMenuItem                   _choose_node_size_mi;
     private JCheckBoxMenuItem           _taxonomy_colorize_node_shapes_cbmi;
     private JCheckBoxMenuItem           _show_confidence_stddev_cbmi;
-    private final LinkedList<TextFrame> _textframes                          = new LinkedList<TextFrame>();
-    private String                      _ext_node_data_buffer                = "";
-    private int                         _ext_node_data_buffer_change_counter = 0;
+    private final LinkedList<TextFrame> _textframes      = new LinkedList<TextFrame>();
 
+    // private String                      _ext_node_data_buffer                = "";
+    // private int                         _ext_node_data_buffer_change_counter = 0;
     @Override
     public void actionPerformed( final ActionEvent e ) {
         final Object o = e.getSource();
@@ -336,7 +336,15 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
      * @return current external node data as String
      */
     public String getCurrentExternalNodesDataBuffer() {
-        return _ext_node_data_buffer;
+        return getCurrentTreePanel().getCurrentExternalNodesDataBufferAsString();
+    }
+
+    public int getCurrentExternalNodesDataBufferCounter() {
+        return getCurrentTreePanel().getCurrentExternalNodesDataBufferChangeCounter();
+    }
+
+    public int getCurrentExternalNodesDataBufferLength() {
+        return getCurrentTreePanel().getCurrentExternalNodesDataBufferAsString().length();
     }
 
     /**
@@ -401,18 +409,10 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
         return dataImg;
     }
 
-    public int getExtNodeDataBufferChangeCounter() {
-        return _ext_node_data_buffer_change_counter;
-    }
-
     public Options getOptions() {
         return _options;
     }
 
-    public void increaseExtNodeDataBufferChangeCounter() {
-        _ext_node_data_buffer_change_counter++;
-    }
-
     @Override
     public void init() {
         final String config_filename = getParameter( Constants.APPLET_PARAM_NAME_FOR_CONFIG_FILE_URL );
@@ -763,6 +763,10 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
         }
     }
 
+    void clearCurrentExternalNodesDataBuffer() {
+        getCurrentTreePanel().clearCurrentExternalNodesDataBuffer();
+    }
+
     void customizeCheckBoxMenuItem( final JCheckBoxMenuItem item, final boolean is_selected ) {
         if ( item != null ) {
             item.setFont( MainFrame.menu_font );
@@ -916,16 +920,6 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
         _configuration = configuration;
     }
 
-    void setCurrentExternalNodesDataBuffer( final String s ) {
-        increaseExtNodeDataBufferChangeCounter();
-        if ( !ForesterUtil.isEmpty( s ) ) {
-            _ext_node_data_buffer = s.trim();
-        }
-        else {
-            _ext_node_data_buffer = "";
-        }
-    }
-
     void setOptions( final Options options ) {
         _options = options;
     }
index ded33a8..461f474 100644 (file)
@@ -231,8 +231,6 @@ public abstract class MainFrame extends JFrame implements ActionListener {
     InferenceManager            _inference_manager;
     final ProcessPool           _process_pool;
     private String              _previous_node_annotation_ref;
-    private String              _ext_node_data_buffer                   = "";
-    private int                 _ext_node_data_buffer_change_counter    = 0;
 
     MainFrame() {
         _process_pool = ProcessPool.createInstance();
@@ -500,11 +498,11 @@ public abstract class MainFrame extends JFrame implements ActionListener {
      * @return current external node data as String
      */
     public String getCurrentExternalNodesDataBuffer() {
-        return _ext_node_data_buffer;
+        return getCurrentTreePanel().getCurrentExternalNodesDataBufferAsString();
     }
 
     public int getExtNodeDataBufferChangeCounter() {
-        return _ext_node_data_buffer_change_counter;
+        return getCurrentTreePanel().getCurrentExternalNodesDataBufferChangeCounter();
     }
 
     public InferenceManager getInferenceManager() {
@@ -523,10 +521,6 @@ public abstract class MainFrame extends JFrame implements ActionListener {
         return _process_pool;
     }
 
-    public void increaseExtNodeDataBufferChangeCounter() {
-        _ext_node_data_buffer_change_counter++;
-    }
-
     public void showTextFrame( final String s, final String title ) {
         checkTextFrames();
         _textframes.addLast( TextFrame.instantiate( s, title, _textframes ) );
@@ -966,16 +960,6 @@ public abstract class MainFrame extends JFrame implements ActionListener {
         _configuration = configuration;
     }
 
-    void setCurrentExternalNodesDataBuffer( final String s ) {
-        increaseExtNodeDataBufferChangeCounter();
-        if ( !ForesterUtil.isEmpty( s ) ) {
-            _ext_node_data_buffer = s.trim();
-        }
-        else {
-            _ext_node_data_buffer = "";
-        }
-    }
-
     void setInferenceManager( final InferenceManager i ) {
         _inference_manager = i;
     }
index fcb1580..bbf8357 100644 (file)
@@ -129,111 +129,114 @@ import org.forester.util.SequenceIdParser;
 
 public final class TreePanel extends JPanel implements ActionListener, MouseWheelListener, Printable {
 
-    private static final float              PI                                = ( float ) ( Math.PI );
-    private static final double             TWO_PI                            = 2 * Math.PI;
-    private static final float              ONEHALF_PI                        = ( float ) ( 1.5 * Math.PI );
-    private static final float              HALF_PI                           = ( float ) ( Math.PI / 2.0 );
-    private static final float              ANGLE_ROTATION_UNIT               = ( float ) ( Math.PI / 32 );
-    private static final short              OV_BORDER                         = 10;
-    final static Cursor                     CUT_CURSOR                        = Cursor.getPredefinedCursor( Cursor.CROSSHAIR_CURSOR );
-    final static Cursor                     MOVE_CURSOR                       = Cursor.getPredefinedCursor( Cursor.MOVE_CURSOR );
-    final static Cursor                     ARROW_CURSOR                      = Cursor.getPredefinedCursor( Cursor.DEFAULT_CURSOR );
-    final static Cursor                     HAND_CURSOR                       = Cursor.getPredefinedCursor( Cursor.HAND_CURSOR );
-    final static Cursor                     WAIT_CURSOR                       = Cursor.getPredefinedCursor( Cursor.WAIT_CURSOR );
-    private final static long               serialVersionUID                  = -978349745916505029L;
-    private final static int                EURO_D                            = 10;
-    private final static String             NODE_POPMENU_NODE_CLIENT_PROPERTY = "node";
-    private final static int                MIN_ROOT_LENGTH                   = 3;
-    private final static int                MAX_SUBTREES                      = 100;
-    private final static int                MAX_NODE_FRAMES                   = 10;
-    private final static int                MOVE                              = 20;
+    private static final float              PI                                                 = ( float ) ( Math.PI );
+    private static final double             TWO_PI                                             = 2 * Math.PI;
+    private static final float              ONEHALF_PI                                         = ( float ) ( 1.5 * Math.PI );
+    private static final float              HALF_PI                                            = ( float ) ( Math.PI / 2.0 );
+    private static final float              ANGLE_ROTATION_UNIT                                = ( float ) ( Math.PI / 32 );
+    private static final short              OV_BORDER                                          = 10;
+    final static Cursor                     CUT_CURSOR                                         = Cursor.getPredefinedCursor( Cursor.CROSSHAIR_CURSOR );
+    final static Cursor                     MOVE_CURSOR                                        = Cursor.getPredefinedCursor( Cursor.MOVE_CURSOR );
+    final static Cursor                     ARROW_CURSOR                                       = Cursor.getPredefinedCursor( Cursor.DEFAULT_CURSOR );
+    final static Cursor                     HAND_CURSOR                                        = Cursor.getPredefinedCursor( Cursor.HAND_CURSOR );
+    final static Cursor                     WAIT_CURSOR                                        = Cursor.getPredefinedCursor( Cursor.WAIT_CURSOR );
+    private final static long               serialVersionUID                                   = -978349745916505029L;
+    private final static int                EURO_D                                             = 10;
+    private final static String             NODE_POPMENU_NODE_CLIENT_PROPERTY                  = "node";
+    private final static int                MIN_ROOT_LENGTH                                    = 3;
+    private final static int                MAX_SUBTREES                                       = 100;
+    private final static int                MAX_NODE_FRAMES                                    = 10;
+    private final static int                MOVE                                               = 20;
     private final static NumberFormat       FORMATTER_CONFIDENCE;
     private final static NumberFormat       FORMATTER_BRANCH_LENGTH;
-    private final static int                WIGGLE                            = 2;
-    private final static int                LIMIT_FOR_HQ_RENDERING            = 1000;
-    private final static int                CONFIDENCE_LEFT_MARGIN            = 4;
+    private final static int                WIGGLE                                             = 2;
+    private final static int                LIMIT_FOR_HQ_RENDERING                             = 1000;
+    private final static int                CONFIDENCE_LEFT_MARGIN                             = 4;
     // TODO "rendering_hints" was static before. Need to make sure everything is OK with it not
     // being static anymore (02/20/2009).
-    private final RenderingHints            _rendering_hints                  = new RenderingHints( RenderingHints.KEY_RENDERING,
-                                                                                                    RenderingHints.VALUE_RENDER_DEFAULT );
-    private File                            _treefile                         = null;
-    private Configuration                   _configuration                    = null;
-    private final NodeFrame[]               _node_frames                      = new NodeFrame[ TreePanel.MAX_NODE_FRAMES ];
-    private int                             _node_frame_index                 = 0;
-    private Phylogeny                       _phylogeny                        = null;
-    private final Phylogeny[]               _sub_phylogenies                  = new Phylogeny[ TreePanel.MAX_SUBTREES ];
-    private final PhylogenyNode[]           _sub_phylogenies_temp_roots       = new PhylogenyNode[ TreePanel.MAX_SUBTREES ];
-    private int                             _subtree_index                    = 0;
-    private MainPanel                       _main_panel                       = null;
-    private Set<Integer>                    _found_nodes                      = null;
-    private PhylogenyNode                   _highlight_node                   = null;
-    private JPopupMenu                      _node_popup_menu                  = null;
-    private JMenuItem                       _node_popup_menu_items[]          = null;
-    private int                             _longest_ext_node_info            = 0;
-    private float                           _x_correction_factor              = 0.0f;
-    private float                           _ov_x_correction_factor           = 0.0f;
-    private float                           _x_distance                       = 0.0f;
-    private float                           _y_distance                       = 0.0f;
-    private PHYLOGENY_GRAPHICS_TYPE         _graphics_type                    = PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR;
-    private double                          _domain_structure_width           = Constants.DOMAIN_STRUCTURE_DEFAULT_WIDTH;
-    private int                             _domain_structure_e_value_thr_exp = Constants.DOMAIN_STRUCTURE_E_VALUE_THR_DEFAULT_EXP;
-    private float                           _last_drag_point_x                = 0;
-    private float                           _last_drag_point_y                = 0;
-    private ControlPanel                    _control_panel                    = null;
-    private int                             _external_node_index              = 0;
-    private final Polygon                   _polygon                          = new Polygon();
-    private final StringBuilder             _sb                               = new StringBuilder();
-    private JColorChooser                   _color_chooser                    = null;
-    private double                          _scale_distance                   = 0.0;
-    private String                          _scale_label                      = null;
-    private final CubicCurve2D              _cubic_curve                      = new CubicCurve2D.Float();
-    private final QuadCurve2D               _quad_curve                       = new QuadCurve2D.Float();
-    private final Line2D                    _line                             = new Line2D.Float();
-    private final Ellipse2D                 _ellipse                          = new Ellipse2D.Float();
-    private final Rectangle2D               _rectangle                        = new Rectangle2D.Float();
-    private Options                         _options                          = null;
-    private float                           _ov_max_width                     = 0;
-    private float                           _ov_max_height                    = 0;
-    private int                             _ov_x_position                    = 0;
-    private int                             _ov_y_position                    = 0;
-    private int                             _ov_y_start                       = 0;
-    private float                           _ov_y_distance                    = 0;
-    private float                           _ov_x_distance                    = 0;
-    private boolean                         _ov_on                            = false;
-    private double                          _urt_starting_angle               = ( float ) ( Math.PI / 2 );
-    private float                           _urt_factor                       = 1;
-    private float                           _urt_factor_ov                    = 1;
+    private final RenderingHints            _rendering_hints                                   = new RenderingHints( RenderingHints.KEY_RENDERING,
+                                                                                                                     RenderingHints.VALUE_RENDER_DEFAULT );
+    private File                            _treefile                                          = null;
+    private Configuration                   _configuration                                     = null;
+    private final NodeFrame[]               _node_frames                                       = new NodeFrame[ TreePanel.MAX_NODE_FRAMES ];
+    private int                             _node_frame_index                                  = 0;
+    private Phylogeny                       _phylogeny                                         = null;
+    private final Phylogeny[]               _sub_phylogenies                                   = new Phylogeny[ TreePanel.MAX_SUBTREES ];
+    private final PhylogenyNode[]           _sub_phylogenies_temp_roots                        = new PhylogenyNode[ TreePanel.MAX_SUBTREES ];
+    private int                             _subtree_index                                     = 0;
+    private MainPanel                       _main_panel                                        = null;
+    private Set<Integer>                    _found_nodes                                       = null;
+    private PhylogenyNode                   _highlight_node                                    = null;
+    private JPopupMenu                      _node_popup_menu                                   = null;
+    private JMenuItem                       _node_popup_menu_items[]                           = null;
+    private int                             _longest_ext_node_info                             = 0;
+    private float                           _x_correction_factor                               = 0.0f;
+    private float                           _ov_x_correction_factor                            = 0.0f;
+    private float                           _x_distance                                        = 0.0f;
+    private float                           _y_distance                                        = 0.0f;
+    private PHYLOGENY_GRAPHICS_TYPE         _graphics_type                                     = PHYLOGENY_GRAPHICS_TYPE.RECTANGULAR;
+    private double                          _domain_structure_width                            = Constants.DOMAIN_STRUCTURE_DEFAULT_WIDTH;
+    private int                             _domain_structure_e_value_thr_exp                  = Constants.DOMAIN_STRUCTURE_E_VALUE_THR_DEFAULT_EXP;
+    private float                           _last_drag_point_x                                 = 0;
+    private float                           _last_drag_point_y                                 = 0;
+    private ControlPanel                    _control_panel                                     = null;
+    private int                             _external_node_index                               = 0;
+    private final Polygon                   _polygon                                           = new Polygon();
+    private final StringBuilder             _sb                                                = new StringBuilder();
+    private JColorChooser                   _color_chooser                                     = null;
+    private double                          _scale_distance                                    = 0.0;
+    private String                          _scale_label                                       = null;
+    private final CubicCurve2D              _cubic_curve                                       = new CubicCurve2D.Float();
+    private final QuadCurve2D               _quad_curve                                        = new QuadCurve2D.Float();
+    private final Line2D                    _line                                              = new Line2D.Float();
+    private final Ellipse2D                 _ellipse                                           = new Ellipse2D.Float();
+    private final Rectangle2D               _rectangle                                         = new Rectangle2D.Float();
+    private Options                         _options                                           = null;
+    private float                           _ov_max_width                                      = 0;
+    private float                           _ov_max_height                                     = 0;
+    private int                             _ov_x_position                                     = 0;
+    private int                             _ov_y_position                                     = 0;
+    private int                             _ov_y_start                                        = 0;
+    private float                           _ov_y_distance                                     = 0;
+    private float                           _ov_x_distance                                     = 0;
+    private boolean                         _ov_on                                             = false;
+    private double                          _urt_starting_angle                                = ( float ) ( Math.PI / 2 );
+    private float                           _urt_factor                                        = 1;
+    private float                           _urt_factor_ov                                     = 1;
     private final boolean                   _phy_has_branch_lengths;
-    private final Rectangle2D               _ov_rectangle                     = new Rectangle2D.Float();
-    private boolean                         _in_ov_rect                       = false;
-    private boolean                         _in_ov                            = false;
-    private final Rectangle                 _ov_virtual_rectangle             = new Rectangle();
-    final private static double             _180_OVER_PI                      = 180.0 / Math.PI;
-    private static final float              ROUNDED_D                         = 8;
+    private final Rectangle2D               _ov_rectangle                                      = new Rectangle2D.Float();
+    private boolean                         _in_ov_rect                                        = false;
+    private boolean                         _in_ov                                             = false;
+    private final Rectangle                 _ov_virtual_rectangle                              = new Rectangle();
+    final private static double             _180_OVER_PI                                       = 180.0 / Math.PI;
+    private static final float              ROUNDED_D                                          = 8;
     private int                             _circ_max_depth;
     private PhylogenyNode                   _root;
-    final private Arc2D                     _arc                              = new Arc2D.Double();
-    final private HashMap<Integer, Double>  _urt_nodeid_angle_map             = new HashMap<Integer, Double>();
-    final private HashMap<Integer, Integer> _urt_nodeid_index_map             = new HashMap<Integer, Integer>();
-    final private Set<Integer>              _collapsed_external_nodeid_set    = new HashSet<Integer>();
-    HashMap<Integer, Short>                 _nodeid_dist_to_leaf              = new HashMap<Integer, Short>();
+    final private Arc2D                     _arc                                               = new Arc2D.Double();
+    final private HashMap<Integer, Double>  _urt_nodeid_angle_map                              = new HashMap<Integer, Double>();
+    final private HashMap<Integer, Integer> _urt_nodeid_index_map                              = new HashMap<Integer, Integer>();
+    final private Set<Integer>              _collapsed_external_nodeid_set                     = new HashSet<Integer>();
+    HashMap<Integer, Short>                 _nodeid_dist_to_leaf                               = new HashMap<Integer, Short>();
     private AffineTransform                 _at;
-    private double                          _max_distance_to_root             = -1;
-    private int                             _dynamic_hiding_factor            = 0;
-    private boolean                         _edited                           = false;
+    private double                          _max_distance_to_root                              = -1;
+    private int                             _dynamic_hiding_factor                             = 0;
+    private boolean                         _edited                                            = false;
     private Popup                           _node_desc_popup;
     private JTextArea                       _rollover_popup;
-    private final StringBuffer              _popup_buffer                     = new StringBuffer();
-    final private static Font               POPUP_FONT                        = new Font( Configuration.getDefaultFontFamilyName(),
-                                                                                          Font.PLAIN,
-                                                                                          12 );
-    private Sequence                        _query_sequence                   = null;
-    private final FontRenderContext         _frc                              = new FontRenderContext( null,
-                                                                                                       false,
-                                                                                                       false );
+    private final StringBuffer              _popup_buffer                                      = new StringBuffer();
+    final private static Font               POPUP_FONT                                         = new Font( Configuration
+                                                                                                                   .getDefaultFontFamilyName(),
+                                                                                                           Font.PLAIN,
+                                                                                                           12 );
+    private Sequence                        _query_sequence                                    = null;
+    private final FontRenderContext         _frc                                               = new FontRenderContext( null,
+                                                                                                                        false,
+                                                                                                                        false );
     // expression values menu:
     private DescriptiveStatistics           _statistics_for_vector_data;
-    private PhylogenyNode[]                 _nodes_in_preorder                = null;
+    private PhylogenyNode[]                 _nodes_in_preorder                                 = null;
+    private StringBuilder                   _current_external_nodes_data_buffer                = new StringBuilder();
+    private int                             _current_external_nodes_data_buffer_change_counter = 0;
     //  private Image                           offscreenImage;
     //  private Graphics                        offscreenGraphics;
     //  private Dimension                       offscreenDimension;
@@ -731,6 +734,10 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
         return c;
     }
 
+    void clearCurrentExternalNodesDataBuffer() {
+        setCurrentExternalNodesDataBuffer( new StringBuilder() );
+    }
+
     /**
      * Collapse the tree from the given node
      * 
@@ -877,6 +884,14 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
         return _control_panel;
     }
 
+    String getCurrentExternalNodesDataBufferAsString() {
+        return _current_external_nodes_data_buffer.toString();
+    }
+
+    int getCurrentExternalNodesDataBufferChangeCounter() {
+        return _current_external_nodes_data_buffer_change_counter;
+    }
+
     final int getDomainStructureEvalueThreshold() {
         return _domain_structure_e_value_thr_exp;
     }
@@ -1736,6 +1751,12 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
         _control_panel = atv_control;
     }
 
+    void setCurrentExternalNodesDataBuffer( final StringBuilder sb ) {
+        increaseCurrentExternalNodesDataBufferChangeCounter();
+        _current_external_nodes_data_buffer = sb;
+        System.out.println( sb.toString() ); //TODO ~~~~~~~~~~~~~~ REMOVEME
+    }
+
     final void setFoundNodes( final Set<Integer> found_nodes ) {
         _found_nodes = found_nodes;
     }
@@ -2770,6 +2791,11 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
         }
     }
 
+    private void increaseCurrentExternalNodesDataBufferChangeCounter() {
+        _current_external_nodes_data_buffer_change_counter++;
+        System.out.println( _current_external_nodes_data_buffer_change_counter ); //TODO ~~~~~~~~~~~~~~ REMOVEME
+    }
+
     final private void increaseOvSize() {
         if ( ( getOvMaxWidth() < ( getMainPanel().getCurrentScrollPane().getViewport().getVisibleRect().getWidth() / 2 ) )
                 && ( getOvMaxHeight() < ( getMainPanel().getCurrentScrollPane().getViewport().getVisibleRect()
@@ -5004,25 +5030,10 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
                 }
             }
             if ( sb.length() < 1 ) {
-                if ( getMainPanel().getMainFrame() == null ) {
-                    // Must be "E" applet version.
-                    ( ( ArchaeopteryxE ) ( ( MainPanelApplets ) getMainPanel() ).getApplet() )
-                            .setCurrentExternalNodesDataBuffer( "" );
-                }
-                else {
-                    getMainPanel().getMainFrame().setCurrentExternalNodesDataBuffer( "" );
-                }
+                clearCurrentExternalNodesDataBuffer();
             }
             else {
-                final String s = sb.toString().trim();
-                if ( getMainPanel().getMainFrame() == null ) {
-                    // Must be "E" applet version.
-                    ( ( ArchaeopteryxE ) ( ( MainPanelApplets ) getMainPanel() ).getApplet() )
-                            .setCurrentExternalNodesDataBuffer( s );
-                }
-                else {
-                    getMainPanel().getMainFrame().setCurrentExternalNodesDataBuffer( s );
-                }
+                setCurrentExternalNodesDataBuffer( sb );
             }
         }
         else if ( getConfiguration().getExtNodeDataReturnOn() == EXT_NODE_DATA_RETURN_ON.WINODW ) {
@@ -5037,16 +5048,10 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
                 AptxUtil.showInformationMessage( this,
                                                  "No Appropriate Data (" + obtainTitleForExtDescNodeData() + ")",
                                                  "Descendants of selected node do not contain selected data" );
-                if ( getMainPanel().getMainFrame() == null ) {
-                    // Must be "E" applet version.
-                    ( ( ArchaeopteryxE ) ( ( MainPanelApplets ) getMainPanel() ).getApplet() )
-                            .setCurrentExternalNodesDataBuffer( "" );
-                }
-                else {
-                    getMainPanel().getMainFrame().setCurrentExternalNodesDataBuffer( "" );
-                }
+                clearCurrentExternalNodesDataBuffer();
             }
             else {
+                setCurrentExternalNodesDataBuffer( sb );
                 final String title = "External Descendants "
                         + ( getOptions().getExtDescNodeDataToReturn() == NODE_DATA.UNKNOWN ? "Data"
                                 : obtainTitleForExtDescNodeData() ) + " (" + data.size() + "/"
@@ -5056,11 +5061,9 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
                     // Must be "E" applet version.
                     final ArchaeopteryxE ae = ( ArchaeopteryxE ) ( ( MainPanelApplets ) getMainPanel() ).getApplet();
                     ae.showTextFrame( s, title );
-                    ae.setCurrentExternalNodesDataBuffer( s );
                 }
                 else {
                     getMainPanel().getMainFrame().showTextFrame( s, title );
-                    getMainPanel().getMainFrame().setCurrentExternalNodesDataBuffer( s );
                 }
             }
         }