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 long serialVersionUID = -8463483932821545633L;
85 private NodeClickAction _action_when_node_clicked;
86 private int _add_new_node_item;
87 private Map<Integer, String> _all_click_to_names;
88 private Map<String, Color> _annotation_colors;
89 private int _blast_item;
90 private JComboBox<String> _click_to_combobox;
91 private JLabel _click_to_label;
92 private List<String> _click_to_names;
93 private int _collapse_cb_item;
94 private JCheckBox _color_acc_species;
95 private JCheckBox _color_acc_sequence;
96 private JCheckBox _color_according_to_annotation;
97 private boolean _color_branches;
98 private JCheckBox _use_visual_styles_cb;
99 private int _color_subtree_cb_item;
100 private int _change_node_font_item;
101 // The settings from the conf file
102 private final Configuration _configuration;
103 private int _copy_subtree_item;
104 private int _cut_subtree_item;
105 private JButton _decr_domain_structure_evalue_thr;
106 private int _delete_node_or_subtree_item;
107 private JCheckBox _display_as_phylogram_cb;
109 private JCheckBox _display_internal_data;
110 private JLabel _domain_display_label;
111 private JTextField _domain_structure_evalue_thr_tf;
112 private List<Boolean> _draw_phylogram;
113 private JCheckBox _dynamically_hide_data;
114 private int _edit_node_data_item;
115 private int _get_ext_desc_data;
116 private JButton _incr_domain_structure_evalue_thr;
117 private final MainPanel _mainpanel;
118 private JCheckBox _node_desc_popup_cb;
119 private int _open_pdb_item;
120 private int _open_seq_web_item;
121 private int _open_tax_web_item;
122 private int _color_node_font_item;
123 private JButton _order;
124 private boolean _order_of_appearance;
125 private int _paste_subtree_item;
126 private int _reroot_cb_item;
127 private JButton _return_to_super_tree;
129 private JLabel _search_found_label_0;
130 private JLabel _search_found_label_1;
131 private JButton _search_reset_button_0;
132 private JButton _search_reset_button_1;
133 private JTextField _search_tf_0;
134 private JTextField _search_tf_1;
135 private int _select_nodes_item;
136 private Sequence _selected_query_seq;
137 private JCheckBox _seq_relation_confidence_switch;
138 private JComboBox<SEQUENCE_RELATION_TYPE> _sequence_relation_type_box;
139 private JCheckBox _show_annotation;
140 private JCheckBox _show_binary_character_counts;
141 private JCheckBox _show_binary_characters;
142 // Indices for the click-to options in the combo box
143 private int _show_data_item;
144 private JCheckBox _show_domain_architectures;
145 private JCheckBox _show_mol_seqs;
146 private JCheckBox _write_branch_length_values;
147 private JCheckBox _show_events;
148 private JCheckBox _show_gene_names;
149 private JCheckBox _show_node_names;
150 private JCheckBox _show_properties_cb;
151 private JCheckBox _show_seq_names;
152 private JCheckBox _show_seq_symbols;
153 private JCheckBox _show_sequence_acc;
154 private JComboBox<String> _show_sequence_relations;
155 private JCheckBox _show_taxo_code;
156 private JCheckBox _show_taxo_common_names;
157 private JCheckBox _show_taxo_images_cb;
158 private JCheckBox _show_taxo_scientific_names;
159 private JCheckBox _show_vector_data_cb;
160 private JButton _show_whole;
161 private int _sort_descendents_item;
162 private Map<String, Color> _species_colors;
163 private Map<String, Color> _sequence_colors;
164 private int _subtree_cb_item;
165 private int _swap_cb_item;
166 private JButton _uncollapse_all;
167 private JCheckBox _width_branches;
168 private JCheckBox _write_confidence;
169 private JButton _zoom_in_domain_structure;
170 private JButton _zoom_in_x;
171 private JButton _zoom_in_y;
172 private JLabel _zoom_label;
173 private JButton _zoom_out_domain_structure;
174 private JButton _zoom_out_x;
175 private JButton _zoom_out_y;
177 ControlPanel( final MainPanel ap, final Configuration configuration ) {
180 _configuration = configuration;
181 if ( !_configuration.isUseNativeUI() ) {
182 setBackground( getConfiguration().getGuiBackgroundColor() );
183 setBorder( BorderFactory.createRaisedBevelBorder() );
185 setLayout( new GridLayout( 0, 1, 2, 2 ) );
186 _order_of_appearance = true;
194 public void actionPerformed( final ActionEvent e ) {
196 if ( e.getSource() == _color_acc_sequence ) {
197 if ( _color_acc_species != null ) {
198 _color_acc_species.setSelected( false );
201 else if ( e.getSource() == _color_acc_species ) {
202 if ( _color_acc_sequence != null ) {
203 _color_acc_sequence.setSelected( false );
206 final TreePanel tp = getMainPanel().getCurrentTreePanel();
210 if ( e.getSource() == _click_to_combobox ) {
211 setClickToAction( _click_to_combobox.getSelectedIndex() );
212 getCurrentTreePanel().repaint();
214 else if ( e.getSource() == _show_binary_characters ) {
215 if ( ( _show_binary_character_counts != null ) && _show_binary_characters.isSelected() ) {
216 _show_binary_character_counts.setSelected( false );
218 displayedPhylogenyMightHaveChanged( true );
220 else if ( e.getSource() == _show_binary_character_counts ) {
221 if ( ( _show_binary_characters != null ) && _show_binary_character_counts.isSelected() ) {
222 _show_binary_characters.setSelected( false );
224 displayedPhylogenyMightHaveChanged( true );
226 else if ( e.getSource() == _show_domain_architectures ) {
229 displayedPhylogenyMightHaveChanged( true );
231 else if ( ( tp != null ) && ( tp.getPhylogeny() != null ) ) {
232 if ( e.getSource() == getDisplayAsPhylogramCb() ) {
233 setDrawPhylogram( getDisplayAsPhylogramCb().isSelected() );
237 else if ( e.getSource() == _zoom_in_x ) {
238 zoomInX( Constants.BUTTON_ZOOM_IN_FACTOR, Constants.BUTTON_ZOOM_IN_X_CORRECTION_FACTOR );
239 displayedPhylogenyMightHaveChanged( false );
241 else if ( e.getSource() == _zoom_in_y ) {
242 zoomInY( Constants.BUTTON_ZOOM_IN_FACTOR );
243 displayedPhylogenyMightHaveChanged( false );
245 else if ( e.getSource() == _zoom_out_x ) {
246 zoomOutX( Constants.BUTTON_ZOOM_OUT_FACTOR, Constants.BUTTON_ZOOM_OUT_X_CORRECTION_FACTOR );
247 displayedPhylogenyMightHaveChanged( false );
249 else if ( e.getSource() == _zoom_out_y ) {
250 zoomOutY( Constants.BUTTON_ZOOM_OUT_FACTOR );
251 displayedPhylogenyMightHaveChanged( false );
253 else if ( e.getSource() == _show_whole ) {
254 displayedPhylogenyMightHaveChanged( true );
257 else if ( e.getSource() == _return_to_super_tree ) {
258 _mainpanel.getCurrentTreePanel().superTree();
261 else if ( e.getSource() == _order ) {
262 DESCENDANT_SORT_PRIORITY pri = DESCENDANT_SORT_PRIORITY.TAXONOMY;
263 if ( ( !isShowTaxonomyScientificNames() && !isShowTaxonomyCode() && !isShowTaxonomyCommonNames() ) ) {
264 if ( ( isShowSequenceAcc() || isShowSeqNames() || isShowSeqSymbols() ) ) {
265 pri = DESCENDANT_SORT_PRIORITY.SEQUENCE;
267 else if ( isShowNodeNames() ) {
268 pri = DESCENDANT_SORT_PRIORITY.NODE_NAME;
271 PhylogenyMethods.orderAppearance( tp.getPhylogeny().getRoot(), _order_of_appearance, true, pri );
272 _order_of_appearance = !_order_of_appearance;
273 tp.setNodeInPreorderToNull();
274 tp.getPhylogeny().externalNodesHaveChanged();
275 tp.getPhylogeny().clearHashIdToNodeMap();
276 tp.getPhylogeny().recalculateNumberOfExternalDescendants( true );
277 tp.resetNodeIdToDistToLeafMap();
278 tp.setEdited( true );
279 displayedPhylogenyMightHaveChanged( true );
281 else if ( e.getSource() == _uncollapse_all ) {
283 displayedPhylogenyMightHaveChanged( false );
285 else if ( e.getSource() == _zoom_in_domain_structure ) {
286 _mainpanel.getCurrentTreePanel().zoomInDomainStructure();
287 displayedPhylogenyMightHaveChanged( true );
289 else if ( e.getSource() == _zoom_out_domain_structure ) {
290 _mainpanel.getCurrentTreePanel().zoomOutDomainStructure();
291 displayedPhylogenyMightHaveChanged( true );
293 else if ( e.getSource() == _decr_domain_structure_evalue_thr ) {
294 _mainpanel.getCurrentTreePanel().decreaseDomainStructureEvalueThreshold();
295 displayedPhylogenyMightHaveChanged( true );
297 else if ( e.getSource() == _incr_domain_structure_evalue_thr ) {
298 _mainpanel.getCurrentTreePanel().increaseDomainStructureEvalueThreshold();
299 displayedPhylogenyMightHaveChanged( true );
301 else if ( e.getSource() == _search_tf_0 ) {
303 displayedPhylogenyMightHaveChanged( true );
305 else if ( e.getSource() == _search_tf_1 ) {
307 displayedPhylogenyMightHaveChanged( true );
309 else if ( ( _dynamically_hide_data != null ) && ( e.getSource() == _dynamically_hide_data )
310 && !_dynamically_hide_data.isSelected() ) {
311 setDynamicHidingIsOn( false );
312 displayedPhylogenyMightHaveChanged( true );
315 displayedPhylogenyMightHaveChanged( true );
319 tp.requestFocusInWindow();
322 catch ( final Exception ex ) {
323 AptxUtil.unexpectedException( ex );
325 catch ( final Error err ) {
326 AptxUtil.unexpectedError( err );
330 public JCheckBox getColorAccSpeciesCb() {
331 return _color_acc_species;
334 public JCheckBox getColorAccSequenceCb() {
335 return _color_acc_sequence;
338 public JCheckBox getUseVisualStylesCb() {
339 return _use_visual_styles_cb;
342 public JCheckBox getDisplayAsPhylogramCb() {
343 return _display_as_phylogram_cb;
346 public JCheckBox getDynamicallyHideData() {
347 return _dynamically_hide_data;
350 public JCheckBox getNodeDescPopupCb() {
351 return _node_desc_popup_cb;
354 public Sequence getSelectedQuerySequence() {
355 return _selected_query_seq;
358 public JComboBox<String> getSequenceRelationBox() {
359 if ( _show_sequence_relations == null ) {
360 _show_sequence_relations = new JComboBox<String>();
361 _show_sequence_relations.setFocusable( false );
362 _show_sequence_relations.setMaximumRowCount( 20 );
363 _show_sequence_relations.setFont( ControlPanel.js_font );
364 if ( !_configuration.isUseNativeUI() ) {
365 _show_sequence_relations.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
366 _show_sequence_relations.setForeground( getConfiguration().getGuiButtonTextColor() );
368 _show_sequence_relations.addItem( "-----" );
369 _show_sequence_relations.setToolTipText( "To display orthology information for selected query" );
371 return _show_sequence_relations;
375 public JComboBox<SEQUENCE_RELATION_TYPE> getSequenceRelationTypeBox() {
376 if ( _sequence_relation_type_box == null ) {
377 _sequence_relation_type_box = new JComboBox<SEQUENCE_RELATION_TYPE>();
378 for( final SequenceRelation.SEQUENCE_RELATION_TYPE type : SequenceRelation.SEQUENCE_RELATION_TYPE.values() ) {
379 _sequence_relation_type_box.addItem( type );
381 _sequence_relation_type_box.addActionListener( new ActionListener() {
384 public void actionPerformed( final ActionEvent e ) {
385 if ( _mainpanel.getCurrentPhylogeny() != null ) {
386 setSequenceRelationQueries( getMainPanel().getCurrentPhylogeny().getSequenceRelationQueries() );
391 return _sequence_relation_type_box;
394 public JCheckBox getShowEventsCb() {
398 public JCheckBox getWriteConfidenceCb() {
399 return _write_confidence;
402 public boolean isShowProperties() {
403 return ( ( _show_properties_cb != null ) && _show_properties_cb.isSelected() );
406 public boolean isShowTaxonomyImages() {
407 return ( ( _show_taxo_images_cb != null ) && _show_taxo_images_cb.isSelected() );
410 public boolean isShowVectorData() {
411 return ( ( _show_vector_data_cb != null ) && _show_vector_data_cb.isSelected() );
414 public void setSequenceRelationQueries( final Collection<Sequence> sequenceRelationQueries ) {
415 final JComboBox<String> box = getSequenceRelationBox();
416 while ( box.getItemCount() > 1 ) {
417 box.removeItemAt( 1 );
419 final HashMap<String, Sequence> sequencesByName = new HashMap<String, Sequence>();
420 final SequenceRelation.SEQUENCE_RELATION_TYPE relationType = ( SequenceRelation.SEQUENCE_RELATION_TYPE ) _sequence_relation_type_box
422 if ( relationType == null ) {
425 final ArrayList<String> sequenceNamesToAdd = new ArrayList<String>();
426 for( final Sequence seq : sequenceRelationQueries ) {
427 if ( seq.hasSequenceRelations() ) {
428 boolean fFoundForCurrentType = false;
429 for( final SequenceRelation sq : seq.getSequenceRelations() ) {
430 if ( sq.getType().equals( relationType ) ) {
431 fFoundForCurrentType = true;
435 if ( fFoundForCurrentType ) {
436 sequenceNamesToAdd.add( seq.getName() );
437 sequencesByName.put( seq.getName(), seq );
441 // sort sequences by name before adding them to the combo
442 final String[] sequenceNameArray = sequenceNamesToAdd.toArray( new String[ sequenceNamesToAdd.size() ] );
443 Arrays.sort( sequenceNameArray, String.CASE_INSENSITIVE_ORDER );
444 for( final String seqName : sequenceNameArray ) {
445 box.addItem( seqName );
447 for( final ItemListener oldItemListener : box.getItemListeners() ) {
448 box.removeItemListener( oldItemListener );
450 box.addItemListener( new ItemListener() {
453 public void itemStateChanged( final ItemEvent e ) {
454 _selected_query_seq = sequencesByName.get( e.getItem() );
455 _mainpanel.getCurrentTreePanel().repaint();
460 void activateButtonToReturnToSuperTree( int index ) {
463 _return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT + " " + index );
466 _return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT );
468 _return_to_super_tree.setForeground( getConfiguration().getGuiCheckboxAndButtonActiveColor() );
469 _return_to_super_tree.setEnabled( true );
473 * Add zoom and quick edit buttons. (Last modified 8/9/04)
476 final JLabel spacer = new JLabel( "" );
477 spacer.setOpaque( false );
479 final JPanel x_panel = new JPanel( new GridLayout( 1, 1, 0, 0 ) );
480 final JPanel y_panel = new JPanel( new GridLayout( 1, 3, 0, 0 ) );
481 final JPanel z_panel = new JPanel( new GridLayout( 1, 1, 0, 0 ) );
482 if ( !getConfiguration().isUseNativeUI() ) {
483 x_panel.setBackground( getBackground() );
484 y_panel.setBackground( getBackground() );
485 z_panel.setBackground( getBackground() );
487 add( _zoom_label = new JLabel( "Zoom:" ) );
488 customizeLabel( _zoom_label, getConfiguration() );
492 if ( getConfiguration().isUseNativeUI() ) {
493 _zoom_in_x = new JButton( "+" );
494 _zoom_out_x = new JButton( "-" );
497 _zoom_in_x = new JButton( "X+" );
498 _zoom_out_x = new JButton( "X-" );
500 _zoom_in_y = new JButton( "Y+" );
501 _zoom_out_y = new JButton( "Y-" );
502 _show_whole = new JButton( "F" );
503 _show_whole.setToolTipText( "To fit the complete phylogeny to the current display size [F or Home]" );
504 _zoom_in_x.setToolTipText( "To zoom in horizontally [Shift+cursor-right]" );
505 _zoom_in_y.setToolTipText( "To zoom in vertically [Shift+cursor-up]" );
506 _zoom_out_x.setToolTipText( "To zoom out horizontally [Shift+cursor-left]" );
507 _zoom_out_y.setToolTipText( "To zoom out vertically [Shift+cursor-down]" );
508 if ( getConfiguration().isUseNativeUI() && ForesterUtil.isMac() ) {
509 _zoom_out_x.setPreferredSize( new Dimension( 55, 10 ) );
510 _zoom_in_x.setPreferredSize( new Dimension( 55, 10 ) );
513 _zoom_out_x.setPreferredSize( new Dimension( 10, 10 ) );
514 _zoom_in_x.setPreferredSize( new Dimension( 10, 10 ) );
516 _zoom_out_y.setPreferredSize( new Dimension( 10, 10 ) );
517 _zoom_in_y.setPreferredSize( new Dimension( 10, 10 ) );
518 _show_whole.setPreferredSize( new Dimension( 10, 10 ) );
519 _return_to_super_tree = new JButton( RETURN_TO_SUPER_TREE_TEXT );
520 _return_to_super_tree.setEnabled( false );
521 _order = new JButton( "Order Subtrees" );
522 _uncollapse_all = new JButton( "Uncollapse All" );
523 addJButton( _zoom_in_y, x_panel );
524 addJButton( _zoom_out_x, y_panel );
525 addJButton( _show_whole, y_panel );
526 addJButton( _zoom_in_x, y_panel );
527 addJButton( _zoom_out_y, z_panel );
528 if ( getConfiguration().doDisplayOption( Configuration.show_domain_architectures ) ) {
529 setUpControlsForDomainStrucures();
531 final JLabel spacer2 = new JLabel( "" );
533 addJButton( _return_to_super_tree, this );
534 addJButton( _order, this );
535 addJButton( _uncollapse_all, this );
536 final JLabel spacer3 = new JLabel( "" );
538 setVisibilityOfDomainStrucureControls();
541 void addCheckbox( final int which, final String title ) {
542 final JPanel ch_panel = new JPanel( new BorderLayout( 0, 0 ) );
544 case Configuration.display_as_phylogram:
545 _display_as_phylogram_cb = new JCheckBox( title );
546 getDisplayAsPhylogramCb().setToolTipText( "To switch between phylogram and cladogram display" );
547 addJCheckBox( getDisplayAsPhylogramCb(), ch_panel );
550 case Configuration.display_internal_data:
551 _display_internal_data = new JCheckBox( title );
552 _display_internal_data.setToolTipText( "To allow or disallow display of internal labels" );
553 addJCheckBox( _display_internal_data, ch_panel );
556 case Configuration.color_according_to_species:
557 _color_acc_species = new JCheckBox( title );
558 _color_acc_species.setToolTipText( "To colorize node labels as a function of taxonomy" );
559 addJCheckBox( _color_acc_species, ch_panel );
562 case Configuration.color_according_to_sequence:
563 _color_acc_sequence = new JCheckBox( title );
564 _color_acc_sequence.setToolTipText( "To colorize node labels as a function of sequence name" );
565 addJCheckBox( _color_acc_sequence, ch_panel );
568 case Configuration.color_according_to_annotation:
569 _color_according_to_annotation = new JCheckBox( title );
570 _color_according_to_annotation
571 .setToolTipText( "To colorize sequence annotation labels as a function of sequence annotation" );
572 addJCheckBox( _color_according_to_annotation, ch_panel );
575 case Configuration.show_node_names:
576 _show_node_names = new JCheckBox( title );
577 addJCheckBox( _show_node_names, ch_panel );
580 case Configuration.show_taxonomy_scientific_names:
581 _show_taxo_scientific_names = new JCheckBox( title );
582 addJCheckBox( _show_taxo_scientific_names, ch_panel );
585 case Configuration.show_taxonomy_common_names:
586 _show_taxo_common_names = new JCheckBox( title );
587 addJCheckBox( _show_taxo_common_names, ch_panel );
590 case Configuration.show_tax_code:
591 _show_taxo_code = new JCheckBox( title );
592 addJCheckBox( _show_taxo_code, ch_panel );
595 case Configuration.show_taxonomy_images:
596 _show_taxo_images_cb = new JCheckBox( title );
597 addJCheckBox( _show_taxo_images_cb, ch_panel );
600 case Configuration.show_binary_characters:
601 _show_binary_characters = new JCheckBox( title );
602 addJCheckBox( _show_binary_characters, ch_panel );
605 case Configuration.show_annotation:
606 _show_annotation = new JCheckBox( title );
607 addJCheckBox( _show_annotation, ch_panel );
610 case Configuration.show_binary_character_counts:
611 _show_binary_character_counts = new JCheckBox( title );
612 addJCheckBox( _show_binary_character_counts, ch_panel );
615 case Configuration.write_confidence_values:
616 _write_confidence = new JCheckBox( title );
617 addJCheckBox( getWriteConfidenceCb(), ch_panel );
620 case Configuration.write_events:
621 _show_events = new JCheckBox( title );
622 addJCheckBox( getShowEventsCb(), ch_panel );
625 case Configuration.use_style:
626 _use_visual_styles_cb = new JCheckBox( title );
627 getUseVisualStylesCb()
628 .setToolTipText( "To use visual styles (node colors, fonts) and branch colors, if present" );
629 addJCheckBox( getUseVisualStylesCb(), ch_panel );
632 case Configuration.width_branches:
633 _width_branches = new JCheckBox( title );
634 _width_branches.setToolTipText( "To use branch width values, if present" );
635 addJCheckBox( _width_branches, ch_panel );
638 case Configuration.write_branch_length_values:
639 _write_branch_length_values = new JCheckBox( title );
640 addJCheckBox( _write_branch_length_values, ch_panel );
643 case Configuration.show_domain_architectures:
644 _show_domain_architectures = new JCheckBox( title );
645 addJCheckBox( _show_domain_architectures, ch_panel );
648 case Configuration.show_mol_seqs:
649 _show_mol_seqs = new JCheckBox( title );
650 addJCheckBox( _show_mol_seqs, ch_panel );
653 case Configuration.show_seq_names:
654 _show_seq_names = new JCheckBox( title );
655 addJCheckBox( _show_seq_names, ch_panel );
658 case Configuration.show_gene_names:
659 _show_gene_names = new JCheckBox( title );
660 addJCheckBox( _show_gene_names, ch_panel );
663 case Configuration.show_seq_symbols:
664 _show_seq_symbols = new JCheckBox( title );
665 addJCheckBox( _show_seq_symbols, ch_panel );
668 case Configuration.show_sequence_acc:
669 _show_sequence_acc = new JCheckBox( title );
670 addJCheckBox( _show_sequence_acc, ch_panel );
673 case Configuration.dynamically_hide_data:
674 _dynamically_hide_data = new JCheckBox( title );
675 getDynamicallyHideData().setToolTipText( "To hide labels depending on expected visibility" );
676 addJCheckBox( getDynamicallyHideData(), ch_panel );
679 case Configuration.node_data_popup:
680 _node_desc_popup_cb = new JCheckBox( title );
681 getNodeDescPopupCb().setToolTipText( "To enable mouse rollover display of basic node data" );
682 addJCheckBox( getNodeDescPopupCb(), ch_panel );
685 case Configuration.show_relation_confidence:
686 _seq_relation_confidence_switch = new JCheckBox( title );
687 addJCheckBox( _seq_relation_confidence_switch, ch_panel );
690 case Configuration.show_vector_data:
691 _show_vector_data_cb = new JCheckBox( title );
692 addJCheckBox( _show_vector_data_cb, ch_panel );
695 case Configuration.show_properties:
696 _show_properties_cb = new JCheckBox( title );
697 addJCheckBox( _show_properties_cb, ch_panel );
701 throw new RuntimeException( "unknown checkbox: " + which );
705 void addJButton( final JButton jb, final JPanel p ) {
706 jb.setFocusPainted( false );
707 jb.setFont( ControlPanel.jcb_font );
708 if ( !_configuration.isUseNativeUI() ) {
709 jb.setBorder( BorderFactory.createLineBorder( getConfiguration().getGuiButtonBorderColor() ) );
710 jb.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
711 jb.setForeground( getConfiguration().getGuiButtonTextColor() );
714 jb.addActionListener( this );
717 void addJCheckBox( final JCheckBox jcb, final JPanel p ) {
718 jcb.setFocusPainted( false );
719 jcb.setFont( ControlPanel.jcb_font );
720 if ( !_configuration.isUseNativeUI() ) {
721 jcb.setBackground( getConfiguration().getGuiBackgroundColor() );
722 jcb.setForeground( getConfiguration().getGuiCheckboxTextColor() );
724 p.add( jcb, "Center" );
725 jcb.addActionListener( this );
728 void addJTextField( final JTextField tf, final JPanel p ) {
729 if ( !_configuration.isUseNativeUI() ) {
730 tf.setForeground( getConfiguration().getGuiBackgroundColor() );
731 tf.setFont( ControlPanel.jcb_font );
734 tf.addActionListener( this );
737 void deactivateButtonToReturnToSuperTree() {
738 _return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT );
739 _return_to_super_tree.setForeground( getConfiguration().getGuiButtonTextColor() );
740 _return_to_super_tree.setEnabled( false );
743 void displayedPhylogenyMightHaveChanged( final boolean recalc_longest_ext_node_info ) {
744 if ( ( _mainpanel != null )
745 && ( ( _mainpanel.getCurrentPhylogeny() != null ) && !_mainpanel.getCurrentPhylogeny().isEmpty() ) ) {
746 if ( getOptions().isShowOverview() ) {
747 _mainpanel.getCurrentTreePanel().updateOvSizes();
749 _mainpanel.getCurrentTreePanel().recalculateMaxDistanceToRoot();
750 setVisibilityOfDomainStrucureControls();
751 updateDomainStructureEvaluethresholdDisplay();
752 _mainpanel.getCurrentTreePanel().calculateScaleDistance();
753 _mainpanel.getCurrentTreePanel().calcMaxDepth();
754 _mainpanel.adjustJScrollPane();
755 if ( recalc_longest_ext_node_info ) {
756 _mainpanel.getCurrentTreePanel().initNodeData();
757 _mainpanel.getCurrentTreePanel().calculateLongestExtNodeInfo();
759 _mainpanel.getCurrentTreePanel().repaint();
760 // _mainpanel.getCurrentTreePanel().setUpUrtFactors();
764 void endClickToOptions() {
765 _click_to_combobox.addActionListener( this );
769 * Indicates what action should be execute when a node is clicked
771 * @return the click-on action
773 NodeClickAction getActionWhenNodeClicked() {
774 return _action_when_node_clicked;
777 Map<Integer, String> getAllClickToItems() {
778 return _all_click_to_names;
781 Map<String, Color> getAnnotationColors() {
782 return _annotation_colors;
785 Configuration getConfiguration() {
786 return _configuration;
789 TreePanel getCurrentTreePanel() {
790 return getMainPanel().getCurrentTreePanel();
793 MainPanel getMainPanel() {
797 Options getOptions() {
798 return getMainPanel().getOptions();
801 JLabel getSearchFoundCountsLabel0() {
802 return _search_found_label_0;
805 JLabel getSearchFoundCountsLabel1() {
806 return _search_found_label_1;
809 JButton getSearchResetButton0() {
810 return _search_reset_button_0;
813 JButton getSearchResetButton1() {
814 return _search_reset_button_1;
817 JTextField getSearchTextField0() {
821 JTextField getSearchTextField1() {
825 List<String> getSingleClickToNames() {
826 return _click_to_names;
829 Map<String, Color> getSpeciesColors() {
830 return _species_colors;
833 Map<String, Color> getSequenceColors() {
834 return _sequence_colors;
837 boolean isAntialiasScreenText() {
841 boolean isColorAccordingToAnnotation() {
842 return ( ( _color_according_to_annotation != null ) && _color_according_to_annotation.isSelected() );
845 boolean isColorAccordingToTaxonomy() {
846 return ( ( _color_acc_species != null ) && _color_acc_species.isSelected() );
849 boolean isColorAccordingToSequence() {
850 return ( ( _color_acc_sequence != null ) && _color_acc_sequence.isSelected() );
853 boolean isUseVisualStyles() {
854 return ( ( ( getUseVisualStylesCb() != null ) && getUseVisualStylesCb().isSelected() ) || ( ( getUseVisualStylesCb() == null ) && _color_branches ) );
857 boolean isDrawPhylogram() {
858 return isDrawPhylogram( getMainPanel().getCurrentTabIndex() );
861 boolean isDynamicallyHideData() {
862 return ( ( getDynamicallyHideData() != null ) && getDynamicallyHideData().isSelected() );
866 return ( ( getShowEventsCb() != null ) && getShowEventsCb().isSelected() );
869 boolean isNodeDescPopup() {
870 return ( ( getNodeDescPopupCb() != null ) && getNodeDescPopupCb().isSelected() );
873 boolean isShowAnnotation() {
874 return ( ( _show_annotation != null ) && _show_annotation.isSelected() );
877 boolean isShowBinaryCharacterCounts() {
878 return ( ( _show_binary_character_counts != null ) && _show_binary_character_counts.isSelected() );
881 boolean isShowBinaryCharacters() {
882 return ( ( _show_binary_characters != null ) && _show_binary_characters.isSelected() );
885 boolean isShowConfidenceValues() {
886 return ( ( getWriteConfidenceCb() != null ) && getWriteConfidenceCb().isSelected() );
889 boolean isWriteBranchLengthValues() {
890 return ( ( _write_branch_length_values != null ) && _write_branch_length_values.isSelected() );
893 boolean isShowDomainArchitectures() {
894 return ( ( _show_domain_architectures != null ) && _show_domain_architectures.isSelected() );
897 public boolean isShowMolSequences() {
898 return ( ( _show_mol_seqs != null ) && _show_mol_seqs.isSelected() );
901 boolean isShowGeneNames() {
902 return ( ( _show_gene_names != null ) && _show_gene_names.isSelected() );
905 boolean isShowInternalData() {
906 return ( ( _display_internal_data == null ) || _display_internal_data.isSelected() );
909 boolean isShowNodeNames() {
910 return ( ( _show_node_names != null ) && _show_node_names.isSelected() );
913 boolean isShowSeqNames() {
914 return ( ( _show_seq_names != null ) && _show_seq_names.isSelected() );
917 boolean isShowSeqSymbols() {
918 return ( ( _show_seq_symbols != null ) && _show_seq_symbols.isSelected() );
921 boolean isShowSequenceAcc() {
922 return ( ( _show_sequence_acc != null ) && _show_sequence_acc.isSelected() );
925 boolean isShowSequenceRelationConfidence() {
926 return ( ( _seq_relation_confidence_switch != null ) && ( _seq_relation_confidence_switch.isSelected() ) );
929 boolean isShowSequenceRelations() {
930 return ( ( _show_sequence_relations != null ) && ( _show_sequence_relations.getSelectedIndex() > 0 ) );
933 boolean isShowTaxonomyCode() {
934 return ( ( _show_taxo_code != null ) && _show_taxo_code.isSelected() );
937 boolean isShowTaxonomyCommonNames() {
938 return ( ( _show_taxo_common_names != null ) && _show_taxo_common_names.isSelected() );
941 boolean isShowTaxonomyScientificNames() {
942 return ( ( _show_taxo_scientific_names != null ) && _show_taxo_scientific_names.isSelected() );
945 boolean isWidthBranches() {
946 return ( ( _width_branches != null ) && _width_branches.isSelected() );
949 void phylogenyAdded( final Configuration configuration ) {
950 getIsDrawPhylogramList().add( configuration.isDrawAsPhylogram() );
953 void phylogenyRemoved( final int index ) {
954 getIsDrawPhylogramList().remove( index );
958 final MainPanel main_panel = getMainPanel();
959 final Phylogeny tree = main_panel.getCurrentPhylogeny();
960 if ( ( tree == null ) || tree.isEmpty() ) {
963 String query = getSearchTextField0().getText();
964 if ( query != null ) {
965 query = query.trim();
967 if ( !ForesterUtil.isEmpty( query ) ) {
968 search0( main_panel, tree, query );
971 getSearchFoundCountsLabel0().setVisible( false );
972 getSearchResetButton0().setEnabled( false );
973 getSearchResetButton0().setVisible( false );
979 final MainPanel main_panel = getMainPanel();
980 final Phylogeny tree = main_panel.getCurrentPhylogeny();
981 if ( ( tree == null ) || tree.isEmpty() ) {
984 String query = getSearchTextField1().getText();
985 if ( query != null ) {
986 query = query.trim();
988 if ( !ForesterUtil.isEmpty( query ) ) {
989 search1( main_panel, tree, query );
992 getSearchFoundCountsLabel1().setVisible( false );
993 getSearchResetButton1().setEnabled( false );
994 getSearchResetButton1().setVisible( false );
999 void searchReset0() {
1000 if ( getMainPanel().getCurrentTreePanel() != null ) {
1001 getMainPanel().getCurrentTreePanel().setFoundNodes0( null );
1005 void searchReset1() {
1006 if ( getMainPanel().getCurrentTreePanel() != null ) {
1007 getMainPanel().getCurrentTreePanel().setFoundNodes1( null );
1011 void setActionWhenNodeClicked( final NodeClickAction action ) {
1012 _action_when_node_clicked = action;
1015 void setAnnotationColors( final Map<String, Color> annotation_colors ) {
1016 _annotation_colors = annotation_colors;
1019 void setCheckbox( final int which, final boolean state ) {
1021 case Configuration.display_as_phylogram:
1022 if ( getDisplayAsPhylogramCb() != null ) {
1023 getDisplayAsPhylogramCb().setSelected( state );
1026 case Configuration.display_internal_data:
1027 if ( _display_internal_data != null ) {
1028 _display_internal_data.setSelected( state );
1031 case Configuration.color_according_to_species:
1032 if ( _color_acc_species != null ) {
1033 _color_acc_species.setSelected( state );
1036 case Configuration.color_according_to_sequence:
1037 if ( _color_acc_sequence != null ) {
1038 _color_acc_sequence.setSelected( state );
1041 case Configuration.color_according_to_annotation:
1042 if ( _color_according_to_annotation != null ) {
1043 _color_according_to_annotation.setSelected( state );
1046 case Configuration.show_node_names:
1047 if ( _show_node_names != null ) {
1048 _show_node_names.setSelected( state );
1051 case Configuration.show_taxonomy_scientific_names:
1052 if ( _show_taxo_scientific_names != null ) {
1053 _show_taxo_scientific_names.setSelected( state );
1056 case Configuration.show_taxonomy_common_names:
1057 if ( _show_taxo_common_names != null ) {
1058 _show_taxo_common_names.setSelected( state );
1061 case Configuration.show_tax_code:
1062 if ( _show_taxo_code != null ) {
1063 _show_taxo_code.setSelected( state );
1066 case Configuration.show_taxonomy_images:
1067 if ( _show_taxo_images_cb != null ) {
1068 _show_taxo_images_cb.setSelected( state );
1071 case Configuration.show_annotation:
1072 if ( _show_annotation != null ) {
1073 _show_annotation.setSelected( state );
1076 case Configuration.show_binary_characters:
1077 if ( _show_binary_characters != null ) {
1078 _show_binary_characters.setSelected( state );
1081 case Configuration.show_binary_character_counts:
1082 if ( _show_binary_character_counts != null ) {
1083 _show_binary_character_counts.setSelected( state );
1086 case Configuration.write_confidence_values:
1087 if ( getWriteConfidenceCb() != null ) {
1088 getWriteConfidenceCb().setSelected( state );
1091 case Configuration.write_events:
1092 if ( getShowEventsCb() != null ) {
1093 getShowEventsCb().setSelected( state );
1096 case Configuration.use_style:
1097 if ( getUseVisualStylesCb() != null ) {
1098 getUseVisualStylesCb().setSelected( state );
1101 case Configuration.width_branches:
1102 if ( _width_branches != null ) {
1103 _width_branches.setSelected( state );
1106 case Configuration.show_domain_architectures:
1107 if ( _show_domain_architectures != null ) {
1108 _show_domain_architectures.setSelected( state );
1111 case Configuration.write_branch_length_values:
1112 if ( _write_branch_length_values != null ) {
1113 _write_branch_length_values.setSelected( state );
1116 case Configuration.show_mol_seqs:
1117 if ( _show_mol_seqs != null ) {
1118 _show_mol_seqs.setSelected( state );
1121 case Configuration.show_seq_names:
1122 if ( _show_seq_names != null ) {
1123 _show_seq_names.setSelected( state );
1126 case Configuration.show_gene_names:
1127 if ( _show_gene_names != null ) {
1128 _show_gene_names.setSelected( state );
1131 case Configuration.show_seq_symbols:
1132 if ( _show_seq_symbols != null ) {
1133 _show_seq_symbols.setSelected( state );
1136 case Configuration.show_vector_data:
1137 if ( _show_vector_data_cb != null ) {
1138 _show_vector_data_cb.setSelected( state );
1141 case Configuration.show_properties:
1142 if ( _show_properties_cb != null ) {
1143 _show_properties_cb.setSelected( state );
1146 case Configuration.show_sequence_acc:
1147 if ( _show_sequence_acc != null ) {
1148 _show_sequence_acc.setSelected( state );
1151 case Configuration.dynamically_hide_data:
1152 if ( getDynamicallyHideData() != null ) {
1153 getDynamicallyHideData().setSelected( state );
1156 case Configuration.node_data_popup:
1157 if ( getNodeDescPopupCb() != null ) {
1158 getNodeDescPopupCb().setSelected( state );
1162 case Configuration.show_relation_confidence:
1163 if ( _seq_relation_confidence_switch != null ) {
1164 _seq_relation_confidence_switch.setSelected( state );
1169 throw new AssertionError( "unknown checkbox: " + which );
1174 * Set this checkbox state. Not all checkboxes have been instantiated
1175 * depending on the config.
1177 void setCheckbox( final JCheckBox cb, final boolean state ) {
1179 cb.setSelected( state );
1183 void setClickToAction( final int action ) {
1184 // Set click-to action
1185 if ( action == _show_data_item ) {
1186 setActionWhenNodeClicked( NodeClickAction.SHOW_DATA );
1188 else if ( action == _collapse_cb_item ) {
1189 setActionWhenNodeClicked( NodeClickAction.COLLAPSE );
1191 else if ( action == _reroot_cb_item ) {
1192 setActionWhenNodeClicked( NodeClickAction.REROOT );
1194 else if ( action == _subtree_cb_item ) {
1195 setActionWhenNodeClicked( NodeClickAction.SUBTREE );
1197 else if ( action == _swap_cb_item ) {
1198 setActionWhenNodeClicked( NodeClickAction.SWAP );
1200 else if ( action == _color_subtree_cb_item ) {
1201 setActionWhenNodeClicked( NodeClickAction.COLOR_SUBTREE );
1203 else if ( action == _open_seq_web_item ) {
1204 setActionWhenNodeClicked( NodeClickAction.OPEN_SEQ_WEB );
1206 else if ( action == _sort_descendents_item ) {
1207 setActionWhenNodeClicked( NodeClickAction.SORT_DESCENDENTS );
1209 else if ( action == _blast_item ) {
1210 setActionWhenNodeClicked( NodeClickAction.BLAST );
1212 else if ( action == _open_tax_web_item ) {
1213 setActionWhenNodeClicked( NodeClickAction.OPEN_TAX_WEB );
1215 else if ( action == _cut_subtree_item ) {
1216 setActionWhenNodeClicked( NodeClickAction.CUT_SUBTREE );
1218 else if ( action == _copy_subtree_item ) {
1219 setActionWhenNodeClicked( NodeClickAction.COPY_SUBTREE );
1221 else if ( action == _delete_node_or_subtree_item ) {
1222 setActionWhenNodeClicked( NodeClickAction.DELETE_NODE_OR_SUBTREE );
1224 else if ( action == _paste_subtree_item ) {
1225 setActionWhenNodeClicked( NodeClickAction.PASTE_SUBTREE );
1227 else if ( action == _add_new_node_item ) {
1228 setActionWhenNodeClicked( NodeClickAction.ADD_NEW_NODE );
1230 else if ( action == _edit_node_data_item ) {
1231 setActionWhenNodeClicked( NodeClickAction.EDIT_NODE_DATA );
1233 else if ( action == _select_nodes_item ) {
1234 setActionWhenNodeClicked( NodeClickAction.SELECT_NODES );
1236 else if ( action == _get_ext_desc_data ) {
1237 setActionWhenNodeClicked( NodeClickAction.GET_EXT_DESC_DATA );
1239 else if ( action == _open_pdb_item ) {
1240 setActionWhenNodeClicked( NodeClickAction.OPEN_PDB_WEB );
1242 else if ( action == _color_node_font_item ) {
1243 setActionWhenNodeClicked( NodeClickAction.COLOR_NODE_FONT );
1245 else if ( action == _change_node_font_item ) {
1246 setActionWhenNodeClicked( NodeClickAction.CHANGE_NODE_FONT );
1249 throw new RuntimeException( "unknown action: " + action );
1251 // make sure drop down is displaying the correct action
1252 // in case this was called from outside the class
1253 _click_to_combobox.setSelectedIndex( action );
1256 void setColorBranches( final boolean color_branches ) {
1257 _color_branches = color_branches;
1260 void setDrawPhylogram( final boolean b ) {
1261 getDisplayAsPhylogramCb().setSelected( b );
1262 setDrawPhylogram( getMainPanel().getCurrentTabIndex(), b );
1265 void setDrawPhylogramEnabled( final boolean b ) {
1266 getDisplayAsPhylogramCb().setEnabled( b );
1269 void setDynamicHidingIsOn( final boolean is_on ) {
1271 getDynamicallyHideData().setForeground( getConfiguration().getGuiCheckboxAndButtonActiveColor() );
1274 if ( !_configuration.isUseNativeUI() ) {
1275 getDynamicallyHideData().setForeground( getConfiguration().getGuiButtonTextColor() );
1278 getDynamicallyHideData().setForeground( Color.BLACK );
1283 void setSearchFoundCountsOnLabel0( final int counts ) {
1284 getSearchFoundCountsLabel0().setText( "Found: " + counts );
1287 void setSearchFoundCountsOnLabel1( final int counts ) {
1288 getSearchFoundCountsLabel1().setText( "Found: " + counts );
1291 void setShowEvents( final boolean show_events ) {
1292 if ( getShowEventsCb() == null ) {
1293 _show_events = new JCheckBox( "" );
1295 getShowEventsCb().setSelected( show_events );
1298 void setSpeciesColors( final Map<String, Color> species_colors ) {
1299 _species_colors = species_colors;
1302 void setSequenceColors( final Map<String, Color> sequence_colors ) {
1303 _sequence_colors = sequence_colors;
1308 * Set up the controls from the config settings. 11/26/05
1310 void setupControls() {
1311 // The tree display options:
1312 setupDisplayCheckboxes();
1314 // The sequence relation query selection combo-box
1315 if ( _configuration.displaySequenceRelations() ) {
1316 addSequenceRelationBlock();
1320 startClickToOptions();
1321 setupClickToOptions();
1322 endClickToOptions();
1323 // Zoom and quick edit buttons
1325 setupSearchTools0();
1326 setupSearchTools1();
1329 void setUpControlsForDomainStrucures() {
1330 _domain_display_label = new JLabel( "Domain Architectures:" );
1331 add( customizeLabel( _domain_display_label, getConfiguration() ) );
1332 add( _domain_display_label );
1333 _zoom_in_domain_structure = new JButton( "d+" );
1334 _zoom_out_domain_structure = new JButton( "d-" );
1335 _decr_domain_structure_evalue_thr = new JButton( "-" );
1336 _incr_domain_structure_evalue_thr = new JButton( "+" );
1337 _zoom_in_domain_structure.setPreferredSize( new Dimension( 10, 10 ) );
1338 _zoom_out_domain_structure.setPreferredSize( new Dimension( 10, 10 ) );
1339 _decr_domain_structure_evalue_thr.setPreferredSize( new Dimension( 10, 10 ) );
1340 _incr_domain_structure_evalue_thr.setPreferredSize( new Dimension( 10, 10 ) );
1341 _incr_domain_structure_evalue_thr.setToolTipText( "Increase the E-value threshold by a factor of 10" );
1342 _decr_domain_structure_evalue_thr.setToolTipText( "Decrease the E-value threshold by a factor of 10" );
1343 _domain_structure_evalue_thr_tf = new JTextField( 3 );
1344 _domain_structure_evalue_thr_tf.setEditable( false );
1345 if ( !getConfiguration().isUseNativeUI() ) {
1346 _domain_structure_evalue_thr_tf.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
1347 _domain_structure_evalue_thr_tf.setBackground( getConfiguration().getGuiCheckboxTextColor() );
1348 _domain_structure_evalue_thr_tf.setBorder( null );
1350 final JPanel d1_panel = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
1351 final JPanel d2_panel = new JPanel( new GridLayout( 1, 3, 0, 0 ) );
1352 if ( !_configuration.isUseNativeUI() ) {
1353 d1_panel.setBackground( getBackground() );
1354 d2_panel.setBackground( getBackground() );
1358 addJButton( _zoom_out_domain_structure, d1_panel );
1359 addJButton( _zoom_in_domain_structure, d1_panel );
1360 addJButton( _decr_domain_structure_evalue_thr, d2_panel );
1361 addJTextField( _domain_structure_evalue_thr_tf, d2_panel );
1362 addJButton( _incr_domain_structure_evalue_thr, d2_panel );
1365 void setupSearchTools0() {
1366 final String tip = "Enter text to search for. Use ',' for multiple searches (logical OR) and '+' for logical AND.";
1367 final JLabel search_label = new JLabel( "Search (A):" );
1368 search_label.setFont( ControlPanel.jcb_bold_font );
1369 if ( !getConfiguration().isUseNativeUI() ) {
1370 search_label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1372 add( search_label );
1373 search_label.setToolTipText( tip );
1374 _search_found_label_0 = new JLabel();
1375 getSearchFoundCountsLabel0().setVisible( false );
1376 _search_found_label_0.setFont( ControlPanel.jcb_bold_font );
1377 if ( !getConfiguration().isUseNativeUI() ) {
1378 _search_found_label_0.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1380 _search_tf_0 = new JTextField( 3 );
1381 _search_tf_0.setToolTipText( tip );
1382 _search_tf_0.setEditable( true );
1383 if ( !getConfiguration().isUseNativeUI() ) {
1384 _search_tf_0.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
1385 _search_tf_0.setBackground( getConfiguration().getGuiCheckboxTextColor() );
1386 _search_tf_0.setBorder( null );
1388 _search_reset_button_0 = new JButton();
1389 getSearchResetButton0().setText( "Reset" );
1390 getSearchResetButton0().setEnabled( false );
1391 getSearchResetButton0().setVisible( false );
1392 final JPanel s_panel_1 = new JPanel( new BorderLayout() );
1393 final JPanel s_panel_2 = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
1394 s_panel_1.setBackground( getBackground() );
1396 s_panel_2.setBackground( getBackground() );
1398 final KeyAdapter key_adapter = new KeyAdapter() {
1401 public void keyReleased( final KeyEvent key_event ) {
1403 displayedPhylogenyMightHaveChanged( true );
1406 final ActionListener action_listener = new ActionListener() {
1409 public void actionPerformed( final ActionEvent e ) {
1411 setSearchFoundCountsOnLabel0( 0 );
1412 getSearchFoundCountsLabel0().setVisible( false );
1413 getSearchTextField0().setText( "" );
1414 getSearchResetButton0().setEnabled( false );
1415 getSearchResetButton0().setVisible( false );
1416 displayedPhylogenyMightHaveChanged( true );
1419 _search_reset_button_0.addActionListener( action_listener );
1420 _search_tf_0.addKeyListener( key_adapter );
1421 addJTextField( _search_tf_0, s_panel_1 );
1422 s_panel_2.add( _search_found_label_0 );
1423 addJButton( _search_reset_button_0, s_panel_2 );
1426 void setupSearchTools1() {
1427 final String tip = "Enter text to search for. Use ',' for multiple searches (logical OR) and '+' for logical AND.";
1428 final JLabel search_label = new JLabel( "Search (B):" );
1429 search_label.setFont( ControlPanel.jcb_bold_font );
1430 if ( !getConfiguration().isUseNativeUI() ) {
1431 search_label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1433 add( search_label );
1434 search_label.setToolTipText( tip );
1435 _search_found_label_1 = new JLabel();
1436 getSearchFoundCountsLabel1().setVisible( false );
1437 _search_found_label_1.setFont( ControlPanel.jcb_bold_font );
1438 if ( !getConfiguration().isUseNativeUI() ) {
1439 _search_found_label_1.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1441 _search_tf_1 = new JTextField( 3 );
1442 _search_tf_1.setToolTipText( tip );
1443 _search_tf_1.setEditable( true );
1444 if ( !getConfiguration().isUseNativeUI() ) {
1445 _search_tf_1.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
1446 _search_tf_1.setBackground( getConfiguration().getGuiCheckboxTextColor() );
1447 _search_tf_1.setBorder( null );
1449 _search_reset_button_1 = new JButton();
1450 getSearchResetButton1().setText( "Reset" );
1451 getSearchResetButton1().setEnabled( false );
1452 getSearchResetButton1().setVisible( false );
1453 final JPanel s_panel_1 = new JPanel( new BorderLayout() );
1454 final JPanel s_panel_2 = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
1455 s_panel_1.setBackground( getBackground() );
1457 s_panel_2.setBackground( getBackground() );
1459 final KeyAdapter key_adapter = new KeyAdapter() {
1462 public void keyReleased( final KeyEvent key_event ) {
1464 displayedPhylogenyMightHaveChanged( true );
1467 final ActionListener action_listener = new ActionListener() {
1470 public void actionPerformed( final ActionEvent e ) {
1472 setSearchFoundCountsOnLabel1( 0 );
1473 getSearchFoundCountsLabel1().setVisible( false );
1474 getSearchTextField1().setText( "" );
1475 getSearchResetButton1().setEnabled( false );
1476 getSearchResetButton1().setVisible( false );
1477 displayedPhylogenyMightHaveChanged( true );
1480 _search_reset_button_1.addActionListener( action_listener );
1481 _search_tf_1.addKeyListener( key_adapter );
1482 addJTextField( _search_tf_1, s_panel_1 );
1483 s_panel_2.add( _search_found_label_1 );
1484 addJButton( _search_reset_button_1, s_panel_2 );
1487 void showAnnotations() {
1488 if ( _show_annotation != null ) {
1489 _show_annotation.setSelected( true );
1491 if ( _color_according_to_annotation != null ) {
1492 _color_according_to_annotation.setSelected( true );
1494 if ( _color_acc_species != null ) {
1495 _color_acc_species.setSelected( false );
1497 if ( _color_acc_sequence != null ) {
1498 _color_acc_sequence.setSelected( false );
1500 _mainpanel.getCurrentTreePanel().repaint();
1504 * Fit entire tree into window.
1507 if ( ( _mainpanel.getCurrentScrollPane() == null ) || _mainpanel.getCurrentTreePanel().getPhylogeny().isEmpty() ) {
1510 getCurrentTreePanel().updateSetOfCollapsedExternalNodes();
1511 displayedPhylogenyMightHaveChanged( true );
1512 _mainpanel.getCurrentTreePanel().updateOvSettings();
1513 _mainpanel.getCurrentTreePanel().validate();
1514 _mainpanel.validate();
1515 _mainpanel.getCurrentTreePanel().calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
1516 _mainpanel.getSizeOfViewport().height,
1518 _mainpanel.getCurrentTreePanel().resetPreferredSize();
1519 _mainpanel.adjustJScrollPane();
1520 _mainpanel.getCurrentTreePanel().repaint();
1521 _mainpanel.getCurrentTreePanel().validate();
1522 _mainpanel.validate();
1523 _mainpanel.getCurrentTreePanel().calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
1524 _mainpanel.getSizeOfViewport().height,
1526 _mainpanel.getCurrentTreePanel().resetPreferredSize();
1527 _mainpanel.adjustJScrollPane();
1528 _mainpanel.getCurrentTreePanel().repaint();
1529 _mainpanel.getCurrentTreePanel().updateOvSizes();
1532 void showWholeAll() {
1533 for( final TreePanel tree_panel : _mainpanel.getTreePanels() ) {
1534 if ( tree_panel != null ) {
1535 tree_panel.validate();
1536 tree_panel.calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
1537 _mainpanel.getSizeOfViewport().height,
1539 tree_panel.resetPreferredSize();
1540 tree_panel.repaint();
1545 // Create header for click-to combo box.
1546 void startClickToOptions() {
1547 final JLabel spacer = new JLabel( "" );
1548 spacer.setFont( ControlPanel.jcb_font );
1550 _click_to_label = new JLabel( "Click on Node to:" );
1551 add( customizeLabel( _click_to_label, getConfiguration() ) );
1552 _click_to_combobox = new JComboBox<String>();
1553 _click_to_combobox.setFocusable( false );
1554 _click_to_combobox.setMaximumRowCount( 14 );
1555 _click_to_combobox.setFont( ControlPanel.js_font );
1556 if ( !_configuration.isUseNativeUI() ) {
1557 _click_to_combobox.setBackground( getConfiguration().getGuiBackgroundColor() );
1559 // don't add listener until all items are set (or each one will trigger
1561 // click_to_list.addActionListener(this);
1562 add( _click_to_combobox );
1563 // Correlates option names to titles
1564 _all_click_to_names = new HashMap<Integer, String>();
1565 _click_to_names = new ArrayList<String>();
1569 if ( getMainPanel().getTabbedPane().getTabCount() > 0 ) {
1570 if ( getCurrentTreePanel().isPhyHasBranchLengths()
1571 && ( getCurrentTreePanel().getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) {
1572 setDrawPhylogramEnabled( true );
1573 setDrawPhylogram( isDrawPhylogram() );
1576 setDrawPhylogramEnabled( false );
1577 setDrawPhylogram( false );
1579 if ( getMainPanel().getMainFrame() == null ) {
1580 // Must be "E" applet version.
1581 final ArchaeopteryxE e = ( ArchaeopteryxE ) ( ( MainPanelApplets ) getMainPanel() ).getApplet();
1582 e.setSelectedTypeInTypeMenu( e.getCurrentTreePanel().getPhylogenyGraphicsType() );
1585 getMainPanel().getMainFrame().setSelectedTypeInTypeMenu( getMainPanel().getCurrentTreePanel()
1586 .getPhylogenyGraphicsType() );
1588 getMainPanel().getCurrentTreePanel().updateSubSuperTreeButton();
1589 getMainPanel().getControlPanel().search0();
1590 getMainPanel().getControlPanel().search1();
1591 getMainPanel().getControlPanel().updateDomainStructureEvaluethresholdDisplay();
1592 getSequenceRelationTypeBox().removeAllItems();
1593 for( final SequenceRelation.SEQUENCE_RELATION_TYPE type : getMainPanel().getCurrentPhylogeny()
1594 .getRelevantSequenceRelationTypes() ) {
1595 _sequence_relation_type_box.addItem( type );
1597 getMainPanel().getCurrentTreePanel().repaint();
1598 //setSequenceRelationQueries( getMainPanel().getCurrentPhylogeny().getSequenceRelationQueries() );
1599 // according to GUILHEM the line above can be removed.
1604 * Uncollapse all nodes.
1606 void uncollapseAll( final TreePanel tp ) {
1607 final Phylogeny t = tp.getPhylogeny();
1608 if ( ( t != null ) && !t.isEmpty() ) {
1609 for( final PhylogenyNodeIterator iter = t.iteratorPreorder(); iter.hasNext(); ) {
1610 final PhylogenyNode node = iter.next();
1611 node.setCollapse( false );
1613 tp.resetNodeIdToDistToLeafMap();
1614 tp.updateSetOfCollapsedExternalNodes();
1615 t.recalculateNumberOfExternalDescendants( false );
1616 tp.setNodeInPreorderToNull();
1617 t.clearHashIdToNodeMap();
1622 void updateDomainStructureEvaluethresholdDisplay() {
1623 if ( _domain_structure_evalue_thr_tf != null ) {
1624 _domain_structure_evalue_thr_tf.setText( "10^"
1625 + getMainPanel().getCurrentTreePanel().getDomainStructureEvalueThreshold() );
1629 void zoomInX( final float factor, final float x_correction_factor ) {
1630 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar();
1631 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1632 treepanel.multiplyUrtFactor( 1f );
1633 if ( ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
1634 || ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
1635 || isDrawPhylogram( getMainPanel().getCurrentTabIndex() )
1636 || ( getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP ) ) {
1637 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1638 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
1639 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
1640 getMainPanel().adjustJScrollPane();
1641 treepanel.resetPreferredSize();
1642 getMainPanel().getCurrentScrollPane().getViewport().validate();
1643 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1644 - ( sb.getVisibleAmount() / 2.0 ) ) );
1647 final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue();
1648 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
1649 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
1650 getMainPanel().adjustJScrollPane();
1651 treepanel.resetPreferredSize();
1652 getMainPanel().getCurrentScrollPane().getViewport().validate();
1653 sb.setValue( sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount() );
1655 treepanel.resetPreferredSize();
1656 treepanel.updateOvSizes();
1659 void zoomInY( final float factor ) {
1660 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getVerticalScrollBar();
1661 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1662 treepanel.multiplyUrtFactor( 1.1f );
1663 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1664 treepanel.setYdistance( ( treepanel.getYdistance() * factor ) );
1665 getMainPanel().adjustJScrollPane();
1666 treepanel.resetPreferredSize();
1667 getMainPanel().getCurrentScrollPane().getViewport().validate();
1668 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1669 - ( sb.getVisibleAmount() / 2.0 ) ) );
1670 treepanel.resetPreferredSize();
1671 treepanel.updateOvSizes();
1674 void zoomOutX( final float factor, final float x_correction_factor ) {
1675 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1676 treepanel.multiplyUrtFactor( 1f );
1677 if ( ( treepanel.getXdistance() * factor ) > 0.0 ) {
1678 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar();
1679 if ( ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
1680 || ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
1681 || isDrawPhylogram( getMainPanel().getCurrentTabIndex() )
1682 || ( getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP ) ) {
1683 getMainPanel().adjustJScrollPane();
1684 treepanel.resetPreferredSize();
1685 getMainPanel().getCurrentScrollPane().getViewport().validate();
1686 final double x = ( sb.getMaximum() - sb.getMinimum() )
1687 / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1688 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
1689 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
1690 getMainPanel().adjustJScrollPane();
1691 treepanel.resetPreferredSize();
1692 getMainPanel().getCurrentScrollPane().getViewport().validate();
1693 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1694 - ( sb.getVisibleAmount() / 2.0 ) ) );
1697 final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue();
1698 treepanel.setXdistance( treepanel.getXdistance() * factor );
1699 treepanel.setXcorrectionFactor( treepanel.getXcorrectionFactor() * x_correction_factor );
1701 getMainPanel().adjustJScrollPane();
1702 treepanel.resetPreferredSize();
1703 getMainPanel().getCurrentScrollPane().getViewport().validate();
1704 sb.setValue( sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount() );
1707 treepanel.resetPreferredSize();
1708 treepanel.updateOvSizes();
1712 void zoomOutY( final float factor ) {
1713 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1714 treepanel.multiplyUrtFactor( 0.9f );
1715 if ( ( treepanel.getYdistance() * factor ) > 0.0 ) {
1716 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getVerticalScrollBar();
1717 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1718 treepanel.setYdistance( ( treepanel.getYdistance() * factor ) );
1719 getMainPanel().adjustJScrollPane();
1720 treepanel.resetPreferredSize();
1721 getMainPanel().getCurrentScrollPane().getViewport().validate();
1722 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1723 - ( sb.getVisibleAmount() / 2.0 ) ) );
1724 treepanel.resetPreferredSize();
1725 treepanel.updateOvSizes();
1729 private void addClickToOption( final int which, final String title ) {
1730 _click_to_combobox.addItem( title );
1731 _click_to_names.add( title );
1732 _all_click_to_names.put( new Integer( which ), title );
1733 if ( !_configuration.isUseNativeUI() ) {
1734 _click_to_combobox.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
1735 _click_to_combobox.setForeground( getConfiguration().getGuiButtonTextColor() );
1740 private void addSequenceRelationBlock() {
1741 final JLabel spacer = new JLabel( "" );
1742 spacer.setSize( 1, 1 );
1744 final JLabel mainLabel = new JLabel( "Sequence relations to display" );
1745 final JLabel typeLabel = customizeLabel( new JLabel( "(type) " ), getConfiguration() );
1746 typeLabel.setFont( ControlPanel.js_font.deriveFont( 7 ) );
1747 getSequenceRelationTypeBox().setFocusable( false );
1748 _sequence_relation_type_box.setFont( ControlPanel.js_font );
1749 if ( !_configuration.isUseNativeUI() ) {
1750 _sequence_relation_type_box.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
1751 _sequence_relation_type_box.setForeground( getConfiguration().getGuiButtonTextColor() );
1753 _sequence_relation_type_box.setRenderer( new ListCellRenderer<Object>() {
1756 public Component getListCellRendererComponent( final JList<?> list,
1759 final boolean isSelected,
1760 final boolean cellHasFocus ) {
1761 final Component component = new DefaultListCellRenderer().getListCellRendererComponent( list,
1766 if ( ( value != null ) && ( value instanceof SequenceRelation.SEQUENCE_RELATION_TYPE ) ) {
1767 ( ( DefaultListCellRenderer ) component ).setText( SequenceRelation
1768 .getPrintableNameByType( ( SequenceRelation.SEQUENCE_RELATION_TYPE ) value ) );
1773 final GridBagLayout gbl = new GridBagLayout();
1774 _sequence_relation_type_box.setMinimumSize( new Dimension( 115, 17 ) );
1775 _sequence_relation_type_box.setPreferredSize( new Dimension( 115, 20 ) );
1776 final JPanel horizGrid = new JPanel( gbl );
1777 horizGrid.setBackground( getBackground() );
1778 horizGrid.add( typeLabel );
1779 horizGrid.add( _sequence_relation_type_box );
1780 add( customizeLabel( mainLabel, getConfiguration() ) );
1782 add( getSequenceRelationBox() );
1783 if ( _configuration.doDisplayOption( Configuration.show_relation_confidence ) ) {
1784 addCheckbox( Configuration.show_relation_confidence,
1785 _configuration.getDisplayTitle( Configuration.show_relation_confidence ) );
1786 setCheckbox( Configuration.show_relation_confidence,
1787 _configuration.doCheckOption( Configuration.show_relation_confidence ) );
1789 }// addSequenceRelationBlock
1792 private List<Boolean> getIsDrawPhylogramList() {
1793 return _draw_phylogram;
1796 private void init() {
1797 _draw_phylogram = new ArrayList<Boolean>();
1798 setSpeciesColors( new HashMap<String, Color>() );
1799 setSequenceColors( new HashMap<String, Color>() );
1800 setAnnotationColors( new HashMap<String, Color>() );
1803 private boolean isDrawPhylogram( final int index ) {
1804 return getIsDrawPhylogramList().get( index );
1807 private void search0( final MainPanel main_panel, final Phylogeny tree, final String query_str ) {
1808 getSearchFoundCountsLabel0().setVisible( true );
1809 getSearchResetButton0().setEnabled( true );
1810 getSearchResetButton0().setVisible( true );
1811 String[] queries = null;
1812 List<PhylogenyNode> nodes = null;
1813 if ( query_str.indexOf( ',' ) >= 0 ) {
1814 queries = query_str.split( ",+" );
1817 queries = new String[ 1 ];
1818 queries[ 0 ] = query_str.trim();
1820 if ( ( queries != null ) && ( queries.length > 0 ) ) {
1821 nodes = new ArrayList<PhylogenyNode>();
1822 for( String query : queries ) {
1823 if ( ForesterUtil.isEmpty( query ) ) {
1826 query = query.trim();
1827 if ( query.indexOf( '+' ) >= 0 ) {
1828 nodes.addAll( PhylogenyMethods.searchDataLogicalAnd( query.split( "\\++" ),
1830 getOptions().isSearchCaseSensitive(),
1831 !getOptions().isMatchWholeTermsOnly(),
1832 isShowDomainArchitectures() ) );
1835 nodes.addAll( PhylogenyMethods.searchData( query,
1837 getOptions().isSearchCaseSensitive(),
1838 !getOptions().isMatchWholeTermsOnly(),
1839 isShowDomainArchitectures() ) );
1842 if ( getOptions().isInverseSearchResult() ) {
1843 final List<PhylogenyNode> all = PhylogenyMethods.obtainAllNodesAsList( tree );
1844 all.removeAll( nodes );
1848 if ( ( nodes != null ) && ( nodes.size() > 0 ) ) {
1849 main_panel.getCurrentTreePanel().setFoundNodes0( new HashSet<Long>() );
1850 for( final PhylogenyNode node : nodes ) {
1851 main_panel.getCurrentTreePanel().getFoundNodes0().add( node.getId() );
1853 setSearchFoundCountsOnLabel0( nodes.size() );
1856 setSearchFoundCountsOnLabel0( 0 );
1861 private void search1( final MainPanel main_panel, final Phylogeny tree, final String query_str ) {
1862 getSearchFoundCountsLabel1().setVisible( true );
1863 getSearchResetButton1().setEnabled( true );
1864 getSearchResetButton1().setVisible( true );
1865 String[] queries = null;
1866 List<PhylogenyNode> nodes = null;
1867 if ( query_str.indexOf( ',' ) >= 0 ) {
1868 queries = query_str.split( ",+" );
1871 queries = new String[ 1 ];
1872 queries[ 0 ] = query_str.trim();
1874 if ( ( queries != null ) && ( queries.length > 0 ) ) {
1875 nodes = new ArrayList<PhylogenyNode>();
1876 for( String query : queries ) {
1877 if ( ForesterUtil.isEmpty( query ) ) {
1880 query = query.trim();
1881 if ( query.indexOf( '+' ) >= 0 ) {
1882 nodes.addAll( PhylogenyMethods.searchDataLogicalAnd( query.split( "\\++" ),
1884 getOptions().isSearchCaseSensitive(),
1885 !getOptions().isMatchWholeTermsOnly(),
1886 isShowDomainArchitectures() ) );
1889 nodes.addAll( PhylogenyMethods.searchData( query,
1891 getOptions().isSearchCaseSensitive(),
1892 !getOptions().isMatchWholeTermsOnly(),
1893 isShowDomainArchitectures() ) );
1896 if ( getOptions().isInverseSearchResult() ) {
1897 final List<PhylogenyNode> all = PhylogenyMethods.obtainAllNodesAsList( tree );
1898 all.removeAll( nodes );
1902 if ( ( nodes != null ) && ( nodes.size() > 0 ) ) {
1903 main_panel.getCurrentTreePanel().setFoundNodes1( new HashSet<Long>() );
1904 for( final PhylogenyNode node : nodes ) {
1905 main_panel.getCurrentTreePanel().getFoundNodes1().add( node.getId() );
1907 setSearchFoundCountsOnLabel1( nodes.size() );
1910 setSearchFoundCountsOnLabel1( 0 );
1915 private void setDrawPhylogram( final int index, final boolean b ) {
1916 getIsDrawPhylogramList().set( index, b );
1919 private void setupClickToOptions() {
1920 final int default_option = _configuration.getDefaultDisplayClicktoOption();
1921 int selected_index = 0;
1923 if ( _configuration.doDisplayClickToOption( Configuration.display_node_data ) ) {
1924 _show_data_item = cb_index;
1925 addClickToOption( Configuration.display_node_data,
1926 _configuration.getClickToTitle( Configuration.display_node_data ) );
1927 if ( default_option == Configuration.display_node_data ) {
1928 selected_index = cb_index;
1932 if ( _configuration.doDisplayClickToOption( Configuration.collapse_uncollapse ) ) {
1933 _collapse_cb_item = cb_index;
1934 addClickToOption( Configuration.collapse_uncollapse,
1935 _configuration.getClickToTitle( Configuration.collapse_uncollapse ) );
1936 if ( default_option == Configuration.collapse_uncollapse ) {
1937 selected_index = cb_index;
1941 if ( _configuration.doDisplayClickToOption( Configuration.reroot ) ) {
1942 _reroot_cb_item = cb_index;
1943 addClickToOption( Configuration.reroot, _configuration.getClickToTitle( Configuration.reroot ) );
1944 if ( default_option == Configuration.reroot ) {
1945 selected_index = cb_index;
1949 if ( _configuration.doDisplayClickToOption( Configuration.subtree ) ) {
1950 _subtree_cb_item = cb_index;
1951 addClickToOption( Configuration.subtree, _configuration.getClickToTitle( Configuration.subtree ) );
1952 if ( default_option == Configuration.subtree ) {
1953 selected_index = cb_index;
1957 if ( _configuration.doDisplayClickToOption( Configuration.swap ) ) {
1958 _swap_cb_item = cb_index;
1959 addClickToOption( Configuration.swap, _configuration.getClickToTitle( Configuration.swap ) );
1960 if ( default_option == Configuration.swap ) {
1961 selected_index = cb_index;
1965 if ( _configuration.doDisplayClickToOption( Configuration.sort_descendents ) ) {
1966 _sort_descendents_item = cb_index;
1967 addClickToOption( Configuration.sort_descendents,
1968 _configuration.getClickToTitle( Configuration.sort_descendents ) );
1969 if ( default_option == Configuration.sort_descendents ) {
1970 selected_index = cb_index;
1974 if ( _configuration.doDisplayClickToOption( Configuration.color_node_font ) ) {
1975 _color_node_font_item = cb_index;
1976 addClickToOption( Configuration.color_node_font,
1977 _configuration.getClickToTitle( Configuration.color_node_font ) );
1978 if ( default_option == Configuration.color_node_font ) {
1979 selected_index = cb_index;
1983 if ( _configuration.doDisplayClickToOption( Configuration.change_node_font ) ) {
1984 _change_node_font_item = cb_index;
1985 addClickToOption( Configuration.change_node_font,
1986 _configuration.getClickToTitle( Configuration.change_node_font ) );
1987 if ( default_option == Configuration.change_node_font ) {
1988 selected_index = cb_index;
1992 if ( _configuration.doDisplayClickToOption( Configuration.color_subtree ) ) {
1993 _color_subtree_cb_item = cb_index;
1994 addClickToOption( Configuration.color_subtree, _configuration.getClickToTitle( Configuration.color_subtree ) );
1995 if ( default_option == Configuration.color_subtree ) {
1996 selected_index = cb_index;
2000 if ( _configuration.doDisplayClickToOption( Configuration.open_seq_web ) ) {
2001 _open_seq_web_item = cb_index;
2002 addClickToOption( Configuration.open_seq_web, _configuration.getClickToTitle( Configuration.open_seq_web ) );
2003 if ( default_option == Configuration.open_seq_web ) {
2004 selected_index = cb_index;
2008 if ( _configuration.doDisplayClickToOption( Configuration.open_pdb_web ) ) {
2009 _open_pdb_item = cb_index;
2010 addClickToOption( Configuration.open_pdb_web, _configuration.getClickToTitle( Configuration.open_pdb_web ) );
2011 if ( default_option == Configuration.open_pdb_web ) {
2012 selected_index = cb_index;
2016 if ( _configuration.doDisplayClickToOption( Configuration.open_tax_web ) ) {
2017 _open_tax_web_item = cb_index;
2018 addClickToOption( Configuration.open_tax_web, _configuration.getClickToTitle( Configuration.open_tax_web ) );
2019 if ( default_option == Configuration.open_tax_web ) {
2020 selected_index = cb_index;
2024 if ( _configuration.doDisplayClickToOption( Configuration.blast ) ) {
2025 _blast_item = cb_index;
2026 addClickToOption( Configuration.blast, _configuration.getClickToTitle( Configuration.blast ) );
2027 if ( default_option == Configuration.blast ) {
2028 selected_index = cb_index;
2032 if ( _configuration.doDisplayClickToOption( Configuration.select_nodes ) ) {
2033 _select_nodes_item = cb_index;
2034 addClickToOption( Configuration.select_nodes, _configuration.getClickToTitle( Configuration.select_nodes ) );
2035 if ( default_option == Configuration.select_nodes ) {
2036 selected_index = cb_index;
2040 if ( _configuration.doDisplayClickToOption( Configuration.get_ext_desc_data ) ) {
2041 _get_ext_desc_data = cb_index;
2042 if ( !ForesterUtil.isEmpty( getConfiguration().getLabelForGetExtDescendentsData() ) ) {
2043 addClickToOption( Configuration.get_ext_desc_data, getConfiguration()
2044 .getLabelForGetExtDescendentsData() );
2048 switch ( getConfiguration().getExtDescNodeDataToReturn() ) {
2053 s = "Sequence Accessors";
2055 case SEQUENCE_MOL_SEQ:
2056 s = "Molecular Sequence";
2058 case SEQUENCE_MOL_SEQ_FASTA:
2059 s = "Molecular Sequence (Fasta)";
2062 s = "Sequence Names";
2067 case SEQUENCE_SYMBOL:
2068 s = "Sequence Symbols";
2071 s = "Taxonomy Codes";
2073 case TAXONOMY_COMM0N_NAME:
2074 s = "Taxonomy Common Names";
2076 case TAXONOMY_SCIENTIFIC_NAME:
2077 s = "Scientific Names";
2080 s = "User Selected Data";
2083 throw new IllegalStateException( "dont know how to deal with "
2084 + getConfiguration().getExtDescNodeDataToReturn() );
2086 final String label = _configuration.getClickToTitle( Configuration.get_ext_desc_data ) + " " + s;
2087 addClickToOption( Configuration.get_ext_desc_data, label );
2089 if ( default_option == Configuration.get_ext_desc_data ) {
2090 selected_index = cb_index;
2094 if ( getOptions().isEditable() ) {
2095 if ( _configuration.doDisplayClickToOption( Configuration.cut_subtree ) ) {
2096 _cut_subtree_item = cb_index;
2097 addClickToOption( Configuration.cut_subtree, _configuration.getClickToTitle( Configuration.cut_subtree ) );
2098 if ( default_option == Configuration.cut_subtree ) {
2099 selected_index = cb_index;
2103 if ( _configuration.doDisplayClickToOption( Configuration.copy_subtree ) ) {
2104 _copy_subtree_item = cb_index;
2105 addClickToOption( Configuration.copy_subtree,
2106 _configuration.getClickToTitle( Configuration.copy_subtree ) );
2107 if ( default_option == Configuration.copy_subtree ) {
2108 selected_index = cb_index;
2112 if ( _configuration.doDisplayClickToOption( Configuration.paste_subtree ) ) {
2113 _paste_subtree_item = cb_index;
2114 addClickToOption( Configuration.paste_subtree,
2115 _configuration.getClickToTitle( Configuration.paste_subtree ) );
2116 if ( default_option == Configuration.paste_subtree ) {
2117 selected_index = cb_index;
2121 if ( _configuration.doDisplayClickToOption( Configuration.delete_subtree_or_node ) ) {
2122 _delete_node_or_subtree_item = cb_index;
2123 addClickToOption( Configuration.delete_subtree_or_node,
2124 _configuration.getClickToTitle( Configuration.delete_subtree_or_node ) );
2125 if ( default_option == Configuration.delete_subtree_or_node ) {
2126 selected_index = cb_index;
2130 if ( _configuration.doDisplayClickToOption( Configuration.add_new_node ) ) {
2131 _add_new_node_item = cb_index;
2132 addClickToOption( Configuration.add_new_node,
2133 _configuration.getClickToTitle( Configuration.add_new_node ) );
2134 if ( default_option == Configuration.add_new_node ) {
2135 selected_index = cb_index;
2139 if ( _configuration.doDisplayClickToOption( Configuration.edit_node_data ) ) {
2140 _edit_node_data_item = cb_index;
2141 addClickToOption( Configuration.edit_node_data,
2142 _configuration.getClickToTitle( Configuration.edit_node_data ) );
2143 if ( default_option == Configuration.edit_node_data ) {
2144 selected_index = cb_index;
2149 // Set default selection and its action
2150 _click_to_combobox.setSelectedIndex( selected_index );
2151 setClickToAction( selected_index );
2154 private void setupDisplayCheckboxes() {
2155 if ( _configuration.doDisplayOption( Configuration.display_as_phylogram ) ) {
2156 addCheckbox( Configuration.display_as_phylogram,
2157 _configuration.getDisplayTitle( Configuration.display_as_phylogram ) );
2158 setCheckbox( Configuration.display_as_phylogram,
2159 _configuration.doCheckOption( Configuration.display_as_phylogram ) );
2161 if ( _configuration.doDisplayOption( Configuration.dynamically_hide_data ) ) {
2162 addCheckbox( Configuration.dynamically_hide_data,
2163 _configuration.getDisplayTitle( Configuration.dynamically_hide_data ) );
2164 setCheckbox( Configuration.dynamically_hide_data,
2165 _configuration.doCheckOption( Configuration.dynamically_hide_data ) );
2167 if ( _configuration.doDisplayOption( Configuration.node_data_popup ) ) {
2168 addCheckbox( Configuration.node_data_popup, _configuration.getDisplayTitle( Configuration.node_data_popup ) );
2169 setCheckbox( Configuration.node_data_popup, _configuration.doCheckOption( Configuration.node_data_popup ) );
2171 if ( _configuration.doDisplayOption( Configuration.display_internal_data ) ) {
2172 addCheckbox( Configuration.display_internal_data,
2173 _configuration.getDisplayTitle( Configuration.display_internal_data ) );
2174 setCheckbox( Configuration.display_internal_data,
2175 _configuration.doCheckOption( Configuration.display_internal_data ) );
2177 if ( _configuration.doDisplayOption( Configuration.color_according_to_sequence ) ) {
2178 addCheckbox( Configuration.color_according_to_sequence,
2179 _configuration.getDisplayTitle( Configuration.color_according_to_sequence ) );
2180 setCheckbox( Configuration.color_according_to_sequence,
2181 _configuration.doCheckOption( Configuration.color_according_to_sequence ) );
2183 if ( _configuration.doDisplayOption( Configuration.color_according_to_species ) ) {
2184 addCheckbox( Configuration.color_according_to_species,
2185 _configuration.getDisplayTitle( Configuration.color_according_to_species ) );
2186 setCheckbox( Configuration.color_according_to_species,
2187 _configuration.doCheckOption( Configuration.color_according_to_species ) );
2189 if ( _configuration.doDisplayOption( Configuration.color_according_to_annotation ) ) {
2190 addCheckbox( Configuration.color_according_to_annotation,
2191 _configuration.getDisplayTitle( Configuration.color_according_to_annotation ) );
2192 setCheckbox( Configuration.color_according_to_annotation,
2193 _configuration.doCheckOption( Configuration.color_according_to_annotation ) );
2195 if ( _configuration.doDisplayOption( Configuration.use_style ) ) {
2196 addCheckbox( Configuration.use_style, _configuration.getDisplayTitle( Configuration.use_style ) );
2197 setCheckbox( Configuration.use_style, _configuration.doCheckOption( Configuration.use_style ) );
2199 if ( _configuration.doDisplayOption( Configuration.width_branches ) ) {
2200 addCheckbox( Configuration.width_branches, _configuration.getDisplayTitle( Configuration.width_branches ) );
2201 setCheckbox( Configuration.width_branches, _configuration.doCheckOption( Configuration.width_branches ) );
2203 final JLabel label = new JLabel( "Display Data:" );
2204 label.setFont( ControlPanel.jcb_bold_font );
2205 if ( !getConfiguration().isUseNativeUI() ) {
2206 label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
2209 if ( _configuration.doDisplayOption( Configuration.show_node_names ) ) {
2210 addCheckbox( Configuration.show_node_names, _configuration.getDisplayTitle( Configuration.show_node_names ) );
2211 setCheckbox( Configuration.show_node_names, _configuration.doCheckOption( Configuration.show_node_names ) );
2213 if ( _configuration.doDisplayOption( Configuration.show_tax_code ) ) {
2214 addCheckbox( Configuration.show_tax_code, _configuration.getDisplayTitle( Configuration.show_tax_code ) );
2215 setCheckbox( Configuration.show_tax_code, _configuration.doCheckOption( Configuration.show_tax_code ) );
2217 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_scientific_names ) ) {
2218 addCheckbox( Configuration.show_taxonomy_scientific_names,
2219 _configuration.getDisplayTitle( Configuration.show_taxonomy_scientific_names ) );
2220 setCheckbox( Configuration.show_taxonomy_scientific_names,
2221 _configuration.doCheckOption( Configuration.show_taxonomy_scientific_names ) );
2223 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_common_names ) ) {
2224 addCheckbox( Configuration.show_taxonomy_common_names,
2225 _configuration.getDisplayTitle( Configuration.show_taxonomy_common_names ) );
2226 setCheckbox( Configuration.show_taxonomy_common_names,
2227 _configuration.doCheckOption( Configuration.show_taxonomy_common_names ) );
2229 if ( _configuration.doDisplayOption( Configuration.show_seq_names ) ) {
2230 addCheckbox( Configuration.show_seq_names, _configuration.getDisplayTitle( Configuration.show_seq_names ) );
2231 setCheckbox( Configuration.show_seq_names, _configuration.doCheckOption( Configuration.show_seq_names ) );
2233 if ( _configuration.doDisplayOption( Configuration.show_gene_names ) ) {
2234 addCheckbox( Configuration.show_gene_names, _configuration.getDisplayTitle( Configuration.show_gene_names ) );
2235 setCheckbox( Configuration.show_gene_names, _configuration.doCheckOption( Configuration.show_gene_names ) );
2237 if ( _configuration.doDisplayOption( Configuration.show_seq_symbols ) ) {
2238 addCheckbox( Configuration.show_seq_symbols,
2239 _configuration.getDisplayTitle( Configuration.show_seq_symbols ) );
2240 setCheckbox( Configuration.show_seq_symbols, _configuration.doCheckOption( Configuration.show_seq_symbols ) );
2242 if ( _configuration.doDisplayOption( Configuration.show_sequence_acc ) ) {
2243 addCheckbox( Configuration.show_sequence_acc,
2244 _configuration.getDisplayTitle( Configuration.show_sequence_acc ) );
2245 setCheckbox( Configuration.show_sequence_acc,
2246 _configuration.doCheckOption( Configuration.show_sequence_acc ) );
2248 if ( _configuration.doDisplayOption( Configuration.show_annotation ) ) {
2249 addCheckbox( Configuration.show_annotation, _configuration.getDisplayTitle( Configuration.show_annotation ) );
2250 setCheckbox( Configuration.show_annotation, _configuration.doCheckOption( Configuration.show_annotation ) );
2252 if ( _configuration.doDisplayOption( Configuration.write_confidence_values ) ) {
2253 addCheckbox( Configuration.write_confidence_values,
2254 _configuration.getDisplayTitle( Configuration.write_confidence_values ) );
2255 setCheckbox( Configuration.write_confidence_values,
2256 _configuration.doCheckOption( Configuration.write_confidence_values ) );
2258 if ( _configuration.doDisplayOption( Configuration.write_branch_length_values ) ) {
2259 addCheckbox( Configuration.write_branch_length_values,
2260 _configuration.getDisplayTitle( Configuration.write_branch_length_values ) );
2261 setCheckbox( Configuration.write_branch_length_values,
2262 _configuration.doCheckOption( Configuration.write_branch_length_values ) );
2264 if ( _configuration.doDisplayOption( Configuration.show_binary_characters ) ) {
2265 addCheckbox( Configuration.show_binary_characters,
2266 _configuration.getDisplayTitle( Configuration.show_binary_characters ) );
2267 setCheckbox( Configuration.show_binary_characters,
2268 _configuration.doCheckOption( Configuration.show_binary_characters ) );
2270 if ( _configuration.doDisplayOption( Configuration.show_binary_character_counts ) ) {
2271 addCheckbox( Configuration.show_binary_character_counts,
2272 _configuration.getDisplayTitle( Configuration.show_binary_character_counts ) );
2273 setCheckbox( Configuration.show_binary_character_counts,
2274 _configuration.doCheckOption( Configuration.show_binary_character_counts ) );
2276 if ( _configuration.doDisplayOption( Configuration.show_domain_architectures ) ) {
2277 addCheckbox( Configuration.show_domain_architectures,
2278 _configuration.getDisplayTitle( Configuration.show_domain_architectures ) );
2279 setCheckbox( Configuration.show_domain_architectures,
2280 _configuration.doCheckOption( Configuration.show_domain_architectures ) );
2282 if ( _configuration.doDisplayOption( Configuration.show_mol_seqs ) ) {
2283 addCheckbox( Configuration.show_mol_seqs, _configuration.getDisplayTitle( Configuration.show_mol_seqs ) );
2284 setCheckbox( Configuration.show_mol_seqs, _configuration.doCheckOption( Configuration.show_mol_seqs ) );
2286 if ( _configuration.doDisplayOption( Configuration.write_events ) ) {
2287 addCheckbox( Configuration.write_events, _configuration.getDisplayTitle( Configuration.write_events ) );
2288 setCheckbox( Configuration.write_events, _configuration.doCheckOption( Configuration.write_events ) );
2290 if ( _configuration.doDisplayOption( Configuration.show_vector_data ) ) {
2291 addCheckbox( Configuration.show_vector_data,
2292 _configuration.getDisplayTitle( Configuration.show_vector_data ) );
2293 setCheckbox( Configuration.show_vector_data, _configuration.doCheckOption( Configuration.show_vector_data ) );
2295 if ( _configuration.doDisplayOption( Configuration.show_properties ) ) {
2296 addCheckbox( Configuration.show_properties, _configuration.getDisplayTitle( Configuration.show_properties ) );
2297 setCheckbox( Configuration.show_properties, _configuration.doCheckOption( Configuration.show_properties ) );
2299 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_images ) ) {
2300 addCheckbox( Configuration.show_taxonomy_images,
2301 _configuration.getDisplayTitle( Configuration.show_taxonomy_images ) );
2302 setCheckbox( Configuration.show_taxonomy_images,
2303 _configuration.doCheckOption( Configuration.show_taxonomy_images ) );
2307 private void setVisibilityOfDomainStrucureControls() {
2308 if ( _zoom_in_domain_structure != null ) {
2309 final MainFrame mf = getMainFrame();
2311 if ( isShowDomainArchitectures() ) {
2312 _domain_display_label.setVisible( true );
2313 _zoom_in_domain_structure.setVisible( true );
2314 _zoom_out_domain_structure.setVisible( true );
2315 _decr_domain_structure_evalue_thr.setVisible( true );
2316 _incr_domain_structure_evalue_thr.setVisible( true );
2317 _domain_structure_evalue_thr_tf.setVisible( true );
2318 if ( mf._right_line_up_domains_cbmi != null ) {
2319 mf._right_line_up_domains_cbmi.setVisible( true );
2321 if ( mf._show_domain_labels != null ) {
2322 mf._show_domain_labels.setVisible( true );
2326 _domain_display_label.setVisible( false );
2327 _zoom_in_domain_structure.setVisible( false );
2328 _zoom_out_domain_structure.setVisible( false );
2329 _decr_domain_structure_evalue_thr.setVisible( false );
2330 _incr_domain_structure_evalue_thr.setVisible( false );
2331 _domain_structure_evalue_thr_tf.setVisible( false );
2332 if ( mf._right_line_up_domains_cbmi != null ) {
2333 mf._right_line_up_domains_cbmi.setVisible( false );
2335 if ( mf._show_domain_labels != null ) {
2336 mf._show_domain_labels.setVisible( false );
2343 // This takes care of ArchaeopteryxE-issue.
2344 // Can, and will, return null prior to ArchaeopteryxE initialization completion.
2345 final private MainFrame getMainFrame() {
2346 MainFrame mf = getMainPanel().getMainFrame();
2348 // Must be "E" applet version.
2349 final ArchaeopteryxE e = ( ArchaeopteryxE ) ( ( MainPanelApplets ) getMainPanel() ).getApplet();
2350 if ( e.getMainPanel() == null ) {
2353 mf = e.getMainPanel().getMainFrame();
2358 void setVisibilityOfX() {
2359 final MainFrame mf = getMainFrame();
2361 if ( ( getCurrentTreePanel() != null ) && ( getCurrentTreePanel().getPhylogeny() != null ) ) {
2362 if ( AptxUtil.isHasAtLeastOneBranchWithSupportSD( getCurrentTreePanel().getPhylogeny() ) ) {
2363 if ( mf._show_confidence_stddev_cbmi != null ) {
2364 mf._show_confidence_stddev_cbmi.setVisible( true );
2368 if ( mf._show_confidence_stddev_cbmi != null ) {
2369 mf._show_confidence_stddev_cbmi.setVisible( false );
2372 if ( AptxUtil.isHasAtLeastOneNodeWithScientificName( getCurrentTreePanel().getPhylogeny() ) ) {
2373 if ( mf._abbreviate_scientific_names != null ) {
2374 mf._abbreviate_scientific_names.setVisible( true );
2378 if ( mf._abbreviate_scientific_names != null ) {
2379 mf._abbreviate_scientific_names.setVisible( false );
2382 if ( AptxUtil.isHasAtLeastOneNodeWithSequenceAnnotation( getCurrentTreePanel().getPhylogeny() ) ) {
2383 if ( mf._show_annotation_ref_source != null ) {
2384 mf._show_annotation_ref_source.setVisible( true );
2388 if ( mf._show_annotation_ref_source != null ) {
2389 mf._show_annotation_ref_source.setVisible( false );
2393 if ( isDrawPhylogram()
2394 || ( ( getCurrentTreePanel() != null ) && ( ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) || ( getCurrentTreePanel()
2395 .getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) ) ) {
2396 if ( mf._non_lined_up_cladograms_rbmi != null ) {
2397 mf._non_lined_up_cladograms_rbmi.setVisible( false );
2399 if ( mf._uniform_cladograms_rbmi != null ) {
2400 mf._uniform_cladograms_rbmi.setVisible( false );
2402 if ( mf._ext_node_dependent_cladogram_rbmi != null ) {
2403 mf._ext_node_dependent_cladogram_rbmi.setVisible( false );
2407 if ( mf._non_lined_up_cladograms_rbmi != null ) {
2408 mf._non_lined_up_cladograms_rbmi.setVisible( true );
2410 if ( mf._uniform_cladograms_rbmi != null ) {
2411 mf._uniform_cladograms_rbmi.setVisible( true );
2413 if ( mf._ext_node_dependent_cladogram_rbmi != null ) {
2414 mf._ext_node_dependent_cladogram_rbmi.setVisible( true );
2417 if ( isDrawPhylogram() ) {
2418 if ( mf._show_scale_cbmi != null ) {
2419 mf._show_scale_cbmi.setVisible( true );
2423 if ( mf._show_scale_cbmi != null ) {
2424 mf._show_scale_cbmi.setVisible( false );
2427 if ( getCurrentTreePanel() != null ) {
2428 if ( ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
2429 || ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) {
2430 if ( mf._label_direction_cbmi != null ) {
2431 mf._label_direction_cbmi.setVisible( true );
2435 if ( mf._label_direction_cbmi != null ) {
2436 mf._label_direction_cbmi.setVisible( false );
2443 void setVisibilityOfDomainStrucureCB() {
2445 if ( ( getCurrentTreePanel() != null )
2446 && ( ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) || ( getCurrentTreePanel()
2447 .getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) ) {
2448 if ( getMainPanel().getMainFrame()._right_line_up_domains_cbmi != null ) {
2449 getMainPanel().getMainFrame()._right_line_up_domains_cbmi.setVisible( false );
2451 if ( getMainPanel().getMainFrame()._show_domain_labels != null ) {
2452 getMainPanel().getMainFrame()._show_domain_labels.setVisible( false );
2455 else if ( isShowDomainArchitectures() ) {
2456 if ( getMainPanel().getMainFrame()._right_line_up_domains_cbmi != null ) {
2457 getMainPanel().getMainFrame()._right_line_up_domains_cbmi.setVisible( true );
2459 if ( getMainPanel().getMainFrame()._show_domain_labels != null ) {
2460 getMainPanel().getMainFrame()._show_domain_labels.setVisible( true );
2464 if ( getMainPanel().getMainFrame()._right_line_up_domains_cbmi != null ) {
2465 getMainPanel().getMainFrame()._right_line_up_domains_cbmi.setVisible( false );
2467 if ( getMainPanel().getMainFrame()._show_domain_labels != null ) {
2468 getMainPanel().getMainFrame()._show_domain_labels.setVisible( false );
2472 catch ( final Exception ignore ) {
2477 static JLabel customizeLabel( final JLabel label, final Configuration configuration ) {
2478 label.setFont( ControlPanel.jcb_bold_font );
2479 if ( !configuration.isUseNativeUI() ) {
2480 label.setForeground( configuration.getGuiCheckboxTextColor() );
2481 label.setBackground( configuration.getGuiBackgroundColor() );
2486 enum NodeClickAction {
2493 DELETE_NODE_OR_SUBTREE,