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;
48 import javax.swing.BorderFactory;
49 import javax.swing.DefaultListCellRenderer;
50 import javax.swing.JButton;
51 import javax.swing.JCheckBox;
52 import javax.swing.JComboBox;
53 import javax.swing.JLabel;
54 import javax.swing.JList;
55 import javax.swing.JPanel;
56 import javax.swing.JScrollBar;
57 import javax.swing.JTextField;
58 import javax.swing.ListCellRenderer;
60 import org.forester.archaeopteryx.Options.CLADOGRAM_TYPE;
61 import org.forester.archaeopteryx.Options.PHYLOGENY_GRAPHICS_TYPE;
62 import org.forester.phylogeny.Phylogeny;
63 import org.forester.phylogeny.PhylogenyMethods;
64 import org.forester.phylogeny.PhylogenyMethods.DESCENDANT_SORT_PRIORITY;
65 import org.forester.phylogeny.PhylogenyNode;
66 import org.forester.phylogeny.data.Sequence;
67 import org.forester.phylogeny.data.SequenceRelation;
68 import org.forester.phylogeny.data.SequenceRelation.SEQUENCE_RELATION_TYPE;
69 import org.forester.phylogeny.iterators.PhylogenyNodeIterator;
70 import org.forester.util.ForesterUtil;
72 final class ControlPanel extends JPanel implements ActionListener {
74 final static Font jcb_bold_font = new Font( Configuration.getDefaultFontFamilyName(),
77 final static Font jcb_font = new Font( Configuration.getDefaultFontFamilyName(),
80 final static Font js_font = new Font( Configuration.getDefaultFontFamilyName(),
83 private static final String RETURN_TO_SUPER_TREE_TEXT = "Back to Super Tree";
84 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).";
85 private static final long serialVersionUID = -8463483932821545633L;
86 private NodeClickAction _action_when_node_clicked;
87 private int _add_new_node_item;
88 private Map<Integer, String> _all_click_to_names;
89 private Map<String, Color> _annotation_colors;
90 private int _blast_item;
91 private JComboBox<String> _click_to_combobox;
92 private JLabel _click_to_label;
93 private List<String> _click_to_names;
94 private int _collapse_cb_item;
95 private JCheckBox _color_acc_species;
96 private JCheckBox _color_acc_sequence;
97 private JCheckBox _color_according_to_annotation;
98 private boolean _color_branches;
99 private JCheckBox _use_visual_styles_cb;
100 private int _color_subtree_cb_item;
101 private int _change_node_font_item;
102 // The settings from the conf file
103 private final Configuration _configuration;
104 private int _copy_subtree_item;
105 private int _cut_subtree_item;
106 private JButton _decr_domain_structure_evalue_thr;
107 private int _delete_node_or_subtree_item;
108 private JCheckBox _display_as_phylogram_cb;
110 private JCheckBox _display_internal_data;
111 private JLabel _domain_display_label;
112 private JTextField _domain_structure_evalue_thr_tf;
113 private List<Boolean> _draw_phylogram;
114 private JCheckBox _dynamically_hide_data;
115 private int _edit_node_data_item;
116 private int _get_ext_desc_data;
117 private JButton _incr_domain_structure_evalue_thr;
118 private final MainPanel _mainpanel;
119 private JCheckBox _node_desc_popup_cb;
120 private int _open_pdb_item;
121 private int _open_seq_web_item;
122 private int _open_tax_web_item;
123 private int _color_node_font_item;
124 private JButton _order;
125 private boolean _order_of_appearance;
126 private int _paste_subtree_item;
127 private int _reroot_cb_item;
128 private JButton _return_to_super_tree;
130 private JLabel _search_found_label_0;
131 private JLabel _search_found_label_1;
132 private JButton _search_reset_button_0;
133 private JButton _search_reset_button_1;
134 private JTextField _search_tf_0;
135 private JTextField _search_tf_1;
136 private int _select_nodes_item;
137 private Sequence _selected_query_seq;
138 private JCheckBox _seq_relation_confidence_switch;
139 private JComboBox<SEQUENCE_RELATION_TYPE> _sequence_relation_type_box;
140 private JCheckBox _show_annotation;
141 private JCheckBox _show_binary_character_counts;
142 private JCheckBox _show_binary_characters;
143 // Indices for the click-to options in the combo box
144 private int _show_data_item;
145 private JCheckBox _show_domain_architectures;
146 private JCheckBox _show_mol_seqs;
147 private JCheckBox _write_branch_length_values;
148 private JCheckBox _show_events;
149 private JCheckBox _show_gene_names;
150 private JCheckBox _show_node_names;
151 private JCheckBox _show_properties_cb;
152 private JCheckBox _show_seq_names;
153 private JCheckBox _show_seq_symbols;
154 private JCheckBox _show_sequence_acc;
155 private JComboBox<String> _show_sequence_relations;
156 private JCheckBox _show_taxo_code;
157 private JCheckBox _show_taxo_common_names;
158 private JCheckBox _show_taxo_images_cb;
159 private JCheckBox _show_taxo_scientific_names;
160 private JCheckBox _show_vector_data_cb;
161 private JButton _show_whole;
162 private int _sort_descendents_item;
163 private Map<String, Color> _species_colors;
164 private Map<String, Color> _sequence_colors;
165 private int _subtree_cb_item;
166 private int _swap_cb_item;
167 private JButton _uncollapse_all;
168 private JCheckBox _width_branches;
169 private JCheckBox _write_confidence;
170 private JButton _zoom_in_domain_structure;
171 private JButton _zoom_in_x;
172 private JButton _zoom_in_y;
173 private JLabel _zoom_label;
174 private JButton _zoom_out_domain_structure;
175 private JButton _zoom_out_x;
176 private JButton _zoom_out_y;
178 ControlPanel( final MainPanel ap, final Configuration configuration ) {
181 _configuration = configuration;
182 if ( !_configuration.isUseNativeUI() ) {
183 setBackground( getConfiguration().getGuiBackgroundColor() );
184 setBorder( BorderFactory.createRaisedBevelBorder() );
186 setLayout( new GridLayout( 0, 1, 2, 2 ) );
187 _order_of_appearance = true;
195 public void actionPerformed( final ActionEvent e ) {
197 if ( e.getSource() == _color_acc_sequence ) {
198 if ( _color_acc_species != null ) {
199 _color_acc_species.setSelected( false );
202 else if ( e.getSource() == _color_acc_species ) {
203 if ( _color_acc_sequence != null ) {
204 _color_acc_sequence.setSelected( false );
207 final TreePanel tp = getMainPanel().getCurrentTreePanel();
211 if ( e.getSource() == _click_to_combobox ) {
212 setClickToAction( _click_to_combobox.getSelectedIndex() );
213 getCurrentTreePanel().repaint();
215 else if ( e.getSource() == _show_binary_characters ) {
216 if ( ( _show_binary_character_counts != null ) && _show_binary_characters.isSelected() ) {
217 _show_binary_character_counts.setSelected( false );
219 displayedPhylogenyMightHaveChanged( true );
221 else if ( e.getSource() == _show_binary_character_counts ) {
222 if ( ( _show_binary_characters != null ) && _show_binary_character_counts.isSelected() ) {
223 _show_binary_characters.setSelected( false );
225 displayedPhylogenyMightHaveChanged( true );
227 else if ( e.getSource() == _show_domain_architectures ) {
230 displayedPhylogenyMightHaveChanged( true );
232 else if ( ( tp != null ) && ( tp.getPhylogeny() != null ) ) {
233 if ( e.getSource() == getDisplayAsPhylogramCb() ) {
234 setDrawPhylogram( getDisplayAsPhylogramCb().isSelected() );
238 else if ( e.getSource() == _zoom_in_x ) {
239 zoomInX( Constants.BUTTON_ZOOM_IN_FACTOR, Constants.BUTTON_ZOOM_IN_X_CORRECTION_FACTOR );
240 displayedPhylogenyMightHaveChanged( false );
242 else if ( e.getSource() == _zoom_in_y ) {
243 zoomInY( Constants.BUTTON_ZOOM_IN_FACTOR );
244 displayedPhylogenyMightHaveChanged( false );
246 else if ( e.getSource() == _zoom_out_x ) {
247 zoomOutX( Constants.BUTTON_ZOOM_OUT_FACTOR, Constants.BUTTON_ZOOM_OUT_X_CORRECTION_FACTOR );
248 displayedPhylogenyMightHaveChanged( false );
250 else if ( e.getSource() == _zoom_out_y ) {
251 zoomOutY( Constants.BUTTON_ZOOM_OUT_FACTOR );
252 displayedPhylogenyMightHaveChanged( false );
254 else if ( e.getSource() == _show_whole ) {
255 displayedPhylogenyMightHaveChanged( true );
258 else if ( e.getSource() == _return_to_super_tree ) {
259 _mainpanel.getCurrentTreePanel().superTree();
262 else if ( e.getSource() == _order ) {
263 DESCENDANT_SORT_PRIORITY pri = DESCENDANT_SORT_PRIORITY.NODE_NAME;
264 if ( isShowTaxonomyScientificNames() || isShowTaxonomyCode() ) {
265 pri = DESCENDANT_SORT_PRIORITY.TAXONOMY;
267 else if ( isShowSeqNames() || isShowSeqSymbols() || isShowGeneNames() ) {
268 pri = DESCENDANT_SORT_PRIORITY.SEQUENCE;
270 PhylogenyMethods.orderAppearance( tp.getPhylogeny().getRoot(), _order_of_appearance, true, pri );
271 _order_of_appearance = !_order_of_appearance;
272 tp.setNodeInPreorderToNull();
273 tp.getPhylogeny().externalNodesHaveChanged();
274 tp.getPhylogeny().clearHashIdToNodeMap();
275 tp.getPhylogeny().recalculateNumberOfExternalDescendants( true );
276 tp.resetNodeIdToDistToLeafMap();
277 tp.setEdited( true );
278 displayedPhylogenyMightHaveChanged( true );
280 else if ( e.getSource() == _uncollapse_all ) {
282 displayedPhylogenyMightHaveChanged( false );
284 else if ( e.getSource() == _zoom_in_domain_structure ) {
285 _mainpanel.getCurrentTreePanel().zoomInDomainStructure();
286 displayedPhylogenyMightHaveChanged( true );
288 else if ( e.getSource() == _zoom_out_domain_structure ) {
289 _mainpanel.getCurrentTreePanel().zoomOutDomainStructure();
290 displayedPhylogenyMightHaveChanged( true );
292 else if ( e.getSource() == _decr_domain_structure_evalue_thr ) {
293 _mainpanel.getCurrentTreePanel().decreaseDomainStructureEvalueThreshold();
294 displayedPhylogenyMightHaveChanged( true );
296 else if ( e.getSource() == _incr_domain_structure_evalue_thr ) {
297 _mainpanel.getCurrentTreePanel().increaseDomainStructureEvalueThreshold();
298 displayedPhylogenyMightHaveChanged( true );
300 else if ( e.getSource() == _search_tf_0 ) {
302 displayedPhylogenyMightHaveChanged( true );
304 else if ( e.getSource() == _search_tf_1 ) {
306 displayedPhylogenyMightHaveChanged( true );
308 else if ( ( _dynamically_hide_data != null ) && ( e.getSource() == _dynamically_hide_data )
309 && !_dynamically_hide_data.isSelected() ) {
310 setDynamicHidingIsOn( false );
311 displayedPhylogenyMightHaveChanged( true );
314 displayedPhylogenyMightHaveChanged( true );
318 tp.requestFocusInWindow();
321 catch ( final Exception ex ) {
322 AptxUtil.unexpectedException( ex );
324 catch ( final Error err ) {
325 AptxUtil.unexpectedError( err );
329 public JCheckBox getColorAccSpeciesCb() {
330 return _color_acc_species;
333 public JCheckBox getColorAccSequenceCb() {
334 return _color_acc_sequence;
337 public JCheckBox getUseVisualStylesCb() {
338 return _use_visual_styles_cb;
341 public JCheckBox getDisplayAsPhylogramCb() {
342 return _display_as_phylogram_cb;
345 public JCheckBox getDynamicallyHideData() {
346 return _dynamically_hide_data;
349 public JCheckBox getNodeDescPopupCb() {
350 return _node_desc_popup_cb;
353 public Sequence getSelectedQuerySequence() {
354 return _selected_query_seq;
357 public JComboBox<String> getSequenceRelationBox() {
358 if ( _show_sequence_relations == null ) {
359 _show_sequence_relations = new JComboBox<String>();
360 _show_sequence_relations.setFocusable( false );
361 _show_sequence_relations.setMaximumRowCount( 20 );
362 _show_sequence_relations.setFont( ControlPanel.js_font );
363 if ( !_configuration.isUseNativeUI() ) {
364 _show_sequence_relations.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
365 _show_sequence_relations.setForeground( getConfiguration().getGuiButtonTextColor() );
367 _show_sequence_relations.addItem( "-----" );
368 _show_sequence_relations.setToolTipText( "To display orthology information for selected query" );
370 return _show_sequence_relations;
374 public JComboBox<SEQUENCE_RELATION_TYPE> getSequenceRelationTypeBox() {
375 if ( _sequence_relation_type_box == null ) {
376 _sequence_relation_type_box = new JComboBox<SEQUENCE_RELATION_TYPE>();
377 for( final SequenceRelation.SEQUENCE_RELATION_TYPE type : SequenceRelation.SEQUENCE_RELATION_TYPE.values() ) {
378 _sequence_relation_type_box.addItem( type );
380 _sequence_relation_type_box.addActionListener( new ActionListener() {
383 public void actionPerformed( final ActionEvent e ) {
384 if ( _mainpanel.getCurrentPhylogeny() != null ) {
385 setSequenceRelationQueries( getMainPanel().getCurrentPhylogeny().getSequenceRelationQueries() );
390 return _sequence_relation_type_box;
393 public JCheckBox getShowEventsCb() {
397 public JCheckBox getWriteConfidenceCb() {
398 return _write_confidence;
401 public boolean isShowProperties() {
402 return ( ( _show_properties_cb != null ) && _show_properties_cb.isSelected() );
405 public boolean isShowTaxonomyImages() {
406 return ( ( _show_taxo_images_cb != null ) && _show_taxo_images_cb.isSelected() );
409 public boolean isShowVectorData() {
410 return ( ( _show_vector_data_cb != null ) && _show_vector_data_cb.isSelected() );
413 public void setSequenceRelationQueries( final Collection<Sequence> sequenceRelationQueries ) {
414 final JComboBox<String> box = getSequenceRelationBox();
415 while ( box.getItemCount() > 1 ) {
416 box.removeItemAt( 1 );
418 final HashMap<String, Sequence> sequencesByName = new HashMap<String, Sequence>();
419 final SequenceRelation.SEQUENCE_RELATION_TYPE relationType = ( SequenceRelation.SEQUENCE_RELATION_TYPE ) _sequence_relation_type_box
421 if ( relationType == null ) {
424 final ArrayList<String> sequenceNamesToAdd = new ArrayList<String>();
425 for( final Sequence seq : sequenceRelationQueries ) {
426 if ( seq.hasSequenceRelations() ) {
427 boolean fFoundForCurrentType = false;
428 for( final SequenceRelation sq : seq.getSequenceRelations() ) {
429 if ( sq.getType().equals( relationType ) ) {
430 fFoundForCurrentType = true;
434 if ( fFoundForCurrentType ) {
435 sequenceNamesToAdd.add( seq.getName() );
436 sequencesByName.put( seq.getName(), seq );
440 // sort sequences by name before adding them to the combo
441 final String[] sequenceNameArray = sequenceNamesToAdd.toArray( new String[ sequenceNamesToAdd.size() ] );
442 Arrays.sort( sequenceNameArray, String.CASE_INSENSITIVE_ORDER );
443 for( final String seqName : sequenceNameArray ) {
444 box.addItem( seqName );
446 for( final ItemListener oldItemListener : box.getItemListeners() ) {
447 box.removeItemListener( oldItemListener );
449 box.addItemListener( new ItemListener() {
452 public void itemStateChanged( final ItemEvent e ) {
453 _selected_query_seq = sequencesByName.get( e.getItem() );
454 _mainpanel.getCurrentTreePanel().repaint();
459 void activateButtonToReturnToSuperTree( int index ) {
462 _return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT + " " + index );
465 _return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT );
467 _return_to_super_tree.setForeground( getConfiguration().getGuiCheckboxAndButtonActiveColor() );
468 _return_to_super_tree.setEnabled( true );
472 * Add zoom and quick edit buttons. (Last modified 8/9/04)
475 final JLabel spacer = new JLabel( "" );
476 spacer.setOpaque( false );
478 final JPanel x_panel = new JPanel( new GridLayout( 1, 1, 0, 0 ) );
479 final JPanel y_panel = new JPanel( new GridLayout( 1, 3, 0, 0 ) );
480 final JPanel z_panel = new JPanel( new GridLayout( 1, 1, 0, 0 ) );
481 if ( !getConfiguration().isUseNativeUI() ) {
482 x_panel.setBackground( getBackground() );
483 y_panel.setBackground( getBackground() );
484 z_panel.setBackground( getBackground() );
486 add( _zoom_label = new JLabel( "Zoom:" ) );
487 customizeLabel( _zoom_label, getConfiguration() );
491 if ( getConfiguration().isUseNativeUI() ) {
492 _zoom_in_x = new JButton( "+" );
493 _zoom_out_x = new JButton( "-" );
496 _zoom_in_x = new JButton( "X+" );
497 _zoom_out_x = new JButton( "X-" );
499 _zoom_in_y = new JButton( "Y+" );
500 _zoom_out_y = new JButton( "Y-" );
501 _show_whole = new JButton( "F" );
502 _show_whole.setToolTipText( "To fit the complete phylogeny to the current display size [F or Home]" );
503 _zoom_in_x.setToolTipText( "To zoom in horizontally [Shift+cursor-right]" );
504 _zoom_in_y.setToolTipText( "To zoom in vertically [Shift+cursor-up]" );
505 _zoom_out_x.setToolTipText( "To zoom out horizontally [Shift+cursor-left]" );
506 _zoom_out_y.setToolTipText( "To zoom out vertically [Shift+cursor-down]" );
507 if ( getConfiguration().isUseNativeUI() && ForesterUtil.isMac() ) {
508 _zoom_out_x.setPreferredSize( new Dimension( 55, 10 ) );
509 _zoom_in_x.setPreferredSize( new Dimension( 55, 10 ) );
512 _zoom_out_x.setPreferredSize( new Dimension( 10, 10 ) );
513 _zoom_in_x.setPreferredSize( new Dimension( 10, 10 ) );
515 _zoom_out_y.setPreferredSize( new Dimension( 10, 10 ) );
516 _zoom_in_y.setPreferredSize( new Dimension( 10, 10 ) );
517 _show_whole.setPreferredSize( new Dimension( 10, 10 ) );
518 _return_to_super_tree = new JButton( RETURN_TO_SUPER_TREE_TEXT );
519 _return_to_super_tree.setEnabled( false );
520 _order = new JButton( "Order Subtrees" );
521 _uncollapse_all = new JButton( "Uncollapse All" );
522 addJButton( _zoom_in_y, x_panel );
523 addJButton( _zoom_out_x, y_panel );
524 addJButton( _show_whole, y_panel );
525 addJButton( _zoom_in_x, y_panel );
526 addJButton( _zoom_out_y, z_panel );
527 if ( getConfiguration().doDisplayOption( Configuration.show_domain_architectures ) ) {
528 setUpControlsForDomainStrucures();
530 final JLabel spacer2 = new JLabel( "" );
532 addJButton( _return_to_super_tree, this );
533 addJButton( _order, this );
534 addJButton( _uncollapse_all, this );
535 final JLabel spacer3 = new JLabel( "" );
537 setVisibilityOfDomainStrucureControls();
540 void addCheckbox( final int which, final String title ) {
541 final JPanel ch_panel = new JPanel( new BorderLayout( 0, 0 ) );
543 case Configuration.display_as_phylogram:
544 _display_as_phylogram_cb = new JCheckBox( title );
545 getDisplayAsPhylogramCb().setToolTipText( "To switch between phylogram and cladogram display" );
546 addJCheckBox( getDisplayAsPhylogramCb(), ch_panel );
549 case Configuration.display_internal_data:
550 _display_internal_data = new JCheckBox( title );
551 _display_internal_data.setToolTipText( "To allow or disallow display of internal labels" );
552 addJCheckBox( _display_internal_data, ch_panel );
555 case Configuration.color_according_to_species:
556 _color_acc_species = new JCheckBox( title );
557 _color_acc_species.setToolTipText( "To colorize node labels as a function of taxonomy" );
558 addJCheckBox( _color_acc_species, ch_panel );
561 case Configuration.color_according_to_sequence:
562 _color_acc_sequence = new JCheckBox( title );
563 _color_acc_sequence.setToolTipText( "To colorize node labels as a function of sequence name" );
564 addJCheckBox( _color_acc_sequence, ch_panel );
567 case Configuration.color_according_to_annotation:
568 _color_according_to_annotation = new JCheckBox( title );
569 _color_according_to_annotation
570 .setToolTipText( "To colorize sequence annotation labels as a function of sequence annotation" );
571 addJCheckBox( _color_according_to_annotation, ch_panel );
574 case Configuration.show_node_names:
575 _show_node_names = new JCheckBox( title );
576 addJCheckBox( _show_node_names, ch_panel );
579 case Configuration.show_taxonomy_scientific_names:
580 _show_taxo_scientific_names = new JCheckBox( title );
581 addJCheckBox( _show_taxo_scientific_names, ch_panel );
584 case Configuration.show_taxonomy_common_names:
585 _show_taxo_common_names = new JCheckBox( title );
586 addJCheckBox( _show_taxo_common_names, ch_panel );
589 case Configuration.show_tax_code:
590 _show_taxo_code = new JCheckBox( title );
591 addJCheckBox( _show_taxo_code, ch_panel );
594 case Configuration.show_taxonomy_images:
595 _show_taxo_images_cb = new JCheckBox( title );
596 addJCheckBox( _show_taxo_images_cb, ch_panel );
599 case Configuration.show_binary_characters:
600 _show_binary_characters = new JCheckBox( title );
601 addJCheckBox( _show_binary_characters, ch_panel );
604 case Configuration.show_annotation:
605 _show_annotation = new JCheckBox( title );
606 addJCheckBox( _show_annotation, ch_panel );
609 case Configuration.show_binary_character_counts:
610 _show_binary_character_counts = new JCheckBox( title );
611 addJCheckBox( _show_binary_character_counts, ch_panel );
614 case Configuration.write_confidence_values:
615 _write_confidence = new JCheckBox( title );
616 addJCheckBox( getWriteConfidenceCb(), ch_panel );
619 case Configuration.write_events:
620 _show_events = new JCheckBox( title );
621 addJCheckBox( getShowEventsCb(), ch_panel );
624 case Configuration.use_style:
625 _use_visual_styles_cb = new JCheckBox( title );
626 getUseVisualStylesCb()
627 .setToolTipText( "To use visual styles (node colors, fonts) and branch colors, if present" );
628 addJCheckBox( getUseVisualStylesCb(), ch_panel );
631 case Configuration.width_branches:
632 _width_branches = new JCheckBox( title );
633 _width_branches.setToolTipText( "To use branch width values, if present" );
634 addJCheckBox( _width_branches, ch_panel );
637 case Configuration.write_branch_length_values:
638 _write_branch_length_values = new JCheckBox( title );
639 addJCheckBox( _write_branch_length_values, ch_panel );
642 case Configuration.show_domain_architectures:
643 _show_domain_architectures = new JCheckBox( title );
644 addJCheckBox( _show_domain_architectures, ch_panel );
647 case Configuration.show_mol_seqs:
648 _show_mol_seqs = new JCheckBox( title );
649 addJCheckBox( _show_mol_seqs, ch_panel );
652 case Configuration.show_seq_names:
653 _show_seq_names = new JCheckBox( title );
654 addJCheckBox( _show_seq_names, ch_panel );
657 case Configuration.show_gene_names:
658 _show_gene_names = new JCheckBox( title );
659 addJCheckBox( _show_gene_names, ch_panel );
662 case Configuration.show_seq_symbols:
663 _show_seq_symbols = new JCheckBox( title );
664 addJCheckBox( _show_seq_symbols, ch_panel );
667 case Configuration.show_sequence_acc:
668 _show_sequence_acc = new JCheckBox( title );
669 addJCheckBox( _show_sequence_acc, ch_panel );
672 case Configuration.dynamically_hide_data:
673 _dynamically_hide_data = new JCheckBox( title );
674 getDynamicallyHideData().setToolTipText( "To hide labels depending on expected visibility" );
675 addJCheckBox( getDynamicallyHideData(), ch_panel );
678 case Configuration.node_data_popup:
679 _node_desc_popup_cb = new JCheckBox( title );
680 getNodeDescPopupCb().setToolTipText( "To enable mouse rollover display of basic node data" );
681 addJCheckBox( getNodeDescPopupCb(), ch_panel );
684 case Configuration.show_relation_confidence:
685 _seq_relation_confidence_switch = new JCheckBox( title );
686 addJCheckBox( _seq_relation_confidence_switch, ch_panel );
689 case Configuration.show_vector_data:
690 _show_vector_data_cb = new JCheckBox( title );
691 addJCheckBox( _show_vector_data_cb, ch_panel );
694 case Configuration.show_properties:
695 _show_properties_cb = new JCheckBox( title );
696 addJCheckBox( _show_properties_cb, ch_panel );
700 throw new RuntimeException( "unknown checkbox: " + which );
704 void addJButton( final JButton jb, final JPanel p ) {
705 jb.setFocusPainted( false );
706 jb.setFont( ControlPanel.jcb_font );
707 if ( !_configuration.isUseNativeUI() ) {
708 jb.setBorder( BorderFactory.createLineBorder( getConfiguration().getGuiButtonBorderColor() ) );
709 jb.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
710 jb.setForeground( getConfiguration().getGuiButtonTextColor() );
713 jb.addActionListener( this );
716 void addJCheckBox( final JCheckBox jcb, final JPanel p ) {
717 jcb.setFocusPainted( false );
718 jcb.setFont( ControlPanel.jcb_font );
719 if ( !_configuration.isUseNativeUI() ) {
720 jcb.setBackground( getConfiguration().getGuiBackgroundColor() );
721 jcb.setForeground( getConfiguration().getGuiCheckboxTextColor() );
723 p.add( jcb, "Center" );
724 jcb.addActionListener( this );
727 void addJTextField( final JTextField tf, final JPanel p ) {
728 if ( !_configuration.isUseNativeUI() ) {
729 tf.setForeground( getConfiguration().getGuiBackgroundColor() );
730 tf.setFont( ControlPanel.jcb_font );
733 tf.addActionListener( this );
736 void deactivateButtonToReturnToSuperTree() {
737 _return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT );
738 _return_to_super_tree.setForeground( getConfiguration().getGuiButtonTextColor() );
739 _return_to_super_tree.setEnabled( false );
742 void displayedPhylogenyMightHaveChanged( final boolean recalc_longest_ext_node_info ) {
743 if ( ( _mainpanel != null )
744 && ( ( _mainpanel.getCurrentPhylogeny() != null ) && !_mainpanel.getCurrentPhylogeny().isEmpty() ) ) {
745 if ( getOptions().isShowOverview() ) {
746 _mainpanel.getCurrentTreePanel().updateOvSizes();
748 _mainpanel.getCurrentTreePanel().recalculateMaxDistanceToRoot();
749 setVisibilityOfDomainStrucureControls();
750 updateDomainStructureEvaluethresholdDisplay();
751 _mainpanel.getCurrentTreePanel().calculateScaleDistance();
752 _mainpanel.getCurrentTreePanel().calcMaxDepth();
753 _mainpanel.adjustJScrollPane();
754 if ( recalc_longest_ext_node_info ) {
755 _mainpanel.getCurrentTreePanel().initNodeData();
756 _mainpanel.getCurrentTreePanel().calculateLongestExtNodeInfo();
758 _mainpanel.getCurrentTreePanel().repaint();
759 // _mainpanel.getCurrentTreePanel().setUpUrtFactors();
763 void endClickToOptions() {
764 _click_to_combobox.addActionListener( this );
768 * Indicates what action should be execute when a node is clicked
770 * @return the click-on action
772 NodeClickAction getActionWhenNodeClicked() {
773 return _action_when_node_clicked;
776 Map<Integer, String> getAllClickToItems() {
777 return _all_click_to_names;
780 Map<String, Color> getAnnotationColors() {
781 return _annotation_colors;
784 Configuration getConfiguration() {
785 return _configuration;
788 TreePanel getCurrentTreePanel() {
789 return getMainPanel().getCurrentTreePanel();
792 MainPanel getMainPanel() {
796 Options getOptions() {
797 return getMainPanel().getOptions();
800 JLabel getSearchFoundCountsLabel0() {
801 return _search_found_label_0;
804 JLabel getSearchFoundCountsLabel1() {
805 return _search_found_label_1;
808 JButton getSearchResetButton0() {
809 return _search_reset_button_0;
812 JButton getSearchResetButton1() {
813 return _search_reset_button_1;
816 JTextField getSearchTextField0() {
820 JTextField getSearchTextField1() {
824 List<String> getSingleClickToNames() {
825 return _click_to_names;
828 Map<String, Color> getSpeciesColors() {
829 return _species_colors;
832 Map<String, Color> getSequenceColors() {
833 return _sequence_colors;
836 boolean isAntialiasScreenText() {
840 boolean isColorAccordingToAnnotation() {
841 return ( ( _color_according_to_annotation != null ) && _color_according_to_annotation.isSelected() );
844 boolean isColorAccordingToTaxonomy() {
845 return ( ( _color_acc_species != null ) && _color_acc_species.isSelected() );
848 boolean isColorAccordingToSequence() {
849 return ( ( _color_acc_sequence != null ) && _color_acc_sequence.isSelected() );
852 boolean isUseVisualStyles() {
853 return ( ( ( getUseVisualStylesCb() != null ) && getUseVisualStylesCb().isSelected() ) || ( ( getUseVisualStylesCb() == null ) && _color_branches ) );
856 boolean isDrawPhylogram() {
857 return isDrawPhylogram( getMainPanel().getCurrentTabIndex() );
860 boolean isDynamicallyHideData() {
861 return ( ( getDynamicallyHideData() != null ) && getDynamicallyHideData().isSelected() );
865 return ( ( getShowEventsCb() != null ) && getShowEventsCb().isSelected() );
868 boolean isNodeDescPopup() {
869 return ( ( getNodeDescPopupCb() != null ) && getNodeDescPopupCb().isSelected() );
872 boolean isShowAnnotation() {
873 return ( ( _show_annotation != null ) && _show_annotation.isSelected() );
876 boolean isShowBinaryCharacterCounts() {
877 return ( ( _show_binary_character_counts != null ) && _show_binary_character_counts.isSelected() );
880 boolean isShowBinaryCharacters() {
881 return ( ( _show_binary_characters != null ) && _show_binary_characters.isSelected() );
884 boolean isShowConfidenceValues() {
885 return ( ( getWriteConfidenceCb() != null ) && getWriteConfidenceCb().isSelected() );
888 boolean isWriteBranchLengthValues() {
889 return ( ( _write_branch_length_values != null ) && _write_branch_length_values.isSelected() );
892 boolean isShowDomainArchitectures() {
893 return ( ( _show_domain_architectures != null ) && _show_domain_architectures.isSelected() );
896 public boolean isShowMolSequences() {
897 return ( ( _show_mol_seqs != null ) && _show_mol_seqs.isSelected() );
900 boolean isShowGeneNames() {
901 return ( ( _show_gene_names != null ) && _show_gene_names.isSelected() );
904 boolean isShowInternalData() {
905 return ( ( _display_internal_data == null ) || _display_internal_data.isSelected() );
908 boolean isShowNodeNames() {
909 return ( ( _show_node_names != null ) && _show_node_names.isSelected() );
912 boolean isShowSeqNames() {
913 return ( ( _show_seq_names != null ) && _show_seq_names.isSelected() );
916 boolean isShowSeqSymbols() {
917 return ( ( _show_seq_symbols != null ) && _show_seq_symbols.isSelected() );
920 boolean isShowSequenceAcc() {
921 return ( ( _show_sequence_acc != null ) && _show_sequence_acc.isSelected() );
924 boolean isShowSequenceRelationConfidence() {
925 return ( ( _seq_relation_confidence_switch != null ) && ( _seq_relation_confidence_switch.isSelected() ) );
928 boolean isShowSequenceRelations() {
929 return ( ( _show_sequence_relations != null ) && ( _show_sequence_relations.getSelectedIndex() > 0 ) );
932 boolean isShowTaxonomyCode() {
933 return ( ( _show_taxo_code != null ) && _show_taxo_code.isSelected() );
936 boolean isShowTaxonomyCommonNames() {
937 return ( ( _show_taxo_common_names != null ) && _show_taxo_common_names.isSelected() );
940 boolean isShowTaxonomyScientificNames() {
941 return ( ( _show_taxo_scientific_names != null ) && _show_taxo_scientific_names.isSelected() );
944 boolean isWidthBranches() {
945 return ( ( _width_branches != null ) && _width_branches.isSelected() );
948 void phylogenyAdded( final Configuration configuration ) {
949 getIsDrawPhylogramList().add( configuration.isDrawAsPhylogram() );
952 void phylogenyRemoved( final int index ) {
953 getIsDrawPhylogramList().remove( index );
957 final MainPanel main_panel = getMainPanel();
958 final Phylogeny tree = main_panel.getCurrentPhylogeny();
959 if ( ( tree == null ) || tree.isEmpty() ) {
962 String query = getSearchTextField0().getText();
963 if ( query != null ) {
964 query = query.trim();
966 if ( !ForesterUtil.isEmpty( query ) ) {
967 search0( main_panel, tree, query );
970 getSearchFoundCountsLabel0().setVisible( false );
971 getSearchResetButton0().setEnabled( false );
972 getSearchResetButton0().setVisible( false );
978 final MainPanel main_panel = getMainPanel();
979 final Phylogeny tree = main_panel.getCurrentPhylogeny();
980 if ( ( tree == null ) || tree.isEmpty() ) {
983 String query = getSearchTextField1().getText();
984 if ( query != null ) {
985 query = query.trim();
987 if ( !ForesterUtil.isEmpty( query ) ) {
988 search1( main_panel, tree, query );
991 getSearchFoundCountsLabel1().setVisible( false );
992 getSearchResetButton1().setEnabled( false );
993 getSearchResetButton1().setVisible( false );
998 void searchReset0() {
999 if ( getMainPanel().getCurrentTreePanel() != null ) {
1000 getMainPanel().getCurrentTreePanel().setFoundNodes0( null );
1004 void searchReset1() {
1005 if ( getMainPanel().getCurrentTreePanel() != null ) {
1006 getMainPanel().getCurrentTreePanel().setFoundNodes1( null );
1010 void setActionWhenNodeClicked( final NodeClickAction action ) {
1011 _action_when_node_clicked = action;
1014 void setAnnotationColors( final Map<String, Color> annotation_colors ) {
1015 _annotation_colors = annotation_colors;
1018 void setCheckbox( final int which, final boolean state ) {
1020 case Configuration.display_as_phylogram:
1021 if ( getDisplayAsPhylogramCb() != null ) {
1022 getDisplayAsPhylogramCb().setSelected( state );
1025 case Configuration.display_internal_data:
1026 if ( _display_internal_data != null ) {
1027 _display_internal_data.setSelected( state );
1030 case Configuration.color_according_to_species:
1031 if ( _color_acc_species != null ) {
1032 _color_acc_species.setSelected( state );
1035 case Configuration.color_according_to_sequence:
1036 if ( _color_acc_sequence != null ) {
1037 _color_acc_sequence.setSelected( state );
1040 case Configuration.color_according_to_annotation:
1041 if ( _color_according_to_annotation != null ) {
1042 _color_according_to_annotation.setSelected( state );
1045 case Configuration.show_node_names:
1046 if ( _show_node_names != null ) {
1047 _show_node_names.setSelected( state );
1050 case Configuration.show_taxonomy_scientific_names:
1051 if ( _show_taxo_scientific_names != null ) {
1052 _show_taxo_scientific_names.setSelected( state );
1055 case Configuration.show_taxonomy_common_names:
1056 if ( _show_taxo_common_names != null ) {
1057 _show_taxo_common_names.setSelected( state );
1060 case Configuration.show_tax_code:
1061 if ( _show_taxo_code != null ) {
1062 _show_taxo_code.setSelected( state );
1065 case Configuration.show_taxonomy_images:
1066 if ( _show_taxo_images_cb != null ) {
1067 _show_taxo_images_cb.setSelected( state );
1070 case Configuration.show_annotation:
1071 if ( _show_annotation != null ) {
1072 _show_annotation.setSelected( state );
1075 case Configuration.show_binary_characters:
1076 if ( _show_binary_characters != null ) {
1077 _show_binary_characters.setSelected( state );
1080 case Configuration.show_binary_character_counts:
1081 if ( _show_binary_character_counts != null ) {
1082 _show_binary_character_counts.setSelected( state );
1085 case Configuration.write_confidence_values:
1086 if ( getWriteConfidenceCb() != null ) {
1087 getWriteConfidenceCb().setSelected( state );
1090 case Configuration.write_events:
1091 if ( getShowEventsCb() != null ) {
1092 getShowEventsCb().setSelected( state );
1095 case Configuration.use_style:
1096 if ( getUseVisualStylesCb() != null ) {
1097 getUseVisualStylesCb().setSelected( state );
1100 case Configuration.width_branches:
1101 if ( _width_branches != null ) {
1102 _width_branches.setSelected( state );
1105 case Configuration.show_domain_architectures:
1106 if ( _show_domain_architectures != null ) {
1107 _show_domain_architectures.setSelected( state );
1110 case Configuration.write_branch_length_values:
1111 if ( _write_branch_length_values != null ) {
1112 _write_branch_length_values.setSelected( state );
1115 case Configuration.show_mol_seqs:
1116 if ( _show_mol_seqs != null ) {
1117 _show_mol_seqs.setSelected( state );
1120 case Configuration.show_seq_names:
1121 if ( _show_seq_names != null ) {
1122 _show_seq_names.setSelected( state );
1125 case Configuration.show_gene_names:
1126 if ( _show_gene_names != null ) {
1127 _show_gene_names.setSelected( state );
1130 case Configuration.show_seq_symbols:
1131 if ( _show_seq_symbols != null ) {
1132 _show_seq_symbols.setSelected( state );
1135 case Configuration.show_vector_data:
1136 if ( _show_vector_data_cb != null ) {
1137 _show_vector_data_cb.setSelected( state );
1140 case Configuration.show_properties:
1141 if ( _show_properties_cb != null ) {
1142 _show_properties_cb.setSelected( state );
1145 case Configuration.show_sequence_acc:
1146 if ( _show_sequence_acc != null ) {
1147 _show_sequence_acc.setSelected( state );
1150 case Configuration.dynamically_hide_data:
1151 if ( getDynamicallyHideData() != null ) {
1152 getDynamicallyHideData().setSelected( state );
1155 case Configuration.node_data_popup:
1156 if ( getNodeDescPopupCb() != null ) {
1157 getNodeDescPopupCb().setSelected( state );
1161 case Configuration.show_relation_confidence:
1162 if ( _seq_relation_confidence_switch != null ) {
1163 _seq_relation_confidence_switch.setSelected( state );
1168 throw new AssertionError( "unknown checkbox: " + which );
1173 * Set this checkbox state. Not all checkboxes have been instantiated
1174 * depending on the config.
1176 void setCheckbox( final JCheckBox cb, final boolean state ) {
1178 cb.setSelected( state );
1182 void setClickToAction( final int action ) {
1183 // Set click-to action
1184 if ( action == _show_data_item ) {
1185 setActionWhenNodeClicked( NodeClickAction.SHOW_DATA );
1187 else if ( action == _collapse_cb_item ) {
1188 setActionWhenNodeClicked( NodeClickAction.COLLAPSE );
1190 else if ( action == _reroot_cb_item ) {
1191 setActionWhenNodeClicked( NodeClickAction.REROOT );
1193 else if ( action == _subtree_cb_item ) {
1194 setActionWhenNodeClicked( NodeClickAction.SUBTREE );
1196 else if ( action == _swap_cb_item ) {
1197 setActionWhenNodeClicked( NodeClickAction.SWAP );
1199 else if ( action == _color_subtree_cb_item ) {
1200 setActionWhenNodeClicked( NodeClickAction.COLOR_SUBTREE );
1202 else if ( action == _open_seq_web_item ) {
1203 setActionWhenNodeClicked( NodeClickAction.OPEN_SEQ_WEB );
1205 else if ( action == _sort_descendents_item ) {
1206 setActionWhenNodeClicked( NodeClickAction.SORT_DESCENDENTS );
1208 else if ( action == _blast_item ) {
1209 setActionWhenNodeClicked( NodeClickAction.BLAST );
1211 else if ( action == _open_tax_web_item ) {
1212 setActionWhenNodeClicked( NodeClickAction.OPEN_TAX_WEB );
1214 else if ( action == _cut_subtree_item ) {
1215 setActionWhenNodeClicked( NodeClickAction.CUT_SUBTREE );
1217 else if ( action == _copy_subtree_item ) {
1218 setActionWhenNodeClicked( NodeClickAction.COPY_SUBTREE );
1220 else if ( action == _delete_node_or_subtree_item ) {
1221 setActionWhenNodeClicked( NodeClickAction.DELETE_NODE_OR_SUBTREE );
1223 else if ( action == _paste_subtree_item ) {
1224 setActionWhenNodeClicked( NodeClickAction.PASTE_SUBTREE );
1226 else if ( action == _add_new_node_item ) {
1227 setActionWhenNodeClicked( NodeClickAction.ADD_NEW_NODE );
1229 else if ( action == _edit_node_data_item ) {
1230 setActionWhenNodeClicked( NodeClickAction.EDIT_NODE_DATA );
1232 else if ( action == _select_nodes_item ) {
1233 setActionWhenNodeClicked( NodeClickAction.SELECT_NODES );
1235 else if ( action == _get_ext_desc_data ) {
1236 setActionWhenNodeClicked( NodeClickAction.GET_EXT_DESC_DATA );
1238 else if ( action == _open_pdb_item ) {
1239 setActionWhenNodeClicked( NodeClickAction.OPEN_PDB_WEB );
1241 else if ( action == _color_node_font_item ) {
1242 setActionWhenNodeClicked( NodeClickAction.COLOR_NODE_FONT );
1244 else if ( action == _change_node_font_item ) {
1245 setActionWhenNodeClicked( NodeClickAction.CHANGE_NODE_FONT );
1248 throw new RuntimeException( "unknown action: " + action );
1250 // make sure drop down is displaying the correct action
1251 // in case this was called from outside the class
1252 _click_to_combobox.setSelectedIndex( action );
1255 void setColorBranches( final boolean color_branches ) {
1256 _color_branches = color_branches;
1259 void setDrawPhylogram( final boolean b ) {
1260 getDisplayAsPhylogramCb().setSelected( b );
1261 setDrawPhylogram( getMainPanel().getCurrentTabIndex(), b );
1264 void setDrawPhylogramEnabled( final boolean b ) {
1265 getDisplayAsPhylogramCb().setEnabled( b );
1268 void setDynamicHidingIsOn( final boolean is_on ) {
1270 getDynamicallyHideData().setForeground( getConfiguration().getGuiCheckboxAndButtonActiveColor() );
1273 if ( !_configuration.isUseNativeUI() ) {
1274 getDynamicallyHideData().setForeground( getConfiguration().getGuiButtonTextColor() );
1277 getDynamicallyHideData().setForeground( Color.BLACK );
1282 void setSearchFoundCountsOnLabel0( final int counts ) {
1283 getSearchFoundCountsLabel0().setText( "Found: " + counts );
1286 void setSearchFoundCountsOnLabel1( final int counts ) {
1287 getSearchFoundCountsLabel1().setText( "Found: " + counts );
1290 void setShowEvents( final boolean show_events ) {
1291 if ( getShowEventsCb() == null ) {
1292 _show_events = new JCheckBox( "" );
1294 getShowEventsCb().setSelected( show_events );
1297 void setSpeciesColors( final Map<String, Color> species_colors ) {
1298 _species_colors = species_colors;
1301 void setSequenceColors( final Map<String, Color> sequence_colors ) {
1302 _sequence_colors = sequence_colors;
1307 * Set up the controls from the config settings. 11/26/05
1309 void setupControls() {
1310 // The tree display options:
1311 setupDisplayCheckboxes();
1313 // The sequence relation query selection combo-box
1314 if ( _configuration.displaySequenceRelations() ) {
1315 addSequenceRelationBlock();
1319 startClickToOptions();
1320 setupClickToOptions();
1321 endClickToOptions();
1322 // Zoom and quick edit buttons
1324 setupSearchTools0();
1325 setupSearchTools1();
1328 void setUpControlsForDomainStrucures() {
1329 _domain_display_label = new JLabel( "Domain Architectures:" );
1330 add( customizeLabel( _domain_display_label, getConfiguration() ) );
1331 add( _domain_display_label );
1332 _zoom_in_domain_structure = new JButton( "d+" );
1333 _zoom_out_domain_structure = new JButton( "d-" );
1334 _decr_domain_structure_evalue_thr = new JButton( "-" );
1335 _incr_domain_structure_evalue_thr = new JButton( "+" );
1336 _zoom_in_domain_structure.setPreferredSize( new Dimension( 10, 10 ) );
1337 _zoom_out_domain_structure.setPreferredSize( new Dimension( 10, 10 ) );
1338 _decr_domain_structure_evalue_thr.setPreferredSize( new Dimension( 10, 10 ) );
1339 _incr_domain_structure_evalue_thr.setPreferredSize( new Dimension( 10, 10 ) );
1340 _incr_domain_structure_evalue_thr.setToolTipText( "Increase the E-value threshold by a factor of 10" );
1341 _decr_domain_structure_evalue_thr.setToolTipText( "Decrease the E-value threshold by a factor of 10" );
1342 _domain_structure_evalue_thr_tf = new JTextField( 3 );
1343 _domain_structure_evalue_thr_tf.setEditable( false );
1344 if ( !getConfiguration().isUseNativeUI() ) {
1345 _domain_structure_evalue_thr_tf.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
1346 _domain_structure_evalue_thr_tf.setBackground( getConfiguration().getGuiCheckboxTextColor() );
1347 _domain_structure_evalue_thr_tf.setBorder( null );
1349 final JPanel d1_panel = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
1350 final JPanel d2_panel = new JPanel( new GridLayout( 1, 3, 0, 0 ) );
1351 if ( !_configuration.isUseNativeUI() ) {
1352 d1_panel.setBackground( getBackground() );
1353 d2_panel.setBackground( getBackground() );
1357 addJButton( _zoom_out_domain_structure, d1_panel );
1358 addJButton( _zoom_in_domain_structure, d1_panel );
1359 addJButton( _decr_domain_structure_evalue_thr, d2_panel );
1360 addJTextField( _domain_structure_evalue_thr_tf, d2_panel );
1361 addJButton( _incr_domain_structure_evalue_thr, d2_panel );
1364 void setupSearchTools0() {
1365 final JLabel search_label = new JLabel( "Search (A):" );
1366 search_label.setFont( ControlPanel.jcb_bold_font );
1367 if ( !getConfiguration().isUseNativeUI() ) {
1368 search_label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1370 add( search_label );
1371 search_label.setToolTipText( SEARCH_TIP_TEXT );
1372 _search_found_label_0 = new JLabel();
1373 getSearchFoundCountsLabel0().setVisible( false );
1374 _search_found_label_0.setFont( ControlPanel.jcb_bold_font );
1375 if ( !getConfiguration().isUseNativeUI() ) {
1376 _search_found_label_0.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1378 _search_tf_0 = new JTextField( 3 );
1379 _search_tf_0.setToolTipText( SEARCH_TIP_TEXT );
1380 _search_tf_0.setEditable( true );
1381 if ( !getConfiguration().isUseNativeUI() ) {
1382 _search_tf_0.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
1383 _search_tf_0.setBackground( getConfiguration().getGuiCheckboxTextColor() );
1384 _search_tf_0.setBorder( null );
1386 _search_reset_button_0 = new JButton();
1387 getSearchResetButton0().setText( "Reset" );
1388 getSearchResetButton0().setEnabled( false );
1389 getSearchResetButton0().setVisible( false );
1390 final JPanel s_panel_1 = new JPanel( new BorderLayout() );
1391 final JPanel s_panel_2 = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
1392 s_panel_1.setBackground( getBackground() );
1394 s_panel_2.setBackground( getBackground() );
1396 final KeyAdapter key_adapter = new KeyAdapter() {
1399 public void keyReleased( final KeyEvent key_event ) {
1401 displayedPhylogenyMightHaveChanged( true );
1404 final ActionListener action_listener = new ActionListener() {
1407 public void actionPerformed( final ActionEvent e ) {
1409 setSearchFoundCountsOnLabel0( 0 );
1410 getSearchFoundCountsLabel0().setVisible( false );
1411 getSearchTextField0().setText( "" );
1412 getSearchResetButton0().setEnabled( false );
1413 getSearchResetButton0().setVisible( false );
1414 displayedPhylogenyMightHaveChanged( true );
1417 _search_reset_button_0.addActionListener( action_listener );
1418 _search_tf_0.addKeyListener( key_adapter );
1419 addJTextField( _search_tf_0, s_panel_1 );
1420 s_panel_2.add( _search_found_label_0 );
1421 addJButton( _search_reset_button_0, s_panel_2 );
1424 void setupSearchTools1() {
1425 final JLabel search_label = new JLabel( "Search (B):" );
1426 search_label.setFont( ControlPanel.jcb_bold_font );
1427 if ( !getConfiguration().isUseNativeUI() ) {
1428 search_label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1430 add( search_label );
1431 search_label.setToolTipText( SEARCH_TIP_TEXT );
1432 _search_found_label_1 = new JLabel();
1433 getSearchFoundCountsLabel1().setVisible( false );
1434 _search_found_label_1.setFont( ControlPanel.jcb_bold_font );
1435 if ( !getConfiguration().isUseNativeUI() ) {
1436 _search_found_label_1.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1438 _search_tf_1 = new JTextField( 3 );
1439 _search_tf_1.setToolTipText( SEARCH_TIP_TEXT );
1440 _search_tf_1.setEditable( true );
1441 if ( !getConfiguration().isUseNativeUI() ) {
1442 _search_tf_1.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
1443 _search_tf_1.setBackground( getConfiguration().getGuiCheckboxTextColor() );
1444 _search_tf_1.setBorder( null );
1446 _search_reset_button_1 = new JButton();
1447 getSearchResetButton1().setText( "Reset" );
1448 getSearchResetButton1().setEnabled( false );
1449 getSearchResetButton1().setVisible( false );
1450 final JPanel s_panel_1 = new JPanel( new BorderLayout() );
1451 final JPanel s_panel_2 = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
1452 s_panel_1.setBackground( getBackground() );
1454 s_panel_2.setBackground( getBackground() );
1456 final KeyAdapter key_adapter = new KeyAdapter() {
1459 public void keyReleased( final KeyEvent key_event ) {
1461 displayedPhylogenyMightHaveChanged( true );
1464 final ActionListener action_listener = new ActionListener() {
1467 public void actionPerformed( final ActionEvent e ) {
1469 setSearchFoundCountsOnLabel1( 0 );
1470 getSearchFoundCountsLabel1().setVisible( false );
1471 getSearchTextField1().setText( "" );
1472 getSearchResetButton1().setEnabled( false );
1473 getSearchResetButton1().setVisible( false );
1474 displayedPhylogenyMightHaveChanged( true );
1477 _search_reset_button_1.addActionListener( action_listener );
1478 _search_tf_1.addKeyListener( key_adapter );
1479 addJTextField( _search_tf_1, s_panel_1 );
1480 s_panel_2.add( _search_found_label_1 );
1481 addJButton( _search_reset_button_1, s_panel_2 );
1484 void showAnnotations() {
1485 if ( _show_annotation != null ) {
1486 _show_annotation.setSelected( true );
1488 if ( _color_according_to_annotation != null ) {
1489 _color_according_to_annotation.setSelected( true );
1491 if ( _color_acc_species != null ) {
1492 _color_acc_species.setSelected( false );
1494 if ( _color_acc_sequence != null ) {
1495 _color_acc_sequence.setSelected( false );
1497 _mainpanel.getCurrentTreePanel().repaint();
1501 * Fit entire tree into window.
1504 if ( ( _mainpanel.getCurrentScrollPane() == null ) || _mainpanel.getCurrentTreePanel().getPhylogeny().isEmpty() ) {
1507 getCurrentTreePanel().updateSetOfCollapsedExternalNodes();
1508 displayedPhylogenyMightHaveChanged( true );
1509 _mainpanel.getCurrentTreePanel().updateOvSettings();
1510 _mainpanel.getCurrentTreePanel().validate();
1511 _mainpanel.validate();
1512 _mainpanel.getCurrentTreePanel().calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
1513 _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,
1523 _mainpanel.getCurrentTreePanel().resetPreferredSize();
1524 _mainpanel.adjustJScrollPane();
1525 _mainpanel.getCurrentTreePanel().repaint();
1526 _mainpanel.getCurrentTreePanel().updateOvSizes();
1529 void showWholeAll() {
1530 for( final TreePanel tree_panel : _mainpanel.getTreePanels() ) {
1531 if ( tree_panel != null ) {
1532 tree_panel.validate();
1533 tree_panel.calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
1534 _mainpanel.getSizeOfViewport().height,
1536 tree_panel.resetPreferredSize();
1537 tree_panel.repaint();
1542 // Create header for click-to combo box.
1543 void startClickToOptions() {
1544 final JLabel spacer = new JLabel( "" );
1545 spacer.setFont( ControlPanel.jcb_font );
1547 _click_to_label = new JLabel( "Click on Node to:" );
1548 add( customizeLabel( _click_to_label, getConfiguration() ) );
1549 _click_to_combobox = new JComboBox<String>();
1550 _click_to_combobox.setFocusable( false );
1551 _click_to_combobox.setMaximumRowCount( 14 );
1552 _click_to_combobox.setFont( ControlPanel.js_font );
1553 if ( !_configuration.isUseNativeUI() ) {
1554 _click_to_combobox.setBackground( getConfiguration().getGuiBackgroundColor() );
1556 // don't add listener until all items are set (or each one will trigger
1558 // click_to_list.addActionListener(this);
1559 add( _click_to_combobox );
1560 // Correlates option names to titles
1561 _all_click_to_names = new HashMap<Integer, String>();
1562 _click_to_names = new ArrayList<String>();
1566 if ( getMainPanel().getTabbedPane().getTabCount() > 0 ) {
1567 if ( getCurrentTreePanel().isPhyHasBranchLengths()
1568 && ( getCurrentTreePanel().getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) {
1569 setDrawPhylogramEnabled( true );
1570 setDrawPhylogram( isDrawPhylogram() );
1573 setDrawPhylogramEnabled( false );
1574 setDrawPhylogram( false );
1576 if ( getMainPanel().getMainFrame() == null ) {
1577 // Must be "E" applet version.
1578 final ArchaeopteryxE e = ( ArchaeopteryxE ) ( ( MainPanelApplets ) getMainPanel() ).getApplet();
1579 e.setSelectedTypeInTypeMenu( e.getCurrentTreePanel().getPhylogenyGraphicsType() );
1582 getMainPanel().getMainFrame().setSelectedTypeInTypeMenu( getMainPanel().getCurrentTreePanel()
1583 .getPhylogenyGraphicsType() );
1585 getMainPanel().getCurrentTreePanel().updateSubSuperTreeButton();
1586 getMainPanel().getControlPanel().search0();
1587 getMainPanel().getControlPanel().search1();
1588 getMainPanel().getControlPanel().updateDomainStructureEvaluethresholdDisplay();
1589 getSequenceRelationTypeBox().removeAllItems();
1590 for( final SequenceRelation.SEQUENCE_RELATION_TYPE type : getMainPanel().getCurrentPhylogeny()
1591 .getRelevantSequenceRelationTypes() ) {
1592 _sequence_relation_type_box.addItem( type );
1594 getMainPanel().getCurrentTreePanel().repaint();
1595 //setSequenceRelationQueries( getMainPanel().getCurrentPhylogeny().getSequenceRelationQueries() );
1596 // according to GUILHEM the line above can be removed.
1601 * Uncollapse all nodes.
1603 void uncollapseAll( final TreePanel tp ) {
1604 final Phylogeny t = tp.getPhylogeny();
1605 if ( ( t != null ) && !t.isEmpty() ) {
1606 for( final PhylogenyNodeIterator iter = t.iteratorPreorder(); iter.hasNext(); ) {
1607 final PhylogenyNode node = iter.next();
1608 node.setCollapse( false );
1610 tp.resetNodeIdToDistToLeafMap();
1611 tp.updateSetOfCollapsedExternalNodes();
1612 t.recalculateNumberOfExternalDescendants( false );
1613 tp.setNodeInPreorderToNull();
1614 t.clearHashIdToNodeMap();
1619 void updateDomainStructureEvaluethresholdDisplay() {
1620 if ( _domain_structure_evalue_thr_tf != null ) {
1621 _domain_structure_evalue_thr_tf.setText( "10^"
1622 + getMainPanel().getCurrentTreePanel().getDomainStructureEvalueThreshold() );
1626 void zoomInX( final float factor, final float x_correction_factor ) {
1627 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar();
1628 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1629 treepanel.multiplyUrtFactor( 1f );
1630 if ( ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
1631 || ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
1632 || isDrawPhylogram( getMainPanel().getCurrentTabIndex() )
1633 || ( getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP ) ) {
1634 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1635 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
1636 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
1637 getMainPanel().adjustJScrollPane();
1638 treepanel.resetPreferredSize();
1639 getMainPanel().getCurrentScrollPane().getViewport().validate();
1640 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1641 - ( sb.getVisibleAmount() / 2.0 ) ) );
1644 final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue();
1645 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
1646 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
1647 getMainPanel().adjustJScrollPane();
1648 treepanel.resetPreferredSize();
1649 getMainPanel().getCurrentScrollPane().getViewport().validate();
1650 sb.setValue( sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount() );
1652 treepanel.resetPreferredSize();
1653 treepanel.updateOvSizes();
1656 void zoomInY( final float factor ) {
1657 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getVerticalScrollBar();
1658 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1659 treepanel.multiplyUrtFactor( 1.1f );
1660 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1661 treepanel.setYdistance( ( treepanel.getYdistance() * factor ) );
1662 getMainPanel().adjustJScrollPane();
1663 treepanel.resetPreferredSize();
1664 getMainPanel().getCurrentScrollPane().getViewport().validate();
1665 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1666 - ( sb.getVisibleAmount() / 2.0 ) ) );
1667 treepanel.resetPreferredSize();
1668 treepanel.updateOvSizes();
1671 void zoomOutX( final float factor, final float x_correction_factor ) {
1672 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1673 treepanel.multiplyUrtFactor( 1f );
1674 if ( ( treepanel.getXdistance() * factor ) > 0.0 ) {
1675 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar();
1676 if ( ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
1677 || ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
1678 || isDrawPhylogram( getMainPanel().getCurrentTabIndex() )
1679 || ( getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP ) ) {
1680 getMainPanel().adjustJScrollPane();
1681 treepanel.resetPreferredSize();
1682 getMainPanel().getCurrentScrollPane().getViewport().validate();
1683 final double x = ( sb.getMaximum() - sb.getMinimum() )
1684 / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1685 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
1686 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
1687 getMainPanel().adjustJScrollPane();
1688 treepanel.resetPreferredSize();
1689 getMainPanel().getCurrentScrollPane().getViewport().validate();
1690 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1691 - ( sb.getVisibleAmount() / 2.0 ) ) );
1694 final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue();
1695 treepanel.setXdistance( treepanel.getXdistance() * factor );
1696 treepanel.setXcorrectionFactor( treepanel.getXcorrectionFactor() * x_correction_factor );
1698 getMainPanel().adjustJScrollPane();
1699 treepanel.resetPreferredSize();
1700 getMainPanel().getCurrentScrollPane().getViewport().validate();
1701 sb.setValue( sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount() );
1704 treepanel.resetPreferredSize();
1705 treepanel.updateOvSizes();
1709 void zoomOutY( final float factor ) {
1710 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1711 treepanel.multiplyUrtFactor( 0.9f );
1712 if ( ( treepanel.getYdistance() * factor ) > 0.0 ) {
1713 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getVerticalScrollBar();
1714 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1715 treepanel.setYdistance( ( treepanel.getYdistance() * factor ) );
1716 getMainPanel().adjustJScrollPane();
1717 treepanel.resetPreferredSize();
1718 getMainPanel().getCurrentScrollPane().getViewport().validate();
1719 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1720 - ( sb.getVisibleAmount() / 2.0 ) ) );
1721 treepanel.resetPreferredSize();
1722 treepanel.updateOvSizes();
1726 private void addClickToOption( final int which, final String title ) {
1727 _click_to_combobox.addItem( title );
1728 _click_to_names.add( title );
1729 _all_click_to_names.put( new Integer( which ), title );
1730 if ( !_configuration.isUseNativeUI() ) {
1731 _click_to_combobox.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
1732 _click_to_combobox.setForeground( getConfiguration().getGuiButtonTextColor() );
1737 private void addSequenceRelationBlock() {
1738 final JLabel spacer = new JLabel( "" );
1739 spacer.setSize( 1, 1 );
1741 final JLabel mainLabel = new JLabel( "Sequence relations to display" );
1742 final JLabel typeLabel = customizeLabel( new JLabel( "(type) " ), getConfiguration() );
1743 typeLabel.setFont( ControlPanel.js_font.deriveFont( 7 ) );
1744 getSequenceRelationTypeBox().setFocusable( false );
1745 _sequence_relation_type_box.setFont( ControlPanel.js_font );
1746 if ( !_configuration.isUseNativeUI() ) {
1747 _sequence_relation_type_box.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
1748 _sequence_relation_type_box.setForeground( getConfiguration().getGuiButtonTextColor() );
1750 _sequence_relation_type_box.setRenderer( new ListCellRenderer<Object>() {
1753 public Component getListCellRendererComponent( final JList<?> list,
1756 final boolean isSelected,
1757 final boolean cellHasFocus ) {
1758 final Component component = new DefaultListCellRenderer().getListCellRendererComponent( list,
1763 if ( ( value != null ) && ( value instanceof SequenceRelation.SEQUENCE_RELATION_TYPE ) ) {
1764 ( ( DefaultListCellRenderer ) component ).setText( SequenceRelation
1765 .getPrintableNameByType( ( SequenceRelation.SEQUENCE_RELATION_TYPE ) value ) );
1770 final GridBagLayout gbl = new GridBagLayout();
1771 _sequence_relation_type_box.setMinimumSize( new Dimension( 115, 17 ) );
1772 _sequence_relation_type_box.setPreferredSize( new Dimension( 115, 20 ) );
1773 final JPanel horizGrid = new JPanel( gbl );
1774 horizGrid.setBackground( getBackground() );
1775 horizGrid.add( typeLabel );
1776 horizGrid.add( _sequence_relation_type_box );
1777 add( customizeLabel( mainLabel, getConfiguration() ) );
1779 add( getSequenceRelationBox() );
1780 if ( _configuration.doDisplayOption( Configuration.show_relation_confidence ) ) {
1781 addCheckbox( Configuration.show_relation_confidence,
1782 _configuration.getDisplayTitle( Configuration.show_relation_confidence ) );
1783 setCheckbox( Configuration.show_relation_confidence,
1784 _configuration.doCheckOption( Configuration.show_relation_confidence ) );
1786 }// addSequenceRelationBlock
1789 private List<Boolean> getIsDrawPhylogramList() {
1790 return _draw_phylogram;
1793 private void init() {
1794 _draw_phylogram = new ArrayList<Boolean>();
1795 setSpeciesColors( new HashMap<String, Color>() );
1796 setSequenceColors( new HashMap<String, Color>() );
1797 setAnnotationColors( new HashMap<String, Color>() );
1800 private boolean isDrawPhylogram( final int index ) {
1801 return getIsDrawPhylogramList().get( index );
1804 private void search0( final MainPanel main_panel, final Phylogeny tree, final String query_str ) {
1805 getSearchFoundCountsLabel0().setVisible( true );
1806 getSearchResetButton0().setEnabled( true );
1807 getSearchResetButton0().setVisible( true );
1808 String[] queries = null;
1809 List<PhylogenyNode> nodes = null;
1810 if ( ( query_str.indexOf( ',' ) >= 0 ) && !getOptions().isSearchWithRegex() ) {
1811 queries = query_str.split( ",+" );
1814 queries = new String[ 1 ];
1815 queries[ 0 ] = query_str.trim();
1817 if ( ( queries != null ) && ( queries.length > 0 ) ) {
1818 nodes = new ArrayList<PhylogenyNode>();
1819 for( String query : queries ) {
1820 if ( ForesterUtil.isEmpty( query ) ) {
1823 query = query.trim();
1824 if ( ( query.indexOf( '+' ) >= 0 ) && !getOptions().isSearchWithRegex() ) {
1825 nodes.addAll( PhylogenyMethods.searchDataLogicalAnd( query.split( "\\++" ),
1827 getOptions().isSearchCaseSensitive(),
1828 !getOptions().isMatchWholeTermsOnly(),
1829 isShowDomainArchitectures() ) );
1832 nodes.addAll( PhylogenyMethods.searchData( query,
1834 getOptions().isSearchCaseSensitive(),
1835 !getOptions().isMatchWholeTermsOnly(),
1836 getOptions().isSearchWithRegex(),
1837 isShowDomainArchitectures() ) );
1840 if ( getOptions().isInverseSearchResult() ) {
1841 final List<PhylogenyNode> all = PhylogenyMethods.obtainAllNodesAsList( tree );
1842 all.removeAll( nodes );
1846 if ( ( nodes != null ) && ( nodes.size() > 0 ) ) {
1847 main_panel.getCurrentTreePanel().setFoundNodes0( new HashSet<Long>() );
1848 for( final PhylogenyNode node : nodes ) {
1849 main_panel.getCurrentTreePanel().getFoundNodes0().add( node.getId() );
1851 setSearchFoundCountsOnLabel0( nodes.size() );
1854 setSearchFoundCountsOnLabel0( 0 );
1859 private void search1( final MainPanel main_panel, final Phylogeny tree, final String query_str ) {
1860 getSearchFoundCountsLabel1().setVisible( true );
1861 getSearchResetButton1().setEnabled( true );
1862 getSearchResetButton1().setVisible( true );
1863 String[] queries = null;
1864 List<PhylogenyNode> nodes = null;
1865 if ( ( query_str.indexOf( ',' ) >= 0 ) && !getOptions().isSearchWithRegex() ) {
1866 queries = query_str.split( ",+" );
1869 queries = new String[ 1 ];
1870 queries[ 0 ] = query_str.trim();
1872 if ( ( queries != null ) && ( queries.length > 0 ) ) {
1873 nodes = new ArrayList<PhylogenyNode>();
1874 for( String query : queries ) {
1875 if ( ForesterUtil.isEmpty( query ) ) {
1878 query = query.trim();
1879 if ( ( query.indexOf( '+' ) >= 0 ) && !getOptions().isSearchWithRegex() ) {
1880 nodes.addAll( PhylogenyMethods.searchDataLogicalAnd( query.split( "\\++" ),
1882 getOptions().isSearchCaseSensitive(),
1883 !getOptions().isMatchWholeTermsOnly(),
1884 isShowDomainArchitectures() ) );
1887 nodes.addAll( PhylogenyMethods.searchData( query,
1889 getOptions().isSearchCaseSensitive(),
1890 !getOptions().isMatchWholeTermsOnly(),
1891 getOptions().isSearchWithRegex(),
1892 isShowDomainArchitectures() ) );
1895 if ( getOptions().isInverseSearchResult() ) {
1896 final List<PhylogenyNode> all = PhylogenyMethods.obtainAllNodesAsList( tree );
1897 all.removeAll( nodes );
1901 if ( ( nodes != null ) && ( nodes.size() > 0 ) ) {
1902 main_panel.getCurrentTreePanel().setFoundNodes1( new HashSet<Long>() );
1903 for( final PhylogenyNode node : nodes ) {
1904 main_panel.getCurrentTreePanel().getFoundNodes1().add( node.getId() );
1906 setSearchFoundCountsOnLabel1( nodes.size() );
1909 setSearchFoundCountsOnLabel1( 0 );
1914 private void setDrawPhylogram( final int index, final boolean b ) {
1915 getIsDrawPhylogramList().set( index, b );
1918 private void setupClickToOptions() {
1919 final int default_option = _configuration.getDefaultDisplayClicktoOption();
1920 int selected_index = 0;
1922 if ( _configuration.doDisplayClickToOption( Configuration.display_node_data ) ) {
1923 _show_data_item = cb_index;
1924 addClickToOption( Configuration.display_node_data,
1925 _configuration.getClickToTitle( Configuration.display_node_data ) );
1926 if ( default_option == Configuration.display_node_data ) {
1927 selected_index = cb_index;
1931 if ( _configuration.doDisplayClickToOption( Configuration.collapse_uncollapse ) ) {
1932 _collapse_cb_item = cb_index;
1933 addClickToOption( Configuration.collapse_uncollapse,
1934 _configuration.getClickToTitle( Configuration.collapse_uncollapse ) );
1935 if ( default_option == Configuration.collapse_uncollapse ) {
1936 selected_index = cb_index;
1940 if ( _configuration.doDisplayClickToOption( Configuration.reroot ) ) {
1941 _reroot_cb_item = cb_index;
1942 addClickToOption( Configuration.reroot, _configuration.getClickToTitle( Configuration.reroot ) );
1943 if ( default_option == Configuration.reroot ) {
1944 selected_index = cb_index;
1948 if ( _configuration.doDisplayClickToOption( Configuration.subtree ) ) {
1949 _subtree_cb_item = cb_index;
1950 addClickToOption( Configuration.subtree, _configuration.getClickToTitle( Configuration.subtree ) );
1951 if ( default_option == Configuration.subtree ) {
1952 selected_index = cb_index;
1956 if ( _configuration.doDisplayClickToOption( Configuration.swap ) ) {
1957 _swap_cb_item = cb_index;
1958 addClickToOption( Configuration.swap, _configuration.getClickToTitle( Configuration.swap ) );
1959 if ( default_option == Configuration.swap ) {
1960 selected_index = cb_index;
1964 if ( _configuration.doDisplayClickToOption( Configuration.sort_descendents ) ) {
1965 _sort_descendents_item = cb_index;
1966 addClickToOption( Configuration.sort_descendents,
1967 _configuration.getClickToTitle( Configuration.sort_descendents ) );
1968 if ( default_option == Configuration.sort_descendents ) {
1969 selected_index = cb_index;
1973 if ( _configuration.doDisplayClickToOption( Configuration.color_node_font ) ) {
1974 _color_node_font_item = cb_index;
1975 addClickToOption( Configuration.color_node_font,
1976 _configuration.getClickToTitle( Configuration.color_node_font ) );
1977 if ( default_option == Configuration.color_node_font ) {
1978 selected_index = cb_index;
1982 if ( _configuration.doDisplayClickToOption( Configuration.change_node_font ) ) {
1983 _change_node_font_item = cb_index;
1984 addClickToOption( Configuration.change_node_font,
1985 _configuration.getClickToTitle( Configuration.change_node_font ) );
1986 if ( default_option == Configuration.change_node_font ) {
1987 selected_index = cb_index;
1991 if ( _configuration.doDisplayClickToOption( Configuration.color_subtree ) ) {
1992 _color_subtree_cb_item = cb_index;
1993 addClickToOption( Configuration.color_subtree, _configuration.getClickToTitle( Configuration.color_subtree ) );
1994 if ( default_option == Configuration.color_subtree ) {
1995 selected_index = cb_index;
1999 if ( _configuration.doDisplayClickToOption( Configuration.open_seq_web ) ) {
2000 _open_seq_web_item = cb_index;
2001 addClickToOption( Configuration.open_seq_web, _configuration.getClickToTitle( Configuration.open_seq_web ) );
2002 if ( default_option == Configuration.open_seq_web ) {
2003 selected_index = cb_index;
2007 if ( _configuration.doDisplayClickToOption( Configuration.open_pdb_web ) ) {
2008 _open_pdb_item = cb_index;
2009 addClickToOption( Configuration.open_pdb_web, _configuration.getClickToTitle( Configuration.open_pdb_web ) );
2010 if ( default_option == Configuration.open_pdb_web ) {
2011 selected_index = cb_index;
2015 if ( _configuration.doDisplayClickToOption( Configuration.open_tax_web ) ) {
2016 _open_tax_web_item = cb_index;
2017 addClickToOption( Configuration.open_tax_web, _configuration.getClickToTitle( Configuration.open_tax_web ) );
2018 if ( default_option == Configuration.open_tax_web ) {
2019 selected_index = cb_index;
2023 if ( _configuration.doDisplayClickToOption( Configuration.blast ) ) {
2024 _blast_item = cb_index;
2025 addClickToOption( Configuration.blast, _configuration.getClickToTitle( Configuration.blast ) );
2026 if ( default_option == Configuration.blast ) {
2027 selected_index = cb_index;
2031 if ( _configuration.doDisplayClickToOption( Configuration.select_nodes ) ) {
2032 _select_nodes_item = cb_index;
2033 addClickToOption( Configuration.select_nodes, _configuration.getClickToTitle( Configuration.select_nodes ) );
2034 if ( default_option == Configuration.select_nodes ) {
2035 selected_index = cb_index;
2039 if ( _configuration.doDisplayClickToOption( Configuration.get_ext_desc_data ) ) {
2040 _get_ext_desc_data = cb_index;
2041 if ( !ForesterUtil.isEmpty( getConfiguration().getLabelForGetExtDescendentsData() ) ) {
2042 addClickToOption( Configuration.get_ext_desc_data, getConfiguration()
2043 .getLabelForGetExtDescendentsData() );
2047 switch ( getConfiguration().getExtDescNodeDataToReturn() ) {
2052 s = "Sequence Accessors";
2054 case SEQUENCE_MOL_SEQ:
2055 s = "Molecular Sequence";
2057 case SEQUENCE_MOL_SEQ_FASTA:
2058 s = "Molecular Sequence (Fasta)";
2061 s = "Sequence Names";
2066 case SEQUENCE_SYMBOL:
2067 s = "Sequence Symbols";
2070 s = "Taxonomy Codes";
2072 case TAXONOMY_COMM0N_NAME:
2073 s = "Taxonomy Common Names";
2075 case TAXONOMY_SCIENTIFIC_NAME:
2076 s = "Scientific Names";
2079 s = "User Selected Data";
2082 throw new IllegalStateException( "dont know how to deal with "
2083 + getConfiguration().getExtDescNodeDataToReturn() );
2085 final String label = _configuration.getClickToTitle( Configuration.get_ext_desc_data ) + " " + s;
2086 addClickToOption( Configuration.get_ext_desc_data, label );
2088 if ( default_option == Configuration.get_ext_desc_data ) {
2089 selected_index = cb_index;
2093 if ( getOptions().isEditable() ) {
2094 if ( _configuration.doDisplayClickToOption( Configuration.cut_subtree ) ) {
2095 _cut_subtree_item = cb_index;
2096 addClickToOption( Configuration.cut_subtree, _configuration.getClickToTitle( Configuration.cut_subtree ) );
2097 if ( default_option == Configuration.cut_subtree ) {
2098 selected_index = cb_index;
2102 if ( _configuration.doDisplayClickToOption( Configuration.copy_subtree ) ) {
2103 _copy_subtree_item = cb_index;
2104 addClickToOption( Configuration.copy_subtree,
2105 _configuration.getClickToTitle( Configuration.copy_subtree ) );
2106 if ( default_option == Configuration.copy_subtree ) {
2107 selected_index = cb_index;
2111 if ( _configuration.doDisplayClickToOption( Configuration.paste_subtree ) ) {
2112 _paste_subtree_item = cb_index;
2113 addClickToOption( Configuration.paste_subtree,
2114 _configuration.getClickToTitle( Configuration.paste_subtree ) );
2115 if ( default_option == Configuration.paste_subtree ) {
2116 selected_index = cb_index;
2120 if ( _configuration.doDisplayClickToOption( Configuration.delete_subtree_or_node ) ) {
2121 _delete_node_or_subtree_item = cb_index;
2122 addClickToOption( Configuration.delete_subtree_or_node,
2123 _configuration.getClickToTitle( Configuration.delete_subtree_or_node ) );
2124 if ( default_option == Configuration.delete_subtree_or_node ) {
2125 selected_index = cb_index;
2129 if ( _configuration.doDisplayClickToOption( Configuration.add_new_node ) ) {
2130 _add_new_node_item = cb_index;
2131 addClickToOption( Configuration.add_new_node,
2132 _configuration.getClickToTitle( Configuration.add_new_node ) );
2133 if ( default_option == Configuration.add_new_node ) {
2134 selected_index = cb_index;
2138 if ( _configuration.doDisplayClickToOption( Configuration.edit_node_data ) ) {
2139 _edit_node_data_item = cb_index;
2140 addClickToOption( Configuration.edit_node_data,
2141 _configuration.getClickToTitle( Configuration.edit_node_data ) );
2142 if ( default_option == Configuration.edit_node_data ) {
2143 selected_index = cb_index;
2148 // Set default selection and its action
2149 _click_to_combobox.setSelectedIndex( selected_index );
2150 setClickToAction( selected_index );
2153 private void setupDisplayCheckboxes() {
2154 if ( _configuration.doDisplayOption( Configuration.display_as_phylogram ) ) {
2155 addCheckbox( Configuration.display_as_phylogram,
2156 _configuration.getDisplayTitle( Configuration.display_as_phylogram ) );
2157 setCheckbox( Configuration.display_as_phylogram,
2158 _configuration.doCheckOption( Configuration.display_as_phylogram ) );
2160 if ( _configuration.doDisplayOption( Configuration.dynamically_hide_data ) ) {
2161 addCheckbox( Configuration.dynamically_hide_data,
2162 _configuration.getDisplayTitle( Configuration.dynamically_hide_data ) );
2163 setCheckbox( Configuration.dynamically_hide_data,
2164 _configuration.doCheckOption( Configuration.dynamically_hide_data ) );
2166 if ( _configuration.doDisplayOption( Configuration.node_data_popup ) ) {
2167 addCheckbox( Configuration.node_data_popup, _configuration.getDisplayTitle( Configuration.node_data_popup ) );
2168 setCheckbox( Configuration.node_data_popup, _configuration.doCheckOption( Configuration.node_data_popup ) );
2170 if ( _configuration.doDisplayOption( Configuration.display_internal_data ) ) {
2171 addCheckbox( Configuration.display_internal_data,
2172 _configuration.getDisplayTitle( Configuration.display_internal_data ) );
2173 setCheckbox( Configuration.display_internal_data,
2174 _configuration.doCheckOption( Configuration.display_internal_data ) );
2176 if ( _configuration.doDisplayOption( Configuration.color_according_to_sequence ) ) {
2177 addCheckbox( Configuration.color_according_to_sequence,
2178 _configuration.getDisplayTitle( Configuration.color_according_to_sequence ) );
2179 setCheckbox( Configuration.color_according_to_sequence,
2180 _configuration.doCheckOption( Configuration.color_according_to_sequence ) );
2182 if ( _configuration.doDisplayOption( Configuration.color_according_to_species ) ) {
2183 addCheckbox( Configuration.color_according_to_species,
2184 _configuration.getDisplayTitle( Configuration.color_according_to_species ) );
2185 setCheckbox( Configuration.color_according_to_species,
2186 _configuration.doCheckOption( Configuration.color_according_to_species ) );
2188 if ( _configuration.doDisplayOption( Configuration.color_according_to_annotation ) ) {
2189 addCheckbox( Configuration.color_according_to_annotation,
2190 _configuration.getDisplayTitle( Configuration.color_according_to_annotation ) );
2191 setCheckbox( Configuration.color_according_to_annotation,
2192 _configuration.doCheckOption( Configuration.color_according_to_annotation ) );
2194 if ( _configuration.doDisplayOption( Configuration.use_style ) ) {
2195 addCheckbox( Configuration.use_style, _configuration.getDisplayTitle( Configuration.use_style ) );
2196 setCheckbox( Configuration.use_style, _configuration.doCheckOption( Configuration.use_style ) );
2198 if ( _configuration.doDisplayOption( Configuration.width_branches ) ) {
2199 addCheckbox( Configuration.width_branches, _configuration.getDisplayTitle( Configuration.width_branches ) );
2200 setCheckbox( Configuration.width_branches, _configuration.doCheckOption( Configuration.width_branches ) );
2202 final JLabel label = new JLabel( "Display Data:" );
2203 label.setFont( ControlPanel.jcb_bold_font );
2204 if ( !getConfiguration().isUseNativeUI() ) {
2205 label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
2208 if ( _configuration.doDisplayOption( Configuration.show_node_names ) ) {
2209 addCheckbox( Configuration.show_node_names, _configuration.getDisplayTitle( Configuration.show_node_names ) );
2210 setCheckbox( Configuration.show_node_names, _configuration.doCheckOption( Configuration.show_node_names ) );
2212 if ( _configuration.doDisplayOption( Configuration.show_tax_code ) ) {
2213 addCheckbox( Configuration.show_tax_code, _configuration.getDisplayTitle( Configuration.show_tax_code ) );
2214 setCheckbox( Configuration.show_tax_code, _configuration.doCheckOption( Configuration.show_tax_code ) );
2216 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_scientific_names ) ) {
2217 addCheckbox( Configuration.show_taxonomy_scientific_names,
2218 _configuration.getDisplayTitle( Configuration.show_taxonomy_scientific_names ) );
2219 setCheckbox( Configuration.show_taxonomy_scientific_names,
2220 _configuration.doCheckOption( Configuration.show_taxonomy_scientific_names ) );
2222 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_common_names ) ) {
2223 addCheckbox( Configuration.show_taxonomy_common_names,
2224 _configuration.getDisplayTitle( Configuration.show_taxonomy_common_names ) );
2225 setCheckbox( Configuration.show_taxonomy_common_names,
2226 _configuration.doCheckOption( Configuration.show_taxonomy_common_names ) );
2228 if ( _configuration.doDisplayOption( Configuration.show_seq_names ) ) {
2229 addCheckbox( Configuration.show_seq_names, _configuration.getDisplayTitle( Configuration.show_seq_names ) );
2230 setCheckbox( Configuration.show_seq_names, _configuration.doCheckOption( Configuration.show_seq_names ) );
2232 if ( _configuration.doDisplayOption( Configuration.show_gene_names ) ) {
2233 addCheckbox( Configuration.show_gene_names, _configuration.getDisplayTitle( Configuration.show_gene_names ) );
2234 setCheckbox( Configuration.show_gene_names, _configuration.doCheckOption( Configuration.show_gene_names ) );
2236 if ( _configuration.doDisplayOption( Configuration.show_seq_symbols ) ) {
2237 addCheckbox( Configuration.show_seq_symbols,
2238 _configuration.getDisplayTitle( Configuration.show_seq_symbols ) );
2239 setCheckbox( Configuration.show_seq_symbols, _configuration.doCheckOption( Configuration.show_seq_symbols ) );
2241 if ( _configuration.doDisplayOption( Configuration.show_sequence_acc ) ) {
2242 addCheckbox( Configuration.show_sequence_acc,
2243 _configuration.getDisplayTitle( Configuration.show_sequence_acc ) );
2244 setCheckbox( Configuration.show_sequence_acc,
2245 _configuration.doCheckOption( Configuration.show_sequence_acc ) );
2247 if ( _configuration.doDisplayOption( Configuration.show_annotation ) ) {
2248 addCheckbox( Configuration.show_annotation, _configuration.getDisplayTitle( Configuration.show_annotation ) );
2249 setCheckbox( Configuration.show_annotation, _configuration.doCheckOption( Configuration.show_annotation ) );
2251 if ( _configuration.doDisplayOption( Configuration.write_confidence_values ) ) {
2252 addCheckbox( Configuration.write_confidence_values,
2253 _configuration.getDisplayTitle( Configuration.write_confidence_values ) );
2254 setCheckbox( Configuration.write_confidence_values,
2255 _configuration.doCheckOption( Configuration.write_confidence_values ) );
2257 if ( _configuration.doDisplayOption( Configuration.write_branch_length_values ) ) {
2258 addCheckbox( Configuration.write_branch_length_values,
2259 _configuration.getDisplayTitle( Configuration.write_branch_length_values ) );
2260 setCheckbox( Configuration.write_branch_length_values,
2261 _configuration.doCheckOption( Configuration.write_branch_length_values ) );
2263 if ( _configuration.doDisplayOption( Configuration.show_binary_characters ) ) {
2264 addCheckbox( Configuration.show_binary_characters,
2265 _configuration.getDisplayTitle( Configuration.show_binary_characters ) );
2266 setCheckbox( Configuration.show_binary_characters,
2267 _configuration.doCheckOption( Configuration.show_binary_characters ) );
2269 if ( _configuration.doDisplayOption( Configuration.show_binary_character_counts ) ) {
2270 addCheckbox( Configuration.show_binary_character_counts,
2271 _configuration.getDisplayTitle( Configuration.show_binary_character_counts ) );
2272 setCheckbox( Configuration.show_binary_character_counts,
2273 _configuration.doCheckOption( Configuration.show_binary_character_counts ) );
2275 if ( _configuration.doDisplayOption( Configuration.show_domain_architectures ) ) {
2276 addCheckbox( Configuration.show_domain_architectures,
2277 _configuration.getDisplayTitle( Configuration.show_domain_architectures ) );
2278 setCheckbox( Configuration.show_domain_architectures,
2279 _configuration.doCheckOption( Configuration.show_domain_architectures ) );
2281 if ( _configuration.doDisplayOption( Configuration.show_mol_seqs ) ) {
2282 addCheckbox( Configuration.show_mol_seqs, _configuration.getDisplayTitle( Configuration.show_mol_seqs ) );
2283 setCheckbox( Configuration.show_mol_seqs, _configuration.doCheckOption( Configuration.show_mol_seqs ) );
2285 if ( _configuration.doDisplayOption( Configuration.write_events ) ) {
2286 addCheckbox( Configuration.write_events, _configuration.getDisplayTitle( Configuration.write_events ) );
2287 setCheckbox( Configuration.write_events, _configuration.doCheckOption( Configuration.write_events ) );
2289 if ( _configuration.doDisplayOption( Configuration.show_vector_data ) ) {
2290 addCheckbox( Configuration.show_vector_data,
2291 _configuration.getDisplayTitle( Configuration.show_vector_data ) );
2292 setCheckbox( Configuration.show_vector_data, _configuration.doCheckOption( Configuration.show_vector_data ) );
2294 if ( _configuration.doDisplayOption( Configuration.show_properties ) ) {
2295 addCheckbox( Configuration.show_properties, _configuration.getDisplayTitle( Configuration.show_properties ) );
2296 setCheckbox( Configuration.show_properties, _configuration.doCheckOption( Configuration.show_properties ) );
2298 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_images ) ) {
2299 addCheckbox( Configuration.show_taxonomy_images,
2300 _configuration.getDisplayTitle( Configuration.show_taxonomy_images ) );
2301 setCheckbox( Configuration.show_taxonomy_images,
2302 _configuration.doCheckOption( Configuration.show_taxonomy_images ) );
2306 private void setVisibilityOfDomainStrucureControls() {
2307 if ( _zoom_in_domain_structure != null ) {
2308 final MainFrame mf = getMainFrame();
2310 if ( isShowDomainArchitectures() ) {
2311 _domain_display_label.setVisible( true );
2312 _zoom_in_domain_structure.setVisible( true );
2313 _zoom_out_domain_structure.setVisible( true );
2314 _decr_domain_structure_evalue_thr.setVisible( true );
2315 _incr_domain_structure_evalue_thr.setVisible( true );
2316 _domain_structure_evalue_thr_tf.setVisible( true );
2317 if ( mf._right_line_up_domains_cbmi != null ) {
2318 mf._right_line_up_domains_cbmi.setVisible( true );
2320 if ( mf._show_domain_labels != null ) {
2321 mf._show_domain_labels.setVisible( true );
2325 _domain_display_label.setVisible( false );
2326 _zoom_in_domain_structure.setVisible( false );
2327 _zoom_out_domain_structure.setVisible( false );
2328 _decr_domain_structure_evalue_thr.setVisible( false );
2329 _incr_domain_structure_evalue_thr.setVisible( false );
2330 _domain_structure_evalue_thr_tf.setVisible( false );
2331 if ( mf._right_line_up_domains_cbmi != null ) {
2332 mf._right_line_up_domains_cbmi.setVisible( false );
2334 if ( mf._show_domain_labels != null ) {
2335 mf._show_domain_labels.setVisible( false );
2342 // This takes care of ArchaeopteryxE-issue.
2343 // Can, and will, return null prior to ArchaeopteryxE initialization completion.
2344 final private MainFrame getMainFrame() {
2345 MainFrame mf = getMainPanel().getMainFrame();
2347 // Must be "E" applet version.
2348 final ArchaeopteryxE e = ( ArchaeopteryxE ) ( ( MainPanelApplets ) getMainPanel() ).getApplet();
2349 if ( e.getMainPanel() == null ) {
2352 mf = e.getMainPanel().getMainFrame();
2357 void setVisibilityOfX() {
2358 final MainFrame mf = getMainFrame();
2360 if ( ( getCurrentTreePanel() != null ) && ( getCurrentTreePanel().getPhylogeny() != null ) ) {
2361 if ( AptxUtil.isHasAtLeastOneBranchWithSupportSD( getCurrentTreePanel().getPhylogeny() ) ) {
2362 if ( mf._show_confidence_stddev_cbmi != null ) {
2363 mf._show_confidence_stddev_cbmi.setVisible( true );
2367 if ( mf._show_confidence_stddev_cbmi != null ) {
2368 mf._show_confidence_stddev_cbmi.setVisible( false );
2371 if ( AptxUtil.isHasAtLeastOneNodeWithScientificName( getCurrentTreePanel().getPhylogeny() ) ) {
2372 if ( mf._abbreviate_scientific_names != null ) {
2373 mf._abbreviate_scientific_names.setVisible( true );
2377 if ( mf._abbreviate_scientific_names != null ) {
2378 mf._abbreviate_scientific_names.setVisible( false );
2381 if ( AptxUtil.isHasAtLeastOneNodeWithSequenceAnnotation( getCurrentTreePanel().getPhylogeny() ) ) {
2382 if ( mf._show_annotation_ref_source != null ) {
2383 mf._show_annotation_ref_source.setVisible( true );
2387 if ( mf._show_annotation_ref_source != null ) {
2388 mf._show_annotation_ref_source.setVisible( false );
2392 if ( isDrawPhylogram()
2393 || ( ( getCurrentTreePanel() != null ) && ( ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) || ( getCurrentTreePanel()
2394 .getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) ) ) {
2395 if ( mf._non_lined_up_cladograms_rbmi != null ) {
2396 mf._non_lined_up_cladograms_rbmi.setVisible( false );
2398 if ( mf._uniform_cladograms_rbmi != null ) {
2399 mf._uniform_cladograms_rbmi.setVisible( false );
2401 if ( mf._ext_node_dependent_cladogram_rbmi != null ) {
2402 mf._ext_node_dependent_cladogram_rbmi.setVisible( false );
2406 if ( mf._non_lined_up_cladograms_rbmi != null ) {
2407 mf._non_lined_up_cladograms_rbmi.setVisible( true );
2409 if ( mf._uniform_cladograms_rbmi != null ) {
2410 mf._uniform_cladograms_rbmi.setVisible( true );
2412 if ( mf._ext_node_dependent_cladogram_rbmi != null ) {
2413 mf._ext_node_dependent_cladogram_rbmi.setVisible( true );
2416 if ( isDrawPhylogram() ) {
2417 if ( mf._show_scale_cbmi != null ) {
2418 mf._show_scale_cbmi.setVisible( true );
2422 if ( mf._show_scale_cbmi != null ) {
2423 mf._show_scale_cbmi.setVisible( false );
2426 if ( getCurrentTreePanel() != null ) {
2427 if ( ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
2428 || ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) {
2429 if ( mf._label_direction_cbmi != null ) {
2430 mf._label_direction_cbmi.setVisible( true );
2434 if ( mf._label_direction_cbmi != null ) {
2435 mf._label_direction_cbmi.setVisible( false );
2442 void setVisibilityOfDomainStrucureCB() {
2444 if ( ( getCurrentTreePanel() != null )
2445 && ( ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) || ( getCurrentTreePanel()
2446 .getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) ) {
2447 if ( getMainPanel().getMainFrame()._right_line_up_domains_cbmi != null ) {
2448 getMainPanel().getMainFrame()._right_line_up_domains_cbmi.setVisible( false );
2450 if ( getMainPanel().getMainFrame()._show_domain_labels != null ) {
2451 getMainPanel().getMainFrame()._show_domain_labels.setVisible( false );
2454 else if ( isShowDomainArchitectures() ) {
2455 if ( getMainPanel().getMainFrame()._right_line_up_domains_cbmi != null ) {
2456 getMainPanel().getMainFrame()._right_line_up_domains_cbmi.setVisible( true );
2458 if ( getMainPanel().getMainFrame()._show_domain_labels != null ) {
2459 getMainPanel().getMainFrame()._show_domain_labels.setVisible( true );
2463 if ( getMainPanel().getMainFrame()._right_line_up_domains_cbmi != null ) {
2464 getMainPanel().getMainFrame()._right_line_up_domains_cbmi.setVisible( false );
2466 if ( getMainPanel().getMainFrame()._show_domain_labels != null ) {
2467 getMainPanel().getMainFrame()._show_domain_labels.setVisible( false );
2471 catch ( final Exception ignore ) {
2476 static JLabel customizeLabel( final JLabel label, final Configuration configuration ) {
2477 label.setFont( ControlPanel.jcb_bold_font );
2478 if ( !configuration.isUseNativeUI() ) {
2479 label.setForeground( configuration.getGuiCheckboxTextColor() );
2480 label.setBackground( configuration.getGuiBackgroundColor() );
2485 enum NodeClickAction {
2492 DELETE_NODE_OR_SUBTREE,