in progress
authorcmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Tue, 21 Jan 2014 23:14:38 +0000 (23:14 +0000)
committercmzmasek@gmail.com <cmzmasek@gmail.com@ca865154-3058-d1c3-3e42-d8f55a55bdbd>
Tue, 21 Jan 2014 23:14:38 +0000 (23:14 +0000)
forester/java/src/org/forester/archaeopteryx/ArchaeopteryxE.java
forester/java/src/org/forester/archaeopteryx/ControlPanel.java
forester/java/src/org/forester/archaeopteryx/MainFrame.java
forester/java/src/org/forester/archaeopteryx/TreeColorSet.java
forester/java/src/org/forester/archaeopteryx/TreePanel.java

index da77e22..72bb43f 100644 (file)
@@ -242,15 +242,18 @@ public class ArchaeopteryxE extends JApplet implements ActionListener {
         }
         else if ( o == _search_case_senstive_cbmi ) {
             updateOptions( getOptions() );
-            getMainPanel().getControlPanel().search();
+            getMainPanel().getControlPanel().search0();
+            getMainPanel().getControlPanel().search1();
         }
         else if ( o == _search_whole_words_only_cbmi ) {
             updateOptions( getOptions() );
-            getMainPanel().getControlPanel().search();
+            getMainPanel().getControlPanel().search0();
+            getMainPanel().getControlPanel().search1();
         }
         else if ( o == _inverse_search_result_cbmi ) {
             updateOptions( getOptions() );
-            getMainPanel().getControlPanel().search();
+            getMainPanel().getControlPanel().search0();
+            getMainPanel().getControlPanel().search1();
         }
         else if ( o == _show_scale_cbmi ) {
             updateOptions( getOptions() );
index f617f24..9549aef 100644 (file)
@@ -121,9 +121,7 @@ final class ControlPanel extends JPanel implements ActionListener {
     private int                  _paste_subtree_item;
     private int                  _reroot_cb_item;
     private JButton              _return_to_super_tree;
-    private JLabel               _search_found_label;
-    private JButton              _search_reset_button;
-    private JTextField           _search_tf;
+   
     private int                  _select_nodes_item;
     private Sequence             _selected_query_seq;
     private JCheckBox            _seq_relation_confidence_switch;
@@ -131,6 +129,14 @@ final class ControlPanel extends JPanel implements ActionListener {
     private JCheckBox            _show_annotation;
     private JCheckBox            _show_binary_character_counts;
     private JCheckBox            _show_binary_characters;
+    // Search 
+    private JLabel               _search_found_label_0;
+    private JButton              _search_reset_button_0;
+    private JTextField           _search_tf_0;
+    private JLabel               _search_found_label_1;
+    private JButton              _search_reset_button_1;
+    private JTextField           _search_tf_1;
+    
     // Indices for the click-to options in the combo box
     private int                  _show_data_item;
     private JCheckBox            _show_domain_architectures;
@@ -204,7 +210,8 @@ final class ControlPanel extends JPanel implements ActionListener {
                 displayedPhylogenyMightHaveChanged( true );
             }
             else if ( e.getSource() == _show_domain_architectures ) {
-                search();
+                search0();
+                search1();
                 displayedPhylogenyMightHaveChanged( true );
             }
             else if ( ( tp != null ) && ( tp.getPhylogeny() != null ) ) {
@@ -276,8 +283,12 @@ final class ControlPanel extends JPanel implements ActionListener {
                     _mainpanel.getCurrentTreePanel().increaseDomainStructureEvalueThreshold();
                     displayedPhylogenyMightHaveChanged( true );
                 }
-                else if ( e.getSource() == _search_tf ) {
-                    search();
+                else if ( e.getSource() == _search_tf_0 ) {
+                    search0();
+                    displayedPhylogenyMightHaveChanged( true );
+                }
+                else if ( e.getSource() == _search_tf_1 ) {
+                    search1();
                     displayedPhylogenyMightHaveChanged( true );
                 }
                 else {
@@ -747,16 +758,28 @@ final class ControlPanel extends JPanel implements ActionListener {
         return getMainPanel().getOptions();
     }
 
-    JLabel getSearchFoundCountsLabel() {
-        return _search_found_label;
+    JLabel getSearchFoundCountsLabel0() {
+        return _search_found_label_0;
+    }
+    
+    JLabel getSearchFoundCountsLabel1() {
+        return _search_found_label_1;
     }
 
-    JButton getSearchResetButton() {
-        return _search_reset_button;
+    JButton getSearchResetButton0() {
+        return _search_reset_button_0;
+    }
+    
+    JButton getSearchResetButton1() {
+        return _search_reset_button_1;
     }
 
-    JTextField getSearchTextField() {
-        return _search_tf;
+    JTextField getSearchTextField0() {
+        return _search_tf_0;
+    }
+    
+    JTextField getSearchTextField1() {
+        return _search_tf_1;
     }
 
     List<String> getSingleClickToNames() {
@@ -875,36 +898,62 @@ final class ControlPanel extends JPanel implements ActionListener {
         getIsDrawPhylogramList().remove( index );
     }
 
-    void search() {
+    void search0() {
         final MainPanel main_panel = getMainPanel();
         final Phylogeny tree = main_panel.getCurrentPhylogeny();
         if ( ( tree == null ) || tree.isEmpty() ) {
             return;
         }
-        String query = getSearchTextField().getText();
+        String query = getSearchTextField0().getText();
         if ( query != null ) {
             query = query.trim();
         }
+       
+        
+        if ( !ForesterUtil.isEmpty( query ) ) {
+            search0( main_panel, tree, query );
+        }
         else {
-            getSearchFoundCountsLabel().setVisible( false );
-            getSearchResetButton().setEnabled( false );
-            getSearchResetButton().setVisible( false );
-            searchReset();
+            getSearchFoundCountsLabel0().setVisible( false );
+            getSearchResetButton0().setEnabled( false );
+            getSearchResetButton0().setVisible( false );
+            searchReset0();
+        }
+    }
+    
+    void search1() {
+        final MainPanel main_panel = getMainPanel();
+        final Phylogeny tree = main_panel.getCurrentPhylogeny();
+        if ( ( tree == null ) || tree.isEmpty() ) {
+            return;
+        }
+        String query = getSearchTextField1().getText();
+        if ( query != null ) {
+            query = query.trim();
         }
+       
         if ( !ForesterUtil.isEmpty( query ) ) {
-            search( main_panel, tree, query );
+            search1( main_panel, tree, query );
         }
         else {
-            getSearchFoundCountsLabel().setVisible( false );
-            getSearchResetButton().setEnabled( false );
-            getSearchResetButton().setVisible( false );
-            searchReset();
+            getSearchFoundCountsLabel1().setVisible( false );
+            getSearchResetButton1().setEnabled( false );
+            getSearchResetButton1().setVisible( false );
+            searchReset1();
         }
     }
+    
+    
 
-    void searchReset() {
+    void searchReset0() {
+        if ( getMainPanel().getCurrentTreePanel() != null ) {
+            getMainPanel().getCurrentTreePanel().setFoundNodes0( null );
+        }
+    }
+    
+    void searchReset1() {
         if ( getMainPanel().getCurrentTreePanel() != null ) {
-            getMainPanel().getCurrentTreePanel().setFoundNodes( null );
+            getMainPanel().getCurrentTreePanel().setFoundNodes1( null );
         }
     }
 
@@ -1161,8 +1210,12 @@ final class ControlPanel extends JPanel implements ActionListener {
         // }
     }
 
-    void setSearchFoundCountsOnLabel( final int counts ) {
-        getSearchFoundCountsLabel().setText( "Found: " + counts );
+    void setSearchFoundCountsOnLabel0( final int counts ) {
+        getSearchFoundCountsLabel0().setText( "Found: " + counts );
+    }
+    
+    void setSearchFoundCountsOnLabel1( final int counts ) {
+        getSearchFoundCountsLabel1().setText( "Found: " + counts );
     }
 
     void setShowEvents( final boolean show_events ) {
@@ -1195,7 +1248,8 @@ final class ControlPanel extends JPanel implements ActionListener {
         endClickToOptions();
         // Zoom and quick edit buttons
         addButtons();
-        setupSearchTools();
+        setupSearchTools0();
+        setupSearchTools1();
     }
 
     void setUpControlsForDomainStrucures() {
@@ -1234,33 +1288,33 @@ final class ControlPanel extends JPanel implements ActionListener {
         addJButton( _incr_domain_structure_evalue_thr, d2_panel );
     }
 
-    void setupSearchTools() {
+    void setupSearchTools0() {
         final String tip = "Enter text to search for. Use ',' for multiple searches (logical OR) and '+' for logical AND.";
-        final JLabel search_label = new JLabel( "Search:" );
+        final JLabel search_label = new JLabel( "Search (A):" );
         search_label.setFont( ControlPanel.jcb_bold_font );
         if ( !getConfiguration().isUseNativeUI() ) {
             search_label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
         }
         add( search_label );
         search_label.setToolTipText( tip );
-        _search_found_label = new JLabel();
-        getSearchFoundCountsLabel().setVisible( false );
-        _search_found_label.setFont( ControlPanel.jcb_bold_font );
+        _search_found_label_0 = new JLabel();
+        getSearchFoundCountsLabel0().setVisible( false );
+        _search_found_label_0.setFont( ControlPanel.jcb_bold_font );
         if ( !getConfiguration().isUseNativeUI() ) {
-            _search_found_label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
+            _search_found_label_0.setForeground( getConfiguration().getGuiCheckboxTextColor() );
         }
-        _search_tf = new JTextField( 3 );
-        _search_tf.setToolTipText( tip );
-        _search_tf.setEditable( true );
+        _search_tf_0 = new JTextField( 3 );
+        _search_tf_0.setToolTipText( tip );
+        _search_tf_0.setEditable( true );
         if ( !getConfiguration().isUseNativeUI() ) {
-            _search_tf.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
-            _search_tf.setBackground( getConfiguration().getGuiCheckboxTextColor() );
-            _search_tf.setBorder( null );
-        }
-        _search_reset_button = new JButton();
-        getSearchResetButton().setText( "Reset" );
-        getSearchResetButton().setEnabled( false );
-        getSearchResetButton().setVisible( false );
+            _search_tf_0.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
+            _search_tf_0.setBackground( getConfiguration().getGuiCheckboxTextColor() );
+            _search_tf_0.setBorder( null );
+        }
+        _search_reset_button_0 = new JButton();
+        getSearchResetButton0().setText( "Reset" );
+        getSearchResetButton0().setEnabled( false );
+        getSearchResetButton0().setVisible( false );
         final JPanel s_panel_1 = new JPanel( new BorderLayout() );
         final JPanel s_panel_2 = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
         s_panel_1.setBackground( getBackground() );
@@ -1271,7 +1325,7 @@ final class ControlPanel extends JPanel implements ActionListener {
 
             @Override
             public void keyReleased( final KeyEvent key_event ) {
-                search();
+                search0();
                 displayedPhylogenyMightHaveChanged( true );
             }
         };
@@ -1279,22 +1333,84 @@ final class ControlPanel extends JPanel implements ActionListener {
 
             @Override
             public void actionPerformed( final ActionEvent e ) {
-                searchReset();
-                setSearchFoundCountsOnLabel( 0 );
-                getSearchFoundCountsLabel().setVisible( false );
-                getSearchTextField().setText( "" );
-                getSearchResetButton().setEnabled( false );
-                getSearchResetButton().setVisible( false );
+                searchReset0();
+                setSearchFoundCountsOnLabel0( 0 );
+                getSearchFoundCountsLabel0().setVisible( false );
+                getSearchTextField0().setText( "" );
+                getSearchResetButton0().setEnabled( false );
+                getSearchResetButton0().setVisible( false );
                 displayedPhylogenyMightHaveChanged( true );
             }
         };
-        _search_reset_button.addActionListener( action_listener );
-        _search_tf.addKeyListener( key_adapter );
-        addJTextField( _search_tf, s_panel_1 );
-        s_panel_2.add( _search_found_label );
-        addJButton( _search_reset_button, s_panel_2 );
+        _search_reset_button_0.addActionListener( action_listener );
+        _search_tf_0.addKeyListener( key_adapter );
+        addJTextField( _search_tf_0, s_panel_1 );
+        s_panel_2.add( _search_found_label_0 );
+        addJButton( _search_reset_button_0, s_panel_2 );
     }
 
+    void setupSearchTools1() {
+        final String tip = "Enter text to search for. Use ',' for multiple searches (logical OR) and '+' for logical AND.";
+        final JLabel search_label = new JLabel( "Search (B):" );
+        search_label.setFont( ControlPanel.jcb_bold_font );
+        if ( !getConfiguration().isUseNativeUI() ) {
+            search_label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
+        }
+        add( search_label );
+        search_label.setToolTipText( tip );
+        _search_found_label_1 = new JLabel();
+        getSearchFoundCountsLabel1().setVisible( false );
+        _search_found_label_1.setFont( ControlPanel.jcb_bold_font );
+        if ( !getConfiguration().isUseNativeUI() ) {
+            _search_found_label_1.setForeground( getConfiguration().getGuiCheckboxTextColor() );
+        }
+        _search_tf_1 = new JTextField( 3 );
+        _search_tf_1.setToolTipText( tip );
+        _search_tf_1.setEditable( true );
+        if ( !getConfiguration().isUseNativeUI() ) {
+            _search_tf_1.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
+            _search_tf_1.setBackground( getConfiguration().getGuiCheckboxTextColor() );
+            _search_tf_1.setBorder( null );
+        }
+        _search_reset_button_1 = new JButton();
+        getSearchResetButton1().setText( "Reset" );
+        getSearchResetButton1().setEnabled( false );
+        getSearchResetButton1().setVisible( false );
+        final JPanel s_panel_1 = new JPanel( new BorderLayout() );
+        final JPanel s_panel_2 = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
+        s_panel_1.setBackground( getBackground() );
+        add( s_panel_1 );
+        s_panel_2.setBackground( getBackground() );
+        add( s_panel_2 );
+        final KeyAdapter key_adapter = new KeyAdapter() {
+
+            @Override
+            public void keyReleased( final KeyEvent key_event ) {
+                search1();
+                displayedPhylogenyMightHaveChanged( true );
+            }
+        };
+        final ActionListener action_listener = new ActionListener() {
+
+            @Override
+            public void actionPerformed( final ActionEvent e ) {
+                searchReset1();
+                setSearchFoundCountsOnLabel1( 0 );
+                getSearchFoundCountsLabel1().setVisible( false );
+                getSearchTextField1().setText( "" );
+                getSearchResetButton1().setEnabled( false );
+                getSearchResetButton1().setVisible( false );
+                displayedPhylogenyMightHaveChanged( true );
+            }
+        };
+        _search_reset_button_1.addActionListener( action_listener );
+        _search_tf_1.addKeyListener( key_adapter );
+        addJTextField( _search_tf_1, s_panel_1 );
+        s_panel_2.add( _search_found_label_1 );
+        addJButton( _search_reset_button_1, s_panel_2 );
+    }
+    
+    
     void showAnnotations() {
         if ( _show_annotation != null ) {
             _show_annotation.setSelected( true );
@@ -1394,7 +1510,8 @@ final class ControlPanel extends JPanel implements ActionListener {
                         .getPhylogenyGraphicsType() );
             }
             getMainPanel().getCurrentTreePanel().updateSubSuperTreeButton();
-            getMainPanel().getControlPanel().search();
+            getMainPanel().getControlPanel().search0();
+            getMainPanel().getControlPanel().search1();
             getMainPanel().getControlPanel().updateDomainStructureEvaluethresholdDisplay();
             getSequenceRelationTypeBox().removeAllItems();
             for( final SequenceRelation.SEQUENCE_RELATION_TYPE type : getMainPanel().getCurrentPhylogeny()
@@ -1610,10 +1727,64 @@ final class ControlPanel extends JPanel implements ActionListener {
         return getIsDrawPhylogramList().get( index );
     }
 
-    private void search( final MainPanel main_panel, final Phylogeny tree, final String query_str ) {
-        getSearchFoundCountsLabel().setVisible( true );
-        getSearchResetButton().setEnabled( true );
-        getSearchResetButton().setVisible( true );
+    private void search0( final MainPanel main_panel, final Phylogeny tree, final String query_str ) {
+        getSearchFoundCountsLabel0().setVisible( true );
+        getSearchResetButton0().setEnabled( true );
+        getSearchResetButton0().setVisible( true );
+        String[] queries = null;
+        List<PhylogenyNode> nodes = null;
+        if ( query_str.indexOf( ',' ) >= 0 ) {
+            queries = query_str.split( ",+" );
+        }
+        else {
+            queries = new String[ 1 ];
+            queries[ 0 ] = query_str.trim();
+        }
+        if ( ( queries != null ) && ( queries.length > 0 ) ) {
+            nodes = new ArrayList<PhylogenyNode>();
+            for( String query : queries ) {
+                if ( ForesterUtil.isEmpty( query ) ) {
+                    continue;
+                }
+                query = query.trim();
+                if ( query.indexOf( '+' ) >= 0 ) {
+                    nodes.addAll( PhylogenyMethods.searchDataLogicalAnd( query.split( "\\++" ),
+                                                                         tree,
+                                                                         getOptions().isSearchCaseSensitive(),
+                                                                         !getOptions().isMatchWholeTermsOnly(),
+                                                                         isShowDomainArchitectures() ) );
+                }
+                else {
+                    nodes.addAll( PhylogenyMethods.searchData( query,
+                                                               tree,
+                                                               getOptions().isSearchCaseSensitive(),
+                                                               !getOptions().isMatchWholeTermsOnly(),
+                                                               isShowDomainArchitectures() ) );
+                }
+            }
+            if ( getOptions().isInverseSearchResult() ) {
+                final List<PhylogenyNode> all = PhylogenyMethods.obtainAllNodesAsList( tree );
+                all.removeAll( nodes );
+                nodes = all;
+            }
+        }
+        if ( ( nodes != null ) && ( nodes.size() > 0 ) ) {
+            main_panel.getCurrentTreePanel().setFoundNodes0( new HashSet<Long>() );
+            for( final PhylogenyNode node : nodes ) {
+                main_panel.getCurrentTreePanel().getFoundNodes0().add( node.getId() );
+            }
+            setSearchFoundCountsOnLabel0( nodes.size() );
+        }
+        else {
+            setSearchFoundCountsOnLabel0( 0 );
+            searchReset0();
+        }
+    }
+    
+    private void search1( final MainPanel main_panel, final Phylogeny tree, final String query_str ) {
+        getSearchFoundCountsLabel1().setVisible( true );
+        getSearchResetButton1().setEnabled( true );
+        getSearchResetButton1().setVisible( true );
         String[] queries = null;
         List<PhylogenyNode> nodes = null;
         if ( query_str.indexOf( ',' ) >= 0 ) {
@@ -1652,15 +1823,15 @@ final class ControlPanel extends JPanel implements ActionListener {
             }
         }
         if ( ( nodes != null ) && ( nodes.size() > 0 ) ) {
-            main_panel.getCurrentTreePanel().setFoundNodes( new HashSet<Long>() );
+            main_panel.getCurrentTreePanel().setFoundNodes1( new HashSet<Long>() );
             for( final PhylogenyNode node : nodes ) {
-                main_panel.getCurrentTreePanel().getFoundNodes().add( node.getId() );
+                main_panel.getCurrentTreePanel().getFoundNodes1().add( node.getId() );
             }
-            setSearchFoundCountsOnLabel( nodes.size() );
+            setSearchFoundCountsOnLabel1( nodes.size() );
         }
         else {
-            setSearchFoundCountsOnLabel( 0 );
-            searchReset();
+            setSearchFoundCountsOnLabel1( 0 );
+            searchReset1();
         }
     }
 
index 0f7fd20..ee537d0 100644 (file)
@@ -424,15 +424,18 @@ public abstract class MainFrame extends JFrame implements ActionListener {
         }
         else if ( o == _search_case_senstive_cbmi ) {
             updateOptions( getOptions() );
-            getMainPanel().getControlPanel().search();
+            getMainPanel().getControlPanel().search0();
+            getMainPanel().getControlPanel().search1();
         }
         else if ( o == _search_whole_words_only_cbmi ) {
             updateOptions( getOptions() );
-            getMainPanel().getControlPanel().search();
+            getMainPanel().getControlPanel().search0();
+            getMainPanel().getControlPanel().search1();
         }
         else if ( o == _inverse_search_result_cbmi ) {
             updateOptions( getOptions() );
-            getMainPanel().getControlPanel().search();
+            getMainPanel().getControlPanel().search0();
+            getMainPanel().getControlPanel().search1();
         }
         else if ( o == _show_scale_cbmi ) {
             updateOptions( getOptions() );
@@ -1427,7 +1430,7 @@ public abstract class MainFrame extends JFrame implements ActionListener {
 
     private void annotateSequences() {
         if ( getCurrentTreePanel() != null ) {
-            final Set<Long> nodes = getCurrentTreePanel().getFoundNodes();
+            final Set<Long> nodes = getCurrentTreePanel().getFoundNodes0();
             if ( ( nodes == null ) || nodes.isEmpty() ) {
                 JOptionPane
                         .showMessageDialog( this,
index b114944..c127885 100644 (file)
@@ -68,7 +68,9 @@ public final class TreeColorSet {
             new Color( 255, 255, 255 ), // branch_color
             new Color( 255, 255, 255 ), // box_color
             new Color( 255, 255, 0 ), // collapesed_fill_color
-            new Color( 0, 255, 0 ), // found_color
+            new Color( 0, 255, 0 ), // found_color 0
+            new Color( 255, 0, 0 ), // found_color 1
+            new Color( 255, 255, 0 ), // found_color 1 + 2
             new Color( 255, 0, 0 ), // duplication_box_color
             new Color( 0, 255, 0 ), // speciation_box_color
             new Color( 255, 255, 0 ), // duplication_speciation_color
@@ -85,7 +87,9 @@ public final class TreeColorSet {
             new Color( 255, 255, 255 ), // branch_color
             new Color( 255, 255, 255 ), // box_color
             new Color( 255, 255, 0 ), // collapesed_fill_color
-            new Color( 0, 255, 0 ), // found_color
+            new Color( 0, 255, 0 ), // found_color 0
+            new Color( 255, 0, 0 ), // found_color 1
+            new Color( 255, 255, 0 ), // found_color 1 + 2
             new Color( 255, 0, 0 ), // duplication_box_color
             new Color( 0, 255, 0 ), // speciation_box_color
             new Color( 255, 255, 0 ), // duplication_speciation_color
@@ -102,7 +106,9 @@ public final class TreeColorSet {
             new Color( 0, 0, 0 ), // branch_color
             new Color( 0, 0, 0 ), // box_color
             new Color( 0, 0, 0 ), // collapesed_fill_color
-            new Color( 255, 0, 0 ), // found_color
+            new Color( 255, 0, 0 ), // found_color 0
+            new Color( 0, 255, 0 ), // found_color 1
+            new Color( 0, 0, 255 ), // found_color 1 + 2
             new Color( 255, 0, 0 ), // duplication_box_color
             new Color( 0, 255, 0 ), // speciation_box_color
             new Color( 255, 255, 0 ), // duplication_speciation_color
@@ -119,7 +125,9 @@ public final class TreeColorSet {
             new Color( 240, 240, 240 ), // branch_color
             new Color( 140, 140, 140 ), // box_color
             new Color( 140, 140, 140 ), // collapesed_fill_color
-            new Color( 255, 0, 0 ), // found_color
+            new Color( 255, 0, 0 ), // found_color 0
+            new Color( 0, 255, 0 ), // found_color 1
+            new Color( 255, 255, 0 ), // found_color 1 + 2
             new Color( 255, 0, 0 ), // duplication_box_color
             new Color( 0, 255, 0 ), // speciation_box_color
             new Color( 255, 255, 0 ), // duplication_speciation_color
@@ -136,7 +144,9 @@ public final class TreeColorSet {
             new Color( 0, 155, 0 ), // branch_color
             new Color( 0, 255, 0 ), // box_color
             new Color( 0, 255, 0 ), // collapesed_fill_color
-            new Color( 255, 255, 255 ), // found_color
+            new Color( 255, 0, 0 ), // found_color 0
+            new Color(  0, 255, 0 ), // found_color 1
+            new Color( 255, 255, 0 ), // found_color 1 + 2
             new Color( 255, 0, 0 ), // duplication_box_color
             new Color( 0, 255, 0 ), // speciation_box_color
             new Color( 255, 255, 0 ), // duplication_speciation_color
@@ -153,7 +163,9 @@ public final class TreeColorSet {
             new Color( 0, 20, 200 ), // branch_color
             new Color( 0, 20, 200 ), // box_color
             new Color( 255, 255, 0 ), // collapesed_fill_color
-            new Color( 0, 255, 0 ), // found_color
+            new Color( 0, 255, 0 ), // found_color 0
+            new Color( 255, 0, 0 ), // found_color 1
+            new Color( 0, 0, 255 ), // found_color 0 + 1
             new Color( 255, 0, 0 ), // duplication_box_color
             new Color( 0, 255, 0 ), // speciation_box_color
             new Color( 255, 255, 0 ), // duplication_speciation_color
@@ -170,7 +182,9 @@ public final class TreeColorSet {
             new Color( 0, 255, 255 ), // branch_color
             new Color( 0, 255, 255 ), // box_color
             new Color( 255, 255, 0 ), // collapesed_fill_color
-            new Color( 0, 255, 0 ), // found_color
+            new Color( 0, 255, 0 ), // found_color 0
+            new Color( 0, 0, 255 ), // found_color 1
+            new Color( 0, 255, 255 ), // found_color 0 + 1
             new Color( 255, 0, 0 ), // duplication_box_color
             new Color( 0, 255, 0 ), // speciation_box_color
             new Color( 255, 255, 0 ), // duplication_speciation_color
@@ -187,7 +201,9 @@ public final class TreeColorSet {
             new Color( 255, 200, 0 ), // branch_color
             new Color( 255, 200, 0 ), // box_color
             new Color( 255, 255, 255 ), // collapesed_fill_color
-            new Color( 255, 255, 255 ), // found_color
+            new Color( 255, 255, 0 ), // found_color 0
+            new Color( 0, 255, 255 ), // found_color 1
+            new Color( 255, 255, 255 ), // found_color 0 + 1
             new Color( 255, 0, 0 ), // duplication_box_color
             new Color( 0, 255, 0 ), // speciation_box_color
             new Color( 255, 255, 0 ), // duplication_speciation_color
@@ -205,6 +221,8 @@ public final class TreeColorSet {
             new Color( 255, 0, 0 ), // box_color
             new Color( 0, 0, 0 ), // collapesed_fill_color
             new Color( 0, 255, 0 ), // found_color
+            new Color( 255, 0, 0 ), // found_color 1
+            new Color( 255, 255, 0 ), // found_color 1 + 2
             new Color( 255, 0, 0 ), // duplication_box_color
             new Color( 0, 255, 0 ), // speciation_box_color
             new Color( 255, 255, 0 ), // duplication_speciation_color
@@ -221,7 +239,9 @@ public final class TreeColorSet {
             new Color( 0, 191, 255 ), // branch_color
             new Color( 0, 191, 255 ), // box_color
             new Color( 255, 255, 255 ), // collapesed_fill_color
-            new Color( 255, 0, 0 ), // found_color
+            new Color( 255, 0, 0 ), // found_color 0
+            new Color( 0, 255, 0 ), // found_color 1
+            new Color( 255, 255, 0 ), // found_color 0 + 1
             new Color( 255, 0, 0 ), // duplication_box_color
             new Color( 0, 255, 0 ), // speciation_box_color
             new Color( 255, 255, 0 ), // duplication_speciation_color
@@ -237,8 +257,10 @@ public final class TreeColorSet {
             new Color( 77, 77, 255 ), // branch_length_color
             new Color( 234, 173, 234 ), // branch_color
             new Color( 77, 77, 255 ), // box_color
-            new Color( 77, 77, 255 ), // collapesed_fill_color
-            new Color( 243, 243, 21 ), // found_color
+            new Color( 77, 77, 255 ), // collapsed_fill_color
+            new Color( 243, 243, 21 ), // found_color 0
+            new Color( 255,20, 147 ), // found_color 1
+            new Color( 255, 255, 255 ), // found_color 1 + 2
             new Color( 255, 0, 0 ), // duplication_box_color
             new Color( 0, 255, 0 ), // speciation_box_color
             new Color( 255, 255, 0 ), // duplication_speciation_color
@@ -261,7 +283,9 @@ public final class TreeColorSet {
     private Color              dup_box_color;
     private Color              spec_box_color;
     private Color              collapse_fill_color;
-    private Color              found_color;
+    private Color              found_color_0;
+    private Color              found_color_1;
+    private Color              found_color_0_and_1;
     private Color              duplication_or_specation_color;
     private Color              domains_color;
     private Color              binary_domain_combinations_color;
@@ -348,8 +372,16 @@ public final class TreeColorSet {
         return duplication_or_specation_color;
     }
 
-    Color getFoundColor() {
-        return found_color;
+    Color getFoundColor0() {
+        return found_color_0;
+    }
+    
+    Color getFoundColor1() {
+        return found_color_1;
+    }
+    
+    Color getFoundColor0and1() {
+        return found_color_0_and_1;
     }
 
     Color getGainedCharactersColor() {
@@ -411,14 +443,20 @@ public final class TreeColorSet {
         branch_color = _color_schemes[ scheme ][ 6 ];
         box_color = _color_schemes[ scheme ][ 7 ];
         collapse_fill_color = _color_schemes[ scheme ][ 8 ];
-        found_color = _color_schemes[ scheme ][ 9 ];
-        dup_box_color = _color_schemes[ scheme ][ 10 ];
-        spec_box_color = _color_schemes[ scheme ][ 11 ];
-        duplication_or_specation_color = _color_schemes[ scheme ][ 12 ];
-        domains_color = _color_schemes[ scheme ][ 13 ];
-        binary_domain_combinations_color = _color_schemes[ scheme ][ 14 ];
-        annotation_color = _color_schemes[ scheme ][ 15 ];
-        ov_color = _color_schemes[ scheme ][ 16 ];
+        found_color_0 = _color_schemes[ scheme ][ 9 ];
+        
+        found_color_1 = _color_schemes[ scheme ][ 10 ];
+        
+        found_color_0_and_1 = _color_schemes[ scheme ][11 ];
+        
+        
+        dup_box_color = _color_schemes[ scheme ][ 12 ];
+        spec_box_color = _color_schemes[ scheme ][ 13 ];
+        duplication_or_specation_color = _color_schemes[ scheme ][ 14 ];
+        domains_color = _color_schemes[ scheme ][ 15 ];
+        binary_domain_combinations_color = _color_schemes[ scheme ][ 16 ];
+        annotation_color = _color_schemes[ scheme ][ 17 ];
+        ov_color = _color_schemes[ scheme ][ 18 ];
     }
 
     void setCurrentColorScheme( final int color_scheme ) {
index fdd4c77..18b0df2 100644 (file)
@@ -174,7 +174,9 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
     private final PhylogenyNode[]        _sub_phylogenies_temp_roots                        = new PhylogenyNode[ TreePanel.MAX_SUBTREES ];
     private int                          _subtree_index                                     = 0;
     private MainPanel                    _main_panel                                        = null;
-    private Set<Long>                    _found_nodes                                       = null;
+    private Set<Long>                    _found_nodes_0                                       = null;
+    private Set<Long>                    _found_nodes_1                                       = null;
+    
     private PhylogenyNode                _highlight_node                                    = null;
     private JPopupMenu                   _node_popup_menu                                   = null;
     private JMenuItem                    _node_popup_menu_items[]                           = null;
@@ -967,8 +969,12 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
         return _domain_structure_e_value_thr_exp;
     }
 
-    final Set<Long> getFoundNodes() {
-        return _found_nodes;
+    final Set<Long> getFoundNodes0() {
+        return _found_nodes_0;
+    }
+    
+    final Set<Long> getFoundNodes1() {
+        return _found_nodes_1;
     }
 
     final Color getGraphicsForNodeBoxWithColorForParentBranch( final PhylogenyNode node ) {
@@ -1223,10 +1229,10 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
                 // Check if shift key is down
                 if ( ( e.getModifiers() & InputEvent.SHIFT_MASK ) != 0 ) {
                     // Yes, so add to _found_nodes
-                    if ( getFoundNodes() == null ) {
-                        setFoundNodes( new HashSet<Long>() );
+                    if ( getFoundNodes0() == null ) {
+                        setFoundNodes0( new HashSet<Long>() );
                     }
-                    getFoundNodes().add( node.getId() );
+                    getFoundNodes0().add( node.getId() );
                     // Check if control key is down
                 }
                 else if ( ( e.getModifiers() & InputEvent.CTRL_MASK ) != 0 ) {
@@ -1424,10 +1430,9 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
                   root_x + ( Math.cos( angle ) * parent_radius ),
                   root_y + ( Math.sin( angle ) * parent_radius ),
                   g );
-        paintNodeBox( c.getXcoord(), c.getYcoord(), c, g, to_pdf, to_graphics_file, isInFoundNodes( c )
-                || isInCurrentExternalNodes( c ) );
+        paintNodeBox( c.getXcoord(), c.getYcoord(), c, g, to_pdf, to_graphics_file );
         if ( c.isExternal() ) {
-            final boolean is_in_found_nodes = isInFoundNodes( c ) || isInCurrentExternalNodes( c );
+            final boolean is_in_found_nodes = isInFoundNodes0( c ) || isInFoundNodes1( c ) || isInCurrentExternalNodes( c );
             if ( ( _dynamic_hiding_factor > 1 ) && !is_in_found_nodes
                     && ( ( _urt_nodeid_index_map.get( c.getId() ) % _dynamic_hiding_factor ) != 1 ) ) {
                 return;
@@ -1454,8 +1459,16 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
                   root_x + ( Math.cos( angle ) * parent_radius ),
                   root_y + ( Math.sin( angle ) * parent_radius ),
                   g );
-        if ( isInFoundNodes( c ) || isInCurrentExternalNodes( c ) ) {
-            g.setColor( getTreeColorSet().getFoundColor() );
+        if ( ( isInFoundNodes0( c ) && !isInFoundNodes1( c ) ) || isInCurrentExternalNodes( c ) ) {
+            g.setColor( getTreeColorSet().getFoundColor0() );
+            drawRectFilled( c.getXSecondary() - 1, c.getYSecondary() - 1, 3, 3, g );
+        }
+        else if ( ( isInFoundNodes1( c ) && !isInFoundNodes0( c ) ) ) {
+            g.setColor( getTreeColorSet().getFoundColor1() );
+            drawRectFilled( c.getXSecondary() - 1, c.getYSecondary() - 1, 3, 3, g );
+        }
+        else if (  isInFoundNodes0( c ) && isInFoundNodes1( c )  ) {
+            g.setColor( getTreeColorSet().getFoundColor0and1() );
             drawRectFilled( c.getXSecondary() - 1, c.getYSecondary() - 1, 3, 3, g );
         }
     }
@@ -1491,7 +1504,11 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
             }
         }
         paintCirculars( phy.getRoot(), phy, center_x, center_y, radius, radial_labels, g, to_pdf, to_graphics_file );
-        paintNodeBox( _root.getXcoord(), _root.getYcoord(), _root, g, to_pdf, to_graphics_file, isInFoundNodes( _root ) );
+        paintNodeBox( _root.getXcoord(), _root.getYcoord(), _root, g, to_pdf, to_graphics_file );
+    }
+
+    private boolean isInFoundNodes( PhylogenyNode n ) {
+        return isInFoundNodes0( n ) || isInFoundNodes1( n );
     }
 
     final void paintCircularLite( final Phylogeny phy,
@@ -1812,22 +1829,22 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
     }
 
     final void selectNode( final PhylogenyNode node ) {
-        if ( ( getFoundNodes() != null ) && getFoundNodes().contains( node.getId() ) ) {
-            getFoundNodes().remove( node.getId() );
-            getControlPanel().setSearchFoundCountsOnLabel( getFoundNodes().size() );
-            if ( getFoundNodes().size() < 1 ) {
-                getControlPanel().searchReset();
+        if ( ( getFoundNodes0() != null ) && getFoundNodes0().contains( node.getId() ) ) {
+            getFoundNodes0().remove( node.getId() );
+            getControlPanel().setSearchFoundCountsOnLabel0( getFoundNodes0().size() );
+            if ( getFoundNodes0().size() < 1 ) {
+                getControlPanel().searchReset0();
             }
         }
         else {
-            getControlPanel().getSearchFoundCountsLabel().setVisible( true );
-            getControlPanel().getSearchResetButton().setEnabled( true );
-            getControlPanel().getSearchResetButton().setVisible( true );
-            if ( getFoundNodes() == null ) {
-                setFoundNodes( new HashSet<Long>() );
+            getControlPanel().getSearchFoundCountsLabel0().setVisible( true );
+            getControlPanel().getSearchResetButton0().setEnabled( true );
+            getControlPanel().getSearchResetButton0().setVisible( true );
+            if ( getFoundNodes0() == null ) {
+                setFoundNodes0( new HashSet<Long>() );
             }
-            getFoundNodes().add( node.getId() );
-            getControlPanel().setSearchFoundCountsOnLabel( getFoundNodes().size() );
+            getFoundNodes0().add( node.getId() );
+            getControlPanel().setSearchFoundCountsOnLabel0( getFoundNodes0().size() );
         }
     }
 
@@ -1845,8 +1862,12 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
         _current_external_nodes_data_buffer = sb;
     }
 
-    final void setFoundNodes( final Set<Long> found_nodes ) {
-        _found_nodes = found_nodes;
+    final void setFoundNodes0( final Set<Long> found_nodes ) {
+        _found_nodes_0 = found_nodes;
+    }
+    
+    final void setFoundNodes1( final Set<Long> found_nodes ) {
+        _found_nodes_1 = found_nodes;
     }
 
     final void setInOvRect( final boolean in_ov_rect ) {
@@ -2247,7 +2268,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
                 && ( getCopiedAndPastedNodes() != null )
                 && !to_pdf
                 && !to_graphics_file && getCopiedAndPastedNodes().contains( node.getId() ) ) {
-            g.setColor( getTreeColorSet().getFoundColor() );
+            g.setColor( getTreeColorSet().getFoundColor0() );
         }
         else if ( getControlPanel().isColorBranches() && ( PhylogenyMethods.getBranchColorValue( node ) != null ) ) {
             g.setColor( PhylogenyMethods.getBranchColorValue( node ) );
@@ -2426,8 +2447,8 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
         }
         _color_chooser.setPreviewPanel( new JPanel() );
         SubtreeColorizationActionListener al;
-        if ( ( getFoundNodes() != null ) && !getFoundNodes().isEmpty() ) {
-            final List<PhylogenyNode> additional_nodes = getFoundNodesAsListOfPhylogenyNodes();
+        if ( ( getFoundNodes0() != null ) && !getFoundNodes0().isEmpty() ) {
+            final List<PhylogenyNode> additional_nodes = getFoundNodes0AsListOfPhylogenyNodes();
             al = new SubtreeColorizationActionListener( _color_chooser, node, additional_nodes );
         }
         else {
@@ -2438,9 +2459,17 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
         dialog.setVisible( true );
     }
 
-    private List<PhylogenyNode> getFoundNodesAsListOfPhylogenyNodes() {
+    private List<PhylogenyNode> getFoundNodes0AsListOfPhylogenyNodes() {
         final List<PhylogenyNode> additional_nodes = new ArrayList<PhylogenyNode>();
-        for( final Long id : getFoundNodes() ) {
+        for( final Long id : getFoundNodes0() ) {
+            additional_nodes.add( _phylogeny.getNode( id ) );
+        }
+        return additional_nodes;
+    }
+    
+    private List<PhylogenyNode> getFoundNodes1AsListOfPhylogenyNodes() {
+        final List<PhylogenyNode> additional_nodes = new ArrayList<PhylogenyNode>();
+        for( final Long id : getFoundNodes1() ) {
             additional_nodes.add( _phylogeny.getNode( id ) );
         }
         return additional_nodes;
@@ -2979,8 +3008,12 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
         return ( ( getCurrentExternalNodes() != null ) && getCurrentExternalNodes().contains( node.getId() ) );
     }
 
-    final private boolean isInFoundNodes( final PhylogenyNode node ) {
-        return ( ( getFoundNodes() != null ) && getFoundNodes().contains( node.getId() ) );
+    final private boolean isInFoundNodes0( final PhylogenyNode node ) {
+        return ( ( getFoundNodes0() != null ) && getFoundNodes0().contains( node.getId() ) );
+    }
+    
+    final private boolean isInFoundNodes1( final PhylogenyNode node ) {
+        return ( ( getFoundNodes1() != null ) && getFoundNodes1().contains( node.getId() ) );
     }
 
     final private boolean isInOv() {
@@ -3653,8 +3686,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
             }
         }
         if ( node.isExternal() ) {
-            paintNodeBox( x2, y2, node, g, to_pdf, to_graphics_file, isInFoundNodes( node )
-                    || isInCurrentExternalNodes( node ) );
+            paintNodeBox( x2, y2, node, g, to_pdf, to_graphics_file );
         }
     }
 
@@ -3739,7 +3771,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
             c = Color.BLACK;
         }
         else if ( is_in_found_nodes ) {
-            c = getTreeColorSet().getFoundColor();
+            c = getColorForFoundNode( node );
         }
         else if ( getControlPanel().isColorAccordingToTaxonomy() ) {
             c = getTaxonomyBasedColor( node );
@@ -3848,11 +3880,35 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
         }
     }
 
-    final private void paintFoundNode( final int x, final int y, final Graphics2D g ) {
+    private final  Color getColorForFoundNode( final PhylogenyNode n ) {
+        if ( isInCurrentExternalNodes( n ) ) {
+            return getTreeColorSet().getFoundColor0();
+        }    
+        else if ( isInFoundNodes0( n ) && !isInFoundNodes1( n ) ) {
+            return getTreeColorSet().getFoundColor0() ;
+        }
+        else if ( !isInFoundNodes0( n ) && isInFoundNodes1( n ) ) {
+            return getTreeColorSet().getFoundColor1() ;
+        }
+        else  {
+            return getTreeColorSet().getFoundColor0and1() ;
+        }
+    }
+    
+    
+    final private void paintFoundNode( final PhylogenyNode n, final double x, final double y, final Graphics2D g ) {
         final int box_size = getOptions().getDefaultNodeShapeSize();
-        final int half_box_size = getOptions().getDefaultNodeShapeSize() / 2;
-        g.setColor( getTreeColorSet().getFoundColor() );
-        g.fillRect( x - half_box_size, y - half_box_size, box_size, box_size );
+        final double half_box_size = getOptions().getDefaultNodeShapeSize() / 2.0;
+        
+      
+                
+        
+        g.setColor( getColorForFoundNode( n ) );
+        //g.fillRect( x - half_box_size, y - half_box_size, box_size, box_size );
+        //TODO check me
+        //FIXME
+        _rectangle.setRect(  x - half_box_size, y - half_box_size, box_size, box_size );
+        g.fill(  _rectangle );
     }
 
     final private void paintGainedAndLostCharacters( final Graphics2D g,
@@ -3893,20 +3949,19 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
                                      final PhylogenyNode node,
                                      final Graphics2D g,
                                      final boolean to_pdf,
-                                     final boolean to_graphics_file,
-                                     final boolean is_in_found_nodes ) {
+                                     final boolean to_graphics_file ) {
         if ( node.isCollapse() ) {
             return;
         }
         // if this node should be highlighted, do so
         if ( ( _highlight_node == node ) && !to_pdf && !to_graphics_file ) {
-            g.setColor( getTreeColorSet().getFoundColor() );
+            g.setColor( getTreeColorSet().getFoundColor0() );
             drawOval( x - 8, y - 8, 16, 16, g );
             drawOval( x - 9, y - 8, 17, 17, g );
             drawOval( x - 9, y - 9, 18, 18, g );
         }
-        if ( is_in_found_nodes ) {
-            paintFoundNode( ForesterUtil.roundToInt( x ), ForesterUtil.roundToInt( y ), g );
+        if ( isInFoundNodes( node ) || isInCurrentExternalNodes( node ) ) {
+            paintFoundNode( node,  x ,  y , g );
         }
         else {
             Color outline_color = null;
@@ -4039,7 +4094,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
             g.setColor( Color.BLACK );
         }
         else if ( is_in_found_nodes ) {
-            g.setColor( getTreeColorSet().getFoundColor() );
+            g.setColor( getColorForFoundNode( node ) );
         }
         else if ( getControlPanel().isColorAccordingToTaxonomy() ) {
             g.setColor( getTaxonomyBasedColor( node ) );
@@ -4258,7 +4313,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
             g.setColor( Color.BLACK );
         }
         else if ( is_in_found_nodes ) {
-            g.setColor( getTreeColorSet().getFoundColor() );
+            g.setColor( getColorForFoundNode( node ) );
         }
         else if ( getControlPanel().isColorAccordingToTaxonomy() ) {
             g.setColor( getTaxonomyBasedColor( node ) );
@@ -4390,7 +4445,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
             return;
         }
         if ( isInFoundNodes( node ) || isInCurrentExternalNodes( node ) ) {
-            g.setColor( getTreeColorSet().getFoundColor() );
+            g.setColor( getColorForFoundNode( node ) );
             drawRectFilled( node.getXSecondary() - 1, node.getYSecondary() - 1, 3, 3, g );
         }
         float new_x = 0;
@@ -4518,8 +4573,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
                 child_node.setYcoord( y2 );
                 y2 += _y_distance * child_node.getNumberOfExternalNodes();
             }
-            paintNodeBox( node.getXcoord(), node.getYcoord(), node, g, to_pdf, to_graphics_file, isInFoundNodes( node )
-                    || isInCurrentExternalNodes( node ) );
+            paintNodeBox( node.getXcoord(), node.getYcoord(), node, g, to_pdf, to_graphics_file );
         }
         if ( dynamically_hide
                 && !is_in_found_nodes
@@ -4646,7 +4700,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
         final float height = getOvMaxHeight() / h_ratio;
         final float x = getVisibleRect().x + getOvXPosition() + ( getOvMaxWidth() / x_ratio );
         final float y = getVisibleRect().y + getOvYPosition() + ( getOvMaxHeight() / y_ratio );
-        g.setColor( getTreeColorSet().getFoundColor() );
+        g.setColor( getTreeColorSet().getFoundColor0() );
         getOvRectangle().setRect( x, y, width, height );
         final Stroke s = g.getStroke();
         g.setStroke( STROKE_1 );
@@ -4715,7 +4769,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
             final double w = PhylogenyMethods.getBranchWidthValue( root );
             drawRectFilled( x1 - d, root.getYcoord() - ( w / 2 ), d, w, g );
         }
-        paintNodeBox( x1, root.getYcoord(), root, g, to_pdf, to_graphics_file, isInFoundNodes( root ) );
+        paintNodeBox( x1, root.getYcoord(), root, g, to_pdf, to_graphics_file );
     }
 
     final private void paintScale( final Graphics2D g,
@@ -4759,7 +4813,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
         }
         else if ( is_in_found_nodes ) {
             g.setFont( getTreeFontSet().getLargeItalicFont().deriveFont( TreeFontSet.BOLD_AND_ITALIC ) );
-            g.setColor( getTreeColorSet().getFoundColor() );
+            g.setColor( getColorForFoundNode( node ) );
         }
         else if ( getControlPanel().isColorAccordingToTaxonomy() ) {
             g.setColor( getTaxonomyBasedColor( node ) );
@@ -4917,11 +4971,10 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
             current_angle += arc_size;
             assignGraphicsForBranchWithColorForParentBranch( desc, false, g, to_pdf, to_graphics_file );
             drawLine( x, y, new_x, new_y, g );
-            paintNodeBox( new_x, new_y, desc, g, to_pdf, to_graphics_file, isInFoundNodes( desc )
-                    || isInCurrentExternalNodes( desc ) );
+            paintNodeBox( new_x, new_y, desc, g, to_pdf, to_graphics_file );
         }
         if ( n.isRoot() ) {
-            paintNodeBox( n.getXcoord(), n.getYcoord(), n, g, to_pdf, to_graphics_file, isInFoundNodes( n ) );
+            paintNodeBox( n.getXcoord(), n.getYcoord(), n, g, to_pdf, to_graphics_file  );
         }
     }
 
@@ -4965,7 +5018,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
             desc.setXSecondary( new_x );
             desc.setYSecondary( new_y );
             if ( isInFoundNodes( desc ) || isInCurrentExternalNodes( desc ) ) {
-                g.setColor( getTreeColorSet().getFoundColor() );
+                g.setColor( getColorForFoundNode( desc ) );
                 drawRectFilled( desc.getXSecondary() - 1, desc.getYSecondary() - 1, 3, 3, g );
                 g.setColor( getTreeColorSet().getOvColor() );
             }
@@ -5177,8 +5230,15 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
     private void showExtDescNodeData( final PhylogenyNode node ) {
         final List<String> data = new ArrayList<String>();
         final List<PhylogenyNode> nodes = node.getAllExternalDescendants();
-        if ( ( getFoundNodes() != null ) && !getFoundNodes().isEmpty() ) {
-            for( final PhylogenyNode n : getFoundNodesAsListOfPhylogenyNodes() ) {
+        if ( ( getFoundNodes0() != null ) && !getFoundNodes0().isEmpty() ) {
+            for( final PhylogenyNode n : getFoundNodes0AsListOfPhylogenyNodes() ) {
+                if ( !nodes.contains( n ) ) {
+                    nodes.add( n );
+                }
+            }
+        }
+        if ( ( getFoundNodes1() != null ) && !getFoundNodes1().isEmpty() ) {
+            for( final PhylogenyNode n : getFoundNodes1AsListOfPhylogenyNodes() ) {
                 if ( !nodes.contains( n ) ) {
                     nodes.add( n );
                 }
@@ -5323,7 +5383,7 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
             else {
                 setCurrentExternalNodesDataBuffer( sb );
                 String title;
-                if ( ( getFoundNodes() != null ) && !getFoundNodes().isEmpty() ) {
+                if ( ( getFoundNodes0() != null ) && !getFoundNodes0().isEmpty() ) {
                     title = ( getOptions().getExtDescNodeDataToReturn() == NODE_DATA.UNKNOWN ? "Data"
                             : obtainTitleForExtDescNodeData() )
                             + " for "
@@ -5556,8 +5616,14 @@ public final class TreePanel extends JPanel implements ActionListener, MouseWhee
                         _rollover_popup
                                 .setBorder( BorderFactory.createLineBorder( getTreeColorSet().getBranchColor() ) );
                         _rollover_popup.setBackground( getTreeColorSet().getBackgroundColor() );
-                        if ( isInFoundNodes( node ) ) {
-                            _rollover_popup.setForeground( getTreeColorSet().getFoundColor() );
+                        if ( isInFoundNodes0( node ) && !isInFoundNodes1( node ) ) {
+                            _rollover_popup.setForeground( getTreeColorSet().getFoundColor0() );
+                        }
+                        else if ( !isInFoundNodes0( node ) && isInFoundNodes1( node ) ) {
+                            _rollover_popup.setForeground( getTreeColorSet().getFoundColor1() );
+                        }
+                        else if ( isInFoundNodes0( node ) && isInFoundNodes1( node ) ) {
+                            _rollover_popup.setForeground( getTreeColorSet().getFoundColor0and1() );
                         }
                         else if ( getControlPanel().isColorAccordingToTaxonomy() ) {
                             _rollover_popup.setForeground( getTaxonomyBasedColor( node ) );