2 // FORESTER -- software libraries and applications
3 // for evolutionary biology research and applications.
5 // Copyright (C) 2008-2009 Christian M. Zmasek
6 // Copyright (C) 2008-2009 Burnham Institute for Medical Research
8 // This library is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU Lesser General Public
10 // License as published by the Free Software Foundation; either
11 // version 2.1 of the License, or (at your option) any later version.
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 // Contact: phylosoft @ gmail . com
23 // WWW: https://sites.google.com/site/cmzmasek/home/software/forester
25 package org.forester.archaeopteryx;
27 import java.awt.BorderLayout;
28 import java.awt.Color;
29 import java.awt.Component;
30 import java.awt.Dimension;
32 import java.awt.GridBagLayout;
33 import java.awt.GridLayout;
34 import java.awt.event.ActionEvent;
35 import java.awt.event.ActionListener;
36 import java.awt.event.ItemEvent;
37 import java.awt.event.ItemListener;
38 import java.awt.event.KeyAdapter;
39 import java.awt.event.KeyEvent;
40 import java.util.ArrayList;
41 import java.util.Arrays;
42 import java.util.Collection;
43 import java.util.HashMap;
44 import java.util.HashSet;
45 import java.util.List;
49 import javax.swing.BorderFactory;
50 import javax.swing.DefaultListCellRenderer;
51 import javax.swing.JButton;
52 import javax.swing.JCheckBox;
53 import javax.swing.JComboBox;
54 import javax.swing.JLabel;
55 import javax.swing.JList;
56 import javax.swing.JPanel;
57 import javax.swing.JScrollBar;
58 import javax.swing.JTextField;
59 import javax.swing.ListCellRenderer;
61 import org.forester.archaeopteryx.Options.CLADOGRAM_TYPE;
62 import org.forester.archaeopteryx.Options.PHYLOGENY_GRAPHICS_TYPE;
63 import org.forester.phylogeny.Phylogeny;
64 import org.forester.phylogeny.PhylogenyMethods;
65 import org.forester.phylogeny.PhylogenyMethods.DESCENDANT_SORT_PRIORITY;
66 import org.forester.phylogeny.PhylogenyNode;
67 import org.forester.phylogeny.data.Sequence;
68 import org.forester.phylogeny.data.SequenceRelation;
69 import org.forester.phylogeny.data.SequenceRelation.SEQUENCE_RELATION_TYPE;
70 import org.forester.phylogeny.iterators.PhylogenyNodeIterator;
71 import org.forester.util.ForesterUtil;
73 final class ControlPanel extends JPanel implements ActionListener {
75 final static Font jcb_bold_font = new Font( Configuration.getDefaultFontFamilyName(),
78 final static Font jcb_font = new Font( Configuration.getDefaultFontFamilyName(),
81 final static Font js_font = new Font( Configuration.getDefaultFontFamilyName(),
84 private static final String RETURN_TO_SUPER_TREE_TEXT = "Back to Super Tree";
85 private static final String SEARCH_TIP_TEXT = "Enter text to search for. Use ',' for logical OR and '+' for logical AND (not used in this manner for regular expression searches).";
86 private static final long serialVersionUID = -8463483932821545633L;
87 private NodeClickAction _action_when_node_clicked;
88 private int _add_new_node_item;
89 private Map<Integer, String> _all_click_to_names;
90 private Map<String, Color> _annotation_colors;
91 private int _blast_item;
92 private JComboBox<String> _click_to_combobox;
93 private JLabel _click_to_label;
94 private List<String> _click_to_names;
95 private int _collapse_cb_item;
96 private JCheckBox _color_acc_species;
97 private JCheckBox _color_acc_sequence;
98 private JCheckBox _color_according_to_annotation;
99 private boolean _color_branches;
100 private JCheckBox _use_visual_styles_cb;
101 private int _color_subtree_cb_item;
102 private int _change_node_font_item;
103 // The settings from the conf file
104 private final Configuration _configuration;
105 private int _copy_subtree_item;
106 private int _cut_subtree_item;
107 private JButton _decr_domain_structure_evalue_thr;
108 private int _delete_node_or_subtree_item;
109 private JCheckBox _display_as_phylogram_cb;
111 private JCheckBox _display_internal_data;
112 private JLabel _domain_display_label;
113 private JTextField _domain_structure_evalue_thr_tf;
114 private List<Boolean> _draw_phylogram;
115 private JCheckBox _dynamically_hide_data;
116 private int _edit_node_data_item;
117 private int _get_ext_desc_data;
118 private JButton _incr_domain_structure_evalue_thr;
119 private final MainPanel _mainpanel;
120 private JCheckBox _node_desc_popup_cb;
121 private int _open_pdb_item;
122 private int _open_seq_web_item;
123 private int _open_tax_web_item;
124 private int _color_node_font_item;
125 private JButton _order;
126 private boolean _order_of_appearance;
127 private int _paste_subtree_item;
128 private int _reroot_cb_item;
129 private JButton _return_to_super_tree;
131 private JLabel _search_found_label_0;
132 private JLabel _search_found_label_1;
133 private JButton _search_reset_button_0;
134 private JButton _search_reset_button_1;
135 private JTextField _search_tf_0;
136 private JTextField _search_tf_1;
137 private int _select_nodes_item;
138 private Sequence _selected_query_seq;
139 private JCheckBox _seq_relation_confidence_switch;
140 private JComboBox<SEQUENCE_RELATION_TYPE> _sequence_relation_type_box;
141 private JCheckBox _show_annotation;
142 private JCheckBox _show_binary_character_counts;
143 private JCheckBox _show_binary_characters;
144 // Indices for the click-to options in the combo box
145 private int _show_data_item;
146 private JCheckBox _show_domain_architectures;
147 private JCheckBox _show_mol_seqs;
148 private JCheckBox _write_branch_length_values;
149 private JCheckBox _show_events;
150 private JCheckBox _show_gene_names;
151 private JCheckBox _show_node_names;
152 private JCheckBox _show_properties_cb;
153 private JCheckBox _show_seq_names;
154 private JCheckBox _show_seq_symbols;
155 private JCheckBox _show_sequence_acc;
156 private JComboBox<String> _show_sequence_relations;
157 private JCheckBox _show_taxo_code;
158 private JCheckBox _show_taxo_common_names;
159 private JCheckBox _show_taxo_images_cb;
160 private JCheckBox _show_taxo_scientific_names;
161 private JCheckBox _show_vector_data_cb;
162 private JButton _show_whole;
163 private int _sort_descendents_item;
164 private Map<String, Color> _species_colors;
165 private Map<String, Color> _sequence_colors;
166 private int _subtree_cb_item;
167 private int _swap_cb_item;
168 private JButton _uncollapse_all;
169 private JCheckBox _width_branches;
170 private JCheckBox _write_confidence;
171 private JButton _zoom_in_domain_structure;
172 private JButton _zoom_in_x;
173 private JButton _zoom_in_y;
174 private JLabel _zoom_label;
175 private JButton _zoom_out_domain_structure;
176 private JButton _zoom_out_x;
177 private JButton _zoom_out_y;
179 ControlPanel( final MainPanel ap, final Configuration configuration ) {
182 _configuration = configuration;
183 if ( !_configuration.isUseNativeUI() ) {
184 setBackground( getConfiguration().getGuiBackgroundColor() );
185 setBorder( BorderFactory.createRaisedBevelBorder() );
187 setLayout( new GridLayout( 0, 1, 2, 2 ) );
188 _order_of_appearance = true;
196 public void actionPerformed( final ActionEvent e ) {
198 if ( e.getSource() == _color_acc_sequence ) {
199 if ( _color_acc_species != null ) {
200 _color_acc_species.setSelected( false );
203 else if ( e.getSource() == _color_acc_species ) {
204 if ( _color_acc_sequence != null ) {
205 _color_acc_sequence.setSelected( false );
208 final TreePanel tp = getMainPanel().getCurrentTreePanel();
212 if ( e.getSource() == _click_to_combobox ) {
213 setClickToAction( _click_to_combobox.getSelectedIndex() );
214 getCurrentTreePanel().repaint();
216 else if ( e.getSource() == _show_binary_characters ) {
217 if ( ( _show_binary_character_counts != null ) && _show_binary_characters.isSelected() ) {
218 _show_binary_character_counts.setSelected( false );
220 displayedPhylogenyMightHaveChanged( true );
222 else if ( e.getSource() == _show_binary_character_counts ) {
223 if ( ( _show_binary_characters != null ) && _show_binary_character_counts.isSelected() ) {
224 _show_binary_characters.setSelected( false );
226 displayedPhylogenyMightHaveChanged( true );
228 else if ( e.getSource() == _show_domain_architectures ) {
231 displayedPhylogenyMightHaveChanged( true );
233 else if ( ( tp != null ) && ( tp.getPhylogeny() != null ) ) {
234 if ( e.getSource() == getDisplayAsPhylogramCb() ) {
235 setDrawPhylogram( getDisplayAsPhylogramCb().isSelected() );
239 else if ( e.getSource() == _zoom_in_x ) {
240 zoomInX( Constants.BUTTON_ZOOM_IN_FACTOR, Constants.BUTTON_ZOOM_IN_X_CORRECTION_FACTOR );
241 displayedPhylogenyMightHaveChanged( false );
243 else if ( e.getSource() == _zoom_in_y ) {
244 zoomInY( Constants.BUTTON_ZOOM_IN_FACTOR );
245 displayedPhylogenyMightHaveChanged( false );
247 else if ( e.getSource() == _zoom_out_x ) {
248 zoomOutX( Constants.BUTTON_ZOOM_OUT_FACTOR, Constants.BUTTON_ZOOM_OUT_X_CORRECTION_FACTOR );
249 displayedPhylogenyMightHaveChanged( false );
251 else if ( e.getSource() == _zoom_out_y ) {
252 zoomOutY( Constants.BUTTON_ZOOM_OUT_FACTOR );
253 displayedPhylogenyMightHaveChanged( false );
255 else if ( e.getSource() == _show_whole ) {
256 displayedPhylogenyMightHaveChanged( true );
259 else if ( e.getSource() == _return_to_super_tree ) {
260 _mainpanel.getCurrentTreePanel().superTree();
263 else if ( e.getSource() == _order ) {
264 DESCENDANT_SORT_PRIORITY pri = DESCENDANT_SORT_PRIORITY.NODE_NAME;
265 if ( isShowTaxonomyScientificNames() || isShowTaxonomyCode() ) {
266 pri = DESCENDANT_SORT_PRIORITY.TAXONOMY;
268 else if ( isShowSeqNames() || isShowSeqSymbols() || isShowGeneNames() ) {
269 pri = DESCENDANT_SORT_PRIORITY.SEQUENCE;
271 PhylogenyMethods.orderAppearance( tp.getPhylogeny().getRoot(), _order_of_appearance, true, pri );
272 _order_of_appearance = !_order_of_appearance;
273 tp.setNodeInPreorderToNull();
274 tp.getPhylogeny().externalNodesHaveChanged();
275 tp.getPhylogeny().clearHashIdToNodeMap();
276 tp.getPhylogeny().recalculateNumberOfExternalDescendants( true );
277 tp.resetNodeIdToDistToLeafMap();
278 tp.setEdited( true );
279 displayedPhylogenyMightHaveChanged( true );
281 else if ( e.getSource() == _uncollapse_all ) {
283 displayedPhylogenyMightHaveChanged( false );
285 else if ( e.getSource() == _zoom_in_domain_structure ) {
286 _mainpanel.getCurrentTreePanel().zoomInDomainStructure();
287 displayedPhylogenyMightHaveChanged( true );
289 else if ( e.getSource() == _zoom_out_domain_structure ) {
290 _mainpanel.getCurrentTreePanel().zoomOutDomainStructure();
291 displayedPhylogenyMightHaveChanged( true );
293 else if ( e.getSource() == _decr_domain_structure_evalue_thr ) {
294 _mainpanel.getCurrentTreePanel().decreaseDomainStructureEvalueThresholdExp();
297 displayedPhylogenyMightHaveChanged( true );
299 else if ( e.getSource() == _incr_domain_structure_evalue_thr ) {
300 _mainpanel.getCurrentTreePanel().increaseDomainStructureEvalueThresholdExp();
303 displayedPhylogenyMightHaveChanged( true );
305 else if ( e.getSource() == _search_tf_0 ) {
307 displayedPhylogenyMightHaveChanged( true );
309 else if ( e.getSource() == _search_tf_1 ) {
311 displayedPhylogenyMightHaveChanged( true );
313 else if ( ( _dynamically_hide_data != null ) && ( e.getSource() == _dynamically_hide_data )
314 && !_dynamically_hide_data.isSelected() ) {
315 setDynamicHidingIsOn( false );
316 displayedPhylogenyMightHaveChanged( true );
319 displayedPhylogenyMightHaveChanged( true );
323 tp.requestFocusInWindow();
326 catch ( final Exception ex ) {
327 AptxUtil.unexpectedException( ex );
329 catch ( final Error err ) {
330 AptxUtil.unexpectedError( err );
334 public JCheckBox getColorAccSpeciesCb() {
335 return _color_acc_species;
338 public JCheckBox getColorAccSequenceCb() {
339 return _color_acc_sequence;
342 public JCheckBox getUseVisualStylesCb() {
343 return _use_visual_styles_cb;
346 public JCheckBox getDisplayAsPhylogramCb() {
347 return _display_as_phylogram_cb;
350 public JCheckBox getDynamicallyHideData() {
351 return _dynamically_hide_data;
354 public JCheckBox getNodeDescPopupCb() {
355 return _node_desc_popup_cb;
358 public Sequence getSelectedQuerySequence() {
359 return _selected_query_seq;
362 public JComboBox<String> getSequenceRelationBox() {
363 if ( _show_sequence_relations == null ) {
364 _show_sequence_relations = new JComboBox<String>();
365 _show_sequence_relations.setFocusable( false );
366 _show_sequence_relations.setMaximumRowCount( 20 );
367 _show_sequence_relations.setFont( ControlPanel.js_font );
368 if ( !_configuration.isUseNativeUI() ) {
369 _show_sequence_relations.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
370 _show_sequence_relations.setForeground( getConfiguration().getGuiButtonTextColor() );
372 _show_sequence_relations.addItem( "-----" );
373 _show_sequence_relations.setToolTipText( "To display orthology information for selected query" );
375 return _show_sequence_relations;
379 public JComboBox<SEQUENCE_RELATION_TYPE> getSequenceRelationTypeBox() {
380 if ( _sequence_relation_type_box == null ) {
381 _sequence_relation_type_box = new JComboBox<SEQUENCE_RELATION_TYPE>();
382 for( final SequenceRelation.SEQUENCE_RELATION_TYPE type : SequenceRelation.SEQUENCE_RELATION_TYPE.values() ) {
383 _sequence_relation_type_box.addItem( type );
385 _sequence_relation_type_box.addActionListener( new ActionListener() {
388 public void actionPerformed( final ActionEvent e ) {
389 if ( _mainpanel.getCurrentPhylogeny() != null ) {
390 setSequenceRelationQueries( getMainPanel().getCurrentPhylogeny().getSequenceRelationQueries() );
395 return _sequence_relation_type_box;
398 public JCheckBox getShowEventsCb() {
402 public JCheckBox getWriteConfidenceCb() {
403 return _write_confidence;
406 public boolean isShowProperties() {
407 return ( ( _show_properties_cb != null ) && _show_properties_cb.isSelected() );
410 public boolean isShowTaxonomyImages() {
411 return ( ( _show_taxo_images_cb != null ) && _show_taxo_images_cb.isSelected() );
414 public boolean isShowVectorData() {
415 return ( ( _show_vector_data_cb != null ) && _show_vector_data_cb.isSelected() );
418 public void setSequenceRelationQueries( final Collection<Sequence> sequenceRelationQueries ) {
419 final JComboBox<String> box = getSequenceRelationBox();
420 while ( box.getItemCount() > 1 ) {
421 box.removeItemAt( 1 );
423 final HashMap<String, Sequence> sequencesByName = new HashMap<String, Sequence>();
424 final SequenceRelation.SEQUENCE_RELATION_TYPE relationType = ( SequenceRelation.SEQUENCE_RELATION_TYPE ) _sequence_relation_type_box
426 if ( relationType == null ) {
429 final ArrayList<String> sequenceNamesToAdd = new ArrayList<String>();
430 for( final Sequence seq : sequenceRelationQueries ) {
431 if ( seq.hasSequenceRelations() ) {
432 boolean fFoundForCurrentType = false;
433 for( final SequenceRelation sq : seq.getSequenceRelations() ) {
434 if ( sq.getType().equals( relationType ) ) {
435 fFoundForCurrentType = true;
439 if ( fFoundForCurrentType ) {
440 sequenceNamesToAdd.add( seq.getName() );
441 sequencesByName.put( seq.getName(), seq );
445 // sort sequences by name before adding them to the combo
446 final String[] sequenceNameArray = sequenceNamesToAdd.toArray( new String[ sequenceNamesToAdd.size() ] );
447 Arrays.sort( sequenceNameArray, String.CASE_INSENSITIVE_ORDER );
448 for( final String seqName : sequenceNameArray ) {
449 box.addItem( seqName );
451 for( final ItemListener oldItemListener : box.getItemListeners() ) {
452 box.removeItemListener( oldItemListener );
454 box.addItemListener( new ItemListener() {
457 public void itemStateChanged( final ItemEvent e ) {
458 _selected_query_seq = sequencesByName.get( e.getItem() );
459 _mainpanel.getCurrentTreePanel().repaint();
464 void activateButtonToReturnToSuperTree( int index ) {
467 _return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT + " " + index );
470 _return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT );
472 _return_to_super_tree.setForeground( getConfiguration().getGuiCheckboxAndButtonActiveColor() );
473 _return_to_super_tree.setEnabled( true );
477 * Add zoom and quick edit buttons. (Last modified 8/9/04)
480 final JLabel spacer = new JLabel( "" );
481 spacer.setOpaque( false );
483 final JPanel x_panel = new JPanel( new GridLayout( 1, 1, 0, 0 ) );
484 final JPanel y_panel = new JPanel( new GridLayout( 1, 3, 0, 0 ) );
485 final JPanel z_panel = new JPanel( new GridLayout( 1, 1, 0, 0 ) );
486 if ( !getConfiguration().isUseNativeUI() ) {
487 x_panel.setBackground( getBackground() );
488 y_panel.setBackground( getBackground() );
489 z_panel.setBackground( getBackground() );
491 add( _zoom_label = new JLabel( "Zoom:" ) );
492 customizeLabel( _zoom_label, getConfiguration() );
496 if ( getConfiguration().isUseNativeUI() ) {
497 _zoom_in_x = new JButton( "+" );
498 _zoom_out_x = new JButton( "-" );
501 _zoom_in_x = new JButton( "X+" );
502 _zoom_out_x = new JButton( "X-" );
504 _zoom_in_y = new JButton( "Y+" );
505 _zoom_out_y = new JButton( "Y-" );
506 _show_whole = new JButton( "F" );
507 _show_whole.setToolTipText( "To fit the complete phylogeny to the current display size [F or Home]" );
508 _zoom_in_x.setToolTipText( "To zoom in horizontally [Shift+cursor-right]" );
509 _zoom_in_y.setToolTipText( "To zoom in vertically [Shift+cursor-up]" );
510 _zoom_out_x.setToolTipText( "To zoom out horizontally [Shift+cursor-left]" );
511 _zoom_out_y.setToolTipText( "To zoom out vertically [Shift+cursor-down]" );
512 if ( getConfiguration().isUseNativeUI() && ForesterUtil.isMac() ) {
513 _zoom_out_x.setPreferredSize( new Dimension( 55, 10 ) );
514 _zoom_in_x.setPreferredSize( new Dimension( 55, 10 ) );
517 _zoom_out_x.setPreferredSize( new Dimension( 10, 10 ) );
518 _zoom_in_x.setPreferredSize( new Dimension( 10, 10 ) );
520 _zoom_out_y.setPreferredSize( new Dimension( 10, 10 ) );
521 _zoom_in_y.setPreferredSize( new Dimension( 10, 10 ) );
522 _show_whole.setPreferredSize( new Dimension( 10, 10 ) );
523 _return_to_super_tree = new JButton( RETURN_TO_SUPER_TREE_TEXT );
524 _return_to_super_tree.setEnabled( false );
525 _order = new JButton( "Order Subtrees" );
526 _uncollapse_all = new JButton( "Uncollapse All" );
527 addJButton( _zoom_in_y, x_panel );
528 addJButton( _zoom_out_x, y_panel );
529 addJButton( _show_whole, y_panel );
530 addJButton( _zoom_in_x, y_panel );
531 addJButton( _zoom_out_y, z_panel );
532 if ( getConfiguration().doDisplayOption( Configuration.show_domain_architectures ) ) {
533 setUpControlsForDomainStrucures();
535 final JLabel spacer2 = new JLabel( "" );
537 addJButton( _return_to_super_tree, this );
538 addJButton( _order, this );
539 addJButton( _uncollapse_all, this );
540 final JLabel spacer3 = new JLabel( "" );
542 setVisibilityOfDomainStrucureControls();
545 void addCheckbox( final int which, final String title ) {
546 final JPanel ch_panel = new JPanel( new BorderLayout( 0, 0 ) );
548 case Configuration.display_as_phylogram:
549 _display_as_phylogram_cb = new JCheckBox( title );
550 getDisplayAsPhylogramCb().setToolTipText( "To switch between phylogram and cladogram display" );
551 addJCheckBox( getDisplayAsPhylogramCb(), ch_panel );
554 case Configuration.display_internal_data:
555 _display_internal_data = new JCheckBox( title );
556 _display_internal_data.setToolTipText( "To allow or disallow display of internal labels" );
557 addJCheckBox( _display_internal_data, ch_panel );
560 case Configuration.color_according_to_species:
561 _color_acc_species = new JCheckBox( title );
562 _color_acc_species.setToolTipText( "To colorize node labels as a function of taxonomy" );
563 addJCheckBox( _color_acc_species, ch_panel );
566 case Configuration.color_according_to_sequence:
567 _color_acc_sequence = new JCheckBox( title );
568 _color_acc_sequence.setToolTipText( "To colorize node labels as a function of sequence name" );
569 addJCheckBox( _color_acc_sequence, ch_panel );
572 case Configuration.color_according_to_annotation:
573 _color_according_to_annotation = new JCheckBox( title );
574 _color_according_to_annotation
575 .setToolTipText( "To colorize sequence annotation labels as a function of sequence annotation" );
576 addJCheckBox( _color_according_to_annotation, ch_panel );
579 case Configuration.show_node_names:
580 _show_node_names = new JCheckBox( title );
581 addJCheckBox( _show_node_names, ch_panel );
584 case Configuration.show_taxonomy_scientific_names:
585 _show_taxo_scientific_names = new JCheckBox( title );
586 addJCheckBox( _show_taxo_scientific_names, ch_panel );
589 case Configuration.show_taxonomy_common_names:
590 _show_taxo_common_names = new JCheckBox( title );
591 addJCheckBox( _show_taxo_common_names, ch_panel );
594 case Configuration.show_tax_code:
595 _show_taxo_code = new JCheckBox( title );
596 addJCheckBox( _show_taxo_code, ch_panel );
599 case Configuration.show_taxonomy_images:
600 _show_taxo_images_cb = new JCheckBox( title );
601 addJCheckBox( _show_taxo_images_cb, ch_panel );
604 case Configuration.show_binary_characters:
605 _show_binary_characters = new JCheckBox( title );
606 addJCheckBox( _show_binary_characters, ch_panel );
609 case Configuration.show_annotation:
610 _show_annotation = new JCheckBox( title );
611 addJCheckBox( _show_annotation, ch_panel );
614 case Configuration.show_binary_character_counts:
615 _show_binary_character_counts = new JCheckBox( title );
616 addJCheckBox( _show_binary_character_counts, ch_panel );
619 case Configuration.write_confidence_values:
620 _write_confidence = new JCheckBox( title );
621 addJCheckBox( getWriteConfidenceCb(), ch_panel );
624 case Configuration.write_events:
625 _show_events = new JCheckBox( title );
626 addJCheckBox( getShowEventsCb(), ch_panel );
629 case Configuration.use_style:
630 _use_visual_styles_cb = new JCheckBox( title );
631 getUseVisualStylesCb()
632 .setToolTipText( "To use visual styles (node colors, fonts) and branch colors, if present" );
633 addJCheckBox( getUseVisualStylesCb(), ch_panel );
636 case Configuration.width_branches:
637 _width_branches = new JCheckBox( title );
638 _width_branches.setToolTipText( "To use branch width values, if present" );
639 addJCheckBox( _width_branches, ch_panel );
642 case Configuration.write_branch_length_values:
643 _write_branch_length_values = new JCheckBox( title );
644 addJCheckBox( _write_branch_length_values, ch_panel );
647 case Configuration.show_domain_architectures:
648 _show_domain_architectures = new JCheckBox( title );
649 addJCheckBox( _show_domain_architectures, ch_panel );
652 case Configuration.show_mol_seqs:
653 _show_mol_seqs = new JCheckBox( title );
654 addJCheckBox( _show_mol_seqs, ch_panel );
657 case Configuration.show_seq_names:
658 _show_seq_names = new JCheckBox( title );
659 addJCheckBox( _show_seq_names, ch_panel );
662 case Configuration.show_gene_names:
663 _show_gene_names = new JCheckBox( title );
664 addJCheckBox( _show_gene_names, ch_panel );
667 case Configuration.show_seq_symbols:
668 _show_seq_symbols = new JCheckBox( title );
669 addJCheckBox( _show_seq_symbols, ch_panel );
672 case Configuration.show_sequence_acc:
673 _show_sequence_acc = new JCheckBox( title );
674 addJCheckBox( _show_sequence_acc, ch_panel );
677 case Configuration.dynamically_hide_data:
678 _dynamically_hide_data = new JCheckBox( title );
679 getDynamicallyHideData().setToolTipText( "To hide labels depending on expected visibility" );
680 addJCheckBox( getDynamicallyHideData(), ch_panel );
683 case Configuration.node_data_popup:
684 _node_desc_popup_cb = new JCheckBox( title );
685 getNodeDescPopupCb().setToolTipText( "To enable mouse rollover display of basic node data" );
686 addJCheckBox( getNodeDescPopupCb(), ch_panel );
689 case Configuration.show_relation_confidence:
690 _seq_relation_confidence_switch = new JCheckBox( title );
691 addJCheckBox( _seq_relation_confidence_switch, ch_panel );
694 case Configuration.show_vector_data:
695 _show_vector_data_cb = new JCheckBox( title );
696 addJCheckBox( _show_vector_data_cb, ch_panel );
699 case Configuration.show_properties:
700 _show_properties_cb = new JCheckBox( title );
701 addJCheckBox( _show_properties_cb, ch_panel );
705 throw new RuntimeException( "unknown checkbox: " + which );
709 void addJButton( final JButton jb, final JPanel p ) {
710 jb.setFocusPainted( false );
711 jb.setFont( ControlPanel.jcb_font );
712 if ( !_configuration.isUseNativeUI() ) {
713 jb.setBorder( BorderFactory.createLineBorder( getConfiguration().getGuiButtonBorderColor() ) );
714 jb.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
715 jb.setForeground( getConfiguration().getGuiButtonTextColor() );
718 jb.addActionListener( this );
721 void addJCheckBox( final JCheckBox jcb, final JPanel p ) {
722 jcb.setFocusPainted( false );
723 jcb.setFont( ControlPanel.jcb_font );
724 if ( !_configuration.isUseNativeUI() ) {
725 jcb.setBackground( getConfiguration().getGuiBackgroundColor() );
726 jcb.setForeground( getConfiguration().getGuiCheckboxTextColor() );
728 p.add( jcb, "Center" );
729 jcb.addActionListener( this );
732 void addJTextField( final JTextField tf, final JPanel p ) {
733 if ( !_configuration.isUseNativeUI() ) {
734 tf.setForeground( getConfiguration().getGuiBackgroundColor() );
735 tf.setFont( ControlPanel.jcb_font );
738 tf.addActionListener( this );
741 void deactivateButtonToReturnToSuperTree() {
742 _return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT );
743 _return_to_super_tree.setForeground( getConfiguration().getGuiButtonTextColor() );
744 _return_to_super_tree.setEnabled( false );
747 void displayedPhylogenyMightHaveChanged( final boolean recalc_longest_ext_node_info ) {
748 if ( ( _mainpanel != null )
749 && ( ( _mainpanel.getCurrentPhylogeny() != null ) && !_mainpanel.getCurrentPhylogeny().isEmpty() ) ) {
750 if ( getOptions().isShowOverview() ) {
751 _mainpanel.getCurrentTreePanel().updateOvSizes();
753 _mainpanel.getCurrentTreePanel().recalculateMaxDistanceToRoot();
754 setVisibilityOfDomainStrucureControls();
755 updateDomainStructureEvaluethresholdDisplay();
756 _mainpanel.getCurrentTreePanel().calculateScaleDistance();
757 _mainpanel.getCurrentTreePanel().calcMaxDepth();
758 _mainpanel.adjustJScrollPane();
759 if ( recalc_longest_ext_node_info ) {
760 _mainpanel.getCurrentTreePanel().initNodeData();
761 _mainpanel.getCurrentTreePanel().calculateLongestExtNodeInfo();
763 _mainpanel.getCurrentTreePanel().repaint();
764 // _mainpanel.getCurrentTreePanel().setUpUrtFactors();
768 void endClickToOptions() {
769 _click_to_combobox.addActionListener( this );
773 * Indicates what action should be execute when a node is clicked
775 * @return the click-on action
777 NodeClickAction getActionWhenNodeClicked() {
778 return _action_when_node_clicked;
781 Map<Integer, String> getAllClickToItems() {
782 return _all_click_to_names;
785 Map<String, Color> getAnnotationColors() {
786 return _annotation_colors;
789 Configuration getConfiguration() {
790 return _configuration;
793 TreePanel getCurrentTreePanel() {
794 return getMainPanel().getCurrentTreePanel();
797 MainPanel getMainPanel() {
801 Options getOptions() {
802 return getMainPanel().getOptions();
805 JLabel getSearchFoundCountsLabel0() {
806 return _search_found_label_0;
809 JLabel getSearchFoundCountsLabel1() {
810 return _search_found_label_1;
813 JButton getSearchResetButton0() {
814 return _search_reset_button_0;
817 JButton getSearchResetButton1() {
818 return _search_reset_button_1;
821 JTextField getSearchTextField0() {
825 JTextField getSearchTextField1() {
829 List<String> getSingleClickToNames() {
830 return _click_to_names;
833 Map<String, Color> getSpeciesColors() {
834 return _species_colors;
837 Map<String, Color> getSequenceColors() {
838 return _sequence_colors;
841 boolean isAntialiasScreenText() {
845 boolean isColorAccordingToAnnotation() {
846 return ( ( _color_according_to_annotation != null ) && _color_according_to_annotation.isSelected() );
849 boolean isColorAccordingToTaxonomy() {
850 return ( ( _color_acc_species != null ) && _color_acc_species.isSelected() );
853 boolean isColorAccordingToSequence() {
854 return ( ( _color_acc_sequence != null ) && _color_acc_sequence.isSelected() );
857 boolean isUseVisualStyles() {
858 return ( ( ( getUseVisualStylesCb() != null ) && getUseVisualStylesCb().isSelected() ) || ( ( getUseVisualStylesCb() == null ) && _color_branches ) );
861 boolean isDrawPhylogram() {
862 return isDrawPhylogram( getMainPanel().getCurrentTabIndex() );
865 boolean isDynamicallyHideData() {
866 return ( ( getDynamicallyHideData() != null ) && getDynamicallyHideData().isSelected() );
870 return ( ( getShowEventsCb() != null ) && getShowEventsCb().isSelected() );
873 boolean isNodeDescPopup() {
874 return ( ( getNodeDescPopupCb() != null ) && getNodeDescPopupCb().isSelected() );
877 boolean isShowAnnotation() {
878 return ( ( _show_annotation != null ) && _show_annotation.isSelected() );
881 boolean isShowBinaryCharacterCounts() {
882 return ( ( _show_binary_character_counts != null ) && _show_binary_character_counts.isSelected() );
885 boolean isShowBinaryCharacters() {
886 return ( ( _show_binary_characters != null ) && _show_binary_characters.isSelected() );
889 boolean isShowConfidenceValues() {
890 return ( ( getWriteConfidenceCb() != null ) && getWriteConfidenceCb().isSelected() );
893 boolean isWriteBranchLengthValues() {
894 return ( ( _write_branch_length_values != null ) && _write_branch_length_values.isSelected() );
897 boolean isShowDomainArchitectures() {
898 return ( ( _show_domain_architectures != null ) && _show_domain_architectures.isSelected() );
901 public boolean isShowMolSequences() {
902 return ( ( _show_mol_seqs != null ) && _show_mol_seqs.isSelected() );
905 boolean isShowGeneNames() {
906 return ( ( _show_gene_names != null ) && _show_gene_names.isSelected() );
909 boolean isShowInternalData() {
910 return ( ( _display_internal_data == null ) || _display_internal_data.isSelected() );
913 boolean isShowNodeNames() {
914 return ( ( _show_node_names != null ) && _show_node_names.isSelected() );
917 boolean isShowSeqNames() {
918 return ( ( _show_seq_names != null ) && _show_seq_names.isSelected() );
921 boolean isShowSeqSymbols() {
922 return ( ( _show_seq_symbols != null ) && _show_seq_symbols.isSelected() );
925 boolean isShowSequenceAcc() {
926 return ( ( _show_sequence_acc != null ) && _show_sequence_acc.isSelected() );
929 boolean isShowSequenceRelationConfidence() {
930 return ( ( _seq_relation_confidence_switch != null ) && ( _seq_relation_confidence_switch.isSelected() ) );
933 boolean isShowSequenceRelations() {
934 return ( ( _show_sequence_relations != null ) && ( _show_sequence_relations.getSelectedIndex() > 0 ) );
937 boolean isShowTaxonomyCode() {
938 return ( ( _show_taxo_code != null ) && _show_taxo_code.isSelected() );
941 boolean isShowTaxonomyCommonNames() {
942 return ( ( _show_taxo_common_names != null ) && _show_taxo_common_names.isSelected() );
945 boolean isShowTaxonomyScientificNames() {
946 return ( ( _show_taxo_scientific_names != null ) && _show_taxo_scientific_names.isSelected() );
949 boolean isWidthBranches() {
950 return ( ( _width_branches != null ) && _width_branches.isSelected() );
953 void phylogenyAdded( final Configuration configuration ) {
954 getIsDrawPhylogramList().add( configuration.isDrawAsPhylogram() );
957 void phylogenyRemoved( final int index ) {
958 getIsDrawPhylogramList().remove( index );
962 final MainPanel main_panel = getMainPanel();
963 final Phylogeny tree = main_panel.getCurrentPhylogeny();
964 if ( ( tree == null ) || tree.isEmpty() ) {
967 String query = getSearchTextField0().getText();
968 if ( query != null ) {
969 query = query.trim();
971 if ( !ForesterUtil.isEmpty( query ) ) {
972 search0( main_panel, tree, query );
975 getSearchFoundCountsLabel0().setVisible( false );
976 getSearchResetButton0().setEnabled( false );
977 getSearchResetButton0().setVisible( false );
983 final MainPanel main_panel = getMainPanel();
984 final Phylogeny tree = main_panel.getCurrentPhylogeny();
985 if ( ( tree == null ) || tree.isEmpty() ) {
988 String query = getSearchTextField1().getText();
989 if ( query != null ) {
990 query = query.trim();
992 if ( !ForesterUtil.isEmpty( query ) ) {
993 search1( main_panel, tree, query );
996 getSearchFoundCountsLabel1().setVisible( false );
997 getSearchResetButton1().setEnabled( false );
998 getSearchResetButton1().setVisible( false );
1003 void searchReset0() {
1004 if ( getMainPanel().getCurrentTreePanel() != null ) {
1005 getMainPanel().getCurrentTreePanel().setFoundNodes0( null );
1009 void searchReset1() {
1010 if ( getMainPanel().getCurrentTreePanel() != null ) {
1011 getMainPanel().getCurrentTreePanel().setFoundNodes1( null );
1015 void setActionWhenNodeClicked( final NodeClickAction action ) {
1016 _action_when_node_clicked = action;
1019 void setAnnotationColors( final Map<String, Color> annotation_colors ) {
1020 _annotation_colors = annotation_colors;
1023 void setCheckbox( final int which, final boolean state ) {
1025 case Configuration.display_as_phylogram:
1026 if ( getDisplayAsPhylogramCb() != null ) {
1027 getDisplayAsPhylogramCb().setSelected( state );
1030 case Configuration.display_internal_data:
1031 if ( _display_internal_data != null ) {
1032 _display_internal_data.setSelected( state );
1035 case Configuration.color_according_to_species:
1036 if ( _color_acc_species != null ) {
1037 _color_acc_species.setSelected( state );
1040 case Configuration.color_according_to_sequence:
1041 if ( _color_acc_sequence != null ) {
1042 _color_acc_sequence.setSelected( state );
1045 case Configuration.color_according_to_annotation:
1046 if ( _color_according_to_annotation != null ) {
1047 _color_according_to_annotation.setSelected( state );
1050 case Configuration.show_node_names:
1051 if ( _show_node_names != null ) {
1052 _show_node_names.setSelected( state );
1055 case Configuration.show_taxonomy_scientific_names:
1056 if ( _show_taxo_scientific_names != null ) {
1057 _show_taxo_scientific_names.setSelected( state );
1060 case Configuration.show_taxonomy_common_names:
1061 if ( _show_taxo_common_names != null ) {
1062 _show_taxo_common_names.setSelected( state );
1065 case Configuration.show_tax_code:
1066 if ( _show_taxo_code != null ) {
1067 _show_taxo_code.setSelected( state );
1070 case Configuration.show_taxonomy_images:
1071 if ( _show_taxo_images_cb != null ) {
1072 _show_taxo_images_cb.setSelected( state );
1075 case Configuration.show_annotation:
1076 if ( _show_annotation != null ) {
1077 _show_annotation.setSelected( state );
1080 case Configuration.show_binary_characters:
1081 if ( _show_binary_characters != null ) {
1082 _show_binary_characters.setSelected( state );
1085 case Configuration.show_binary_character_counts:
1086 if ( _show_binary_character_counts != null ) {
1087 _show_binary_character_counts.setSelected( state );
1090 case Configuration.write_confidence_values:
1091 if ( getWriteConfidenceCb() != null ) {
1092 getWriteConfidenceCb().setSelected( state );
1095 case Configuration.write_events:
1096 if ( getShowEventsCb() != null ) {
1097 getShowEventsCb().setSelected( state );
1100 case Configuration.use_style:
1101 if ( getUseVisualStylesCb() != null ) {
1102 getUseVisualStylesCb().setSelected( state );
1105 case Configuration.width_branches:
1106 if ( _width_branches != null ) {
1107 _width_branches.setSelected( state );
1110 case Configuration.show_domain_architectures:
1111 if ( _show_domain_architectures != null ) {
1112 _show_domain_architectures.setSelected( state );
1115 case Configuration.write_branch_length_values:
1116 if ( _write_branch_length_values != null ) {
1117 _write_branch_length_values.setSelected( state );
1120 case Configuration.show_mol_seqs:
1121 if ( _show_mol_seqs != null ) {
1122 _show_mol_seqs.setSelected( state );
1125 case Configuration.show_seq_names:
1126 if ( _show_seq_names != null ) {
1127 _show_seq_names.setSelected( state );
1130 case Configuration.show_gene_names:
1131 if ( _show_gene_names != null ) {
1132 _show_gene_names.setSelected( state );
1135 case Configuration.show_seq_symbols:
1136 if ( _show_seq_symbols != null ) {
1137 _show_seq_symbols.setSelected( state );
1140 case Configuration.show_vector_data:
1141 if ( _show_vector_data_cb != null ) {
1142 _show_vector_data_cb.setSelected( state );
1145 case Configuration.show_properties:
1146 if ( _show_properties_cb != null ) {
1147 _show_properties_cb.setSelected( state );
1150 case Configuration.show_sequence_acc:
1151 if ( _show_sequence_acc != null ) {
1152 _show_sequence_acc.setSelected( state );
1155 case Configuration.dynamically_hide_data:
1156 if ( getDynamicallyHideData() != null ) {
1157 getDynamicallyHideData().setSelected( state );
1160 case Configuration.node_data_popup:
1161 if ( getNodeDescPopupCb() != null ) {
1162 getNodeDescPopupCb().setSelected( state );
1166 case Configuration.show_relation_confidence:
1167 if ( _seq_relation_confidence_switch != null ) {
1168 _seq_relation_confidence_switch.setSelected( state );
1173 throw new AssertionError( "unknown checkbox: " + which );
1178 * Set this checkbox state. Not all checkboxes have been instantiated
1179 * depending on the config.
1181 void setCheckbox( final JCheckBox cb, final boolean state ) {
1183 cb.setSelected( state );
1187 void setClickToAction( final int action ) {
1188 // Set click-to action
1189 if ( action == _show_data_item ) {
1190 setActionWhenNodeClicked( NodeClickAction.SHOW_DATA );
1192 else if ( action == _collapse_cb_item ) {
1193 setActionWhenNodeClicked( NodeClickAction.COLLAPSE );
1195 else if ( action == _reroot_cb_item ) {
1196 setActionWhenNodeClicked( NodeClickAction.REROOT );
1198 else if ( action == _subtree_cb_item ) {
1199 setActionWhenNodeClicked( NodeClickAction.SUBTREE );
1201 else if ( action == _swap_cb_item ) {
1202 setActionWhenNodeClicked( NodeClickAction.SWAP );
1204 else if ( action == _color_subtree_cb_item ) {
1205 setActionWhenNodeClicked( NodeClickAction.COLOR_SUBTREE );
1207 else if ( action == _open_seq_web_item ) {
1208 setActionWhenNodeClicked( NodeClickAction.OPEN_SEQ_WEB );
1210 else if ( action == _sort_descendents_item ) {
1211 setActionWhenNodeClicked( NodeClickAction.SORT_DESCENDENTS );
1213 else if ( action == _blast_item ) {
1214 setActionWhenNodeClicked( NodeClickAction.BLAST );
1216 else if ( action == _open_tax_web_item ) {
1217 setActionWhenNodeClicked( NodeClickAction.OPEN_TAX_WEB );
1219 else if ( action == _cut_subtree_item ) {
1220 setActionWhenNodeClicked( NodeClickAction.CUT_SUBTREE );
1222 else if ( action == _copy_subtree_item ) {
1223 setActionWhenNodeClicked( NodeClickAction.COPY_SUBTREE );
1225 else if ( action == _delete_node_or_subtree_item ) {
1226 setActionWhenNodeClicked( NodeClickAction.DELETE_NODE_OR_SUBTREE );
1228 else if ( action == _paste_subtree_item ) {
1229 setActionWhenNodeClicked( NodeClickAction.PASTE_SUBTREE );
1231 else if ( action == _add_new_node_item ) {
1232 setActionWhenNodeClicked( NodeClickAction.ADD_NEW_NODE );
1234 else if ( action == _edit_node_data_item ) {
1235 setActionWhenNodeClicked( NodeClickAction.EDIT_NODE_DATA );
1237 else if ( action == _select_nodes_item ) {
1238 setActionWhenNodeClicked( NodeClickAction.SELECT_NODES );
1240 else if ( action == _get_ext_desc_data ) {
1241 setActionWhenNodeClicked( NodeClickAction.GET_EXT_DESC_DATA );
1243 else if ( action == _open_pdb_item ) {
1244 setActionWhenNodeClicked( NodeClickAction.OPEN_PDB_WEB );
1246 else if ( action == _color_node_font_item ) {
1247 setActionWhenNodeClicked( NodeClickAction.COLOR_NODE_FONT );
1249 else if ( action == _change_node_font_item ) {
1250 setActionWhenNodeClicked( NodeClickAction.CHANGE_NODE_FONT );
1253 throw new RuntimeException( "unknown action: " + action );
1255 // make sure drop down is displaying the correct action
1256 // in case this was called from outside the class
1257 _click_to_combobox.setSelectedIndex( action );
1260 void setColorBranches( final boolean color_branches ) {
1261 _color_branches = color_branches;
1264 void setDrawPhylogram( final boolean b ) {
1265 getDisplayAsPhylogramCb().setSelected( b );
1266 setDrawPhylogram( getMainPanel().getCurrentTabIndex(), b );
1269 void setDrawPhylogramEnabled( final boolean b ) {
1270 getDisplayAsPhylogramCb().setEnabled( b );
1273 void setDynamicHidingIsOn( final boolean is_on ) {
1275 getDynamicallyHideData().setForeground( getConfiguration().getGuiCheckboxAndButtonActiveColor() );
1278 if ( !_configuration.isUseNativeUI() ) {
1279 getDynamicallyHideData().setForeground( getConfiguration().getGuiButtonTextColor() );
1282 getDynamicallyHideData().setForeground( Color.BLACK );
1287 void setSearchFoundCountsOnLabel0( final int counts ) {
1288 getSearchFoundCountsLabel0().setText( "Found: " + counts );
1291 void setSearchFoundCountsOnLabel1( final int counts ) {
1292 getSearchFoundCountsLabel1().setText( "Found: " + counts );
1295 void setShowEvents( final boolean show_events ) {
1296 if ( getShowEventsCb() == null ) {
1297 _show_events = new JCheckBox( "" );
1299 getShowEventsCb().setSelected( show_events );
1302 void setSpeciesColors( final Map<String, Color> species_colors ) {
1303 _species_colors = species_colors;
1306 void setSequenceColors( final Map<String, Color> sequence_colors ) {
1307 _sequence_colors = sequence_colors;
1310 void setupControls() {
1311 // The tree display options:
1312 setupDisplayCheckboxes();
1314 // The sequence relation query selection combo-box
1315 if ( _configuration.displaySequenceRelations() ) {
1316 addSequenceRelationBlock();
1320 startClickToOptions();
1321 setupClickToOptions();
1322 endClickToOptions();
1323 // Zoom and quick edit buttons
1325 setupSearchTools0();
1326 setupSearchTools1();
1329 void setUpControlsForDomainStrucures() {
1330 _domain_display_label = new JLabel( "Domain Architectures:" );
1331 add( customizeLabel( _domain_display_label, getConfiguration() ) );
1332 add( _domain_display_label );
1333 _zoom_in_domain_structure = new JButton( "d+" );
1334 _zoom_out_domain_structure = new JButton( "d-" );
1335 _decr_domain_structure_evalue_thr = new JButton( "-" );
1336 _incr_domain_structure_evalue_thr = new JButton( "+" );
1337 _zoom_in_domain_structure.setPreferredSize( new Dimension( 10, 10 ) );
1338 _zoom_out_domain_structure.setPreferredSize( new Dimension( 10, 10 ) );
1339 _decr_domain_structure_evalue_thr.setPreferredSize( new Dimension( 10, 10 ) );
1340 _incr_domain_structure_evalue_thr.setPreferredSize( new Dimension( 10, 10 ) );
1341 _incr_domain_structure_evalue_thr.setToolTipText( "Increase the E-value threshold by a factor of 10" );
1342 _decr_domain_structure_evalue_thr.setToolTipText( "Decrease the E-value threshold by a factor of 10" );
1343 _domain_structure_evalue_thr_tf = new JTextField( 3 );
1344 _domain_structure_evalue_thr_tf.setEditable( false );
1345 if ( !getConfiguration().isUseNativeUI() ) {
1346 _domain_structure_evalue_thr_tf.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
1347 _domain_structure_evalue_thr_tf.setBackground( getConfiguration().getGuiCheckboxTextColor() );
1348 _domain_structure_evalue_thr_tf.setBorder( null );
1350 final JPanel d1_panel = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
1351 final JPanel d2_panel = new JPanel( new GridLayout( 1, 3, 0, 0 ) );
1352 if ( !_configuration.isUseNativeUI() ) {
1353 d1_panel.setBackground( getBackground() );
1354 d2_panel.setBackground( getBackground() );
1358 addJButton( _zoom_out_domain_structure, d1_panel );
1359 addJButton( _zoom_in_domain_structure, d1_panel );
1360 addJButton( _decr_domain_structure_evalue_thr, d2_panel );
1361 addJTextField( _domain_structure_evalue_thr_tf, d2_panel );
1362 addJButton( _incr_domain_structure_evalue_thr, d2_panel );
1365 void setupSearchTools0() {
1366 final JLabel search_label = new JLabel( "Search (A):" );
1367 search_label.setFont( ControlPanel.jcb_bold_font );
1368 if ( !getConfiguration().isUseNativeUI() ) {
1369 search_label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1371 add( search_label );
1372 search_label.setToolTipText( SEARCH_TIP_TEXT );
1373 _search_found_label_0 = new JLabel();
1374 getSearchFoundCountsLabel0().setVisible( false );
1375 _search_found_label_0.setFont( ControlPanel.jcb_bold_font );
1376 if ( !getConfiguration().isUseNativeUI() ) {
1377 _search_found_label_0.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1379 _search_tf_0 = new JTextField( 3 );
1380 _search_tf_0.setToolTipText( SEARCH_TIP_TEXT );
1381 _search_tf_0.setEditable( true );
1382 if ( !getConfiguration().isUseNativeUI() ) {
1383 _search_tf_0.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
1384 _search_tf_0.setBackground( getConfiguration().getGuiCheckboxTextColor() );
1385 _search_tf_0.setBorder( null );
1387 _search_reset_button_0 = new JButton();
1388 getSearchResetButton0().setText( "Reset" );
1389 getSearchResetButton0().setEnabled( false );
1390 getSearchResetButton0().setVisible( false );
1391 final JPanel s_panel_1 = new JPanel( new BorderLayout() );
1392 final JPanel s_panel_2 = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
1393 s_panel_1.setBackground( getBackground() );
1395 s_panel_2.setBackground( getBackground() );
1397 final KeyAdapter key_adapter = new KeyAdapter() {
1400 public void keyReleased( final KeyEvent key_event ) {
1402 displayedPhylogenyMightHaveChanged( true );
1405 final ActionListener action_listener = new ActionListener() {
1408 public void actionPerformed( final ActionEvent e ) {
1410 setSearchFoundCountsOnLabel0( 0 );
1411 getSearchFoundCountsLabel0().setVisible( false );
1412 getSearchTextField0().setText( "" );
1413 getSearchResetButton0().setEnabled( false );
1414 getSearchResetButton0().setVisible( false );
1415 displayedPhylogenyMightHaveChanged( true );
1418 _search_reset_button_0.addActionListener( action_listener );
1419 _search_tf_0.addKeyListener( key_adapter );
1420 addJTextField( _search_tf_0, s_panel_1 );
1421 s_panel_2.add( _search_found_label_0 );
1422 addJButton( _search_reset_button_0, s_panel_2 );
1425 void setupSearchTools1() {
1426 final JLabel search_label = new JLabel( "Search (B):" );
1427 search_label.setFont( ControlPanel.jcb_bold_font );
1428 if ( !getConfiguration().isUseNativeUI() ) {
1429 search_label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1431 add( search_label );
1432 search_label.setToolTipText( SEARCH_TIP_TEXT );
1433 _search_found_label_1 = new JLabel();
1434 getSearchFoundCountsLabel1().setVisible( false );
1435 _search_found_label_1.setFont( ControlPanel.jcb_bold_font );
1436 if ( !getConfiguration().isUseNativeUI() ) {
1437 _search_found_label_1.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1439 _search_tf_1 = new JTextField( 3 );
1440 _search_tf_1.setToolTipText( SEARCH_TIP_TEXT );
1441 _search_tf_1.setEditable( true );
1442 if ( !getConfiguration().isUseNativeUI() ) {
1443 _search_tf_1.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
1444 _search_tf_1.setBackground( getConfiguration().getGuiCheckboxTextColor() );
1445 _search_tf_1.setBorder( null );
1447 _search_reset_button_1 = new JButton();
1448 getSearchResetButton1().setText( "Reset" );
1449 getSearchResetButton1().setEnabled( false );
1450 getSearchResetButton1().setVisible( false );
1451 final JPanel s_panel_1 = new JPanel( new BorderLayout() );
1452 final JPanel s_panel_2 = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
1453 s_panel_1.setBackground( getBackground() );
1455 s_panel_2.setBackground( getBackground() );
1457 final KeyAdapter key_adapter = new KeyAdapter() {
1460 public void keyReleased( final KeyEvent key_event ) {
1462 displayedPhylogenyMightHaveChanged( true );
1465 final ActionListener action_listener = new ActionListener() {
1468 public void actionPerformed( final ActionEvent e ) {
1470 setSearchFoundCountsOnLabel1( 0 );
1471 getSearchFoundCountsLabel1().setVisible( false );
1472 getSearchTextField1().setText( "" );
1473 getSearchResetButton1().setEnabled( false );
1474 getSearchResetButton1().setVisible( false );
1475 displayedPhylogenyMightHaveChanged( true );
1478 _search_reset_button_1.addActionListener( action_listener );
1479 _search_tf_1.addKeyListener( key_adapter );
1480 addJTextField( _search_tf_1, s_panel_1 );
1481 s_panel_2.add( _search_found_label_1 );
1482 addJButton( _search_reset_button_1, s_panel_2 );
1485 void showAnnotations() {
1486 if ( _show_annotation != null ) {
1487 _show_annotation.setSelected( true );
1489 if ( _color_according_to_annotation != null ) {
1490 _color_according_to_annotation.setSelected( true );
1492 if ( _color_acc_species != null ) {
1493 _color_acc_species.setSelected( false );
1495 if ( _color_acc_sequence != null ) {
1496 _color_acc_sequence.setSelected( false );
1498 _mainpanel.getCurrentTreePanel().repaint();
1502 * Fit entire tree into window.
1505 if ( ( _mainpanel.getCurrentScrollPane() == null ) || _mainpanel.getCurrentTreePanel().getPhylogeny().isEmpty() ) {
1508 getCurrentTreePanel().updateSetOfCollapsedExternalNodes();
1509 displayedPhylogenyMightHaveChanged( true );
1510 _mainpanel.getCurrentTreePanel().updateOvSettings();
1511 _mainpanel.getCurrentTreePanel().validate();
1512 _mainpanel.validate();
1513 _mainpanel.getCurrentTreePanel().calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
1514 _mainpanel.getSizeOfViewport().height );
1515 _mainpanel.getCurrentTreePanel().resetPreferredSize();
1516 _mainpanel.adjustJScrollPane();
1517 _mainpanel.getCurrentTreePanel().repaint();
1518 _mainpanel.getCurrentTreePanel().validate();
1519 _mainpanel.validate();
1520 _mainpanel.getCurrentTreePanel().calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
1521 _mainpanel.getSizeOfViewport().height );
1522 _mainpanel.getCurrentTreePanel().resetPreferredSize();
1523 _mainpanel.adjustJScrollPane();
1524 _mainpanel.getCurrentTreePanel().repaint();
1525 _mainpanel.getCurrentTreePanel().updateOvSizes();
1528 void showWholeAll() {
1529 for( final TreePanel tree_panel : _mainpanel.getTreePanels() ) {
1530 if ( tree_panel != null ) {
1531 tree_panel.validate();
1532 tree_panel.calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
1533 _mainpanel.getSizeOfViewport().height );
1534 tree_panel.resetPreferredSize();
1535 tree_panel.repaint();
1540 // Create header for click-to combo box.
1541 void startClickToOptions() {
1542 final JLabel spacer = new JLabel( "" );
1543 spacer.setFont( ControlPanel.jcb_font );
1545 _click_to_label = new JLabel( "Click on Node to:" );
1546 add( customizeLabel( _click_to_label, getConfiguration() ) );
1547 _click_to_combobox = new JComboBox<String>();
1548 _click_to_combobox.setFocusable( false );
1549 _click_to_combobox.setMaximumRowCount( 14 );
1550 _click_to_combobox.setFont( ControlPanel.js_font );
1551 if ( !_configuration.isUseNativeUI() ) {
1552 _click_to_combobox.setBackground( getConfiguration().getGuiBackgroundColor() );
1554 // don't add listener until all items are set (or each one will trigger
1556 // click_to_list.addActionListener(this);
1557 add( _click_to_combobox );
1558 // Correlates option names to titles
1559 _all_click_to_names = new HashMap<Integer, String>();
1560 _click_to_names = new ArrayList<String>();
1564 if ( getMainPanel().getTabbedPane().getTabCount() > 0 ) {
1565 if ( getCurrentTreePanel().isPhyHasBranchLengths()
1566 && ( getCurrentTreePanel().getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) {
1567 setDrawPhylogramEnabled( true );
1568 setDrawPhylogram( isDrawPhylogram() );
1571 setDrawPhylogramEnabled( false );
1572 setDrawPhylogram( false );
1574 if ( getMainPanel().getMainFrame() == null ) {
1575 // Must be "E" applet version.
1576 final ArchaeopteryxE e = ( ArchaeopteryxE ) ( ( MainPanelApplets ) getMainPanel() ).getApplet();
1577 e.setSelectedTypeInTypeMenu( e.getCurrentTreePanel().getPhylogenyGraphicsType() );
1580 getMainPanel().getMainFrame().setSelectedTypeInTypeMenu( getMainPanel().getCurrentTreePanel()
1581 .getPhylogenyGraphicsType() );
1583 getMainPanel().getCurrentTreePanel().updateSubSuperTreeButton();
1584 getMainPanel().getControlPanel().search0();
1585 getMainPanel().getControlPanel().search1();
1586 getMainPanel().getControlPanel().updateDomainStructureEvaluethresholdDisplay();
1587 getSequenceRelationTypeBox().removeAllItems();
1588 for( final SequenceRelation.SEQUENCE_RELATION_TYPE type : getMainPanel().getCurrentPhylogeny()
1589 .getRelevantSequenceRelationTypes() ) {
1590 _sequence_relation_type_box.addItem( type );
1592 getMainPanel().getCurrentTreePanel().repaint();
1593 //setSequenceRelationQueries( getMainPanel().getCurrentPhylogeny().getSequenceRelationQueries() );
1594 // according to GUILHEM the line above can be removed.
1599 * Uncollapse all nodes.
1601 void uncollapseAll( final TreePanel tp ) {
1602 final Phylogeny t = tp.getPhylogeny();
1603 if ( ( t != null ) && !t.isEmpty() ) {
1604 for( final PhylogenyNodeIterator iter = t.iteratorPreorder(); iter.hasNext(); ) {
1605 final PhylogenyNode node = iter.next();
1606 node.setCollapse( false );
1608 tp.resetNodeIdToDistToLeafMap();
1609 tp.updateSetOfCollapsedExternalNodes();
1610 t.recalculateNumberOfExternalDescendants( false );
1611 tp.setNodeInPreorderToNull();
1612 t.clearHashIdToNodeMap();
1617 void updateDomainStructureEvaluethresholdDisplay() {
1618 if ( _domain_structure_evalue_thr_tf != null ) {
1619 _domain_structure_evalue_thr_tf.setText( "10^"
1620 + getMainPanel().getCurrentTreePanel().getDomainStructureEvalueThresholdExp() );
1624 void zoomInX( final float factor, final float x_correction_factor ) {
1625 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar();
1626 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1627 treepanel.multiplyUrtFactor( 1f );
1628 if ( ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
1629 || ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
1630 || isDrawPhylogram( getMainPanel().getCurrentTabIndex() )
1631 || ( getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP ) ) {
1632 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1633 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
1634 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
1635 getMainPanel().adjustJScrollPane();
1636 treepanel.resetPreferredSize();
1637 getMainPanel().getCurrentScrollPane().getViewport().validate();
1638 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1639 - ( sb.getVisibleAmount() / 2.0 ) ) );
1642 final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue();
1643 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
1644 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
1645 getMainPanel().adjustJScrollPane();
1646 treepanel.resetPreferredSize();
1647 getMainPanel().getCurrentScrollPane().getViewport().validate();
1648 sb.setValue( sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount() );
1650 treepanel.resetPreferredSize();
1651 treepanel.updateOvSizes();
1654 void zoomInY( final float factor ) {
1655 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getVerticalScrollBar();
1656 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1657 treepanel.multiplyUrtFactor( 1.1f );
1658 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1659 treepanel.setYdistance( ( treepanel.getYdistance() * factor ) );
1660 getMainPanel().adjustJScrollPane();
1661 treepanel.resetPreferredSize();
1662 getMainPanel().getCurrentScrollPane().getViewport().validate();
1663 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1664 - ( sb.getVisibleAmount() / 2.0 ) ) );
1665 treepanel.resetPreferredSize();
1666 treepanel.updateOvSizes();
1669 void zoomOutX( final float factor, final float x_correction_factor ) {
1670 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1671 treepanel.multiplyUrtFactor( 1f );
1672 if ( ( treepanel.getXdistance() * factor ) > 0.0 ) {
1673 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar();
1674 if ( ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
1675 || ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
1676 || isDrawPhylogram( getMainPanel().getCurrentTabIndex() )
1677 || ( getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP ) ) {
1678 getMainPanel().adjustJScrollPane();
1679 treepanel.resetPreferredSize();
1680 getMainPanel().getCurrentScrollPane().getViewport().validate();
1681 final double x = ( sb.getMaximum() - sb.getMinimum() )
1682 / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1683 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
1684 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
1685 getMainPanel().adjustJScrollPane();
1686 treepanel.resetPreferredSize();
1687 getMainPanel().getCurrentScrollPane().getViewport().validate();
1688 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1689 - ( sb.getVisibleAmount() / 2.0 ) ) );
1692 final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue();
1693 treepanel.setXdistance( treepanel.getXdistance() * factor );
1694 treepanel.setXcorrectionFactor( treepanel.getXcorrectionFactor() * x_correction_factor );
1696 getMainPanel().adjustJScrollPane();
1697 treepanel.resetPreferredSize();
1698 getMainPanel().getCurrentScrollPane().getViewport().validate();
1699 sb.setValue( sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount() );
1702 treepanel.resetPreferredSize();
1703 treepanel.updateOvSizes();
1707 void zoomOutY( final float factor ) {
1708 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1709 treepanel.multiplyUrtFactor( 0.9f );
1710 if ( ( treepanel.getYdistance() * factor ) > 0.0 ) {
1711 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getVerticalScrollBar();
1712 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1713 treepanel.setYdistance( ( treepanel.getYdistance() * factor ) );
1714 getMainPanel().adjustJScrollPane();
1715 treepanel.resetPreferredSize();
1716 getMainPanel().getCurrentScrollPane().getViewport().validate();
1717 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1718 - ( sb.getVisibleAmount() / 2.0 ) ) );
1719 treepanel.resetPreferredSize();
1720 treepanel.updateOvSizes();
1724 private void addClickToOption( final int which, final String title ) {
1725 _click_to_combobox.addItem( title );
1726 _click_to_names.add( title );
1727 _all_click_to_names.put( new Integer( which ), title );
1728 if ( !_configuration.isUseNativeUI() ) {
1729 _click_to_combobox.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
1730 _click_to_combobox.setForeground( getConfiguration().getGuiButtonTextColor() );
1735 private void addSequenceRelationBlock() {
1736 final JLabel spacer = new JLabel( "" );
1737 spacer.setSize( 1, 1 );
1739 final JLabel mainLabel = new JLabel( "Sequence relations to display" );
1740 final JLabel typeLabel = customizeLabel( new JLabel( "(type) " ), getConfiguration() );
1741 typeLabel.setFont( ControlPanel.js_font.deriveFont( 7 ) );
1742 getSequenceRelationTypeBox().setFocusable( false );
1743 _sequence_relation_type_box.setFont( ControlPanel.js_font );
1744 if ( !_configuration.isUseNativeUI() ) {
1745 _sequence_relation_type_box.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
1746 _sequence_relation_type_box.setForeground( getConfiguration().getGuiButtonTextColor() );
1748 _sequence_relation_type_box.setRenderer( new ListCellRenderer<Object>() {
1751 public Component getListCellRendererComponent( final JList<?> list,
1754 final boolean isSelected,
1755 final boolean cellHasFocus ) {
1756 final Component component = new DefaultListCellRenderer().getListCellRendererComponent( list,
1761 if ( ( value != null ) && ( value instanceof SequenceRelation.SEQUENCE_RELATION_TYPE ) ) {
1762 ( ( DefaultListCellRenderer ) component ).setText( SequenceRelation
1763 .getPrintableNameByType( ( SequenceRelation.SEQUENCE_RELATION_TYPE ) value ) );
1768 final GridBagLayout gbl = new GridBagLayout();
1769 _sequence_relation_type_box.setMinimumSize( new Dimension( 115, 17 ) );
1770 _sequence_relation_type_box.setPreferredSize( new Dimension( 115, 20 ) );
1771 final JPanel horizGrid = new JPanel( gbl );
1772 horizGrid.setBackground( getBackground() );
1773 horizGrid.add( typeLabel );
1774 horizGrid.add( _sequence_relation_type_box );
1775 add( customizeLabel( mainLabel, getConfiguration() ) );
1777 add( getSequenceRelationBox() );
1778 if ( _configuration.doDisplayOption( Configuration.show_relation_confidence ) ) {
1779 addCheckbox( Configuration.show_relation_confidence,
1780 _configuration.getDisplayTitle( Configuration.show_relation_confidence ) );
1781 setCheckbox( Configuration.show_relation_confidence,
1782 _configuration.doCheckOption( Configuration.show_relation_confidence ) );
1784 }// addSequenceRelationBlock
1787 private List<Boolean> getIsDrawPhylogramList() {
1788 return _draw_phylogram;
1791 private void init() {
1792 _draw_phylogram = new ArrayList<Boolean>();
1793 setSpeciesColors( new HashMap<String, Color>() );
1794 setSequenceColors( new HashMap<String, Color>() );
1795 setAnnotationColors( new HashMap<String, Color>() );
1798 private boolean isDrawPhylogram( final int index ) {
1799 return getIsDrawPhylogramList().get( index );
1802 private void search0( final MainPanel main_panel, final Phylogeny tree, final String query_str ) {
1803 getSearchFoundCountsLabel0().setVisible( true );
1804 getSearchResetButton0().setEnabled( true );
1805 getSearchResetButton0().setVisible( true );
1806 String[] queries = null;
1807 Set<PhylogenyNode> nodes = null;
1808 if ( ( query_str.indexOf( ',' ) >= 0 ) && !getOptions().isSearchWithRegex() ) {
1809 queries = query_str.split( ",+" );
1812 queries = new String[ 1 ];
1813 queries[ 0 ] = query_str.trim();
1815 if ( ( queries != null ) && ( queries.length > 0 ) ) {
1816 nodes = new HashSet<PhylogenyNode>();
1817 for( String query : queries ) {
1818 if ( ForesterUtil.isEmpty( query ) ) {
1821 query = query.trim();
1822 final TreePanel tp = getMainPanel().getCurrentTreePanel();
1823 if ( ( query.indexOf( '+' ) > 0 ) && !getOptions().isSearchWithRegex() ) {
1824 nodes.addAll( PhylogenyMethods.searchDataLogicalAnd( query.split( "\\++" ),
1826 getOptions().isSearchCaseSensitive(),
1827 !getOptions().isMatchWholeTermsOnly(),
1828 isShowDomainArchitectures(),
1829 tp != null ? Math.pow( 10,
1830 tp.getDomainStructureEvalueThresholdExp() )
1834 nodes.addAll( PhylogenyMethods.searchData( query,
1836 getOptions().isSearchCaseSensitive(),
1837 !getOptions().isMatchWholeTermsOnly(),
1838 getOptions().isSearchWithRegex(),
1839 isShowDomainArchitectures(),
1840 tp != null ? Math.pow( 10, tp
1841 .getDomainStructureEvalueThresholdExp() ) : 0 ) );
1844 if ( getOptions().isInverseSearchResult() ) {
1845 final List<PhylogenyNode> all = PhylogenyMethods.obtainAllNodesAsList( tree );
1846 all.removeAll( nodes );
1847 nodes = new HashSet<PhylogenyNode>();
1848 nodes.addAll( all );
1851 if ( ( nodes != null ) && ( nodes.size() > 0 ) ) {
1852 main_panel.getCurrentTreePanel().setFoundNodes0( new HashSet<Long>() );
1853 for( final PhylogenyNode node : nodes ) {
1854 main_panel.getCurrentTreePanel().getFoundNodes0().add( node.getId() );
1856 setSearchFoundCountsOnLabel0( nodes.size() );
1859 setSearchFoundCountsOnLabel0( 0 );
1864 private void search1( final MainPanel main_panel, final Phylogeny tree, final String query_str ) {
1865 getSearchFoundCountsLabel1().setVisible( true );
1866 getSearchResetButton1().setEnabled( true );
1867 getSearchResetButton1().setVisible( true );
1868 String[] queries = null;
1869 Set<PhylogenyNode> nodes = null;
1870 if ( ( query_str.indexOf( ',' ) >= 0 ) && !getOptions().isSearchWithRegex() ) {
1871 queries = query_str.split( ",+" );
1874 queries = new String[ 1 ];
1875 queries[ 0 ] = query_str.trim();
1877 if ( ( queries != null ) && ( queries.length > 0 ) ) {
1878 nodes = new HashSet<PhylogenyNode>();
1879 for( String query : queries ) {
1880 if ( ForesterUtil.isEmpty( query ) ) {
1883 query = query.trim();
1884 final TreePanel tp = getMainPanel().getCurrentTreePanel();
1885 if ( ( query.indexOf( '+' ) > 0 ) && !getOptions().isSearchWithRegex() ) {
1886 nodes.addAll( PhylogenyMethods.searchDataLogicalAnd( query.split( "\\++" ),
1888 getOptions().isSearchCaseSensitive(),
1889 !getOptions().isMatchWholeTermsOnly(),
1890 isShowDomainArchitectures(),
1891 tp != null ? Math.pow( 10,
1892 tp.getDomainStructureEvalueThresholdExp() )
1896 nodes.addAll( PhylogenyMethods.searchData( query,
1898 getOptions().isSearchCaseSensitive(),
1899 !getOptions().isMatchWholeTermsOnly(),
1900 getOptions().isSearchWithRegex(),
1901 isShowDomainArchitectures(),
1902 tp != null ? Math.pow( 10, tp
1903 .getDomainStructureEvalueThresholdExp() ) : 0 ) );
1906 if ( getOptions().isInverseSearchResult() ) {
1907 final List<PhylogenyNode> all = PhylogenyMethods.obtainAllNodesAsList( tree );
1908 all.removeAll( nodes );
1909 nodes = new HashSet<PhylogenyNode>();
1910 nodes.addAll( all );
1913 if ( ( nodes != null ) && ( nodes.size() > 0 ) ) {
1914 main_panel.getCurrentTreePanel().setFoundNodes1( new HashSet<Long>() );
1915 for( final PhylogenyNode node : nodes ) {
1916 main_panel.getCurrentTreePanel().getFoundNodes1().add( node.getId() );
1918 setSearchFoundCountsOnLabel1( nodes.size() );
1921 setSearchFoundCountsOnLabel1( 0 );
1926 private void setDrawPhylogram( final int index, final boolean b ) {
1927 getIsDrawPhylogramList().set( index, b );
1930 private void setupClickToOptions() {
1931 final int default_option = _configuration.getDefaultDisplayClicktoOption();
1932 int selected_index = 0;
1934 if ( _configuration.doDisplayClickToOption( Configuration.display_node_data ) ) {
1935 _show_data_item = cb_index;
1936 addClickToOption( Configuration.display_node_data,
1937 _configuration.getClickToTitle( Configuration.display_node_data ) );
1938 if ( default_option == Configuration.display_node_data ) {
1939 selected_index = cb_index;
1943 if ( _configuration.doDisplayClickToOption( Configuration.collapse_uncollapse ) ) {
1944 _collapse_cb_item = cb_index;
1945 addClickToOption( Configuration.collapse_uncollapse,
1946 _configuration.getClickToTitle( Configuration.collapse_uncollapse ) );
1947 if ( default_option == Configuration.collapse_uncollapse ) {
1948 selected_index = cb_index;
1952 if ( _configuration.doDisplayClickToOption( Configuration.reroot ) ) {
1953 _reroot_cb_item = cb_index;
1954 addClickToOption( Configuration.reroot, _configuration.getClickToTitle( Configuration.reroot ) );
1955 if ( default_option == Configuration.reroot ) {
1956 selected_index = cb_index;
1960 if ( _configuration.doDisplayClickToOption( Configuration.subtree ) ) {
1961 _subtree_cb_item = cb_index;
1962 addClickToOption( Configuration.subtree, _configuration.getClickToTitle( Configuration.subtree ) );
1963 if ( default_option == Configuration.subtree ) {
1964 selected_index = cb_index;
1968 if ( _configuration.doDisplayClickToOption( Configuration.swap ) ) {
1969 _swap_cb_item = cb_index;
1970 addClickToOption( Configuration.swap, _configuration.getClickToTitle( Configuration.swap ) );
1971 if ( default_option == Configuration.swap ) {
1972 selected_index = cb_index;
1976 if ( _configuration.doDisplayClickToOption( Configuration.sort_descendents ) ) {
1977 _sort_descendents_item = cb_index;
1978 addClickToOption( Configuration.sort_descendents,
1979 _configuration.getClickToTitle( Configuration.sort_descendents ) );
1980 if ( default_option == Configuration.sort_descendents ) {
1981 selected_index = cb_index;
1985 if ( _configuration.doDisplayClickToOption( Configuration.color_node_font ) ) {
1986 _color_node_font_item = cb_index;
1987 addClickToOption( Configuration.color_node_font,
1988 _configuration.getClickToTitle( Configuration.color_node_font ) );
1989 if ( default_option == Configuration.color_node_font ) {
1990 selected_index = cb_index;
1994 if ( _configuration.doDisplayClickToOption( Configuration.change_node_font ) ) {
1995 _change_node_font_item = cb_index;
1996 addClickToOption( Configuration.change_node_font,
1997 _configuration.getClickToTitle( Configuration.change_node_font ) );
1998 if ( default_option == Configuration.change_node_font ) {
1999 selected_index = cb_index;
2003 if ( _configuration.doDisplayClickToOption( Configuration.color_subtree ) ) {
2004 _color_subtree_cb_item = cb_index;
2005 addClickToOption( Configuration.color_subtree, _configuration.getClickToTitle( Configuration.color_subtree ) );
2006 if ( default_option == Configuration.color_subtree ) {
2007 selected_index = cb_index;
2011 if ( _configuration.doDisplayClickToOption( Configuration.open_seq_web ) ) {
2012 _open_seq_web_item = cb_index;
2013 addClickToOption( Configuration.open_seq_web, _configuration.getClickToTitle( Configuration.open_seq_web ) );
2014 if ( default_option == Configuration.open_seq_web ) {
2015 selected_index = cb_index;
2019 if ( _configuration.doDisplayClickToOption( Configuration.open_pdb_web ) ) {
2020 _open_pdb_item = cb_index;
2021 addClickToOption( Configuration.open_pdb_web, _configuration.getClickToTitle( Configuration.open_pdb_web ) );
2022 if ( default_option == Configuration.open_pdb_web ) {
2023 selected_index = cb_index;
2027 if ( _configuration.doDisplayClickToOption( Configuration.open_tax_web ) ) {
2028 _open_tax_web_item = cb_index;
2029 addClickToOption( Configuration.open_tax_web, _configuration.getClickToTitle( Configuration.open_tax_web ) );
2030 if ( default_option == Configuration.open_tax_web ) {
2031 selected_index = cb_index;
2035 if ( _configuration.doDisplayClickToOption( Configuration.blast ) ) {
2036 _blast_item = cb_index;
2037 addClickToOption( Configuration.blast, _configuration.getClickToTitle( Configuration.blast ) );
2038 if ( default_option == Configuration.blast ) {
2039 selected_index = cb_index;
2043 if ( _configuration.doDisplayClickToOption( Configuration.select_nodes ) ) {
2044 _select_nodes_item = cb_index;
2045 addClickToOption( Configuration.select_nodes, _configuration.getClickToTitle( Configuration.select_nodes ) );
2046 if ( default_option == Configuration.select_nodes ) {
2047 selected_index = cb_index;
2051 if ( _configuration.doDisplayClickToOption( Configuration.get_ext_desc_data ) ) {
2052 _get_ext_desc_data = cb_index;
2053 if ( !ForesterUtil.isEmpty( getConfiguration().getLabelForGetExtDescendentsData() ) ) {
2054 addClickToOption( Configuration.get_ext_desc_data, getConfiguration()
2055 .getLabelForGetExtDescendentsData() );
2058 addClickToOption( Configuration.get_ext_desc_data,
2059 getConfiguration().getClickToTitle( Configuration.get_ext_desc_data ) );
2061 if ( default_option == Configuration.get_ext_desc_data ) {
2062 selected_index = cb_index;
2066 if ( getOptions().isEditable() ) {
2067 if ( _configuration.doDisplayClickToOption( Configuration.cut_subtree ) ) {
2068 _cut_subtree_item = cb_index;
2069 addClickToOption( Configuration.cut_subtree, _configuration.getClickToTitle( Configuration.cut_subtree ) );
2070 if ( default_option == Configuration.cut_subtree ) {
2071 selected_index = cb_index;
2075 if ( _configuration.doDisplayClickToOption( Configuration.copy_subtree ) ) {
2076 _copy_subtree_item = cb_index;
2077 addClickToOption( Configuration.copy_subtree,
2078 _configuration.getClickToTitle( Configuration.copy_subtree ) );
2079 if ( default_option == Configuration.copy_subtree ) {
2080 selected_index = cb_index;
2084 if ( _configuration.doDisplayClickToOption( Configuration.paste_subtree ) ) {
2085 _paste_subtree_item = cb_index;
2086 addClickToOption( Configuration.paste_subtree,
2087 _configuration.getClickToTitle( Configuration.paste_subtree ) );
2088 if ( default_option == Configuration.paste_subtree ) {
2089 selected_index = cb_index;
2093 if ( _configuration.doDisplayClickToOption( Configuration.delete_subtree_or_node ) ) {
2094 _delete_node_or_subtree_item = cb_index;
2095 addClickToOption( Configuration.delete_subtree_or_node,
2096 _configuration.getClickToTitle( Configuration.delete_subtree_or_node ) );
2097 if ( default_option == Configuration.delete_subtree_or_node ) {
2098 selected_index = cb_index;
2102 if ( _configuration.doDisplayClickToOption( Configuration.add_new_node ) ) {
2103 _add_new_node_item = cb_index;
2104 addClickToOption( Configuration.add_new_node,
2105 _configuration.getClickToTitle( Configuration.add_new_node ) );
2106 if ( default_option == Configuration.add_new_node ) {
2107 selected_index = cb_index;
2111 if ( _configuration.doDisplayClickToOption( Configuration.edit_node_data ) ) {
2112 _edit_node_data_item = cb_index;
2113 addClickToOption( Configuration.edit_node_data,
2114 _configuration.getClickToTitle( Configuration.edit_node_data ) );
2115 if ( default_option == Configuration.edit_node_data ) {
2116 selected_index = cb_index;
2121 // Set default selection and its action
2122 _click_to_combobox.setSelectedIndex( selected_index );
2123 setClickToAction( selected_index );
2126 private void setupDisplayCheckboxes() {
2127 if ( _configuration.doDisplayOption( Configuration.display_as_phylogram ) ) {
2128 addCheckbox( Configuration.display_as_phylogram,
2129 _configuration.getDisplayTitle( Configuration.display_as_phylogram ) );
2130 setCheckbox( Configuration.display_as_phylogram,
2131 _configuration.doCheckOption( Configuration.display_as_phylogram ) );
2133 if ( _configuration.doDisplayOption( Configuration.dynamically_hide_data ) ) {
2134 addCheckbox( Configuration.dynamically_hide_data,
2135 _configuration.getDisplayTitle( Configuration.dynamically_hide_data ) );
2136 setCheckbox( Configuration.dynamically_hide_data,
2137 _configuration.doCheckOption( Configuration.dynamically_hide_data ) );
2139 if ( _configuration.doDisplayOption( Configuration.node_data_popup ) ) {
2140 addCheckbox( Configuration.node_data_popup, _configuration.getDisplayTitle( Configuration.node_data_popup ) );
2141 setCheckbox( Configuration.node_data_popup, _configuration.doCheckOption( Configuration.node_data_popup ) );
2143 if ( _configuration.doDisplayOption( Configuration.display_internal_data ) ) {
2144 addCheckbox( Configuration.display_internal_data,
2145 _configuration.getDisplayTitle( Configuration.display_internal_data ) );
2146 setCheckbox( Configuration.display_internal_data,
2147 _configuration.doCheckOption( Configuration.display_internal_data ) );
2149 if ( _configuration.doDisplayOption( Configuration.color_according_to_sequence ) ) {
2150 addCheckbox( Configuration.color_according_to_sequence,
2151 _configuration.getDisplayTitle( Configuration.color_according_to_sequence ) );
2152 setCheckbox( Configuration.color_according_to_sequence,
2153 _configuration.doCheckOption( Configuration.color_according_to_sequence ) );
2155 if ( _configuration.doDisplayOption( Configuration.color_according_to_species ) ) {
2156 addCheckbox( Configuration.color_according_to_species,
2157 _configuration.getDisplayTitle( Configuration.color_according_to_species ) );
2158 setCheckbox( Configuration.color_according_to_species,
2159 _configuration.doCheckOption( Configuration.color_according_to_species ) );
2161 if ( _configuration.doDisplayOption( Configuration.color_according_to_annotation ) ) {
2162 addCheckbox( Configuration.color_according_to_annotation,
2163 _configuration.getDisplayTitle( Configuration.color_according_to_annotation ) );
2164 setCheckbox( Configuration.color_according_to_annotation,
2165 _configuration.doCheckOption( Configuration.color_according_to_annotation ) );
2167 if ( _configuration.doDisplayOption( Configuration.use_style ) ) {
2168 addCheckbox( Configuration.use_style, _configuration.getDisplayTitle( Configuration.use_style ) );
2169 setCheckbox( Configuration.use_style, _configuration.doCheckOption( Configuration.use_style ) );
2171 if ( _configuration.doDisplayOption( Configuration.width_branches ) ) {
2172 addCheckbox( Configuration.width_branches, _configuration.getDisplayTitle( Configuration.width_branches ) );
2173 setCheckbox( Configuration.width_branches, _configuration.doCheckOption( Configuration.width_branches ) );
2175 final JLabel label = new JLabel( "Display Data:" );
2176 label.setFont( ControlPanel.jcb_bold_font );
2177 if ( !getConfiguration().isUseNativeUI() ) {
2178 label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
2181 if ( _configuration.doDisplayOption( Configuration.show_node_names ) ) {
2182 addCheckbox( Configuration.show_node_names, _configuration.getDisplayTitle( Configuration.show_node_names ) );
2183 setCheckbox( Configuration.show_node_names, _configuration.doCheckOption( Configuration.show_node_names ) );
2185 if ( _configuration.doDisplayOption( Configuration.show_tax_code ) ) {
2186 addCheckbox( Configuration.show_tax_code, _configuration.getDisplayTitle( Configuration.show_tax_code ) );
2187 setCheckbox( Configuration.show_tax_code, _configuration.doCheckOption( Configuration.show_tax_code ) );
2189 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_scientific_names ) ) {
2190 addCheckbox( Configuration.show_taxonomy_scientific_names,
2191 _configuration.getDisplayTitle( Configuration.show_taxonomy_scientific_names ) );
2192 setCheckbox( Configuration.show_taxonomy_scientific_names,
2193 _configuration.doCheckOption( Configuration.show_taxonomy_scientific_names ) );
2195 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_common_names ) ) {
2196 addCheckbox( Configuration.show_taxonomy_common_names,
2197 _configuration.getDisplayTitle( Configuration.show_taxonomy_common_names ) );
2198 setCheckbox( Configuration.show_taxonomy_common_names,
2199 _configuration.doCheckOption( Configuration.show_taxonomy_common_names ) );
2201 if ( _configuration.doDisplayOption( Configuration.show_seq_names ) ) {
2202 addCheckbox( Configuration.show_seq_names, _configuration.getDisplayTitle( Configuration.show_seq_names ) );
2203 setCheckbox( Configuration.show_seq_names, _configuration.doCheckOption( Configuration.show_seq_names ) );
2205 if ( _configuration.doDisplayOption( Configuration.show_gene_names ) ) {
2206 addCheckbox( Configuration.show_gene_names, _configuration.getDisplayTitle( Configuration.show_gene_names ) );
2207 setCheckbox( Configuration.show_gene_names, _configuration.doCheckOption( Configuration.show_gene_names ) );
2209 if ( _configuration.doDisplayOption( Configuration.show_seq_symbols ) ) {
2210 addCheckbox( Configuration.show_seq_symbols,
2211 _configuration.getDisplayTitle( Configuration.show_seq_symbols ) );
2212 setCheckbox( Configuration.show_seq_symbols, _configuration.doCheckOption( Configuration.show_seq_symbols ) );
2214 if ( _configuration.doDisplayOption( Configuration.show_sequence_acc ) ) {
2215 addCheckbox( Configuration.show_sequence_acc,
2216 _configuration.getDisplayTitle( Configuration.show_sequence_acc ) );
2217 setCheckbox( Configuration.show_sequence_acc,
2218 _configuration.doCheckOption( Configuration.show_sequence_acc ) );
2220 if ( _configuration.doDisplayOption( Configuration.show_annotation ) ) {
2221 addCheckbox( Configuration.show_annotation, _configuration.getDisplayTitle( Configuration.show_annotation ) );
2222 setCheckbox( Configuration.show_annotation, _configuration.doCheckOption( Configuration.show_annotation ) );
2224 if ( _configuration.doDisplayOption( Configuration.write_confidence_values ) ) {
2225 addCheckbox( Configuration.write_confidence_values,
2226 _configuration.getDisplayTitle( Configuration.write_confidence_values ) );
2227 setCheckbox( Configuration.write_confidence_values,
2228 _configuration.doCheckOption( Configuration.write_confidence_values ) );
2230 if ( _configuration.doDisplayOption( Configuration.write_branch_length_values ) ) {
2231 addCheckbox( Configuration.write_branch_length_values,
2232 _configuration.getDisplayTitle( Configuration.write_branch_length_values ) );
2233 setCheckbox( Configuration.write_branch_length_values,
2234 _configuration.doCheckOption( Configuration.write_branch_length_values ) );
2236 if ( _configuration.doDisplayOption( Configuration.show_binary_characters ) ) {
2237 addCheckbox( Configuration.show_binary_characters,
2238 _configuration.getDisplayTitle( Configuration.show_binary_characters ) );
2239 setCheckbox( Configuration.show_binary_characters,
2240 _configuration.doCheckOption( Configuration.show_binary_characters ) );
2242 if ( _configuration.doDisplayOption( Configuration.show_binary_character_counts ) ) {
2243 addCheckbox( Configuration.show_binary_character_counts,
2244 _configuration.getDisplayTitle( Configuration.show_binary_character_counts ) );
2245 setCheckbox( Configuration.show_binary_character_counts,
2246 _configuration.doCheckOption( Configuration.show_binary_character_counts ) );
2248 if ( _configuration.doDisplayOption( Configuration.show_domain_architectures ) ) {
2249 addCheckbox( Configuration.show_domain_architectures,
2250 _configuration.getDisplayTitle( Configuration.show_domain_architectures ) );
2251 setCheckbox( Configuration.show_domain_architectures,
2252 _configuration.doCheckOption( Configuration.show_domain_architectures ) );
2254 if ( _configuration.doDisplayOption( Configuration.show_mol_seqs ) ) {
2255 addCheckbox( Configuration.show_mol_seqs, _configuration.getDisplayTitle( Configuration.show_mol_seqs ) );
2256 setCheckbox( Configuration.show_mol_seqs, _configuration.doCheckOption( Configuration.show_mol_seqs ) );
2258 if ( _configuration.doDisplayOption( Configuration.write_events ) ) {
2259 addCheckbox( Configuration.write_events, _configuration.getDisplayTitle( Configuration.write_events ) );
2260 setCheckbox( Configuration.write_events, _configuration.doCheckOption( Configuration.write_events ) );
2262 if ( _configuration.doDisplayOption( Configuration.show_vector_data ) ) {
2263 addCheckbox( Configuration.show_vector_data,
2264 _configuration.getDisplayTitle( Configuration.show_vector_data ) );
2265 setCheckbox( Configuration.show_vector_data, _configuration.doCheckOption( Configuration.show_vector_data ) );
2267 if ( _configuration.doDisplayOption( Configuration.show_properties ) ) {
2268 addCheckbox( Configuration.show_properties, _configuration.getDisplayTitle( Configuration.show_properties ) );
2269 setCheckbox( Configuration.show_properties, _configuration.doCheckOption( Configuration.show_properties ) );
2271 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_images ) ) {
2272 addCheckbox( Configuration.show_taxonomy_images,
2273 _configuration.getDisplayTitle( Configuration.show_taxonomy_images ) );
2274 setCheckbox( Configuration.show_taxonomy_images,
2275 _configuration.doCheckOption( Configuration.show_taxonomy_images ) );
2279 private void setVisibilityOfDomainStrucureControls() {
2280 if ( _zoom_in_domain_structure != null ) {
2281 final MainFrame mf = getMainFrame();
2283 if ( isShowDomainArchitectures() ) {
2284 _domain_display_label.setVisible( true );
2285 _zoom_in_domain_structure.setVisible( true );
2286 _zoom_out_domain_structure.setVisible( true );
2287 _decr_domain_structure_evalue_thr.setVisible( true );
2288 _incr_domain_structure_evalue_thr.setVisible( true );
2289 _domain_structure_evalue_thr_tf.setVisible( true );
2290 if ( mf._right_line_up_domains_cbmi != null ) {
2291 mf._right_line_up_domains_cbmi.setVisible( true );
2293 if ( mf._show_domain_labels != null ) {
2294 mf._show_domain_labels.setVisible( true );
2298 _domain_display_label.setVisible( false );
2299 _zoom_in_domain_structure.setVisible( false );
2300 _zoom_out_domain_structure.setVisible( false );
2301 _decr_domain_structure_evalue_thr.setVisible( false );
2302 _incr_domain_structure_evalue_thr.setVisible( false );
2303 _domain_structure_evalue_thr_tf.setVisible( false );
2304 if ( mf._right_line_up_domains_cbmi != null ) {
2305 mf._right_line_up_domains_cbmi.setVisible( false );
2307 if ( mf._show_domain_labels != null ) {
2308 mf._show_domain_labels.setVisible( false );
2315 // This takes care of ArchaeopteryxE-issue.
2316 // Can, and will, return null prior to ArchaeopteryxE initialization completion.
2317 final private MainFrame getMainFrame() {
2318 MainFrame mf = getMainPanel().getMainFrame();
2320 // Must be "E" applet version.
2321 final ArchaeopteryxE e = ( ArchaeopteryxE ) ( ( MainPanelApplets ) getMainPanel() ).getApplet();
2322 if ( e.getMainPanel() == null ) {
2325 mf = e.getMainPanel().getMainFrame();
2330 void setVisibilityOfX() {
2331 final MainFrame mf = getMainFrame();
2333 if ( ( getCurrentTreePanel() != null ) && ( getCurrentTreePanel().getPhylogeny() != null ) ) {
2334 if ( AptxUtil.isHasAtLeastOneBranchWithSupportSD( getCurrentTreePanel().getPhylogeny() ) ) {
2335 if ( mf._show_confidence_stddev_cbmi != null ) {
2336 mf._show_confidence_stddev_cbmi.setVisible( true );
2340 if ( mf._show_confidence_stddev_cbmi != null ) {
2341 mf._show_confidence_stddev_cbmi.setVisible( false );
2344 if ( AptxUtil.isHasAtLeastOneNodeWithScientificName( getCurrentTreePanel().getPhylogeny() ) ) {
2345 if ( mf._abbreviate_scientific_names != null ) {
2346 mf._abbreviate_scientific_names.setVisible( true );
2350 if ( mf._abbreviate_scientific_names != null ) {
2351 mf._abbreviate_scientific_names.setVisible( false );
2354 if ( AptxUtil.isHasAtLeastOneNodeWithSequenceAnnotation( getCurrentTreePanel().getPhylogeny() ) ) {
2355 if ( mf._show_annotation_ref_source != null ) {
2356 mf._show_annotation_ref_source.setVisible( true );
2360 if ( mf._show_annotation_ref_source != null ) {
2361 mf._show_annotation_ref_source.setVisible( false );
2365 if ( isDrawPhylogram()
2366 || ( ( getCurrentTreePanel() != null ) && ( ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) || ( getCurrentTreePanel()
2367 .getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) ) ) {
2368 if ( mf._non_lined_up_cladograms_rbmi != null ) {
2369 mf._non_lined_up_cladograms_rbmi.setVisible( false );
2371 if ( mf._uniform_cladograms_rbmi != null ) {
2372 mf._uniform_cladograms_rbmi.setVisible( false );
2374 if ( mf._ext_node_dependent_cladogram_rbmi != null ) {
2375 mf._ext_node_dependent_cladogram_rbmi.setVisible( false );
2379 if ( mf._non_lined_up_cladograms_rbmi != null ) {
2380 mf._non_lined_up_cladograms_rbmi.setVisible( true );
2382 if ( mf._uniform_cladograms_rbmi != null ) {
2383 mf._uniform_cladograms_rbmi.setVisible( true );
2385 if ( mf._ext_node_dependent_cladogram_rbmi != null ) {
2386 mf._ext_node_dependent_cladogram_rbmi.setVisible( true );
2389 if ( isDrawPhylogram() ) {
2390 if ( mf._show_scale_cbmi != null ) {
2391 mf._show_scale_cbmi.setVisible( true );
2395 if ( mf._show_scale_cbmi != null ) {
2396 mf._show_scale_cbmi.setVisible( false );
2399 if ( getCurrentTreePanel() != null ) {
2400 if ( ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
2401 || ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) {
2402 if ( mf._label_direction_cbmi != null ) {
2403 mf._label_direction_cbmi.setVisible( true );
2407 if ( mf._label_direction_cbmi != null ) {
2408 mf._label_direction_cbmi.setVisible( false );
2415 void setVisibilityOfDomainStrucureCB() {
2417 if ( ( getCurrentTreePanel() != null )
2418 && ( ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) || ( getCurrentTreePanel()
2419 .getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) ) {
2420 if ( getMainPanel().getMainFrame()._right_line_up_domains_cbmi != null ) {
2421 getMainPanel().getMainFrame()._right_line_up_domains_cbmi.setVisible( false );
2423 if ( getMainPanel().getMainFrame()._show_domain_labels != null ) {
2424 getMainPanel().getMainFrame()._show_domain_labels.setVisible( false );
2427 else if ( isShowDomainArchitectures() ) {
2428 if ( getMainPanel().getMainFrame()._right_line_up_domains_cbmi != null ) {
2429 getMainPanel().getMainFrame()._right_line_up_domains_cbmi.setVisible( true );
2431 if ( getMainPanel().getMainFrame()._show_domain_labels != null ) {
2432 getMainPanel().getMainFrame()._show_domain_labels.setVisible( true );
2436 if ( getMainPanel().getMainFrame()._right_line_up_domains_cbmi != null ) {
2437 getMainPanel().getMainFrame()._right_line_up_domains_cbmi.setVisible( false );
2439 if ( getMainPanel().getMainFrame()._show_domain_labels != null ) {
2440 getMainPanel().getMainFrame()._show_domain_labels.setVisible( false );
2444 catch ( final Exception ignore ) {
2449 static JLabel customizeLabel( final JLabel label, final Configuration configuration ) {
2450 label.setFont( ControlPanel.jcb_bold_font );
2451 if ( !configuration.isUseNativeUI() ) {
2452 label.setForeground( configuration.getGuiCheckboxTextColor() );
2453 label.setBackground( configuration.getGuiBackgroundColor() );
2458 enum NodeClickAction {
2465 DELETE_NODE_OR_SUBTREE,