+ add( search_label );
+ search_label.setToolTipText( SEARCH_TIP_TEXT );
+ _search_found_label_0 = new JLabel();
+ getSearchFoundCountsLabel0().setVisible( false );
+ _search_found_label_0.setFont( ControlPanel.jcb_bold_font );
+ if ( !getConfiguration().isUseNativeUI() ) {
+ _search_found_label_0.setForeground( getConfiguration().getGuiCheckboxTextColor() );
+ }
+ _search_tf_0 = new JTextField( 3 );
+ _search_tf_0.setToolTipText( SEARCH_TIP_TEXT );
+ _search_tf_0.setEditable( true );
+ if ( !getConfiguration().isUseNativeUI() ) {
+ _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() );
+ 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 ) {
+ search0();
+ displayedPhylogenyMightHaveChanged( true );
+ }
+ };
+ final ActionListener action_listener = new ActionListener() {
+
+ @Override
+ public void actionPerformed( final ActionEvent e ) {
+ searchReset0();
+ setSearchFoundCountsOnLabel0( 0 );
+ getSearchFoundCountsLabel0().setVisible( false );
+ getSearchTextField0().setText( "" );
+ getSearchResetButton0().setEnabled( false );
+ getSearchResetButton0().setVisible( false );
+ displayedPhylogenyMightHaveChanged( true );
+ }
+ };
+ _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 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( SEARCH_TIP_TEXT );
+ _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( SEARCH_TIP_TEXT );
+ _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 );
+ }
+ if ( _color_according_to_annotation != null ) {
+ _color_according_to_annotation.setSelected( true );
+ }
+ if ( _color_acc_species != null ) {
+ _color_acc_species.setSelected( false );
+ }
+ if ( _color_acc_sequence != null ) {
+ _color_acc_sequence.setSelected( false );
+ }
+ _mainpanel.getCurrentTreePanel().repaint();
+ }
+
+ /**
+ * Fit entire tree into window.
+ */
+ void showWhole() {
+ if ( ( _mainpanel.getCurrentScrollPane() == null ) || _mainpanel.getCurrentTreePanel().getPhylogeny().isEmpty() ) {
+ return;
+ }
+ getCurrentTreePanel().updateSetOfCollapsedExternalNodes();
+ displayedPhylogenyMightHaveChanged( true );
+ _mainpanel.getCurrentTreePanel().updateOvSettings();
+ _mainpanel.getCurrentTreePanel().validate();
+ _mainpanel.validate();
+ _mainpanel.getCurrentTreePanel().calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
+ _mainpanel.getSizeOfViewport().height );
+ _mainpanel.getCurrentTreePanel().resetPreferredSize();
+ _mainpanel.adjustJScrollPane();
+ _mainpanel.getCurrentTreePanel().repaint();
+ _mainpanel.getCurrentTreePanel().validate();
+ _mainpanel.validate();
+ _mainpanel.getCurrentTreePanel().calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
+ _mainpanel.getSizeOfViewport().height );
+ _mainpanel.getCurrentTreePanel().resetPreferredSize();
+ _mainpanel.adjustJScrollPane();
+ _mainpanel.getCurrentTreePanel().repaint();
+ _mainpanel.getCurrentTreePanel().updateOvSizes();
+ }
+
+ void showWholeAll() {
+ for( final TreePanel tree_panel : _mainpanel.getTreePanels() ) {
+ if ( tree_panel != null ) {
+ tree_panel.validate();
+ tree_panel.calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
+ _mainpanel.getSizeOfViewport().height );
+ tree_panel.resetPreferredSize();
+ tree_panel.repaint();
+ }
+ }
+ }
+
+ // Create header for click-to combo box.
+ void startClickToOptions() {
+ final JLabel spacer = new JLabel( "" );
+ spacer.setFont( ControlPanel.jcb_font );
+ add( spacer );
+ _click_to_label = new JLabel( "Click on Node to:" );
+ add( customizeLabel( _click_to_label, getConfiguration() ) );
+ _click_to_combobox = new JComboBox<String>();
+ _click_to_combobox.setFocusable( false );
+ _click_to_combobox.setMaximumRowCount( 14 );
+ _click_to_combobox.setFont( ControlPanel.js_font );
+ if ( !_configuration.isUseNativeUI() ) {
+ _click_to_combobox.setBackground( getConfiguration().getGuiBackgroundColor() );
+ }
+ // don't add listener until all items are set (or each one will trigger
+ // an event)
+ // click_to_list.addActionListener(this);
+ add( _click_to_combobox );
+ // Correlates option names to titles
+ _all_click_to_names = new HashMap<Integer, String>();
+ _click_to_names = new ArrayList<String>();
+ }
+
+ void tabChanged() {
+ if ( getMainPanel().getTabbedPane().getTabCount() > 0 ) {
+ if ( getCurrentTreePanel().isPhyHasBranchLengths()
+ && ( getCurrentTreePanel().getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) {
+ setDrawPhylogramEnabled( true );
+ setDrawPhylogram( isDrawPhylogram() );
+ }
+ else {
+ setDrawPhylogramEnabled( false );
+ setDrawPhylogram( false );
+ }
+ if ( getMainPanel().getMainFrame() == null ) {
+ // Must be "E" applet version.
+ final ArchaeopteryxE e = ( ArchaeopteryxE ) ( ( MainPanelApplets ) getMainPanel() ).getApplet();
+ e.setSelectedTypeInTypeMenu( e.getCurrentTreePanel().getPhylogenyGraphicsType() );
+ }
+ else {
+ getMainPanel().getMainFrame().setSelectedTypeInTypeMenu( getMainPanel().getCurrentTreePanel()
+ .getPhylogenyGraphicsType() );
+ }
+ getMainPanel().getCurrentTreePanel().updateSubSuperTreeButton();
+ getMainPanel().getControlPanel().search0();
+ getMainPanel().getControlPanel().search1();
+ getMainPanel().getControlPanel().updateDomainStructureEvaluethresholdDisplay();
+ getSequenceRelationTypeBox().removeAllItems();
+ for( final SequenceRelation.SEQUENCE_RELATION_TYPE type : getMainPanel().getCurrentPhylogeny()
+ .getRelevantSequenceRelationTypes() ) {
+ _sequence_relation_type_box.addItem( type );
+ }
+ getMainPanel().getCurrentTreePanel().repaint();
+ //setSequenceRelationQueries( getMainPanel().getCurrentPhylogeny().getSequenceRelationQueries() );
+ // according to GUILHEM the line above can be removed.
+ }
+ }
+
+ /**
+ * Uncollapse all nodes.
+ */
+ void uncollapseAll( final TreePanel tp ) {
+ final Phylogeny t = tp.getPhylogeny();
+ if ( ( t != null ) && !t.isEmpty() ) {
+ for( final PhylogenyNodeIterator iter = t.iteratorPreorder(); iter.hasNext(); ) {
+ final PhylogenyNode node = iter.next();
+ node.setCollapse( false );
+ }
+ tp.resetNodeIdToDistToLeafMap();
+ tp.updateSetOfCollapsedExternalNodes();
+ t.recalculateNumberOfExternalDescendants( false );
+ tp.setNodeInPreorderToNull();
+ t.clearHashIdToNodeMap();
+ showWhole();
+ }
+ }
+
+ void updateDomainStructureEvaluethresholdDisplay() {
+ if ( _domain_structure_evalue_thr_tf != null ) {
+ _domain_structure_evalue_thr_tf.setText( "10^"
+ + getMainPanel().getCurrentTreePanel().getDomainStructureEvalueThresholdExp() );
+ }
+ }
+
+ void zoomInX( final float factor, final float x_correction_factor ) {
+ final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar();
+ final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
+ treepanel.multiplyUrtFactor( 1f );
+ if ( ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
+ || ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
+ || isDrawPhylogram( getMainPanel().getCurrentTabIndex() )
+ || ( getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP ) ) {
+ final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
+ treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
+ treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
+ getMainPanel().adjustJScrollPane();
+ treepanel.resetPreferredSize();
+ getMainPanel().getCurrentScrollPane().getViewport().validate();
+ sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
+ - ( sb.getVisibleAmount() / 2.0 ) ) );
+ }
+ else {
+ final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue();
+ treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
+ treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
+ getMainPanel().adjustJScrollPane();
+ treepanel.resetPreferredSize();
+ getMainPanel().getCurrentScrollPane().getViewport().validate();
+ sb.setValue( sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount() );
+ }
+ treepanel.resetPreferredSize();
+ treepanel.updateOvSizes();
+ }
+
+ void zoomInY( final float factor ) {
+ final JScrollBar sb = getMainPanel().getCurrentScrollPane().getVerticalScrollBar();
+ final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
+ treepanel.multiplyUrtFactor( 1.1f );
+ final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
+ treepanel.setYdistance( ( treepanel.getYdistance() * factor ) );
+ getMainPanel().adjustJScrollPane();
+ treepanel.resetPreferredSize();
+ getMainPanel().getCurrentScrollPane().getViewport().validate();
+ sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
+ - ( sb.getVisibleAmount() / 2.0 ) ) );
+ treepanel.resetPreferredSize();
+ treepanel.updateOvSizes();
+ }
+
+ void zoomOutX( final float factor, final float x_correction_factor ) {
+ final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
+ treepanel.multiplyUrtFactor( 1f );
+ if ( ( treepanel.getXdistance() * factor ) > 0.0 ) {
+ final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar();
+ if ( ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
+ || ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
+ || isDrawPhylogram( getMainPanel().getCurrentTabIndex() )
+ || ( getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP ) ) {
+ getMainPanel().adjustJScrollPane();
+ treepanel.resetPreferredSize();
+ getMainPanel().getCurrentScrollPane().getViewport().validate();
+ final double x = ( sb.getMaximum() - sb.getMinimum() )
+ / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
+ treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
+ treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
+ getMainPanel().adjustJScrollPane();
+ treepanel.resetPreferredSize();
+ getMainPanel().getCurrentScrollPane().getViewport().validate();
+ sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
+ - ( sb.getVisibleAmount() / 2.0 ) ) );
+ }
+ else {
+ final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue();
+ treepanel.setXdistance( treepanel.getXdistance() * factor );
+ treepanel.setXcorrectionFactor( treepanel.getXcorrectionFactor() * x_correction_factor );
+ if ( x > 0 ) {
+ getMainPanel().adjustJScrollPane();
+ treepanel.resetPreferredSize();
+ getMainPanel().getCurrentScrollPane().getViewport().validate();
+ sb.setValue( sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount() );
+ }
+ }
+ treepanel.resetPreferredSize();
+ treepanel.updateOvSizes();
+ }
+ }
+
+ void zoomOutY( final float factor ) {
+ final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
+ treepanel.multiplyUrtFactor( 0.9f );
+ if ( ( treepanel.getYdistance() * factor ) > 0.0 ) {
+ final JScrollBar sb = getMainPanel().getCurrentScrollPane().getVerticalScrollBar();
+ final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
+ treepanel.setYdistance( ( treepanel.getYdistance() * factor ) );
+ getMainPanel().adjustJScrollPane();
+ treepanel.resetPreferredSize();
+ getMainPanel().getCurrentScrollPane().getViewport().validate();
+ sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
+ - ( sb.getVisibleAmount() / 2.0 ) ) );
+ treepanel.resetPreferredSize();
+ treepanel.updateOvSizes();
+ }
+ }
+
+ private void addClickToOption( final int which, final String title ) {
+ _click_to_combobox.addItem( title );
+ _click_to_names.add( title );
+ _all_click_to_names.put( new Integer( which ), title );
+ if ( !_configuration.isUseNativeUI() ) {
+ _click_to_combobox.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
+ _click_to_combobox.setForeground( getConfiguration().getGuiButtonTextColor() );
+ }
+ }
+
+ /* GUILHEM_BEG */
+ private void addSequenceRelationBlock() {
+ final JLabel spacer = new JLabel( "" );
+ spacer.setSize( 1, 1 );
+ add( spacer );
+ final JLabel mainLabel = new JLabel( "Sequence relations to display" );
+ final JLabel typeLabel = customizeLabel( new JLabel( "(type) " ), getConfiguration() );
+ typeLabel.setFont( ControlPanel.js_font.deriveFont( 7 ) );
+ getSequenceRelationTypeBox().setFocusable( false );
+ _sequence_relation_type_box.setFont( ControlPanel.js_font );
+ if ( !_configuration.isUseNativeUI() ) {
+ _sequence_relation_type_box.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
+ _sequence_relation_type_box.setForeground( getConfiguration().getGuiButtonTextColor() );
+ }
+ _sequence_relation_type_box.setRenderer( new ListCellRenderer<Object>() {
+
+ @Override
+ public Component getListCellRendererComponent( final JList<?> list,
+ final Object value,
+ final int index,
+ final boolean isSelected,
+ final boolean cellHasFocus ) {
+ final Component component = new DefaultListCellRenderer().getListCellRendererComponent( list,
+ value,
+ index,
+ isSelected,
+ cellHasFocus );
+ if ( ( value != null ) && ( value instanceof SequenceRelation.SEQUENCE_RELATION_TYPE ) ) {
+ ( ( DefaultListCellRenderer ) component ).setText( SequenceRelation
+ .getPrintableNameByType( ( SequenceRelation.SEQUENCE_RELATION_TYPE ) value ) );
+ }
+ return component;
+ }
+ } );
+ final GridBagLayout gbl = new GridBagLayout();
+ _sequence_relation_type_box.setMinimumSize( new Dimension( 115, 17 ) );
+ _sequence_relation_type_box.setPreferredSize( new Dimension( 115, 20 ) );
+ final JPanel horizGrid = new JPanel( gbl );
+ horizGrid.setBackground( getBackground() );
+ horizGrid.add( typeLabel );
+ horizGrid.add( _sequence_relation_type_box );
+ add( customizeLabel( mainLabel, getConfiguration() ) );
+ add( horizGrid );
+ add( getSequenceRelationBox() );
+ if ( _configuration.doDisplayOption( Configuration.show_relation_confidence ) ) {
+ addCheckbox( Configuration.show_relation_confidence,
+ _configuration.getDisplayTitle( Configuration.show_relation_confidence ) );
+ setCheckbox( Configuration.show_relation_confidence,
+ _configuration.doCheckOption( Configuration.show_relation_confidence ) );
+ }
+ }// addSequenceRelationBlock
+
+ /* GUILHEM_END */
+ private List<Boolean> getIsDrawPhylogramList() {
+ return _draw_phylogram;
+ }
+
+ private void init() {
+ _draw_phylogram = new ArrayList<Boolean>();
+ setSpeciesColors( new HashMap<String, Color>() );
+ setSequenceColors( new HashMap<String, Color>() );
+ setAnnotationColors( new HashMap<String, Color>() );
+ }
+
+ private boolean isDrawPhylogram( final int index ) {
+ return getIsDrawPhylogramList().get( index );
+ }
+
+ 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;
+ Set<PhylogenyNode> nodes = null;
+ if ( ( query_str.indexOf( ',' ) >= 0 ) && !getOptions().isSearchWithRegex() ) {
+ queries = query_str.split( ",+" );
+ }
+ else {
+ queries = new String[ 1 ];
+ queries[ 0 ] = query_str.trim();
+ }
+ if ( ( queries != null ) && ( queries.length > 0 ) ) {
+ nodes = new HashSet<PhylogenyNode>();
+ for( String query : queries ) {
+ if ( ForesterUtil.isEmpty( query ) ) {
+ continue;
+ }
+ query = query.trim();
+ final TreePanel tp = getMainPanel().getCurrentTreePanel();
+ if ( ( query.indexOf( '+' ) > 0 ) && !getOptions().isSearchWithRegex() ) {
+ nodes.addAll( PhylogenyMethods.searchDataLogicalAnd( query.split( "\\++" ),
+ tree,
+ getOptions().isSearchCaseSensitive(),
+ !getOptions().isMatchWholeTermsOnly(),
+ isShowDomainArchitectures(),
+ tp != null ? Math.pow( 10,
+ tp.getDomainStructureEvalueThresholdExp() )
+ : 0 ) );
+ }
+ else {
+ nodes.addAll( PhylogenyMethods.searchData( query,
+ tree,
+ getOptions().isSearchCaseSensitive(),
+ !getOptions().isMatchWholeTermsOnly(),
+ getOptions().isSearchWithRegex(),
+ isShowDomainArchitectures(),
+ tp != null ? Math.pow( 10, tp
+ .getDomainStructureEvalueThresholdExp() ) : 0 ) );
+ }
+ }
+ if ( getOptions().isInverseSearchResult() ) {
+ final List<PhylogenyNode> all = PhylogenyMethods.obtainAllNodesAsList( tree );
+ all.removeAll( nodes );
+ nodes = new HashSet<PhylogenyNode>();
+ nodes.addAll( 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;
+ Set<PhylogenyNode> nodes = null;
+ if ( ( query_str.indexOf( ',' ) >= 0 ) && !getOptions().isSearchWithRegex() ) {
+ queries = query_str.split( ",+" );
+ }
+ else {
+ queries = new String[ 1 ];
+ queries[ 0 ] = query_str.trim();
+ }
+ if ( ( queries != null ) && ( queries.length > 0 ) ) {
+ nodes = new HashSet<PhylogenyNode>();
+ for( String query : queries ) {
+ if ( ForesterUtil.isEmpty( query ) ) {
+ continue;
+ }
+ query = query.trim();
+ final TreePanel tp = getMainPanel().getCurrentTreePanel();
+ if ( ( query.indexOf( '+' ) > 0 ) && !getOptions().isSearchWithRegex() ) {
+ nodes.addAll( PhylogenyMethods.searchDataLogicalAnd( query.split( "\\++" ),
+ tree,
+ getOptions().isSearchCaseSensitive(),
+ !getOptions().isMatchWholeTermsOnly(),
+ isShowDomainArchitectures(),
+ tp != null ? Math.pow( 10,
+ tp.getDomainStructureEvalueThresholdExp() )
+ : 0 ) );
+ }
+ else {
+ nodes.addAll( PhylogenyMethods.searchData( query,
+ tree,
+ getOptions().isSearchCaseSensitive(),
+ !getOptions().isMatchWholeTermsOnly(),
+ getOptions().isSearchWithRegex(),
+ isShowDomainArchitectures(),
+ tp != null ? Math.pow( 10, tp
+ .getDomainStructureEvalueThresholdExp() ) : 0 ) );
+ }
+ }
+ if ( getOptions().isInverseSearchResult() ) {
+ final List<PhylogenyNode> all = PhylogenyMethods.obtainAllNodesAsList( tree );
+ all.removeAll( nodes );
+ nodes = new HashSet<PhylogenyNode>();
+ nodes.addAll( all );
+ }
+ }
+ if ( ( nodes != null ) && ( nodes.size() > 0 ) ) {
+ main_panel.getCurrentTreePanel().setFoundNodes1( new HashSet<Long>() );
+ for( final PhylogenyNode node : nodes ) {
+ main_panel.getCurrentTreePanel().getFoundNodes1().add( node.getId() );
+ }
+ setSearchFoundCountsOnLabel1( nodes.size() );
+ }
+ else {
+ setSearchFoundCountsOnLabel1( 0 );
+ searchReset1();
+ }
+ }
+
+ private void setDrawPhylogram( final int index, final boolean b ) {
+ getIsDrawPhylogramList().set( index, b );
+ }
+
+ private void setupClickToOptions() {
+ final int default_option = _configuration.getDefaultDisplayClicktoOption();
+ int selected_index = 0;
+ int cb_index = 0;
+ if ( _configuration.doDisplayClickToOption( Configuration.display_node_data ) ) {
+ _show_data_item = cb_index;
+ addClickToOption( Configuration.display_node_data,
+ _configuration.getClickToTitle( Configuration.display_node_data ) );
+ if ( default_option == Configuration.display_node_data ) {
+ selected_index = cb_index;
+ }
+ cb_index++;
+ }
+ if ( _configuration.doDisplayClickToOption( Configuration.collapse_uncollapse ) ) {
+ _collapse_cb_item = cb_index;
+ addClickToOption( Configuration.collapse_uncollapse,
+ _configuration.getClickToTitle( Configuration.collapse_uncollapse ) );
+ if ( default_option == Configuration.collapse_uncollapse ) {
+ selected_index = cb_index;
+ }
+ cb_index++;
+ }
+ if ( _configuration.doDisplayClickToOption( Configuration.reroot ) ) {
+ _reroot_cb_item = cb_index;
+ addClickToOption( Configuration.reroot, _configuration.getClickToTitle( Configuration.reroot ) );
+ if ( default_option == Configuration.reroot ) {
+ selected_index = cb_index;
+ }
+ cb_index++;
+ }
+ if ( _configuration.doDisplayClickToOption( Configuration.subtree ) ) {
+ _subtree_cb_item = cb_index;
+ addClickToOption( Configuration.subtree, _configuration.getClickToTitle( Configuration.subtree ) );
+ if ( default_option == Configuration.subtree ) {
+ selected_index = cb_index;
+ }
+ cb_index++;
+ }
+ if ( _configuration.doDisplayClickToOption( Configuration.swap ) ) {
+ _swap_cb_item = cb_index;
+ addClickToOption( Configuration.swap, _configuration.getClickToTitle( Configuration.swap ) );
+ if ( default_option == Configuration.swap ) {
+ selected_index = cb_index;
+ }
+ cb_index++;
+ }
+ if ( _configuration.doDisplayClickToOption( Configuration.sort_descendents ) ) {
+ _sort_descendents_item = cb_index;
+ addClickToOption( Configuration.sort_descendents,
+ _configuration.getClickToTitle( Configuration.sort_descendents ) );
+ if ( default_option == Configuration.sort_descendents ) {
+ selected_index = cb_index;
+ }
+ cb_index++;
+ }
+ if ( _configuration.doDisplayClickToOption( Configuration.color_node_font ) ) {
+ _color_node_font_item = cb_index;
+ addClickToOption( Configuration.color_node_font,
+ _configuration.getClickToTitle( Configuration.color_node_font ) );
+ if ( default_option == Configuration.color_node_font ) {
+ selected_index = cb_index;
+ }
+ cb_index++;
+ }
+ if ( _configuration.doDisplayClickToOption( Configuration.change_node_font ) ) {
+ _change_node_font_item = cb_index;
+ addClickToOption( Configuration.change_node_font,
+ _configuration.getClickToTitle( Configuration.change_node_font ) );
+ if ( default_option == Configuration.change_node_font ) {
+ selected_index = cb_index;
+ }
+ cb_index++;