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().decreaseDomainStructureEvalueThresholdExp();
296 displayedPhylogenyMightHaveChanged( true );
298 else if ( e.getSource() == _incr_domain_structure_evalue_thr ) {
299 _mainpanel.getCurrentTreePanel().increaseDomainStructureEvalueThresholdExp();
302 displayedPhylogenyMightHaveChanged( true );
304 else if ( e.getSource() == _search_tf_0 ) {
306 displayedPhylogenyMightHaveChanged( true );
308 else if ( e.getSource() == _search_tf_1 ) {
310 displayedPhylogenyMightHaveChanged( true );
312 else if ( ( _dynamically_hide_data != null ) && ( e.getSource() == _dynamically_hide_data )
313 && !_dynamically_hide_data.isSelected() ) {
314 setDynamicHidingIsOn( false );
315 displayedPhylogenyMightHaveChanged( true );
318 displayedPhylogenyMightHaveChanged( true );
322 tp.requestFocusInWindow();
325 catch ( final Exception ex ) {
326 AptxUtil.unexpectedException( ex );
328 catch ( final Error err ) {
329 AptxUtil.unexpectedError( err );
333 public JCheckBox getColorAccSpeciesCb() {
334 return _color_acc_species;
337 public JCheckBox getColorAccSequenceCb() {
338 return _color_acc_sequence;
341 public JCheckBox getUseVisualStylesCb() {
342 return _use_visual_styles_cb;
345 public JCheckBox getDisplayAsPhylogramCb() {
346 return _display_as_phylogram_cb;
349 public JCheckBox getDynamicallyHideData() {
350 return _dynamically_hide_data;
353 public JCheckBox getNodeDescPopupCb() {
354 return _node_desc_popup_cb;
357 public Sequence getSelectedQuerySequence() {
358 return _selected_query_seq;
361 public JComboBox<String> getSequenceRelationBox() {
362 if ( _show_sequence_relations == null ) {
363 _show_sequence_relations = new JComboBox<String>();
364 _show_sequence_relations.setFocusable( false );
365 _show_sequence_relations.setMaximumRowCount( 20 );
366 _show_sequence_relations.setFont( ControlPanel.js_font );
367 if ( !_configuration.isUseNativeUI() ) {
368 _show_sequence_relations.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
369 _show_sequence_relations.setForeground( getConfiguration().getGuiButtonTextColor() );
371 _show_sequence_relations.addItem( "-----" );
372 _show_sequence_relations.setToolTipText( "To display orthology information for selected query" );
374 return _show_sequence_relations;
378 public JComboBox<SEQUENCE_RELATION_TYPE> getSequenceRelationTypeBox() {
379 if ( _sequence_relation_type_box == null ) {
380 _sequence_relation_type_box = new JComboBox<SEQUENCE_RELATION_TYPE>();
381 for( final SequenceRelation.SEQUENCE_RELATION_TYPE type : SequenceRelation.SEQUENCE_RELATION_TYPE.values() ) {
382 _sequence_relation_type_box.addItem( type );
384 _sequence_relation_type_box.addActionListener( new ActionListener() {
387 public void actionPerformed( final ActionEvent e ) {
388 if ( _mainpanel.getCurrentPhylogeny() != null ) {
389 setSequenceRelationQueries( getMainPanel().getCurrentPhylogeny().getSequenceRelationQueries() );
394 return _sequence_relation_type_box;
397 public JCheckBox getShowEventsCb() {
401 public JCheckBox getWriteConfidenceCb() {
402 return _write_confidence;
405 public boolean isShowProperties() {
406 return ( ( _show_properties_cb != null ) && _show_properties_cb.isSelected() );
409 public boolean isShowTaxonomyImages() {
410 return ( ( _show_taxo_images_cb != null ) && _show_taxo_images_cb.isSelected() );
413 public boolean isShowVectorData() {
414 return ( ( _show_vector_data_cb != null ) && _show_vector_data_cb.isSelected() );
417 public void setSequenceRelationQueries( final Collection<Sequence> sequenceRelationQueries ) {
418 final JComboBox<String> box = getSequenceRelationBox();
419 while ( box.getItemCount() > 1 ) {
420 box.removeItemAt( 1 );
422 final HashMap<String, Sequence> sequencesByName = new HashMap<String, Sequence>();
423 final SequenceRelation.SEQUENCE_RELATION_TYPE relationType = ( SequenceRelation.SEQUENCE_RELATION_TYPE ) _sequence_relation_type_box
425 if ( relationType == null ) {
428 final ArrayList<String> sequenceNamesToAdd = new ArrayList<String>();
429 for( final Sequence seq : sequenceRelationQueries ) {
430 if ( seq.hasSequenceRelations() ) {
431 boolean fFoundForCurrentType = false;
432 for( final SequenceRelation sq : seq.getSequenceRelations() ) {
433 if ( sq.getType().equals( relationType ) ) {
434 fFoundForCurrentType = true;
438 if ( fFoundForCurrentType ) {
439 sequenceNamesToAdd.add( seq.getName() );
440 sequencesByName.put( seq.getName(), seq );
444 // sort sequences by name before adding them to the combo
445 final String[] sequenceNameArray = sequenceNamesToAdd.toArray( new String[ sequenceNamesToAdd.size() ] );
446 Arrays.sort( sequenceNameArray, String.CASE_INSENSITIVE_ORDER );
447 for( final String seqName : sequenceNameArray ) {
448 box.addItem( seqName );
450 for( final ItemListener oldItemListener : box.getItemListeners() ) {
451 box.removeItemListener( oldItemListener );
453 box.addItemListener( new ItemListener() {
456 public void itemStateChanged( final ItemEvent e ) {
457 _selected_query_seq = sequencesByName.get( e.getItem() );
458 _mainpanel.getCurrentTreePanel().repaint();
463 void activateButtonToReturnToSuperTree( int index ) {
466 _return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT + " " + index );
469 _return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT );
471 _return_to_super_tree.setForeground( getConfiguration().getGuiCheckboxAndButtonActiveColor() );
472 _return_to_super_tree.setEnabled( true );
476 * Add zoom and quick edit buttons. (Last modified 8/9/04)
479 final JLabel spacer = new JLabel( "" );
480 spacer.setOpaque( false );
482 final JPanel x_panel = new JPanel( new GridLayout( 1, 1, 0, 0 ) );
483 final JPanel y_panel = new JPanel( new GridLayout( 1, 3, 0, 0 ) );
484 final JPanel z_panel = new JPanel( new GridLayout( 1, 1, 0, 0 ) );
485 if ( !getConfiguration().isUseNativeUI() ) {
486 x_panel.setBackground( getBackground() );
487 y_panel.setBackground( getBackground() );
488 z_panel.setBackground( getBackground() );
490 add( _zoom_label = new JLabel( "Zoom:" ) );
491 customizeLabel( _zoom_label, getConfiguration() );
495 if ( getConfiguration().isUseNativeUI() ) {
496 _zoom_in_x = new JButton( "+" );
497 _zoom_out_x = new JButton( "-" );
500 _zoom_in_x = new JButton( "X+" );
501 _zoom_out_x = new JButton( "X-" );
503 _zoom_in_y = new JButton( "Y+" );
504 _zoom_out_y = new JButton( "Y-" );
505 _show_whole = new JButton( "F" );
506 _show_whole.setToolTipText( "To fit the complete phylogeny to the current display size [F or Home]" );
507 _zoom_in_x.setToolTipText( "To zoom in horizontally [Shift+cursor-right]" );
508 _zoom_in_y.setToolTipText( "To zoom in vertically [Shift+cursor-up]" );
509 _zoom_out_x.setToolTipText( "To zoom out horizontally [Shift+cursor-left]" );
510 _zoom_out_y.setToolTipText( "To zoom out vertically [Shift+cursor-down]" );
511 if ( getConfiguration().isUseNativeUI() && ForesterUtil.isMac() ) {
512 _zoom_out_x.setPreferredSize( new Dimension( 55, 10 ) );
513 _zoom_in_x.setPreferredSize( new Dimension( 55, 10 ) );
516 _zoom_out_x.setPreferredSize( new Dimension( 10, 10 ) );
517 _zoom_in_x.setPreferredSize( new Dimension( 10, 10 ) );
519 _zoom_out_y.setPreferredSize( new Dimension( 10, 10 ) );
520 _zoom_in_y.setPreferredSize( new Dimension( 10, 10 ) );
521 _show_whole.setPreferredSize( new Dimension( 10, 10 ) );
522 _return_to_super_tree = new JButton( RETURN_TO_SUPER_TREE_TEXT );
523 _return_to_super_tree.setEnabled( false );
524 _order = new JButton( "Order Subtrees" );
525 _uncollapse_all = new JButton( "Uncollapse All" );
526 addJButton( _zoom_in_y, x_panel );
527 addJButton( _zoom_out_x, y_panel );
528 addJButton( _show_whole, y_panel );
529 addJButton( _zoom_in_x, y_panel );
530 addJButton( _zoom_out_y, z_panel );
531 if ( getConfiguration().doDisplayOption( Configuration.show_domain_architectures ) ) {
532 setUpControlsForDomainStrucures();
534 final JLabel spacer2 = new JLabel( "" );
536 addJButton( _return_to_super_tree, this );
537 addJButton( _order, this );
538 addJButton( _uncollapse_all, this );
539 final JLabel spacer3 = new JLabel( "" );
541 setVisibilityOfDomainStrucureControls();
544 void addCheckbox( final int which, final String title ) {
545 final JPanel ch_panel = new JPanel( new BorderLayout( 0, 0 ) );
547 case Configuration.display_as_phylogram:
548 _display_as_phylogram_cb = new JCheckBox( title );
549 getDisplayAsPhylogramCb().setToolTipText( "To switch between phylogram and cladogram display" );
550 addJCheckBox( getDisplayAsPhylogramCb(), ch_panel );
553 case Configuration.display_internal_data:
554 _display_internal_data = new JCheckBox( title );
555 _display_internal_data.setToolTipText( "To allow or disallow display of internal labels" );
556 addJCheckBox( _display_internal_data, ch_panel );
559 case Configuration.color_according_to_species:
560 _color_acc_species = new JCheckBox( title );
561 _color_acc_species.setToolTipText( "To colorize node labels as a function of taxonomy" );
562 addJCheckBox( _color_acc_species, ch_panel );
565 case Configuration.color_according_to_sequence:
566 _color_acc_sequence = new JCheckBox( title );
567 _color_acc_sequence.setToolTipText( "To colorize node labels as a function of sequence name" );
568 addJCheckBox( _color_acc_sequence, ch_panel );
571 case Configuration.color_according_to_annotation:
572 _color_according_to_annotation = new JCheckBox( title );
573 _color_according_to_annotation
574 .setToolTipText( "To colorize sequence annotation labels as a function of sequence annotation" );
575 addJCheckBox( _color_according_to_annotation, ch_panel );
578 case Configuration.show_node_names:
579 _show_node_names = new JCheckBox( title );
580 addJCheckBox( _show_node_names, ch_panel );
583 case Configuration.show_taxonomy_scientific_names:
584 _show_taxo_scientific_names = new JCheckBox( title );
585 addJCheckBox( _show_taxo_scientific_names, ch_panel );
588 case Configuration.show_taxonomy_common_names:
589 _show_taxo_common_names = new JCheckBox( title );
590 addJCheckBox( _show_taxo_common_names, ch_panel );
593 case Configuration.show_tax_code:
594 _show_taxo_code = new JCheckBox( title );
595 addJCheckBox( _show_taxo_code, ch_panel );
598 case Configuration.show_taxonomy_images:
599 _show_taxo_images_cb = new JCheckBox( title );
600 addJCheckBox( _show_taxo_images_cb, ch_panel );
603 case Configuration.show_binary_characters:
604 _show_binary_characters = new JCheckBox( title );
605 addJCheckBox( _show_binary_characters, ch_panel );
608 case Configuration.show_annotation:
609 _show_annotation = new JCheckBox( title );
610 addJCheckBox( _show_annotation, ch_panel );
613 case Configuration.show_binary_character_counts:
614 _show_binary_character_counts = new JCheckBox( title );
615 addJCheckBox( _show_binary_character_counts, ch_panel );
618 case Configuration.write_confidence_values:
619 _write_confidence = new JCheckBox( title );
620 addJCheckBox( getWriteConfidenceCb(), ch_panel );
623 case Configuration.write_events:
624 _show_events = new JCheckBox( title );
625 addJCheckBox( getShowEventsCb(), ch_panel );
628 case Configuration.use_style:
629 _use_visual_styles_cb = new JCheckBox( title );
630 getUseVisualStylesCb()
631 .setToolTipText( "To use visual styles (node colors, fonts) and branch colors, if present" );
632 addJCheckBox( getUseVisualStylesCb(), ch_panel );
635 case Configuration.width_branches:
636 _width_branches = new JCheckBox( title );
637 _width_branches.setToolTipText( "To use branch width values, if present" );
638 addJCheckBox( _width_branches, ch_panel );
641 case Configuration.write_branch_length_values:
642 _write_branch_length_values = new JCheckBox( title );
643 addJCheckBox( _write_branch_length_values, ch_panel );
646 case Configuration.show_domain_architectures:
647 _show_domain_architectures = new JCheckBox( title );
648 addJCheckBox( _show_domain_architectures, ch_panel );
651 case Configuration.show_mol_seqs:
652 _show_mol_seqs = new JCheckBox( title );
653 addJCheckBox( _show_mol_seqs, ch_panel );
656 case Configuration.show_seq_names:
657 _show_seq_names = new JCheckBox( title );
658 addJCheckBox( _show_seq_names, ch_panel );
661 case Configuration.show_gene_names:
662 _show_gene_names = new JCheckBox( title );
663 addJCheckBox( _show_gene_names, ch_panel );
666 case Configuration.show_seq_symbols:
667 _show_seq_symbols = new JCheckBox( title );
668 addJCheckBox( _show_seq_symbols, ch_panel );
671 case Configuration.show_sequence_acc:
672 _show_sequence_acc = new JCheckBox( title );
673 addJCheckBox( _show_sequence_acc, ch_panel );
676 case Configuration.dynamically_hide_data:
677 _dynamically_hide_data = new JCheckBox( title );
678 getDynamicallyHideData().setToolTipText( "To hide labels depending on expected visibility" );
679 addJCheckBox( getDynamicallyHideData(), ch_panel );
682 case Configuration.node_data_popup:
683 _node_desc_popup_cb = new JCheckBox( title );
684 getNodeDescPopupCb().setToolTipText( "To enable mouse rollover display of basic node data" );
685 addJCheckBox( getNodeDescPopupCb(), ch_panel );
688 case Configuration.show_relation_confidence:
689 _seq_relation_confidence_switch = new JCheckBox( title );
690 addJCheckBox( _seq_relation_confidence_switch, ch_panel );
693 case Configuration.show_vector_data:
694 _show_vector_data_cb = new JCheckBox( title );
695 addJCheckBox( _show_vector_data_cb, ch_panel );
698 case Configuration.show_properties:
699 _show_properties_cb = new JCheckBox( title );
700 addJCheckBox( _show_properties_cb, ch_panel );
704 throw new RuntimeException( "unknown checkbox: " + which );
708 void addJButton( final JButton jb, final JPanel p ) {
709 jb.setFocusPainted( false );
710 jb.setFont( ControlPanel.jcb_font );
711 if ( !_configuration.isUseNativeUI() ) {
712 jb.setBorder( BorderFactory.createLineBorder( getConfiguration().getGuiButtonBorderColor() ) );
713 jb.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
714 jb.setForeground( getConfiguration().getGuiButtonTextColor() );
717 jb.addActionListener( this );
720 void addJCheckBox( final JCheckBox jcb, final JPanel p ) {
721 jcb.setFocusPainted( false );
722 jcb.setFont( ControlPanel.jcb_font );
723 if ( !_configuration.isUseNativeUI() ) {
724 jcb.setBackground( getConfiguration().getGuiBackgroundColor() );
725 jcb.setForeground( getConfiguration().getGuiCheckboxTextColor() );
727 p.add( jcb, "Center" );
728 jcb.addActionListener( this );
731 void addJTextField( final JTextField tf, final JPanel p ) {
732 if ( !_configuration.isUseNativeUI() ) {
733 tf.setForeground( getConfiguration().getGuiBackgroundColor() );
734 tf.setFont( ControlPanel.jcb_font );
737 tf.addActionListener( this );
740 void deactivateButtonToReturnToSuperTree() {
741 _return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT );
742 _return_to_super_tree.setForeground( getConfiguration().getGuiButtonTextColor() );
743 _return_to_super_tree.setEnabled( false );
746 void displayedPhylogenyMightHaveChanged( final boolean recalc_longest_ext_node_info ) {
747 if ( ( _mainpanel != null )
748 && ( ( _mainpanel.getCurrentPhylogeny() != null ) && !_mainpanel.getCurrentPhylogeny().isEmpty() ) ) {
749 if ( getOptions().isShowOverview() ) {
750 _mainpanel.getCurrentTreePanel().updateOvSizes();
752 _mainpanel.getCurrentTreePanel().recalculateMaxDistanceToRoot();
753 setVisibilityOfDomainStrucureControls();
754 updateDomainStructureEvaluethresholdDisplay();
755 _mainpanel.getCurrentTreePanel().calculateScaleDistance();
756 _mainpanel.getCurrentTreePanel().calcMaxDepth();
757 _mainpanel.adjustJScrollPane();
758 if ( recalc_longest_ext_node_info ) {
759 _mainpanel.getCurrentTreePanel().initNodeData();
760 _mainpanel.getCurrentTreePanel().calculateLongestExtNodeInfo();
762 _mainpanel.getCurrentTreePanel().repaint();
763 // _mainpanel.getCurrentTreePanel().setUpUrtFactors();
767 void endClickToOptions() {
768 _click_to_combobox.addActionListener( this );
772 * Indicates what action should be execute when a node is clicked
774 * @return the click-on action
776 NodeClickAction getActionWhenNodeClicked() {
777 return _action_when_node_clicked;
780 Map<Integer, String> getAllClickToItems() {
781 return _all_click_to_names;
784 Map<String, Color> getAnnotationColors() {
785 return _annotation_colors;
788 Configuration getConfiguration() {
789 return _configuration;
792 TreePanel getCurrentTreePanel() {
793 return getMainPanel().getCurrentTreePanel();
796 MainPanel getMainPanel() {
800 Options getOptions() {
801 return getMainPanel().getOptions();
804 JLabel getSearchFoundCountsLabel0() {
805 return _search_found_label_0;
808 JLabel getSearchFoundCountsLabel1() {
809 return _search_found_label_1;
812 JButton getSearchResetButton0() {
813 return _search_reset_button_0;
816 JButton getSearchResetButton1() {
817 return _search_reset_button_1;
820 JTextField getSearchTextField0() {
824 JTextField getSearchTextField1() {
828 List<String> getSingleClickToNames() {
829 return _click_to_names;
832 Map<String, Color> getSpeciesColors() {
833 return _species_colors;
836 Map<String, Color> getSequenceColors() {
837 return _sequence_colors;
840 boolean isAntialiasScreenText() {
844 boolean isColorAccordingToAnnotation() {
845 return ( ( _color_according_to_annotation != null ) && _color_according_to_annotation.isSelected() );
848 boolean isColorAccordingToTaxonomy() {
849 return ( ( _color_acc_species != null ) && _color_acc_species.isSelected() );
852 boolean isColorAccordingToSequence() {
853 return ( ( _color_acc_sequence != null ) && _color_acc_sequence.isSelected() );
856 boolean isUseVisualStyles() {
857 return ( ( ( getUseVisualStylesCb() != null ) && getUseVisualStylesCb().isSelected() ) || ( ( getUseVisualStylesCb() == null ) && _color_branches ) );
860 boolean isDrawPhylogram() {
861 return isDrawPhylogram( getMainPanel().getCurrentTabIndex() );
864 boolean isDynamicallyHideData() {
865 return ( ( getDynamicallyHideData() != null ) && getDynamicallyHideData().isSelected() );
869 return ( ( getShowEventsCb() != null ) && getShowEventsCb().isSelected() );
872 boolean isNodeDescPopup() {
873 return ( ( getNodeDescPopupCb() != null ) && getNodeDescPopupCb().isSelected() );
876 boolean isShowAnnotation() {
877 return ( ( _show_annotation != null ) && _show_annotation.isSelected() );
880 boolean isShowBinaryCharacterCounts() {
881 return ( ( _show_binary_character_counts != null ) && _show_binary_character_counts.isSelected() );
884 boolean isShowBinaryCharacters() {
885 return ( ( _show_binary_characters != null ) && _show_binary_characters.isSelected() );
888 boolean isShowConfidenceValues() {
889 return ( ( getWriteConfidenceCb() != null ) && getWriteConfidenceCb().isSelected() );
892 boolean isWriteBranchLengthValues() {
893 return ( ( _write_branch_length_values != null ) && _write_branch_length_values.isSelected() );
896 boolean isShowDomainArchitectures() {
897 return ( ( _show_domain_architectures != null ) && _show_domain_architectures.isSelected() );
900 public boolean isShowMolSequences() {
901 return ( ( _show_mol_seqs != null ) && _show_mol_seqs.isSelected() );
904 boolean isShowGeneNames() {
905 return ( ( _show_gene_names != null ) && _show_gene_names.isSelected() );
908 boolean isShowInternalData() {
909 return ( ( _display_internal_data == null ) || _display_internal_data.isSelected() );
912 boolean isShowNodeNames() {
913 return ( ( _show_node_names != null ) && _show_node_names.isSelected() );
916 boolean isShowSeqNames() {
917 return ( ( _show_seq_names != null ) && _show_seq_names.isSelected() );
920 boolean isShowSeqSymbols() {
921 return ( ( _show_seq_symbols != null ) && _show_seq_symbols.isSelected() );
924 boolean isShowSequenceAcc() {
925 return ( ( _show_sequence_acc != null ) && _show_sequence_acc.isSelected() );
928 boolean isShowSequenceRelationConfidence() {
929 return ( ( _seq_relation_confidence_switch != null ) && ( _seq_relation_confidence_switch.isSelected() ) );
932 boolean isShowSequenceRelations() {
933 return ( ( _show_sequence_relations != null ) && ( _show_sequence_relations.getSelectedIndex() > 0 ) );
936 boolean isShowTaxonomyCode() {
937 return ( ( _show_taxo_code != null ) && _show_taxo_code.isSelected() );
940 boolean isShowTaxonomyCommonNames() {
941 return ( ( _show_taxo_common_names != null ) && _show_taxo_common_names.isSelected() );
944 boolean isShowTaxonomyScientificNames() {
945 return ( ( _show_taxo_scientific_names != null ) && _show_taxo_scientific_names.isSelected() );
948 boolean isWidthBranches() {
949 return ( ( _width_branches != null ) && _width_branches.isSelected() );
952 void phylogenyAdded( final Configuration configuration ) {
953 getIsDrawPhylogramList().add( configuration.isDrawAsPhylogram() );
956 void phylogenyRemoved( final int index ) {
957 getIsDrawPhylogramList().remove( index );
961 final MainPanel main_panel = getMainPanel();
962 final Phylogeny tree = main_panel.getCurrentPhylogeny();
963 if ( ( tree == null ) || tree.isEmpty() ) {
966 String query = getSearchTextField0().getText();
967 if ( query != null ) {
968 query = query.trim();
970 if ( !ForesterUtil.isEmpty( query ) ) {
971 search0( main_panel, tree, query );
974 getSearchFoundCountsLabel0().setVisible( false );
975 getSearchResetButton0().setEnabled( false );
976 getSearchResetButton0().setVisible( false );
982 final MainPanel main_panel = getMainPanel();
983 final Phylogeny tree = main_panel.getCurrentPhylogeny();
984 if ( ( tree == null ) || tree.isEmpty() ) {
987 String query = getSearchTextField1().getText();
988 if ( query != null ) {
989 query = query.trim();
991 if ( !ForesterUtil.isEmpty( query ) ) {
992 search1( main_panel, tree, query );
995 getSearchFoundCountsLabel1().setVisible( false );
996 getSearchResetButton1().setEnabled( false );
997 getSearchResetButton1().setVisible( false );
1002 void searchReset0() {
1003 if ( getMainPanel().getCurrentTreePanel() != null ) {
1004 getMainPanel().getCurrentTreePanel().setFoundNodes0( null );
1008 void searchReset1() {
1009 if ( getMainPanel().getCurrentTreePanel() != null ) {
1010 getMainPanel().getCurrentTreePanel().setFoundNodes1( null );
1014 void setActionWhenNodeClicked( final NodeClickAction action ) {
1015 _action_when_node_clicked = action;
1018 void setAnnotationColors( final Map<String, Color> annotation_colors ) {
1019 _annotation_colors = annotation_colors;
1022 void setCheckbox( final int which, final boolean state ) {
1024 case Configuration.display_as_phylogram:
1025 if ( getDisplayAsPhylogramCb() != null ) {
1026 getDisplayAsPhylogramCb().setSelected( state );
1029 case Configuration.display_internal_data:
1030 if ( _display_internal_data != null ) {
1031 _display_internal_data.setSelected( state );
1034 case Configuration.color_according_to_species:
1035 if ( _color_acc_species != null ) {
1036 _color_acc_species.setSelected( state );
1039 case Configuration.color_according_to_sequence:
1040 if ( _color_acc_sequence != null ) {
1041 _color_acc_sequence.setSelected( state );
1044 case Configuration.color_according_to_annotation:
1045 if ( _color_according_to_annotation != null ) {
1046 _color_according_to_annotation.setSelected( state );
1049 case Configuration.show_node_names:
1050 if ( _show_node_names != null ) {
1051 _show_node_names.setSelected( state );
1054 case Configuration.show_taxonomy_scientific_names:
1055 if ( _show_taxo_scientific_names != null ) {
1056 _show_taxo_scientific_names.setSelected( state );
1059 case Configuration.show_taxonomy_common_names:
1060 if ( _show_taxo_common_names != null ) {
1061 _show_taxo_common_names.setSelected( state );
1064 case Configuration.show_tax_code:
1065 if ( _show_taxo_code != null ) {
1066 _show_taxo_code.setSelected( state );
1069 case Configuration.show_taxonomy_images:
1070 if ( _show_taxo_images_cb != null ) {
1071 _show_taxo_images_cb.setSelected( state );
1074 case Configuration.show_annotation:
1075 if ( _show_annotation != null ) {
1076 _show_annotation.setSelected( state );
1079 case Configuration.show_binary_characters:
1080 if ( _show_binary_characters != null ) {
1081 _show_binary_characters.setSelected( state );
1084 case Configuration.show_binary_character_counts:
1085 if ( _show_binary_character_counts != null ) {
1086 _show_binary_character_counts.setSelected( state );
1089 case Configuration.write_confidence_values:
1090 if ( getWriteConfidenceCb() != null ) {
1091 getWriteConfidenceCb().setSelected( state );
1094 case Configuration.write_events:
1095 if ( getShowEventsCb() != null ) {
1096 getShowEventsCb().setSelected( state );
1099 case Configuration.use_style:
1100 if ( getUseVisualStylesCb() != null ) {
1101 getUseVisualStylesCb().setSelected( state );
1104 case Configuration.width_branches:
1105 if ( _width_branches != null ) {
1106 _width_branches.setSelected( state );
1109 case Configuration.show_domain_architectures:
1110 if ( _show_domain_architectures != null ) {
1111 _show_domain_architectures.setSelected( state );
1114 case Configuration.write_branch_length_values:
1115 if ( _write_branch_length_values != null ) {
1116 _write_branch_length_values.setSelected( state );
1119 case Configuration.show_mol_seqs:
1120 if ( _show_mol_seqs != null ) {
1121 _show_mol_seqs.setSelected( state );
1124 case Configuration.show_seq_names:
1125 if ( _show_seq_names != null ) {
1126 _show_seq_names.setSelected( state );
1129 case Configuration.show_gene_names:
1130 if ( _show_gene_names != null ) {
1131 _show_gene_names.setSelected( state );
1134 case Configuration.show_seq_symbols:
1135 if ( _show_seq_symbols != null ) {
1136 _show_seq_symbols.setSelected( state );
1139 case Configuration.show_vector_data:
1140 if ( _show_vector_data_cb != null ) {
1141 _show_vector_data_cb.setSelected( state );
1144 case Configuration.show_properties:
1145 if ( _show_properties_cb != null ) {
1146 _show_properties_cb.setSelected( state );
1149 case Configuration.show_sequence_acc:
1150 if ( _show_sequence_acc != null ) {
1151 _show_sequence_acc.setSelected( state );
1154 case Configuration.dynamically_hide_data:
1155 if ( getDynamicallyHideData() != null ) {
1156 getDynamicallyHideData().setSelected( state );
1159 case Configuration.node_data_popup:
1160 if ( getNodeDescPopupCb() != null ) {
1161 getNodeDescPopupCb().setSelected( state );
1165 case Configuration.show_relation_confidence:
1166 if ( _seq_relation_confidence_switch != null ) {
1167 _seq_relation_confidence_switch.setSelected( state );
1172 throw new AssertionError( "unknown checkbox: " + which );
1177 * Set this checkbox state. Not all checkboxes have been instantiated
1178 * depending on the config.
1180 void setCheckbox( final JCheckBox cb, final boolean state ) {
1182 cb.setSelected( state );
1186 void setClickToAction( final int action ) {
1187 // Set click-to action
1188 if ( action == _show_data_item ) {
1189 setActionWhenNodeClicked( NodeClickAction.SHOW_DATA );
1191 else if ( action == _collapse_cb_item ) {
1192 setActionWhenNodeClicked( NodeClickAction.COLLAPSE );
1194 else if ( action == _reroot_cb_item ) {
1195 setActionWhenNodeClicked( NodeClickAction.REROOT );
1197 else if ( action == _subtree_cb_item ) {
1198 setActionWhenNodeClicked( NodeClickAction.SUBTREE );
1200 else if ( action == _swap_cb_item ) {
1201 setActionWhenNodeClicked( NodeClickAction.SWAP );
1203 else if ( action == _color_subtree_cb_item ) {
1204 setActionWhenNodeClicked( NodeClickAction.COLOR_SUBTREE );
1206 else if ( action == _open_seq_web_item ) {
1207 setActionWhenNodeClicked( NodeClickAction.OPEN_SEQ_WEB );
1209 else if ( action == _sort_descendents_item ) {
1210 setActionWhenNodeClicked( NodeClickAction.SORT_DESCENDENTS );
1212 else if ( action == _blast_item ) {
1213 setActionWhenNodeClicked( NodeClickAction.BLAST );
1215 else if ( action == _open_tax_web_item ) {
1216 setActionWhenNodeClicked( NodeClickAction.OPEN_TAX_WEB );
1218 else if ( action == _cut_subtree_item ) {
1219 setActionWhenNodeClicked( NodeClickAction.CUT_SUBTREE );
1221 else if ( action == _copy_subtree_item ) {
1222 setActionWhenNodeClicked( NodeClickAction.COPY_SUBTREE );
1224 else if ( action == _delete_node_or_subtree_item ) {
1225 setActionWhenNodeClicked( NodeClickAction.DELETE_NODE_OR_SUBTREE );
1227 else if ( action == _paste_subtree_item ) {
1228 setActionWhenNodeClicked( NodeClickAction.PASTE_SUBTREE );
1230 else if ( action == _add_new_node_item ) {
1231 setActionWhenNodeClicked( NodeClickAction.ADD_NEW_NODE );
1233 else if ( action == _edit_node_data_item ) {
1234 setActionWhenNodeClicked( NodeClickAction.EDIT_NODE_DATA );
1236 else if ( action == _select_nodes_item ) {
1237 setActionWhenNodeClicked( NodeClickAction.SELECT_NODES );
1239 else if ( action == _get_ext_desc_data ) {
1240 setActionWhenNodeClicked( NodeClickAction.GET_EXT_DESC_DATA );
1242 else if ( action == _open_pdb_item ) {
1243 setActionWhenNodeClicked( NodeClickAction.OPEN_PDB_WEB );
1245 else if ( action == _color_node_font_item ) {
1246 setActionWhenNodeClicked( NodeClickAction.COLOR_NODE_FONT );
1248 else if ( action == _change_node_font_item ) {
1249 setActionWhenNodeClicked( NodeClickAction.CHANGE_NODE_FONT );
1252 throw new RuntimeException( "unknown action: " + action );
1254 // make sure drop down is displaying the correct action
1255 // in case this was called from outside the class
1256 _click_to_combobox.setSelectedIndex( action );
1259 void setColorBranches( final boolean color_branches ) {
1260 _color_branches = color_branches;
1263 void setDrawPhylogram( final boolean b ) {
1264 getDisplayAsPhylogramCb().setSelected( b );
1265 setDrawPhylogram( getMainPanel().getCurrentTabIndex(), b );
1268 void setDrawPhylogramEnabled( final boolean b ) {
1269 getDisplayAsPhylogramCb().setEnabled( b );
1272 void setDynamicHidingIsOn( final boolean is_on ) {
1274 getDynamicallyHideData().setForeground( getConfiguration().getGuiCheckboxAndButtonActiveColor() );
1277 if ( !_configuration.isUseNativeUI() ) {
1278 getDynamicallyHideData().setForeground( getConfiguration().getGuiButtonTextColor() );
1281 getDynamicallyHideData().setForeground( Color.BLACK );
1286 void setSearchFoundCountsOnLabel0( final int counts ) {
1287 getSearchFoundCountsLabel0().setText( "Found: " + counts );
1290 void setSearchFoundCountsOnLabel1( final int counts ) {
1291 getSearchFoundCountsLabel1().setText( "Found: " + counts );
1294 void setShowEvents( final boolean show_events ) {
1295 if ( getShowEventsCb() == null ) {
1296 _show_events = new JCheckBox( "" );
1298 getShowEventsCb().setSelected( show_events );
1301 void setSpeciesColors( final Map<String, Color> species_colors ) {
1302 _species_colors = species_colors;
1305 void setSequenceColors( final Map<String, Color> sequence_colors ) {
1306 _sequence_colors = sequence_colors;
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 );
1514 _mainpanel.getCurrentTreePanel().resetPreferredSize();
1515 _mainpanel.adjustJScrollPane();
1516 _mainpanel.getCurrentTreePanel().repaint();
1517 _mainpanel.getCurrentTreePanel().validate();
1518 _mainpanel.validate();
1519 _mainpanel.getCurrentTreePanel().calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
1520 _mainpanel.getSizeOfViewport().height );
1521 _mainpanel.getCurrentTreePanel().resetPreferredSize();
1522 _mainpanel.adjustJScrollPane();
1523 _mainpanel.getCurrentTreePanel().repaint();
1524 _mainpanel.getCurrentTreePanel().updateOvSizes();
1527 void showWholeAll() {
1528 for( final TreePanel tree_panel : _mainpanel.getTreePanels() ) {
1529 if ( tree_panel != null ) {
1530 tree_panel.validate();
1531 tree_panel.calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
1532 _mainpanel.getSizeOfViewport().height );
1533 tree_panel.resetPreferredSize();
1534 tree_panel.repaint();
1539 // Create header for click-to combo box.
1540 void startClickToOptions() {
1541 final JLabel spacer = new JLabel( "" );
1542 spacer.setFont( ControlPanel.jcb_font );
1544 _click_to_label = new JLabel( "Click on Node to:" );
1545 add( customizeLabel( _click_to_label, getConfiguration() ) );
1546 _click_to_combobox = new JComboBox<String>();
1547 _click_to_combobox.setFocusable( false );
1548 _click_to_combobox.setMaximumRowCount( 14 );
1549 _click_to_combobox.setFont( ControlPanel.js_font );
1550 if ( !_configuration.isUseNativeUI() ) {
1551 _click_to_combobox.setBackground( getConfiguration().getGuiBackgroundColor() );
1553 // don't add listener until all items are set (or each one will trigger
1555 // click_to_list.addActionListener(this);
1556 add( _click_to_combobox );
1557 // Correlates option names to titles
1558 _all_click_to_names = new HashMap<Integer, String>();
1559 _click_to_names = new ArrayList<String>();
1563 if ( getMainPanel().getTabbedPane().getTabCount() > 0 ) {
1564 if ( getCurrentTreePanel().isPhyHasBranchLengths()
1565 && ( getCurrentTreePanel().getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) {
1566 setDrawPhylogramEnabled( true );
1567 setDrawPhylogram( isDrawPhylogram() );
1570 setDrawPhylogramEnabled( false );
1571 setDrawPhylogram( false );
1573 if ( getMainPanel().getMainFrame() == null ) {
1574 // Must be "E" applet version.
1575 final ArchaeopteryxE e = ( ArchaeopteryxE ) ( ( MainPanelApplets ) getMainPanel() ).getApplet();
1576 e.setSelectedTypeInTypeMenu( e.getCurrentTreePanel().getPhylogenyGraphicsType() );
1579 getMainPanel().getMainFrame().setSelectedTypeInTypeMenu( getMainPanel().getCurrentTreePanel()
1580 .getPhylogenyGraphicsType() );
1582 getMainPanel().getCurrentTreePanel().updateSubSuperTreeButton();
1583 getMainPanel().getControlPanel().search0();
1584 getMainPanel().getControlPanel().search1();
1585 getMainPanel().getControlPanel().updateDomainStructureEvaluethresholdDisplay();
1586 getSequenceRelationTypeBox().removeAllItems();
1587 for( final SequenceRelation.SEQUENCE_RELATION_TYPE type : getMainPanel().getCurrentPhylogeny()
1588 .getRelevantSequenceRelationTypes() ) {
1589 _sequence_relation_type_box.addItem( type );
1591 getMainPanel().getCurrentTreePanel().repaint();
1592 //setSequenceRelationQueries( getMainPanel().getCurrentPhylogeny().getSequenceRelationQueries() );
1593 // according to GUILHEM the line above can be removed.
1598 * Uncollapse all nodes.
1600 void uncollapseAll( final TreePanel tp ) {
1601 final Phylogeny t = tp.getPhylogeny();
1602 if ( ( t != null ) && !t.isEmpty() ) {
1603 for( final PhylogenyNodeIterator iter = t.iteratorPreorder(); iter.hasNext(); ) {
1604 final PhylogenyNode node = iter.next();
1605 node.setCollapse( false );
1607 tp.resetNodeIdToDistToLeafMap();
1608 tp.updateSetOfCollapsedExternalNodes();
1609 t.recalculateNumberOfExternalDescendants( false );
1610 tp.setNodeInPreorderToNull();
1611 t.clearHashIdToNodeMap();
1616 void updateDomainStructureEvaluethresholdDisplay() {
1617 if ( _domain_structure_evalue_thr_tf != null ) {
1618 _domain_structure_evalue_thr_tf.setText( "10^"
1619 + getMainPanel().getCurrentTreePanel().getDomainStructureEvalueThresholdExp() );
1623 void zoomInX( final float factor, final float x_correction_factor ) {
1624 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar();
1625 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1626 treepanel.multiplyUrtFactor( 1f );
1627 if ( ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
1628 || ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
1629 || isDrawPhylogram( getMainPanel().getCurrentTabIndex() )
1630 || ( getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP ) ) {
1631 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1632 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
1633 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
1634 getMainPanel().adjustJScrollPane();
1635 treepanel.resetPreferredSize();
1636 getMainPanel().getCurrentScrollPane().getViewport().validate();
1637 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1638 - ( sb.getVisibleAmount() / 2.0 ) ) );
1641 final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue();
1642 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
1643 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
1644 getMainPanel().adjustJScrollPane();
1645 treepanel.resetPreferredSize();
1646 getMainPanel().getCurrentScrollPane().getViewport().validate();
1647 sb.setValue( sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount() );
1649 treepanel.resetPreferredSize();
1650 treepanel.updateOvSizes();
1653 void zoomInY( final float factor ) {
1654 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getVerticalScrollBar();
1655 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1656 treepanel.multiplyUrtFactor( 1.1f );
1657 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1658 treepanel.setYdistance( ( treepanel.getYdistance() * factor ) );
1659 getMainPanel().adjustJScrollPane();
1660 treepanel.resetPreferredSize();
1661 getMainPanel().getCurrentScrollPane().getViewport().validate();
1662 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1663 - ( sb.getVisibleAmount() / 2.0 ) ) );
1664 treepanel.resetPreferredSize();
1665 treepanel.updateOvSizes();
1668 void zoomOutX( final float factor, final float x_correction_factor ) {
1669 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1670 treepanel.multiplyUrtFactor( 1f );
1671 if ( ( treepanel.getXdistance() * factor ) > 0.0 ) {
1672 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar();
1673 if ( ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
1674 || ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
1675 || isDrawPhylogram( getMainPanel().getCurrentTabIndex() )
1676 || ( getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP ) ) {
1677 getMainPanel().adjustJScrollPane();
1678 treepanel.resetPreferredSize();
1679 getMainPanel().getCurrentScrollPane().getViewport().validate();
1680 final double x = ( sb.getMaximum() - sb.getMinimum() )
1681 / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1682 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
1683 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
1684 getMainPanel().adjustJScrollPane();
1685 treepanel.resetPreferredSize();
1686 getMainPanel().getCurrentScrollPane().getViewport().validate();
1687 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1688 - ( sb.getVisibleAmount() / 2.0 ) ) );
1691 final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue();
1692 treepanel.setXdistance( treepanel.getXdistance() * factor );
1693 treepanel.setXcorrectionFactor( treepanel.getXcorrectionFactor() * x_correction_factor );
1695 getMainPanel().adjustJScrollPane();
1696 treepanel.resetPreferredSize();
1697 getMainPanel().getCurrentScrollPane().getViewport().validate();
1698 sb.setValue( sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount() );
1701 treepanel.resetPreferredSize();
1702 treepanel.updateOvSizes();
1706 void zoomOutY( final float factor ) {
1707 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1708 treepanel.multiplyUrtFactor( 0.9f );
1709 if ( ( treepanel.getYdistance() * factor ) > 0.0 ) {
1710 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getVerticalScrollBar();
1711 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1712 treepanel.setYdistance( ( treepanel.getYdistance() * factor ) );
1713 getMainPanel().adjustJScrollPane();
1714 treepanel.resetPreferredSize();
1715 getMainPanel().getCurrentScrollPane().getViewport().validate();
1716 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1717 - ( sb.getVisibleAmount() / 2.0 ) ) );
1718 treepanel.resetPreferredSize();
1719 treepanel.updateOvSizes();
1723 private void addClickToOption( final int which, final String title ) {
1724 _click_to_combobox.addItem( title );
1725 _click_to_names.add( title );
1726 _all_click_to_names.put( new Integer( which ), title );
1727 if ( !_configuration.isUseNativeUI() ) {
1728 _click_to_combobox.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
1729 _click_to_combobox.setForeground( getConfiguration().getGuiButtonTextColor() );
1734 private void addSequenceRelationBlock() {
1735 final JLabel spacer = new JLabel( "" );
1736 spacer.setSize( 1, 1 );
1738 final JLabel mainLabel = new JLabel( "Sequence relations to display" );
1739 final JLabel typeLabel = customizeLabel( new JLabel( "(type) " ), getConfiguration() );
1740 typeLabel.setFont( ControlPanel.js_font.deriveFont( 7 ) );
1741 getSequenceRelationTypeBox().setFocusable( false );
1742 _sequence_relation_type_box.setFont( ControlPanel.js_font );
1743 if ( !_configuration.isUseNativeUI() ) {
1744 _sequence_relation_type_box.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
1745 _sequence_relation_type_box.setForeground( getConfiguration().getGuiButtonTextColor() );
1747 _sequence_relation_type_box.setRenderer( new ListCellRenderer<Object>() {
1750 public Component getListCellRendererComponent( final JList<?> list,
1753 final boolean isSelected,
1754 final boolean cellHasFocus ) {
1755 final Component component = new DefaultListCellRenderer().getListCellRendererComponent( list,
1760 if ( ( value != null ) && ( value instanceof SequenceRelation.SEQUENCE_RELATION_TYPE ) ) {
1761 ( ( DefaultListCellRenderer ) component ).setText( SequenceRelation
1762 .getPrintableNameByType( ( SequenceRelation.SEQUENCE_RELATION_TYPE ) value ) );
1767 final GridBagLayout gbl = new GridBagLayout();
1768 _sequence_relation_type_box.setMinimumSize( new Dimension( 115, 17 ) );
1769 _sequence_relation_type_box.setPreferredSize( new Dimension( 115, 20 ) );
1770 final JPanel horizGrid = new JPanel( gbl );
1771 horizGrid.setBackground( getBackground() );
1772 horizGrid.add( typeLabel );
1773 horizGrid.add( _sequence_relation_type_box );
1774 add( customizeLabel( mainLabel, getConfiguration() ) );
1776 add( getSequenceRelationBox() );
1777 if ( _configuration.doDisplayOption( Configuration.show_relation_confidence ) ) {
1778 addCheckbox( Configuration.show_relation_confidence,
1779 _configuration.getDisplayTitle( Configuration.show_relation_confidence ) );
1780 setCheckbox( Configuration.show_relation_confidence,
1781 _configuration.doCheckOption( Configuration.show_relation_confidence ) );
1783 }// addSequenceRelationBlock
1786 private List<Boolean> getIsDrawPhylogramList() {
1787 return _draw_phylogram;
1790 private void init() {
1791 _draw_phylogram = new ArrayList<Boolean>();
1792 setSpeciesColors( new HashMap<String, Color>() );
1793 setSequenceColors( new HashMap<String, Color>() );
1794 setAnnotationColors( new HashMap<String, Color>() );
1797 private boolean isDrawPhylogram( final int index ) {
1798 return getIsDrawPhylogramList().get( index );
1801 private void search0( final MainPanel main_panel, final Phylogeny tree, final String query_str ) {
1802 getSearchFoundCountsLabel0().setVisible( true );
1803 getSearchResetButton0().setEnabled( true );
1804 getSearchResetButton0().setVisible( true );
1805 String[] queries = null;
1806 List<PhylogenyNode> nodes = null;
1807 if ( ( query_str.indexOf( ',' ) >= 0 ) && !getOptions().isSearchWithRegex() ) {
1808 queries = query_str.split( ",+" );
1811 queries = new String[ 1 ];
1812 queries[ 0 ] = query_str.trim();
1814 if ( ( queries != null ) && ( queries.length > 0 ) ) {
1815 nodes = new ArrayList<PhylogenyNode>();
1816 for( String query : queries ) {
1817 if ( ForesterUtil.isEmpty( query ) ) {
1820 query = query.trim();
1821 final TreePanel tp = getMainPanel().getCurrentTreePanel();
1822 if ( ( query.indexOf( '+' ) > 0 ) && !getOptions().isSearchWithRegex() ) {
1823 nodes.addAll( PhylogenyMethods.searchDataLogicalAnd( query.split( "\\++" ),
1825 getOptions().isSearchCaseSensitive(),
1826 !getOptions().isMatchWholeTermsOnly(),
1827 isShowDomainArchitectures(),
1828 tp != null ? Math.pow( 10,
1829 tp.getDomainStructureEvalueThresholdExp() )
1833 nodes.addAll( PhylogenyMethods.searchData( query,
1835 getOptions().isSearchCaseSensitive(),
1836 !getOptions().isMatchWholeTermsOnly(),
1837 getOptions().isSearchWithRegex(),
1838 isShowDomainArchitectures(),
1839 tp != null ? Math.pow( 10, tp
1840 .getDomainStructureEvalueThresholdExp() ) : 0 ) );
1843 if ( getOptions().isInverseSearchResult() ) {
1844 final List<PhylogenyNode> all = PhylogenyMethods.obtainAllNodesAsList( tree );
1845 all.removeAll( nodes );
1849 if ( ( nodes != null ) && ( nodes.size() > 0 ) ) {
1850 main_panel.getCurrentTreePanel().setFoundNodes0( new HashSet<Long>() );
1851 for( final PhylogenyNode node : nodes ) {
1852 main_panel.getCurrentTreePanel().getFoundNodes0().add( node.getId() );
1854 setSearchFoundCountsOnLabel0( nodes.size() );
1857 setSearchFoundCountsOnLabel0( 0 );
1862 private void search1( final MainPanel main_panel, final Phylogeny tree, final String query_str ) {
1863 getSearchFoundCountsLabel1().setVisible( true );
1864 getSearchResetButton1().setEnabled( true );
1865 getSearchResetButton1().setVisible( true );
1866 String[] queries = null;
1867 List<PhylogenyNode> nodes = null;
1868 if ( ( query_str.indexOf( ',' ) >= 0 ) && !getOptions().isSearchWithRegex() ) {
1869 queries = query_str.split( ",+" );
1872 queries = new String[ 1 ];
1873 queries[ 0 ] = query_str.trim();
1875 if ( ( queries != null ) && ( queries.length > 0 ) ) {
1876 nodes = new ArrayList<PhylogenyNode>();
1877 for( String query : queries ) {
1878 if ( ForesterUtil.isEmpty( query ) ) {
1881 query = query.trim();
1882 final TreePanel tp = getMainPanel().getCurrentTreePanel();
1883 if ( ( query.indexOf( '+' ) > 0 ) && !getOptions().isSearchWithRegex() ) {
1884 nodes.addAll( PhylogenyMethods.searchDataLogicalAnd( query.split( "\\++" ),
1886 getOptions().isSearchCaseSensitive(),
1887 !getOptions().isMatchWholeTermsOnly(),
1888 isShowDomainArchitectures(),
1889 tp != null ? Math.pow( 10,
1890 tp.getDomainStructureEvalueThresholdExp() )
1894 nodes.addAll( PhylogenyMethods.searchData( query,
1896 getOptions().isSearchCaseSensitive(),
1897 !getOptions().isMatchWholeTermsOnly(),
1898 getOptions().isSearchWithRegex(),
1899 isShowDomainArchitectures(),
1900 tp != null ? Math.pow( 10, tp
1901 .getDomainStructureEvalueThresholdExp() ) : 0 ) );
1904 if ( getOptions().isInverseSearchResult() ) {
1905 final List<PhylogenyNode> all = PhylogenyMethods.obtainAllNodesAsList( tree );
1906 all.removeAll( nodes );
1910 if ( ( nodes != null ) && ( nodes.size() > 0 ) ) {
1911 main_panel.getCurrentTreePanel().setFoundNodes1( new HashSet<Long>() );
1912 for( final PhylogenyNode node : nodes ) {
1913 main_panel.getCurrentTreePanel().getFoundNodes1().add( node.getId() );
1915 setSearchFoundCountsOnLabel1( nodes.size() );
1918 setSearchFoundCountsOnLabel1( 0 );
1923 private void setDrawPhylogram( final int index, final boolean b ) {
1924 getIsDrawPhylogramList().set( index, b );
1927 private void setupClickToOptions() {
1928 final int default_option = _configuration.getDefaultDisplayClicktoOption();
1929 int selected_index = 0;
1931 if ( _configuration.doDisplayClickToOption( Configuration.display_node_data ) ) {
1932 _show_data_item = cb_index;
1933 addClickToOption( Configuration.display_node_data,
1934 _configuration.getClickToTitle( Configuration.display_node_data ) );
1935 if ( default_option == Configuration.display_node_data ) {
1936 selected_index = cb_index;
1940 if ( _configuration.doDisplayClickToOption( Configuration.collapse_uncollapse ) ) {
1941 _collapse_cb_item = cb_index;
1942 addClickToOption( Configuration.collapse_uncollapse,
1943 _configuration.getClickToTitle( Configuration.collapse_uncollapse ) );
1944 if ( default_option == Configuration.collapse_uncollapse ) {
1945 selected_index = cb_index;
1949 if ( _configuration.doDisplayClickToOption( Configuration.reroot ) ) {
1950 _reroot_cb_item = cb_index;
1951 addClickToOption( Configuration.reroot, _configuration.getClickToTitle( Configuration.reroot ) );
1952 if ( default_option == Configuration.reroot ) {
1953 selected_index = cb_index;
1957 if ( _configuration.doDisplayClickToOption( Configuration.subtree ) ) {
1958 _subtree_cb_item = cb_index;
1959 addClickToOption( Configuration.subtree, _configuration.getClickToTitle( Configuration.subtree ) );
1960 if ( default_option == Configuration.subtree ) {
1961 selected_index = cb_index;
1965 if ( _configuration.doDisplayClickToOption( Configuration.swap ) ) {
1966 _swap_cb_item = cb_index;
1967 addClickToOption( Configuration.swap, _configuration.getClickToTitle( Configuration.swap ) );
1968 if ( default_option == Configuration.swap ) {
1969 selected_index = cb_index;
1973 if ( _configuration.doDisplayClickToOption( Configuration.sort_descendents ) ) {
1974 _sort_descendents_item = cb_index;
1975 addClickToOption( Configuration.sort_descendents,
1976 _configuration.getClickToTitle( Configuration.sort_descendents ) );
1977 if ( default_option == Configuration.sort_descendents ) {
1978 selected_index = cb_index;
1982 if ( _configuration.doDisplayClickToOption( Configuration.color_node_font ) ) {
1983 _color_node_font_item = cb_index;
1984 addClickToOption( Configuration.color_node_font,
1985 _configuration.getClickToTitle( Configuration.color_node_font ) );
1986 if ( default_option == Configuration.color_node_font ) {
1987 selected_index = cb_index;
1991 if ( _configuration.doDisplayClickToOption( Configuration.change_node_font ) ) {
1992 _change_node_font_item = cb_index;
1993 addClickToOption( Configuration.change_node_font,
1994 _configuration.getClickToTitle( Configuration.change_node_font ) );
1995 if ( default_option == Configuration.change_node_font ) {
1996 selected_index = cb_index;
2000 if ( _configuration.doDisplayClickToOption( Configuration.color_subtree ) ) {
2001 _color_subtree_cb_item = cb_index;
2002 addClickToOption( Configuration.color_subtree, _configuration.getClickToTitle( Configuration.color_subtree ) );
2003 if ( default_option == Configuration.color_subtree ) {
2004 selected_index = cb_index;
2008 if ( _configuration.doDisplayClickToOption( Configuration.open_seq_web ) ) {
2009 _open_seq_web_item = cb_index;
2010 addClickToOption( Configuration.open_seq_web, _configuration.getClickToTitle( Configuration.open_seq_web ) );
2011 if ( default_option == Configuration.open_seq_web ) {
2012 selected_index = cb_index;
2016 if ( _configuration.doDisplayClickToOption( Configuration.open_pdb_web ) ) {
2017 _open_pdb_item = cb_index;
2018 addClickToOption( Configuration.open_pdb_web, _configuration.getClickToTitle( Configuration.open_pdb_web ) );
2019 if ( default_option == Configuration.open_pdb_web ) {
2020 selected_index = cb_index;
2024 if ( _configuration.doDisplayClickToOption( Configuration.open_tax_web ) ) {
2025 _open_tax_web_item = cb_index;
2026 addClickToOption( Configuration.open_tax_web, _configuration.getClickToTitle( Configuration.open_tax_web ) );
2027 if ( default_option == Configuration.open_tax_web ) {
2028 selected_index = cb_index;
2032 if ( _configuration.doDisplayClickToOption( Configuration.blast ) ) {
2033 _blast_item = cb_index;
2034 addClickToOption( Configuration.blast, _configuration.getClickToTitle( Configuration.blast ) );
2035 if ( default_option == Configuration.blast ) {
2036 selected_index = cb_index;
2040 if ( _configuration.doDisplayClickToOption( Configuration.select_nodes ) ) {
2041 _select_nodes_item = cb_index;
2042 addClickToOption( Configuration.select_nodes, _configuration.getClickToTitle( Configuration.select_nodes ) );
2043 if ( default_option == Configuration.select_nodes ) {
2044 selected_index = cb_index;
2048 if ( _configuration.doDisplayClickToOption( Configuration.get_ext_desc_data ) ) {
2049 _get_ext_desc_data = cb_index;
2050 if ( !ForesterUtil.isEmpty( getConfiguration().getLabelForGetExtDescendentsData() ) ) {
2051 addClickToOption( Configuration.get_ext_desc_data, getConfiguration()
2052 .getLabelForGetExtDescendentsData() );
2055 addClickToOption( Configuration.get_ext_desc_data,
2056 getConfiguration().getClickToTitle( Configuration.get_ext_desc_data ) );
2058 if ( default_option == Configuration.get_ext_desc_data ) {
2059 selected_index = cb_index;
2063 if ( getOptions().isEditable() ) {
2064 if ( _configuration.doDisplayClickToOption( Configuration.cut_subtree ) ) {
2065 _cut_subtree_item = cb_index;
2066 addClickToOption( Configuration.cut_subtree, _configuration.getClickToTitle( Configuration.cut_subtree ) );
2067 if ( default_option == Configuration.cut_subtree ) {
2068 selected_index = cb_index;
2072 if ( _configuration.doDisplayClickToOption( Configuration.copy_subtree ) ) {
2073 _copy_subtree_item = cb_index;
2074 addClickToOption( Configuration.copy_subtree,
2075 _configuration.getClickToTitle( Configuration.copy_subtree ) );
2076 if ( default_option == Configuration.copy_subtree ) {
2077 selected_index = cb_index;
2081 if ( _configuration.doDisplayClickToOption( Configuration.paste_subtree ) ) {
2082 _paste_subtree_item = cb_index;
2083 addClickToOption( Configuration.paste_subtree,
2084 _configuration.getClickToTitle( Configuration.paste_subtree ) );
2085 if ( default_option == Configuration.paste_subtree ) {
2086 selected_index = cb_index;
2090 if ( _configuration.doDisplayClickToOption( Configuration.delete_subtree_or_node ) ) {
2091 _delete_node_or_subtree_item = cb_index;
2092 addClickToOption( Configuration.delete_subtree_or_node,
2093 _configuration.getClickToTitle( Configuration.delete_subtree_or_node ) );
2094 if ( default_option == Configuration.delete_subtree_or_node ) {
2095 selected_index = cb_index;
2099 if ( _configuration.doDisplayClickToOption( Configuration.add_new_node ) ) {
2100 _add_new_node_item = cb_index;
2101 addClickToOption( Configuration.add_new_node,
2102 _configuration.getClickToTitle( Configuration.add_new_node ) );
2103 if ( default_option == Configuration.add_new_node ) {
2104 selected_index = cb_index;
2108 if ( _configuration.doDisplayClickToOption( Configuration.edit_node_data ) ) {
2109 _edit_node_data_item = cb_index;
2110 addClickToOption( Configuration.edit_node_data,
2111 _configuration.getClickToTitle( Configuration.edit_node_data ) );
2112 if ( default_option == Configuration.edit_node_data ) {
2113 selected_index = cb_index;
2118 // Set default selection and its action
2119 _click_to_combobox.setSelectedIndex( selected_index );
2120 setClickToAction( selected_index );
2123 private void setupDisplayCheckboxes() {
2124 if ( _configuration.doDisplayOption( Configuration.display_as_phylogram ) ) {
2125 addCheckbox( Configuration.display_as_phylogram,
2126 _configuration.getDisplayTitle( Configuration.display_as_phylogram ) );
2127 setCheckbox( Configuration.display_as_phylogram,
2128 _configuration.doCheckOption( Configuration.display_as_phylogram ) );
2130 if ( _configuration.doDisplayOption( Configuration.dynamically_hide_data ) ) {
2131 addCheckbox( Configuration.dynamically_hide_data,
2132 _configuration.getDisplayTitle( Configuration.dynamically_hide_data ) );
2133 setCheckbox( Configuration.dynamically_hide_data,
2134 _configuration.doCheckOption( Configuration.dynamically_hide_data ) );
2136 if ( _configuration.doDisplayOption( Configuration.node_data_popup ) ) {
2137 addCheckbox( Configuration.node_data_popup, _configuration.getDisplayTitle( Configuration.node_data_popup ) );
2138 setCheckbox( Configuration.node_data_popup, _configuration.doCheckOption( Configuration.node_data_popup ) );
2140 if ( _configuration.doDisplayOption( Configuration.display_internal_data ) ) {
2141 addCheckbox( Configuration.display_internal_data,
2142 _configuration.getDisplayTitle( Configuration.display_internal_data ) );
2143 setCheckbox( Configuration.display_internal_data,
2144 _configuration.doCheckOption( Configuration.display_internal_data ) );
2146 if ( _configuration.doDisplayOption( Configuration.color_according_to_sequence ) ) {
2147 addCheckbox( Configuration.color_according_to_sequence,
2148 _configuration.getDisplayTitle( Configuration.color_according_to_sequence ) );
2149 setCheckbox( Configuration.color_according_to_sequence,
2150 _configuration.doCheckOption( Configuration.color_according_to_sequence ) );
2152 if ( _configuration.doDisplayOption( Configuration.color_according_to_species ) ) {
2153 addCheckbox( Configuration.color_according_to_species,
2154 _configuration.getDisplayTitle( Configuration.color_according_to_species ) );
2155 setCheckbox( Configuration.color_according_to_species,
2156 _configuration.doCheckOption( Configuration.color_according_to_species ) );
2158 if ( _configuration.doDisplayOption( Configuration.color_according_to_annotation ) ) {
2159 addCheckbox( Configuration.color_according_to_annotation,
2160 _configuration.getDisplayTitle( Configuration.color_according_to_annotation ) );
2161 setCheckbox( Configuration.color_according_to_annotation,
2162 _configuration.doCheckOption( Configuration.color_according_to_annotation ) );
2164 if ( _configuration.doDisplayOption( Configuration.use_style ) ) {
2165 addCheckbox( Configuration.use_style, _configuration.getDisplayTitle( Configuration.use_style ) );
2166 setCheckbox( Configuration.use_style, _configuration.doCheckOption( Configuration.use_style ) );
2168 if ( _configuration.doDisplayOption( Configuration.width_branches ) ) {
2169 addCheckbox( Configuration.width_branches, _configuration.getDisplayTitle( Configuration.width_branches ) );
2170 setCheckbox( Configuration.width_branches, _configuration.doCheckOption( Configuration.width_branches ) );
2172 final JLabel label = new JLabel( "Display Data:" );
2173 label.setFont( ControlPanel.jcb_bold_font );
2174 if ( !getConfiguration().isUseNativeUI() ) {
2175 label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
2178 if ( _configuration.doDisplayOption( Configuration.show_node_names ) ) {
2179 addCheckbox( Configuration.show_node_names, _configuration.getDisplayTitle( Configuration.show_node_names ) );
2180 setCheckbox( Configuration.show_node_names, _configuration.doCheckOption( Configuration.show_node_names ) );
2182 if ( _configuration.doDisplayOption( Configuration.show_tax_code ) ) {
2183 addCheckbox( Configuration.show_tax_code, _configuration.getDisplayTitle( Configuration.show_tax_code ) );
2184 setCheckbox( Configuration.show_tax_code, _configuration.doCheckOption( Configuration.show_tax_code ) );
2186 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_scientific_names ) ) {
2187 addCheckbox( Configuration.show_taxonomy_scientific_names,
2188 _configuration.getDisplayTitle( Configuration.show_taxonomy_scientific_names ) );
2189 setCheckbox( Configuration.show_taxonomy_scientific_names,
2190 _configuration.doCheckOption( Configuration.show_taxonomy_scientific_names ) );
2192 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_common_names ) ) {
2193 addCheckbox( Configuration.show_taxonomy_common_names,
2194 _configuration.getDisplayTitle( Configuration.show_taxonomy_common_names ) );
2195 setCheckbox( Configuration.show_taxonomy_common_names,
2196 _configuration.doCheckOption( Configuration.show_taxonomy_common_names ) );
2198 if ( _configuration.doDisplayOption( Configuration.show_seq_names ) ) {
2199 addCheckbox( Configuration.show_seq_names, _configuration.getDisplayTitle( Configuration.show_seq_names ) );
2200 setCheckbox( Configuration.show_seq_names, _configuration.doCheckOption( Configuration.show_seq_names ) );
2202 if ( _configuration.doDisplayOption( Configuration.show_gene_names ) ) {
2203 addCheckbox( Configuration.show_gene_names, _configuration.getDisplayTitle( Configuration.show_gene_names ) );
2204 setCheckbox( Configuration.show_gene_names, _configuration.doCheckOption( Configuration.show_gene_names ) );
2206 if ( _configuration.doDisplayOption( Configuration.show_seq_symbols ) ) {
2207 addCheckbox( Configuration.show_seq_symbols,
2208 _configuration.getDisplayTitle( Configuration.show_seq_symbols ) );
2209 setCheckbox( Configuration.show_seq_symbols, _configuration.doCheckOption( Configuration.show_seq_symbols ) );
2211 if ( _configuration.doDisplayOption( Configuration.show_sequence_acc ) ) {
2212 addCheckbox( Configuration.show_sequence_acc,
2213 _configuration.getDisplayTitle( Configuration.show_sequence_acc ) );
2214 setCheckbox( Configuration.show_sequence_acc,
2215 _configuration.doCheckOption( Configuration.show_sequence_acc ) );
2217 if ( _configuration.doDisplayOption( Configuration.show_annotation ) ) {
2218 addCheckbox( Configuration.show_annotation, _configuration.getDisplayTitle( Configuration.show_annotation ) );
2219 setCheckbox( Configuration.show_annotation, _configuration.doCheckOption( Configuration.show_annotation ) );
2221 if ( _configuration.doDisplayOption( Configuration.write_confidence_values ) ) {
2222 addCheckbox( Configuration.write_confidence_values,
2223 _configuration.getDisplayTitle( Configuration.write_confidence_values ) );
2224 setCheckbox( Configuration.write_confidence_values,
2225 _configuration.doCheckOption( Configuration.write_confidence_values ) );
2227 if ( _configuration.doDisplayOption( Configuration.write_branch_length_values ) ) {
2228 addCheckbox( Configuration.write_branch_length_values,
2229 _configuration.getDisplayTitle( Configuration.write_branch_length_values ) );
2230 setCheckbox( Configuration.write_branch_length_values,
2231 _configuration.doCheckOption( Configuration.write_branch_length_values ) );
2233 if ( _configuration.doDisplayOption( Configuration.show_binary_characters ) ) {
2234 addCheckbox( Configuration.show_binary_characters,
2235 _configuration.getDisplayTitle( Configuration.show_binary_characters ) );
2236 setCheckbox( Configuration.show_binary_characters,
2237 _configuration.doCheckOption( Configuration.show_binary_characters ) );
2239 if ( _configuration.doDisplayOption( Configuration.show_binary_character_counts ) ) {
2240 addCheckbox( Configuration.show_binary_character_counts,
2241 _configuration.getDisplayTitle( Configuration.show_binary_character_counts ) );
2242 setCheckbox( Configuration.show_binary_character_counts,
2243 _configuration.doCheckOption( Configuration.show_binary_character_counts ) );
2245 if ( _configuration.doDisplayOption( Configuration.show_domain_architectures ) ) {
2246 addCheckbox( Configuration.show_domain_architectures,
2247 _configuration.getDisplayTitle( Configuration.show_domain_architectures ) );
2248 setCheckbox( Configuration.show_domain_architectures,
2249 _configuration.doCheckOption( Configuration.show_domain_architectures ) );
2251 if ( _configuration.doDisplayOption( Configuration.show_mol_seqs ) ) {
2252 addCheckbox( Configuration.show_mol_seqs, _configuration.getDisplayTitle( Configuration.show_mol_seqs ) );
2253 setCheckbox( Configuration.show_mol_seqs, _configuration.doCheckOption( Configuration.show_mol_seqs ) );
2255 if ( _configuration.doDisplayOption( Configuration.write_events ) ) {
2256 addCheckbox( Configuration.write_events, _configuration.getDisplayTitle( Configuration.write_events ) );
2257 setCheckbox( Configuration.write_events, _configuration.doCheckOption( Configuration.write_events ) );
2259 if ( _configuration.doDisplayOption( Configuration.show_vector_data ) ) {
2260 addCheckbox( Configuration.show_vector_data,
2261 _configuration.getDisplayTitle( Configuration.show_vector_data ) );
2262 setCheckbox( Configuration.show_vector_data, _configuration.doCheckOption( Configuration.show_vector_data ) );
2264 if ( _configuration.doDisplayOption( Configuration.show_properties ) ) {
2265 addCheckbox( Configuration.show_properties, _configuration.getDisplayTitle( Configuration.show_properties ) );
2266 setCheckbox( Configuration.show_properties, _configuration.doCheckOption( Configuration.show_properties ) );
2268 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_images ) ) {
2269 addCheckbox( Configuration.show_taxonomy_images,
2270 _configuration.getDisplayTitle( Configuration.show_taxonomy_images ) );
2271 setCheckbox( Configuration.show_taxonomy_images,
2272 _configuration.doCheckOption( Configuration.show_taxonomy_images ) );
2276 private void setVisibilityOfDomainStrucureControls() {
2277 if ( _zoom_in_domain_structure != null ) {
2278 final MainFrame mf = getMainFrame();
2280 if ( isShowDomainArchitectures() ) {
2281 _domain_display_label.setVisible( true );
2282 _zoom_in_domain_structure.setVisible( true );
2283 _zoom_out_domain_structure.setVisible( true );
2284 _decr_domain_structure_evalue_thr.setVisible( true );
2285 _incr_domain_structure_evalue_thr.setVisible( true );
2286 _domain_structure_evalue_thr_tf.setVisible( true );
2287 if ( mf._right_line_up_domains_cbmi != null ) {
2288 mf._right_line_up_domains_cbmi.setVisible( true );
2290 if ( mf._show_domain_labels != null ) {
2291 mf._show_domain_labels.setVisible( true );
2295 _domain_display_label.setVisible( false );
2296 _zoom_in_domain_structure.setVisible( false );
2297 _zoom_out_domain_structure.setVisible( false );
2298 _decr_domain_structure_evalue_thr.setVisible( false );
2299 _incr_domain_structure_evalue_thr.setVisible( false );
2300 _domain_structure_evalue_thr_tf.setVisible( false );
2301 if ( mf._right_line_up_domains_cbmi != null ) {
2302 mf._right_line_up_domains_cbmi.setVisible( false );
2304 if ( mf._show_domain_labels != null ) {
2305 mf._show_domain_labels.setVisible( false );
2312 // This takes care of ArchaeopteryxE-issue.
2313 // Can, and will, return null prior to ArchaeopteryxE initialization completion.
2314 final private MainFrame getMainFrame() {
2315 MainFrame mf = getMainPanel().getMainFrame();
2317 // Must be "E" applet version.
2318 final ArchaeopteryxE e = ( ArchaeopteryxE ) ( ( MainPanelApplets ) getMainPanel() ).getApplet();
2319 if ( e.getMainPanel() == null ) {
2322 mf = e.getMainPanel().getMainFrame();
2327 void setVisibilityOfX() {
2328 final MainFrame mf = getMainFrame();
2330 if ( ( getCurrentTreePanel() != null ) && ( getCurrentTreePanel().getPhylogeny() != null ) ) {
2331 if ( AptxUtil.isHasAtLeastOneBranchWithSupportSD( getCurrentTreePanel().getPhylogeny() ) ) {
2332 if ( mf._show_confidence_stddev_cbmi != null ) {
2333 mf._show_confidence_stddev_cbmi.setVisible( true );
2337 if ( mf._show_confidence_stddev_cbmi != null ) {
2338 mf._show_confidence_stddev_cbmi.setVisible( false );
2341 if ( AptxUtil.isHasAtLeastOneNodeWithScientificName( getCurrentTreePanel().getPhylogeny() ) ) {
2342 if ( mf._abbreviate_scientific_names != null ) {
2343 mf._abbreviate_scientific_names.setVisible( true );
2347 if ( mf._abbreviate_scientific_names != null ) {
2348 mf._abbreviate_scientific_names.setVisible( false );
2351 if ( AptxUtil.isHasAtLeastOneNodeWithSequenceAnnotation( getCurrentTreePanel().getPhylogeny() ) ) {
2352 if ( mf._show_annotation_ref_source != null ) {
2353 mf._show_annotation_ref_source.setVisible( true );
2357 if ( mf._show_annotation_ref_source != null ) {
2358 mf._show_annotation_ref_source.setVisible( false );
2362 if ( isDrawPhylogram()
2363 || ( ( getCurrentTreePanel() != null ) && ( ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) || ( getCurrentTreePanel()
2364 .getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) ) ) {
2365 if ( mf._non_lined_up_cladograms_rbmi != null ) {
2366 mf._non_lined_up_cladograms_rbmi.setVisible( false );
2368 if ( mf._uniform_cladograms_rbmi != null ) {
2369 mf._uniform_cladograms_rbmi.setVisible( false );
2371 if ( mf._ext_node_dependent_cladogram_rbmi != null ) {
2372 mf._ext_node_dependent_cladogram_rbmi.setVisible( false );
2376 if ( mf._non_lined_up_cladograms_rbmi != null ) {
2377 mf._non_lined_up_cladograms_rbmi.setVisible( true );
2379 if ( mf._uniform_cladograms_rbmi != null ) {
2380 mf._uniform_cladograms_rbmi.setVisible( true );
2382 if ( mf._ext_node_dependent_cladogram_rbmi != null ) {
2383 mf._ext_node_dependent_cladogram_rbmi.setVisible( true );
2386 if ( isDrawPhylogram() ) {
2387 if ( mf._show_scale_cbmi != null ) {
2388 mf._show_scale_cbmi.setVisible( true );
2392 if ( mf._show_scale_cbmi != null ) {
2393 mf._show_scale_cbmi.setVisible( false );
2396 if ( getCurrentTreePanel() != null ) {
2397 if ( ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
2398 || ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) {
2399 if ( mf._label_direction_cbmi != null ) {
2400 mf._label_direction_cbmi.setVisible( true );
2404 if ( mf._label_direction_cbmi != null ) {
2405 mf._label_direction_cbmi.setVisible( false );
2412 void setVisibilityOfDomainStrucureCB() {
2414 if ( ( getCurrentTreePanel() != null )
2415 && ( ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) || ( getCurrentTreePanel()
2416 .getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) ) {
2417 if ( getMainPanel().getMainFrame()._right_line_up_domains_cbmi != null ) {
2418 getMainPanel().getMainFrame()._right_line_up_domains_cbmi.setVisible( false );
2420 if ( getMainPanel().getMainFrame()._show_domain_labels != null ) {
2421 getMainPanel().getMainFrame()._show_domain_labels.setVisible( false );
2424 else if ( isShowDomainArchitectures() ) {
2425 if ( getMainPanel().getMainFrame()._right_line_up_domains_cbmi != null ) {
2426 getMainPanel().getMainFrame()._right_line_up_domains_cbmi.setVisible( true );
2428 if ( getMainPanel().getMainFrame()._show_domain_labels != null ) {
2429 getMainPanel().getMainFrame()._show_domain_labels.setVisible( true );
2433 if ( getMainPanel().getMainFrame()._right_line_up_domains_cbmi != null ) {
2434 getMainPanel().getMainFrame()._right_line_up_domains_cbmi.setVisible( false );
2436 if ( getMainPanel().getMainFrame()._show_domain_labels != null ) {
2437 getMainPanel().getMainFrame()._show_domain_labels.setVisible( false );
2441 catch ( final Exception ignore ) {
2446 static JLabel customizeLabel( final JLabel label, final Configuration configuration ) {
2447 label.setFont( ControlPanel.jcb_bold_font );
2448 if ( !configuration.isUseNativeUI() ) {
2449 label.setForeground( configuration.getGuiCheckboxTextColor() );
2450 label.setBackground( configuration.getGuiBackgroundColor() );
2455 enum NodeClickAction {
2462 DELETE_NODE_OR_SUBTREE,