X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Farchaeopteryx%2FControlPanel.java;h=d7df7056263a93029be53b79f00d35c35da03b58;hb=a07102813fbac79ba1a534dc9954a8500dc5e5ff;hp=419f2c5f6c7cad6634ca17b8e95d0198b5512b95;hpb=7f4318a3ef37864b5453e3cd56270b8e91e76b9f;p=jalview.git diff --git a/forester/java/src/org/forester/archaeopteryx/ControlPanel.java b/forester/java/src/org/forester/archaeopteryx/ControlPanel.java index 419f2c5..d7df705 100644 --- a/forester/java/src/org/forester/archaeopteryx/ControlPanel.java +++ b/forester/java/src/org/forester/archaeopteryx/ControlPanel.java @@ -134,6 +134,7 @@ final class ControlPanel extends JPanel implements ActionListener { private int _paste_subtree_item; private int _add_new_node_item; private int _edit_node_data_item; + private int _get_ext_desc_data; private int _blast_item; // zooming and quick tree manipulation buttons: private JButton _zoom_in_x; @@ -211,6 +212,10 @@ final class ControlPanel extends JPanel implements ActionListener { } displayedPhylogenyMightHaveChanged( false ); } + else if ( e.getSource() == _show_domain_architectures ) { + search(); + displayedPhylogenyMightHaveChanged( false ); + } else if ( ( tp != null ) && ( tp.getPhylogeny() != null ) ) { if ( e.getSource() == getDisplayAsPhylogramCb() ) { setDrawPhylogram( getDisplayAsPhylogramCb().isSelected() ); @@ -254,7 +259,7 @@ final class ControlPanel extends JPanel implements ActionListener { _order_of_appearance = !_order_of_appearance; tp.setNodeInPreorderToNull(); tp.getPhylogeny().externalNodesHaveChanged(); - tp.getPhylogeny().hashIDs(); + tp.getPhylogeny().clearHashIdToNodeMap(); tp.getPhylogeny().recalculateNumberOfExternalDescendants( true ); tp.resetNodeIdToDistToLeafMap(); tp.setEdited( true ); @@ -625,7 +630,8 @@ final class ControlPanel extends JPanel implements ActionListener { } void displayedPhylogenyMightHaveChanged( final boolean recalc_longest_ext_node_info ) { - if ( ( _mainpanel != null ) && ( _mainpanel.getCurrentPhylogeny() != null ) ) { + if ( ( _mainpanel != null ) + && ( ( _mainpanel.getCurrentPhylogeny() != null ) && !_mainpanel.getCurrentPhylogeny().isEmpty() ) ) { if ( getOptions().isShowOverview() ) { _mainpanel.getCurrentTreePanel().updateOvSizes(); } @@ -948,14 +954,18 @@ final class ControlPanel extends JPanel implements ActionListener { } query = query.trim(); if ( query.indexOf( '+' ) >= 0 ) { - nodes.addAll( PhylogenyMethods.searchDataLogicalAnd( query.split( "\\++" ), tree, getOptions() - .isSearchCaseSensitive(), !getOptions().isMatchWholeTermsOnly() ) ); + nodes.addAll( PhylogenyMethods.searchDataLogicalAnd( query.split( "\\++" ), + tree, + getOptions().isSearchCaseSensitive(), + !getOptions().isMatchWholeTermsOnly(), + isShowDomainArchitectures() ) ); } else { nodes.addAll( PhylogenyMethods.searchData( query, tree, getOptions().isSearchCaseSensitive(), - !getOptions().isMatchWholeTermsOnly() ) ); + !getOptions().isMatchWholeTermsOnly(), + isShowDomainArchitectures() ) ); } } if ( getOptions().isInverseSearchResult() ) { @@ -1162,9 +1172,7 @@ final class ControlPanel extends JPanel implements ActionListener { setActionWhenNodeClicked( NodeClickAction.SORT_DESCENDENTS ); } else if ( action == _blast_item ) { - if ( !Constants.__RELEASE && !Constants.__SNAPSHOT_RELEASE ) { - setActionWhenNodeClicked( NodeClickAction.BLAST ); - } + setActionWhenNodeClicked( NodeClickAction.BLAST ); } else if ( action == _open_tax_web_item ) { setActionWhenNodeClicked( NodeClickAction.OPEN_TAX_WEB ); @@ -1187,6 +1195,9 @@ final class ControlPanel extends JPanel implements ActionListener { else if ( action == _edit_node_data_item ) { setActionWhenNodeClicked( NodeClickAction.EDIT_NODE_DATA ); } + else if ( action == _get_ext_desc_data ) { + setActionWhenNodeClicked( NodeClickAction.GET_EXT_DESC_DATA ); + } else { throw new RuntimeException( "unknown action: " + action ); } @@ -1368,6 +1379,56 @@ final class ControlPanel extends JPanel implements ActionListener { } cb_index++; } + if ( _configuration.doDisplayClickToOption( Configuration.blast ) ) { + _blast_item = cb_index; + addClickToOption( Configuration.blast, _configuration.getClickToTitle( Configuration.blast ) ); + if ( default_option == Configuration.blast ) { + selected_index = cb_index; + } + cb_index++; + } + if ( _configuration.doDisplayClickToOption( Configuration.get_ext_desc_data ) ) { + _get_ext_desc_data = cb_index; + if ( !ForesterUtil.isEmpty( getConfiguration().getLabelForGetExtDescendentsData() ) ) { + addClickToOption( Configuration.get_ext_desc_data, getConfiguration() + .getLabelForGetExtDescendentsData() ); + } + else { + String s = ";"; + switch ( getConfiguration().getExtDescNodeDataToReturn() ) { + case NODE_NAME: + s = "Node Names"; + break; + case SEQUENCE_ACC: + s = "Sequence Accessors"; + break; + case SEQUENCE_MOL_SEQ: + s = "Molecular Sequence"; + break; + case SEQUENCE_NAME: + s = "Sequence Names"; + break; + case SEQUENCE_SYMBOL: + s = "Sequence Symbols"; + break; + case TAXONOMY_CODE: + s = "Taxonomy Codes"; + break; + case TAXONOMY_SCIENTIFIC_NAME: + s = "Scientific Names"; + break; + case UNKNOWN: + s = "User Selected Data"; + break; + } + final String label = _configuration.getClickToTitle( Configuration.get_ext_desc_data ) + " " + s; + addClickToOption( Configuration.get_ext_desc_data, label ); + } + if ( default_option == Configuration.get_ext_desc_data ) { + selected_index = cb_index; + } + cb_index++; + } if ( getOptions().isEditable() ) { if ( _configuration.doDisplayClickToOption( Configuration.cut_subtree ) ) { _cut_subtree_item = cb_index; @@ -1422,16 +1483,6 @@ final class ControlPanel extends JPanel implements ActionListener { } cb_index++; } - if ( !Constants.__RELEASE && !Constants.__SNAPSHOT_RELEASE ) { - if ( _configuration.doDisplayClickToOption( Configuration.blast ) ) { - _blast_item = cb_index; - addClickToOption( Configuration.blast, _configuration.getClickToTitle( Configuration.blast ) ); - if ( default_option == Configuration.blast ) { - selected_index = cb_index; - } - cb_index++; - } - } } // Set default selection and its action _click_to_combobox.setSelectedIndex( selected_index ); @@ -1716,10 +1767,11 @@ final class ControlPanel extends JPanel implements ActionListener { * Fit entire tree into window. */ void showWhole() { - if ( _mainpanel.getCurrentScrollPane() == null ) { + if ( ( _mainpanel.getCurrentScrollPane() == null ) || _mainpanel.getCurrentTreePanel().getPhylogeny().isEmpty() ) { return; } - displayedPhylogenyMightHaveChanged( false ); + getCurrentTreePanel().updateSetOfCollapsedExternalNodes(); + displayedPhylogenyMightHaveChanged( true ); _mainpanel.getCurrentTreePanel().updateOvSettings(); _mainpanel.getCurrentTreePanel().validate(); _mainpanel.validate(); @@ -1819,10 +1871,10 @@ final class ControlPanel extends JPanel implements ActionListener { node.setCollapse( false ); } tp.resetNodeIdToDistToLeafMap(); - tp.updateSetOfCollapsedExternalNodes( t ); + tp.updateSetOfCollapsedExternalNodes(); t.recalculateNumberOfExternalDescendants( false ); tp.setNodeInPreorderToNull(); - t.hashIDs(); + t.clearHashIdToNodeMap(); showWhole(); } } @@ -1959,6 +2011,7 @@ final class ControlPanel extends JPanel implements ActionListener { ADD_NEW_NODE, EDIT_NODE_DATA, SORT_DESCENDENTS, + GET_EXT_DESC_DATA, BLAST; } }