can now do antialias on Mac OS.
[jalview.git] / forester / java / src / org / forester / archaeopteryx / ControlPanel.java
index 98d5b54..3bd8738 100644 (file)
@@ -44,6 +44,7 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import javax.swing.BorderFactory;
 import javax.swing.DefaultListCellRenderer;
@@ -224,12 +225,11 @@ final class ControlPanel extends JPanel implements ActionListener {
                 }
                 displayedPhylogenyMightHaveChanged( true );
             }
-            else if ( e.getSource() == _show_domain_architectures  ) {
+            else if ( e.getSource() == _show_domain_architectures ) {
                 search0();
                 search1();
                 displayedPhylogenyMightHaveChanged( true );
             }
-            
             else if ( ( tp != null ) && ( tp.getPhylogeny() != null ) ) {
                 if ( e.getSource() == getDisplayAsPhylogramCb() ) {
                     setDrawPhylogram( getDisplayAsPhylogramCb().isSelected() );
@@ -1804,7 +1804,7 @@ final class ControlPanel extends JPanel implements ActionListener {
         getSearchResetButton0().setEnabled( true );
         getSearchResetButton0().setVisible( true );
         String[] queries = null;
-        List<PhylogenyNode> nodes = null;
+        Set<PhylogenyNode> nodes = null;
         if ( ( query_str.indexOf( ',' ) >= 0 ) && !getOptions().isSearchWithRegex() ) {
             queries = query_str.split( ",+" );
         }
@@ -1813,36 +1813,39 @@ final class ControlPanel extends JPanel implements ActionListener {
             queries[ 0 ] = query_str.trim();
         }
         if ( ( queries != null ) && ( queries.length > 0 ) ) {
-            nodes = new ArrayList<PhylogenyNode>();
+            nodes = new HashSet<PhylogenyNode>();
             for( String query : queries ) {
                 if ( ForesterUtil.isEmpty( query ) ) {
                     continue;
                 }
                 query = query.trim();
-                if ( ( query.indexOf( '+' ) >= 0 ) && !getOptions().isSearchWithRegex() ) {
+                final TreePanel tp = getMainPanel().getCurrentTreePanel();
+                if ( ( query.indexOf( '+' ) > 0 ) && !getOptions().isSearchWithRegex() ) {
                     nodes.addAll( PhylogenyMethods.searchDataLogicalAnd( query.split( "\\++" ),
                                                                          tree,
                                                                          getOptions().isSearchCaseSensitive(),
                                                                          !getOptions().isMatchWholeTermsOnly(),
-                                                                         isShowDomainArchitectures() ) );
+                                                                         isShowDomainArchitectures(),
+                                                                         tp != null ? Math.pow( 10,
+                                                                                                tp.getDomainStructureEvalueThresholdExp() )
+                                                                                                : 0 ) );
                 }
                 else {
-                    final TreePanel tp = getMainPanel().getCurrentTreePanel();
-                   
-                    
                     nodes.addAll( PhylogenyMethods.searchData( query,
                                                                tree,
                                                                getOptions().isSearchCaseSensitive(),
                                                                !getOptions().isMatchWholeTermsOnly(),
                                                                getOptions().isSearchWithRegex(),
                                                                isShowDomainArchitectures(),
-                                                               tp != null ? Math.pow( 10, tp.getDomainStructureEvalueThresholdExp() ) : 0 )  );
+                                                               tp != null ? Math.pow( 10, tp
+                                                                                      .getDomainStructureEvalueThresholdExp() ) : 0 ) );
                 }
             }
             if ( getOptions().isInverseSearchResult() ) {
                 final List<PhylogenyNode> all = PhylogenyMethods.obtainAllNodesAsList( tree );
                 all.removeAll( nodes );
-                nodes = all;
+                nodes = new HashSet<PhylogenyNode>();
+                nodes.addAll( all );
             }
         }
         if ( ( nodes != null ) && ( nodes.size() > 0 ) ) {
@@ -1863,7 +1866,7 @@ final class ControlPanel extends JPanel implements ActionListener {
         getSearchResetButton1().setEnabled( true );
         getSearchResetButton1().setVisible( true );
         String[] queries = null;
-        List<PhylogenyNode> nodes = null;
+        Set<PhylogenyNode> nodes = null;
         if ( ( query_str.indexOf( ',' ) >= 0 ) && !getOptions().isSearchWithRegex() ) {
             queries = query_str.split( ",+" );
         }
@@ -1872,34 +1875,39 @@ final class ControlPanel extends JPanel implements ActionListener {
             queries[ 0 ] = query_str.trim();
         }
         if ( ( queries != null ) && ( queries.length > 0 ) ) {
-            nodes = new ArrayList<PhylogenyNode>();
+            nodes = new HashSet<PhylogenyNode>();
             for( String query : queries ) {
                 if ( ForesterUtil.isEmpty( query ) ) {
                     continue;
                 }
                 query = query.trim();
-                if ( ( query.indexOf( '+' ) >= 0 ) && !getOptions().isSearchWithRegex() ) {
+                final TreePanel tp = getMainPanel().getCurrentTreePanel();
+                if ( ( query.indexOf( '+' ) > 0 ) && !getOptions().isSearchWithRegex() ) {
                     nodes.addAll( PhylogenyMethods.searchDataLogicalAnd( query.split( "\\++" ),
                                                                          tree,
                                                                          getOptions().isSearchCaseSensitive(),
                                                                          !getOptions().isMatchWholeTermsOnly(),
-                                                                         isShowDomainArchitectures() ) );
+                                                                         isShowDomainArchitectures(),
+                                                                         tp != null ? Math.pow( 10,
+                                                                                                tp.getDomainStructureEvalueThresholdExp() )
+                                                                                                : 0 ) );
                 }
                 else {
-                    final TreePanel tp = getMainPanel().getCurrentTreePanel();
                     nodes.addAll( PhylogenyMethods.searchData( query,
                                                                tree,
                                                                getOptions().isSearchCaseSensitive(),
                                                                !getOptions().isMatchWholeTermsOnly(),
                                                                getOptions().isSearchWithRegex(),
                                                                isShowDomainArchitectures(),
-                                                               tp != null ? Math.pow( 10, tp.getDomainStructureEvalueThresholdExp() ) : 0 )  );
+                                                               tp != null ? Math.pow( 10, tp
+                                                                                      .getDomainStructureEvalueThresholdExp() ) : 0 ) );
                 }
             }
             if ( getOptions().isInverseSearchResult() ) {
                 final List<PhylogenyNode> all = PhylogenyMethods.obtainAllNodesAsList( tree );
                 all.removeAll( nodes );
-                nodes = all;
+                nodes = new HashSet<PhylogenyNode>();
+                nodes.addAll( all );
             }
         }
         if ( ( nodes != null ) && ( nodes.size() > 0 ) ) {
@@ -2047,11 +2055,9 @@ final class ControlPanel extends JPanel implements ActionListener {
                                   .getLabelForGetExtDescendentsData() );
             }
             else {
-               
                 addClickToOption( Configuration.get_ext_desc_data,
                                   getConfiguration().getClickToTitle( Configuration.get_ext_desc_data ) );
             }
-           
             if ( default_option == Configuration.get_ext_desc_data ) {
                 selected_index = cb_index;
             }