import org.forester.archaeopteryx.Options.PHYLOGENY_GRAPHICS_TYPE;
import org.forester.phylogeny.Phylogeny;
import org.forester.phylogeny.PhylogenyMethods;
+import org.forester.phylogeny.PhylogenyMethods.DESCENDANT_SORT_PRIORITY;
import org.forester.phylogeny.PhylogenyNode;
import org.forester.phylogeny.data.Sequence;
import org.forester.phylogeny.data.SequenceRelation;
+import org.forester.phylogeny.iterators.PhylogenyNodeIterator;
import org.forester.util.ForesterUtil;
final class ControlPanel extends JPanel implements ActionListener {
private JComboBox _show_sequence_relations;
private JComboBox _sequence_relation_type_box;
private JCheckBox _show_vector_data_cb;
+ private JCheckBox _show_properties_cb;
private JLabel _click_to_label;
private JLabel _zoom_label;
private JLabel _domain_display_label;
private int _subtree_cb_item;
private int _color_subtree_cb_item;
private int _open_seq_web_item;
+ private int _sort_descendents_item;
private int _open_tax_web_item;
private int _cut_subtree_item;
private int _copy_subtree_item;
showWhole();
}
else if ( e.getSource() == _order ) {
- tp.getPhylogeny().orderAppearance( _order_of_appearance );
+ DESCENDANT_SORT_PRIORITY pri = DESCENDANT_SORT_PRIORITY.TAXONOMY;
+ if ( ( !isShowTaxonomyScientificNames() && !isShowTaxonomyCode() && !isShowTaxonomyCommonNames() ) ) {
+ if ( ( isShowSequenceAcc() || isShowGeneNames() || isShowGeneSymbols() ) ) {
+ pri = DESCENDANT_SORT_PRIORITY.SEQUENCE;
+ }
+ else if ( isShowNodeNames() ) {
+ pri = DESCENDANT_SORT_PRIORITY.NODE_NAME;
+ }
+ }
+ PhylogenyMethods.orderAppearance( tp.getPhylogeny().getRoot(), _order_of_appearance, true, pri );
_order_of_appearance = !_order_of_appearance;
+ tp.setNodeInPreorderToNull();
+ tp.getPhylogeny().externalNodesHaveChanged();
+ tp.getPhylogeny().hashIDs();
+ tp.getPhylogeny().recalculateNumberOfExternalDescendants( true );
+ tp.resetNodeIdToDistToLeafMap();
+ tp.setEdited( true );
displayedPhylogenyMightHaveChanged( false );
}
else if ( e.getSource() == _uncollapse_all ) {
tp.requestFocus();
}
catch ( final Exception ex ) {
- Util.unexpectedException( ex );
+ AptxUtil.unexpectedException( ex );
}
catch ( final Error err ) {
- Util.unexpectedError( err );
+ AptxUtil.unexpectedError( err );
}
}
_zoom_in_y.setToolTipText( "To zoom in vertically [Shift+Up]" );
_zoom_out_x.setToolTipText( "To zoom out horizontally [Shift+Left]" );
_zoom_out_y.setToolTipText( "To zoom out vertically [Shift+Down]" );
- if ( getConfiguration().isUseNativeUI() && Util.isMac() ) {
+ if ( getConfiguration().isUseNativeUI() && AptxUtil.isMac() ) {
_zoom_out_x.setPreferredSize( new Dimension( 55, 10 ) );
_zoom_in_x.setPreferredSize( new Dimension( 55, 10 ) );
}
addJCheckBox( _show_node_names, ch_panel );
add( ch_panel );
break;
- case Configuration.show_tax_code:
- _show_taxo_code = new JCheckBox( title );
- addJCheckBox( _show_taxo_code, ch_panel );
- add( ch_panel );
- break;
case Configuration.show_taxonomy_scientific_names:
_show_taxo_scientific_names = new JCheckBox( title );
addJCheckBox( _show_taxo_scientific_names, ch_panel );
addJCheckBox( _show_taxo_common_names, ch_panel );
add( ch_panel );
break;
+ case Configuration.show_tax_code:
+ _show_taxo_code = new JCheckBox( title );
+ addJCheckBox( _show_taxo_code, ch_panel );
+ add( ch_panel );
+ break;
case Configuration.show_taxonomy_images:
_show_taxo_images_cb = new JCheckBox( title );
addJCheckBox( _show_taxo_images_cb, ch_panel );
addJCheckBox( _show_vector_data_cb, ch_panel );
add( ch_panel );
break;
+ case Configuration.show_properties:
+ _show_properties_cb = new JCheckBox( title );
+ addJCheckBox( _show_properties_cb, ch_panel );
+ add( ch_panel );
+ break;
default:
throw new RuntimeException( "unknown checkbox: " + which );
}
return _color_branches_cb;
}
+ public JCheckBox getColorAccSpeciesCb() {
+ return _color_acc_species;
+ }
+
Configuration getConfiguration() {
return _configuration;
}
return ( ( _show_binary_characters != null ) && _show_binary_characters.isSelected() );
}
- boolean isShowBootstrapValues() {
+ boolean isShowConfidenceValues() {
return ( ( getWriteConfidenceCb() != null ) && getWriteConfidenceCb().isSelected() );
}
return ( ( _show_vector_data_cb != null ) && _show_vector_data_cb.isSelected() );
}
+ public boolean isShowProperties() {
+ return ( ( _show_properties_cb != null ) && _show_properties_cb.isSelected() );
+ }
+
boolean isShowGeneSymbols() {
return ( ( _show_gene_symbols != null ) && _show_gene_symbols.isSelected() );
}
return ( ( _show_node_names != null ) && _show_node_names.isSelected() );
}
- boolean isShowProperty() {
- return ( ( _show_annotation != null ) && _show_annotation.isSelected() );
- }
-
boolean isShowSequenceAcc() {
return ( ( _show_sequence_acc != null ) && _show_sequence_acc.isSelected() );
}
_show_node_names.setSelected( state );
}
break;
- case Configuration.show_tax_code:
- if ( _show_taxo_code != null ) {
- _show_taxo_code.setSelected( state );
- }
- break;
case Configuration.show_taxonomy_scientific_names:
if ( _show_taxo_scientific_names != null ) {
_show_taxo_scientific_names.setSelected( state );
_show_taxo_common_names.setSelected( state );
}
break;
+ case Configuration.show_tax_code:
+ if ( _show_taxo_code != null ) {
+ _show_taxo_code.setSelected( state );
+ }
+ break;
case Configuration.show_taxonomy_images:
if ( _show_taxo_images_cb != null ) {
_show_taxo_images_cb.setSelected( state );
_show_vector_data_cb.setSelected( state );
}
break;
+ case Configuration.show_properties:
+ if ( _show_properties_cb != null ) {
+ _show_properties_cb.setSelected( state );
+ }
+ break;
case Configuration.show_sequence_acc:
if ( _show_sequence_acc != null ) {
_show_sequence_acc.setSelected( state );
else if ( action == _open_seq_web_item ) {
setActionWhenNodeClicked( NodeClickAction.OPEN_SEQ_WEB );
}
+ else if ( action == _sort_descendents_item ) {
+ 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 );
}
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_subtree ) ) {
_color_subtree_cb_item = cb_index;
addClickToOption( Configuration.color_subtree, _configuration.getClickToTitle( Configuration.color_subtree ) );
}
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 ( getOptions().isEditable() ) {
if ( _configuration.doDisplayClickToOption( Configuration.cut_subtree ) ) {
_cut_subtree_item = cb_index;
}
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 );
_configuration.getDisplayTitle( Configuration.show_vector_data ) );
setCheckbox( Configuration.show_vector_data, _configuration.doCheckOption( Configuration.show_vector_data ) );
}
+ if ( _configuration.doDisplayOption( Configuration.show_properties ) ) {
+ addCheckbox( Configuration.show_properties, _configuration.getDisplayTitle( Configuration.show_properties ) );
+ setCheckbox( Configuration.show_properties, _configuration.doCheckOption( Configuration.show_properties ) );
+ }
}
void setupSearchTools() {
if ( _mainpanel.getCurrentScrollPane() == null ) {
return;
}
- displayedPhylogenyMightHaveChanged( false );
+ getCurrentTreePanel().updateSetOfCollapsedExternalNodes();
+ displayedPhylogenyMightHaveChanged( true );
_mainpanel.getCurrentTreePanel().updateOvSettings();
_mainpanel.getCurrentTreePanel().validate();
_mainpanel.validate();
void uncollapseAll( final TreePanel tp ) {
final Phylogeny t = tp.getPhylogeny();
if ( ( t != null ) && !t.isEmpty() ) {
- t.setAllNodesToNotCollapse();
+ 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.hashIDs();
showWhole();
}
}
PASTE_SUBTREE,
ADD_NEW_NODE,
EDIT_NODE_DATA,
+ SORT_DESCENDENTS,
BLAST;
}
}