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.NODE_NAME;
263 if ( isShowTaxonomyScientificNames() || isShowTaxonomyCode() ) {
264 pri = DESCENDANT_SORT_PRIORITY.TAXONOMY;
266 else if ( isShowSeqNames() || isShowSeqSymbols() || isShowGeneNames() ) {
267 pri = DESCENDANT_SORT_PRIORITY.SEQUENCE;
269 PhylogenyMethods.orderAppearance( tp.getPhylogeny().getRoot(), _order_of_appearance, true, pri );
270 _order_of_appearance = !_order_of_appearance;
271 tp.setNodeInPreorderToNull();
272 tp.getPhylogeny().externalNodesHaveChanged();
273 tp.getPhylogeny().clearHashIdToNodeMap();
274 tp.getPhylogeny().recalculateNumberOfExternalDescendants( true );
275 tp.resetNodeIdToDistToLeafMap();
276 tp.setEdited( true );
277 displayedPhylogenyMightHaveChanged( true );
279 else if ( e.getSource() == _uncollapse_all ) {
281 displayedPhylogenyMightHaveChanged( false );
283 else if ( e.getSource() == _zoom_in_domain_structure ) {
284 _mainpanel.getCurrentTreePanel().zoomInDomainStructure();
285 displayedPhylogenyMightHaveChanged( true );
287 else if ( e.getSource() == _zoom_out_domain_structure ) {
288 _mainpanel.getCurrentTreePanel().zoomOutDomainStructure();
289 displayedPhylogenyMightHaveChanged( true );
291 else if ( e.getSource() == _decr_domain_structure_evalue_thr ) {
292 _mainpanel.getCurrentTreePanel().decreaseDomainStructureEvalueThreshold();
293 displayedPhylogenyMightHaveChanged( true );
295 else if ( e.getSource() == _incr_domain_structure_evalue_thr ) {
296 _mainpanel.getCurrentTreePanel().increaseDomainStructureEvalueThreshold();
297 displayedPhylogenyMightHaveChanged( true );
299 else if ( e.getSource() == _search_tf_0 ) {
301 displayedPhylogenyMightHaveChanged( true );
303 else if ( e.getSource() == _search_tf_1 ) {
305 displayedPhylogenyMightHaveChanged( true );
307 else if ( ( _dynamically_hide_data != null ) && ( e.getSource() == _dynamically_hide_data )
308 && !_dynamically_hide_data.isSelected() ) {
309 setDynamicHidingIsOn( false );
310 displayedPhylogenyMightHaveChanged( true );
313 displayedPhylogenyMightHaveChanged( true );
317 tp.requestFocusInWindow();
320 catch ( final Exception ex ) {
321 AptxUtil.unexpectedException( ex );
323 catch ( final Error err ) {
324 AptxUtil.unexpectedError( err );
328 public JCheckBox getColorAccSpeciesCb() {
329 return _color_acc_species;
332 public JCheckBox getColorAccSequenceCb() {
333 return _color_acc_sequence;
336 public JCheckBox getUseVisualStylesCb() {
337 return _use_visual_styles_cb;
340 public JCheckBox getDisplayAsPhylogramCb() {
341 return _display_as_phylogram_cb;
344 public JCheckBox getDynamicallyHideData() {
345 return _dynamically_hide_data;
348 public JCheckBox getNodeDescPopupCb() {
349 return _node_desc_popup_cb;
352 public Sequence getSelectedQuerySequence() {
353 return _selected_query_seq;
356 public JComboBox<String> getSequenceRelationBox() {
357 if ( _show_sequence_relations == null ) {
358 _show_sequence_relations = new JComboBox<String>();
359 _show_sequence_relations.setFocusable( false );
360 _show_sequence_relations.setMaximumRowCount( 20 );
361 _show_sequence_relations.setFont( ControlPanel.js_font );
362 if ( !_configuration.isUseNativeUI() ) {
363 _show_sequence_relations.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
364 _show_sequence_relations.setForeground( getConfiguration().getGuiButtonTextColor() );
366 _show_sequence_relations.addItem( "-----" );
367 _show_sequence_relations.setToolTipText( "To display orthology information for selected query" );
369 return _show_sequence_relations;
373 public JComboBox<SEQUENCE_RELATION_TYPE> getSequenceRelationTypeBox() {
374 if ( _sequence_relation_type_box == null ) {
375 _sequence_relation_type_box = new JComboBox<SEQUENCE_RELATION_TYPE>();
376 for( final SequenceRelation.SEQUENCE_RELATION_TYPE type : SequenceRelation.SEQUENCE_RELATION_TYPE.values() ) {
377 _sequence_relation_type_box.addItem( type );
379 _sequence_relation_type_box.addActionListener( new ActionListener() {
382 public void actionPerformed( final ActionEvent e ) {
383 if ( _mainpanel.getCurrentPhylogeny() != null ) {
384 setSequenceRelationQueries( getMainPanel().getCurrentPhylogeny().getSequenceRelationQueries() );
389 return _sequence_relation_type_box;
392 public JCheckBox getShowEventsCb() {
396 public JCheckBox getWriteConfidenceCb() {
397 return _write_confidence;
400 public boolean isShowProperties() {
401 return ( ( _show_properties_cb != null ) && _show_properties_cb.isSelected() );
404 public boolean isShowTaxonomyImages() {
405 return ( ( _show_taxo_images_cb != null ) && _show_taxo_images_cb.isSelected() );
408 public boolean isShowVectorData() {
409 return ( ( _show_vector_data_cb != null ) && _show_vector_data_cb.isSelected() );
412 public void setSequenceRelationQueries( final Collection<Sequence> sequenceRelationQueries ) {
413 final JComboBox<String> box = getSequenceRelationBox();
414 while ( box.getItemCount() > 1 ) {
415 box.removeItemAt( 1 );
417 final HashMap<String, Sequence> sequencesByName = new HashMap<String, Sequence>();
418 final SequenceRelation.SEQUENCE_RELATION_TYPE relationType = ( SequenceRelation.SEQUENCE_RELATION_TYPE ) _sequence_relation_type_box
420 if ( relationType == null ) {
423 final ArrayList<String> sequenceNamesToAdd = new ArrayList<String>();
424 for( final Sequence seq : sequenceRelationQueries ) {
425 if ( seq.hasSequenceRelations() ) {
426 boolean fFoundForCurrentType = false;
427 for( final SequenceRelation sq : seq.getSequenceRelations() ) {
428 if ( sq.getType().equals( relationType ) ) {
429 fFoundForCurrentType = true;
433 if ( fFoundForCurrentType ) {
434 sequenceNamesToAdd.add( seq.getName() );
435 sequencesByName.put( seq.getName(), seq );
439 // sort sequences by name before adding them to the combo
440 final String[] sequenceNameArray = sequenceNamesToAdd.toArray( new String[ sequenceNamesToAdd.size() ] );
441 Arrays.sort( sequenceNameArray, String.CASE_INSENSITIVE_ORDER );
442 for( final String seqName : sequenceNameArray ) {
443 box.addItem( seqName );
445 for( final ItemListener oldItemListener : box.getItemListeners() ) {
446 box.removeItemListener( oldItemListener );
448 box.addItemListener( new ItemListener() {
451 public void itemStateChanged( final ItemEvent e ) {
452 _selected_query_seq = sequencesByName.get( e.getItem() );
453 _mainpanel.getCurrentTreePanel().repaint();
458 void activateButtonToReturnToSuperTree( int index ) {
461 _return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT + " " + index );
464 _return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT );
466 _return_to_super_tree.setForeground( getConfiguration().getGuiCheckboxAndButtonActiveColor() );
467 _return_to_super_tree.setEnabled( true );
471 * Add zoom and quick edit buttons. (Last modified 8/9/04)
474 final JLabel spacer = new JLabel( "" );
475 spacer.setOpaque( false );
477 final JPanel x_panel = new JPanel( new GridLayout( 1, 1, 0, 0 ) );
478 final JPanel y_panel = new JPanel( new GridLayout( 1, 3, 0, 0 ) );
479 final JPanel z_panel = new JPanel( new GridLayout( 1, 1, 0, 0 ) );
480 if ( !getConfiguration().isUseNativeUI() ) {
481 x_panel.setBackground( getBackground() );
482 y_panel.setBackground( getBackground() );
483 z_panel.setBackground( getBackground() );
485 add( _zoom_label = new JLabel( "Zoom:" ) );
486 customizeLabel( _zoom_label, getConfiguration() );
490 if ( getConfiguration().isUseNativeUI() ) {
491 _zoom_in_x = new JButton( "+" );
492 _zoom_out_x = new JButton( "-" );
495 _zoom_in_x = new JButton( "X+" );
496 _zoom_out_x = new JButton( "X-" );
498 _zoom_in_y = new JButton( "Y+" );
499 _zoom_out_y = new JButton( "Y-" );
500 _show_whole = new JButton( "F" );
501 _show_whole.setToolTipText( "To fit the complete phylogeny to the current display size [F or Home]" );
502 _zoom_in_x.setToolTipText( "To zoom in horizontally [Shift+cursor-right]" );
503 _zoom_in_y.setToolTipText( "To zoom in vertically [Shift+cursor-up]" );
504 _zoom_out_x.setToolTipText( "To zoom out horizontally [Shift+cursor-left]" );
505 _zoom_out_y.setToolTipText( "To zoom out vertically [Shift+cursor-down]" );
506 if ( getConfiguration().isUseNativeUI() && ForesterUtil.isMac() ) {
507 _zoom_out_x.setPreferredSize( new Dimension( 55, 10 ) );
508 _zoom_in_x.setPreferredSize( new Dimension( 55, 10 ) );
511 _zoom_out_x.setPreferredSize( new Dimension( 10, 10 ) );
512 _zoom_in_x.setPreferredSize( new Dimension( 10, 10 ) );
514 _zoom_out_y.setPreferredSize( new Dimension( 10, 10 ) );
515 _zoom_in_y.setPreferredSize( new Dimension( 10, 10 ) );
516 _show_whole.setPreferredSize( new Dimension( 10, 10 ) );
517 _return_to_super_tree = new JButton( RETURN_TO_SUPER_TREE_TEXT );
518 _return_to_super_tree.setEnabled( false );
519 _order = new JButton( "Order Subtrees" );
520 _uncollapse_all = new JButton( "Uncollapse All" );
521 addJButton( _zoom_in_y, x_panel );
522 addJButton( _zoom_out_x, y_panel );
523 addJButton( _show_whole, y_panel );
524 addJButton( _zoom_in_x, y_panel );
525 addJButton( _zoom_out_y, z_panel );
526 if ( getConfiguration().doDisplayOption( Configuration.show_domain_architectures ) ) {
527 setUpControlsForDomainStrucures();
529 final JLabel spacer2 = new JLabel( "" );
531 addJButton( _return_to_super_tree, this );
532 addJButton( _order, this );
533 addJButton( _uncollapse_all, this );
534 final JLabel spacer3 = new JLabel( "" );
536 setVisibilityOfDomainStrucureControls();
539 void addCheckbox( final int which, final String title ) {
540 final JPanel ch_panel = new JPanel( new BorderLayout( 0, 0 ) );
542 case Configuration.display_as_phylogram:
543 _display_as_phylogram_cb = new JCheckBox( title );
544 getDisplayAsPhylogramCb().setToolTipText( "To switch between phylogram and cladogram display" );
545 addJCheckBox( getDisplayAsPhylogramCb(), ch_panel );
548 case Configuration.display_internal_data:
549 _display_internal_data = new JCheckBox( title );
550 _display_internal_data.setToolTipText( "To allow or disallow display of internal labels" );
551 addJCheckBox( _display_internal_data, ch_panel );
554 case Configuration.color_according_to_species:
555 _color_acc_species = new JCheckBox( title );
556 _color_acc_species.setToolTipText( "To colorize node labels as a function of taxonomy" );
557 addJCheckBox( _color_acc_species, ch_panel );
560 case Configuration.color_according_to_sequence:
561 _color_acc_sequence = new JCheckBox( title );
562 _color_acc_sequence.setToolTipText( "To colorize node labels as a function of sequence name" );
563 addJCheckBox( _color_acc_sequence, ch_panel );
566 case Configuration.color_according_to_annotation:
567 _color_according_to_annotation = new JCheckBox( title );
568 _color_according_to_annotation
569 .setToolTipText( "To colorize sequence annotation labels as a function of sequence annotation" );
570 addJCheckBox( _color_according_to_annotation, ch_panel );
573 case Configuration.show_node_names:
574 _show_node_names = new JCheckBox( title );
575 addJCheckBox( _show_node_names, ch_panel );
578 case Configuration.show_taxonomy_scientific_names:
579 _show_taxo_scientific_names = new JCheckBox( title );
580 addJCheckBox( _show_taxo_scientific_names, ch_panel );
583 case Configuration.show_taxonomy_common_names:
584 _show_taxo_common_names = new JCheckBox( title );
585 addJCheckBox( _show_taxo_common_names, ch_panel );
588 case Configuration.show_tax_code:
589 _show_taxo_code = new JCheckBox( title );
590 addJCheckBox( _show_taxo_code, ch_panel );
593 case Configuration.show_taxonomy_images:
594 _show_taxo_images_cb = new JCheckBox( title );
595 addJCheckBox( _show_taxo_images_cb, ch_panel );
598 case Configuration.show_binary_characters:
599 _show_binary_characters = new JCheckBox( title );
600 addJCheckBox( _show_binary_characters, ch_panel );
603 case Configuration.show_annotation:
604 _show_annotation = new JCheckBox( title );
605 addJCheckBox( _show_annotation, ch_panel );
608 case Configuration.show_binary_character_counts:
609 _show_binary_character_counts = new JCheckBox( title );
610 addJCheckBox( _show_binary_character_counts, ch_panel );
613 case Configuration.write_confidence_values:
614 _write_confidence = new JCheckBox( title );
615 addJCheckBox( getWriteConfidenceCb(), ch_panel );
618 case Configuration.write_events:
619 _show_events = new JCheckBox( title );
620 addJCheckBox( getShowEventsCb(), ch_panel );
623 case Configuration.use_style:
624 _use_visual_styles_cb = new JCheckBox( title );
625 getUseVisualStylesCb()
626 .setToolTipText( "To use visual styles (node colors, fonts) and branch colors, if present" );
627 addJCheckBox( getUseVisualStylesCb(), ch_panel );
630 case Configuration.width_branches:
631 _width_branches = new JCheckBox( title );
632 _width_branches.setToolTipText( "To use branch width values, if present" );
633 addJCheckBox( _width_branches, ch_panel );
636 case Configuration.write_branch_length_values:
637 _write_branch_length_values = new JCheckBox( title );
638 addJCheckBox( _write_branch_length_values, ch_panel );
641 case Configuration.show_domain_architectures:
642 _show_domain_architectures = new JCheckBox( title );
643 addJCheckBox( _show_domain_architectures, ch_panel );
646 case Configuration.show_mol_seqs:
647 _show_mol_seqs = new JCheckBox( title );
648 addJCheckBox( _show_mol_seqs, ch_panel );
651 case Configuration.show_seq_names:
652 _show_seq_names = new JCheckBox( title );
653 addJCheckBox( _show_seq_names, ch_panel );
656 case Configuration.show_gene_names:
657 _show_gene_names = new JCheckBox( title );
658 addJCheckBox( _show_gene_names, ch_panel );
661 case Configuration.show_seq_symbols:
662 _show_seq_symbols = new JCheckBox( title );
663 addJCheckBox( _show_seq_symbols, ch_panel );
666 case Configuration.show_sequence_acc:
667 _show_sequence_acc = new JCheckBox( title );
668 addJCheckBox( _show_sequence_acc, ch_panel );
671 case Configuration.dynamically_hide_data:
672 _dynamically_hide_data = new JCheckBox( title );
673 getDynamicallyHideData().setToolTipText( "To hide labels depending on expected visibility" );
674 addJCheckBox( getDynamicallyHideData(), ch_panel );
677 case Configuration.node_data_popup:
678 _node_desc_popup_cb = new JCheckBox( title );
679 getNodeDescPopupCb().setToolTipText( "To enable mouse rollover display of basic node data" );
680 addJCheckBox( getNodeDescPopupCb(), ch_panel );
683 case Configuration.show_relation_confidence:
684 _seq_relation_confidence_switch = new JCheckBox( title );
685 addJCheckBox( _seq_relation_confidence_switch, ch_panel );
688 case Configuration.show_vector_data:
689 _show_vector_data_cb = new JCheckBox( title );
690 addJCheckBox( _show_vector_data_cb, ch_panel );
693 case Configuration.show_properties:
694 _show_properties_cb = new JCheckBox( title );
695 addJCheckBox( _show_properties_cb, ch_panel );
699 throw new RuntimeException( "unknown checkbox: " + which );
703 void addJButton( final JButton jb, final JPanel p ) {
704 jb.setFocusPainted( false );
705 jb.setFont( ControlPanel.jcb_font );
706 if ( !_configuration.isUseNativeUI() ) {
707 jb.setBorder( BorderFactory.createLineBorder( getConfiguration().getGuiButtonBorderColor() ) );
708 jb.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
709 jb.setForeground( getConfiguration().getGuiButtonTextColor() );
712 jb.addActionListener( this );
715 void addJCheckBox( final JCheckBox jcb, final JPanel p ) {
716 jcb.setFocusPainted( false );
717 jcb.setFont( ControlPanel.jcb_font );
718 if ( !_configuration.isUseNativeUI() ) {
719 jcb.setBackground( getConfiguration().getGuiBackgroundColor() );
720 jcb.setForeground( getConfiguration().getGuiCheckboxTextColor() );
722 p.add( jcb, "Center" );
723 jcb.addActionListener( this );
726 void addJTextField( final JTextField tf, final JPanel p ) {
727 if ( !_configuration.isUseNativeUI() ) {
728 tf.setForeground( getConfiguration().getGuiBackgroundColor() );
729 tf.setFont( ControlPanel.jcb_font );
732 tf.addActionListener( this );
735 void deactivateButtonToReturnToSuperTree() {
736 _return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT );
737 _return_to_super_tree.setForeground( getConfiguration().getGuiButtonTextColor() );
738 _return_to_super_tree.setEnabled( false );
741 void displayedPhylogenyMightHaveChanged( final boolean recalc_longest_ext_node_info ) {
742 if ( ( _mainpanel != null )
743 && ( ( _mainpanel.getCurrentPhylogeny() != null ) && !_mainpanel.getCurrentPhylogeny().isEmpty() ) ) {
744 if ( getOptions().isShowOverview() ) {
745 _mainpanel.getCurrentTreePanel().updateOvSizes();
747 _mainpanel.getCurrentTreePanel().recalculateMaxDistanceToRoot();
748 setVisibilityOfDomainStrucureControls();
749 updateDomainStructureEvaluethresholdDisplay();
750 _mainpanel.getCurrentTreePanel().calculateScaleDistance();
751 _mainpanel.getCurrentTreePanel().calcMaxDepth();
752 _mainpanel.adjustJScrollPane();
753 if ( recalc_longest_ext_node_info ) {
754 _mainpanel.getCurrentTreePanel().initNodeData();
755 _mainpanel.getCurrentTreePanel().calculateLongestExtNodeInfo();
757 _mainpanel.getCurrentTreePanel().repaint();
758 // _mainpanel.getCurrentTreePanel().setUpUrtFactors();
762 void endClickToOptions() {
763 _click_to_combobox.addActionListener( this );
767 * Indicates what action should be execute when a node is clicked
769 * @return the click-on action
771 NodeClickAction getActionWhenNodeClicked() {
772 return _action_when_node_clicked;
775 Map<Integer, String> getAllClickToItems() {
776 return _all_click_to_names;
779 Map<String, Color> getAnnotationColors() {
780 return _annotation_colors;
783 Configuration getConfiguration() {
784 return _configuration;
787 TreePanel getCurrentTreePanel() {
788 return getMainPanel().getCurrentTreePanel();
791 MainPanel getMainPanel() {
795 Options getOptions() {
796 return getMainPanel().getOptions();
799 JLabel getSearchFoundCountsLabel0() {
800 return _search_found_label_0;
803 JLabel getSearchFoundCountsLabel1() {
804 return _search_found_label_1;
807 JButton getSearchResetButton0() {
808 return _search_reset_button_0;
811 JButton getSearchResetButton1() {
812 return _search_reset_button_1;
815 JTextField getSearchTextField0() {
819 JTextField getSearchTextField1() {
823 List<String> getSingleClickToNames() {
824 return _click_to_names;
827 Map<String, Color> getSpeciesColors() {
828 return _species_colors;
831 Map<String, Color> getSequenceColors() {
832 return _sequence_colors;
835 boolean isAntialiasScreenText() {
839 boolean isColorAccordingToAnnotation() {
840 return ( ( _color_according_to_annotation != null ) && _color_according_to_annotation.isSelected() );
843 boolean isColorAccordingToTaxonomy() {
844 return ( ( _color_acc_species != null ) && _color_acc_species.isSelected() );
847 boolean isColorAccordingToSequence() {
848 return ( ( _color_acc_sequence != null ) && _color_acc_sequence.isSelected() );
851 boolean isUseVisualStyles() {
852 return ( ( ( getUseVisualStylesCb() != null ) && getUseVisualStylesCb().isSelected() ) || ( ( getUseVisualStylesCb() == null ) && _color_branches ) );
855 boolean isDrawPhylogram() {
856 return isDrawPhylogram( getMainPanel().getCurrentTabIndex() );
859 boolean isDynamicallyHideData() {
860 return ( ( getDynamicallyHideData() != null ) && getDynamicallyHideData().isSelected() );
864 return ( ( getShowEventsCb() != null ) && getShowEventsCb().isSelected() );
867 boolean isNodeDescPopup() {
868 return ( ( getNodeDescPopupCb() != null ) && getNodeDescPopupCb().isSelected() );
871 boolean isShowAnnotation() {
872 return ( ( _show_annotation != null ) && _show_annotation.isSelected() );
875 boolean isShowBinaryCharacterCounts() {
876 return ( ( _show_binary_character_counts != null ) && _show_binary_character_counts.isSelected() );
879 boolean isShowBinaryCharacters() {
880 return ( ( _show_binary_characters != null ) && _show_binary_characters.isSelected() );
883 boolean isShowConfidenceValues() {
884 return ( ( getWriteConfidenceCb() != null ) && getWriteConfidenceCb().isSelected() );
887 boolean isWriteBranchLengthValues() {
888 return ( ( _write_branch_length_values != null ) && _write_branch_length_values.isSelected() );
891 boolean isShowDomainArchitectures() {
892 return ( ( _show_domain_architectures != null ) && _show_domain_architectures.isSelected() );
895 public boolean isShowMolSequences() {
896 return ( ( _show_mol_seqs != null ) && _show_mol_seqs.isSelected() );
899 boolean isShowGeneNames() {
900 return ( ( _show_gene_names != null ) && _show_gene_names.isSelected() );
903 boolean isShowInternalData() {
904 return ( ( _display_internal_data == null ) || _display_internal_data.isSelected() );
907 boolean isShowNodeNames() {
908 return ( ( _show_node_names != null ) && _show_node_names.isSelected() );
911 boolean isShowSeqNames() {
912 return ( ( _show_seq_names != null ) && _show_seq_names.isSelected() );
915 boolean isShowSeqSymbols() {
916 return ( ( _show_seq_symbols != null ) && _show_seq_symbols.isSelected() );
919 boolean isShowSequenceAcc() {
920 return ( ( _show_sequence_acc != null ) && _show_sequence_acc.isSelected() );
923 boolean isShowSequenceRelationConfidence() {
924 return ( ( _seq_relation_confidence_switch != null ) && ( _seq_relation_confidence_switch.isSelected() ) );
927 boolean isShowSequenceRelations() {
928 return ( ( _show_sequence_relations != null ) && ( _show_sequence_relations.getSelectedIndex() > 0 ) );
931 boolean isShowTaxonomyCode() {
932 return ( ( _show_taxo_code != null ) && _show_taxo_code.isSelected() );
935 boolean isShowTaxonomyCommonNames() {
936 return ( ( _show_taxo_common_names != null ) && _show_taxo_common_names.isSelected() );
939 boolean isShowTaxonomyScientificNames() {
940 return ( ( _show_taxo_scientific_names != null ) && _show_taxo_scientific_names.isSelected() );
943 boolean isWidthBranches() {
944 return ( ( _width_branches != null ) && _width_branches.isSelected() );
947 void phylogenyAdded( final Configuration configuration ) {
948 getIsDrawPhylogramList().add( configuration.isDrawAsPhylogram() );
951 void phylogenyRemoved( final int index ) {
952 getIsDrawPhylogramList().remove( index );
956 final MainPanel main_panel = getMainPanel();
957 final Phylogeny tree = main_panel.getCurrentPhylogeny();
958 if ( ( tree == null ) || tree.isEmpty() ) {
961 String query = getSearchTextField0().getText();
962 if ( query != null ) {
963 query = query.trim();
965 if ( !ForesterUtil.isEmpty( query ) ) {
966 search0( main_panel, tree, query );
969 getSearchFoundCountsLabel0().setVisible( false );
970 getSearchResetButton0().setEnabled( false );
971 getSearchResetButton0().setVisible( false );
977 final MainPanel main_panel = getMainPanel();
978 final Phylogeny tree = main_panel.getCurrentPhylogeny();
979 if ( ( tree == null ) || tree.isEmpty() ) {
982 String query = getSearchTextField1().getText();
983 if ( query != null ) {
984 query = query.trim();
986 if ( !ForesterUtil.isEmpty( query ) ) {
987 search1( main_panel, tree, query );
990 getSearchFoundCountsLabel1().setVisible( false );
991 getSearchResetButton1().setEnabled( false );
992 getSearchResetButton1().setVisible( false );
997 void searchReset0() {
998 if ( getMainPanel().getCurrentTreePanel() != null ) {
999 getMainPanel().getCurrentTreePanel().setFoundNodes0( null );
1003 void searchReset1() {
1004 if ( getMainPanel().getCurrentTreePanel() != null ) {
1005 getMainPanel().getCurrentTreePanel().setFoundNodes1( null );
1009 void setActionWhenNodeClicked( final NodeClickAction action ) {
1010 _action_when_node_clicked = action;
1013 void setAnnotationColors( final Map<String, Color> annotation_colors ) {
1014 _annotation_colors = annotation_colors;
1017 void setCheckbox( final int which, final boolean state ) {
1019 case Configuration.display_as_phylogram:
1020 if ( getDisplayAsPhylogramCb() != null ) {
1021 getDisplayAsPhylogramCb().setSelected( state );
1024 case Configuration.display_internal_data:
1025 if ( _display_internal_data != null ) {
1026 _display_internal_data.setSelected( state );
1029 case Configuration.color_according_to_species:
1030 if ( _color_acc_species != null ) {
1031 _color_acc_species.setSelected( state );
1034 case Configuration.color_according_to_sequence:
1035 if ( _color_acc_sequence != null ) {
1036 _color_acc_sequence.setSelected( state );
1039 case Configuration.color_according_to_annotation:
1040 if ( _color_according_to_annotation != null ) {
1041 _color_according_to_annotation.setSelected( state );
1044 case Configuration.show_node_names:
1045 if ( _show_node_names != null ) {
1046 _show_node_names.setSelected( state );
1049 case Configuration.show_taxonomy_scientific_names:
1050 if ( _show_taxo_scientific_names != null ) {
1051 _show_taxo_scientific_names.setSelected( state );
1054 case Configuration.show_taxonomy_common_names:
1055 if ( _show_taxo_common_names != null ) {
1056 _show_taxo_common_names.setSelected( state );
1059 case Configuration.show_tax_code:
1060 if ( _show_taxo_code != null ) {
1061 _show_taxo_code.setSelected( state );
1064 case Configuration.show_taxonomy_images:
1065 if ( _show_taxo_images_cb != null ) {
1066 _show_taxo_images_cb.setSelected( state );
1069 case Configuration.show_annotation:
1070 if ( _show_annotation != null ) {
1071 _show_annotation.setSelected( state );
1074 case Configuration.show_binary_characters:
1075 if ( _show_binary_characters != null ) {
1076 _show_binary_characters.setSelected( state );
1079 case Configuration.show_binary_character_counts:
1080 if ( _show_binary_character_counts != null ) {
1081 _show_binary_character_counts.setSelected( state );
1084 case Configuration.write_confidence_values:
1085 if ( getWriteConfidenceCb() != null ) {
1086 getWriteConfidenceCb().setSelected( state );
1089 case Configuration.write_events:
1090 if ( getShowEventsCb() != null ) {
1091 getShowEventsCb().setSelected( state );
1094 case Configuration.use_style:
1095 if ( getUseVisualStylesCb() != null ) {
1096 getUseVisualStylesCb().setSelected( state );
1099 case Configuration.width_branches:
1100 if ( _width_branches != null ) {
1101 _width_branches.setSelected( state );
1104 case Configuration.show_domain_architectures:
1105 if ( _show_domain_architectures != null ) {
1106 _show_domain_architectures.setSelected( state );
1109 case Configuration.write_branch_length_values:
1110 if ( _write_branch_length_values != null ) {
1111 _write_branch_length_values.setSelected( state );
1114 case Configuration.show_mol_seqs:
1115 if ( _show_mol_seqs != null ) {
1116 _show_mol_seqs.setSelected( state );
1119 case Configuration.show_seq_names:
1120 if ( _show_seq_names != null ) {
1121 _show_seq_names.setSelected( state );
1124 case Configuration.show_gene_names:
1125 if ( _show_gene_names != null ) {
1126 _show_gene_names.setSelected( state );
1129 case Configuration.show_seq_symbols:
1130 if ( _show_seq_symbols != null ) {
1131 _show_seq_symbols.setSelected( state );
1134 case Configuration.show_vector_data:
1135 if ( _show_vector_data_cb != null ) {
1136 _show_vector_data_cb.setSelected( state );
1139 case Configuration.show_properties:
1140 if ( _show_properties_cb != null ) {
1141 _show_properties_cb.setSelected( state );
1144 case Configuration.show_sequence_acc:
1145 if ( _show_sequence_acc != null ) {
1146 _show_sequence_acc.setSelected( state );
1149 case Configuration.dynamically_hide_data:
1150 if ( getDynamicallyHideData() != null ) {
1151 getDynamicallyHideData().setSelected( state );
1154 case Configuration.node_data_popup:
1155 if ( getNodeDescPopupCb() != null ) {
1156 getNodeDescPopupCb().setSelected( state );
1160 case Configuration.show_relation_confidence:
1161 if ( _seq_relation_confidence_switch != null ) {
1162 _seq_relation_confidence_switch.setSelected( state );
1167 throw new AssertionError( "unknown checkbox: " + which );
1172 * Set this checkbox state. Not all checkboxes have been instantiated
1173 * depending on the config.
1175 void setCheckbox( final JCheckBox cb, final boolean state ) {
1177 cb.setSelected( state );
1181 void setClickToAction( final int action ) {
1182 // Set click-to action
1183 if ( action == _show_data_item ) {
1184 setActionWhenNodeClicked( NodeClickAction.SHOW_DATA );
1186 else if ( action == _collapse_cb_item ) {
1187 setActionWhenNodeClicked( NodeClickAction.COLLAPSE );
1189 else if ( action == _reroot_cb_item ) {
1190 setActionWhenNodeClicked( NodeClickAction.REROOT );
1192 else if ( action == _subtree_cb_item ) {
1193 setActionWhenNodeClicked( NodeClickAction.SUBTREE );
1195 else if ( action == _swap_cb_item ) {
1196 setActionWhenNodeClicked( NodeClickAction.SWAP );
1198 else if ( action == _color_subtree_cb_item ) {
1199 setActionWhenNodeClicked( NodeClickAction.COLOR_SUBTREE );
1201 else if ( action == _open_seq_web_item ) {
1202 setActionWhenNodeClicked( NodeClickAction.OPEN_SEQ_WEB );
1204 else if ( action == _sort_descendents_item ) {
1205 setActionWhenNodeClicked( NodeClickAction.SORT_DESCENDENTS );
1207 else if ( action == _blast_item ) {
1208 setActionWhenNodeClicked( NodeClickAction.BLAST );
1210 else if ( action == _open_tax_web_item ) {
1211 setActionWhenNodeClicked( NodeClickAction.OPEN_TAX_WEB );
1213 else if ( action == _cut_subtree_item ) {
1214 setActionWhenNodeClicked( NodeClickAction.CUT_SUBTREE );
1216 else if ( action == _copy_subtree_item ) {
1217 setActionWhenNodeClicked( NodeClickAction.COPY_SUBTREE );
1219 else if ( action == _delete_node_or_subtree_item ) {
1220 setActionWhenNodeClicked( NodeClickAction.DELETE_NODE_OR_SUBTREE );
1222 else if ( action == _paste_subtree_item ) {
1223 setActionWhenNodeClicked( NodeClickAction.PASTE_SUBTREE );
1225 else if ( action == _add_new_node_item ) {
1226 setActionWhenNodeClicked( NodeClickAction.ADD_NEW_NODE );
1228 else if ( action == _edit_node_data_item ) {
1229 setActionWhenNodeClicked( NodeClickAction.EDIT_NODE_DATA );
1231 else if ( action == _select_nodes_item ) {
1232 setActionWhenNodeClicked( NodeClickAction.SELECT_NODES );
1234 else if ( action == _get_ext_desc_data ) {
1235 setActionWhenNodeClicked( NodeClickAction.GET_EXT_DESC_DATA );
1237 else if ( action == _open_pdb_item ) {
1238 setActionWhenNodeClicked( NodeClickAction.OPEN_PDB_WEB );
1240 else if ( action == _color_node_font_item ) {
1241 setActionWhenNodeClicked( NodeClickAction.COLOR_NODE_FONT );
1243 else if ( action == _change_node_font_item ) {
1244 setActionWhenNodeClicked( NodeClickAction.CHANGE_NODE_FONT );
1247 throw new RuntimeException( "unknown action: " + action );
1249 // make sure drop down is displaying the correct action
1250 // in case this was called from outside the class
1251 _click_to_combobox.setSelectedIndex( action );
1254 void setColorBranches( final boolean color_branches ) {
1255 _color_branches = color_branches;
1258 void setDrawPhylogram( final boolean b ) {
1259 getDisplayAsPhylogramCb().setSelected( b );
1260 setDrawPhylogram( getMainPanel().getCurrentTabIndex(), b );
1263 void setDrawPhylogramEnabled( final boolean b ) {
1264 getDisplayAsPhylogramCb().setEnabled( b );
1267 void setDynamicHidingIsOn( final boolean is_on ) {
1269 getDynamicallyHideData().setForeground( getConfiguration().getGuiCheckboxAndButtonActiveColor() );
1272 if ( !_configuration.isUseNativeUI() ) {
1273 getDynamicallyHideData().setForeground( getConfiguration().getGuiButtonTextColor() );
1276 getDynamicallyHideData().setForeground( Color.BLACK );
1281 void setSearchFoundCountsOnLabel0( final int counts ) {
1282 getSearchFoundCountsLabel0().setText( "Found: " + counts );
1285 void setSearchFoundCountsOnLabel1( final int counts ) {
1286 getSearchFoundCountsLabel1().setText( "Found: " + counts );
1289 void setShowEvents( final boolean show_events ) {
1290 if ( getShowEventsCb() == null ) {
1291 _show_events = new JCheckBox( "" );
1293 getShowEventsCb().setSelected( show_events );
1296 void setSpeciesColors( final Map<String, Color> species_colors ) {
1297 _species_colors = species_colors;
1300 void setSequenceColors( final Map<String, Color> sequence_colors ) {
1301 _sequence_colors = sequence_colors;
1306 * Set up the controls from the config settings. 11/26/05
1308 void setupControls() {
1309 // The tree display options:
1310 setupDisplayCheckboxes();
1312 // The sequence relation query selection combo-box
1313 if ( _configuration.displaySequenceRelations() ) {
1314 addSequenceRelationBlock();
1318 startClickToOptions();
1319 setupClickToOptions();
1320 endClickToOptions();
1321 // Zoom and quick edit buttons
1323 setupSearchTools0();
1324 setupSearchTools1();
1327 void setUpControlsForDomainStrucures() {
1328 _domain_display_label = new JLabel( "Domain Architectures:" );
1329 add( customizeLabel( _domain_display_label, getConfiguration() ) );
1330 add( _domain_display_label );
1331 _zoom_in_domain_structure = new JButton( "d+" );
1332 _zoom_out_domain_structure = new JButton( "d-" );
1333 _decr_domain_structure_evalue_thr = new JButton( "-" );
1334 _incr_domain_structure_evalue_thr = new JButton( "+" );
1335 _zoom_in_domain_structure.setPreferredSize( new Dimension( 10, 10 ) );
1336 _zoom_out_domain_structure.setPreferredSize( new Dimension( 10, 10 ) );
1337 _decr_domain_structure_evalue_thr.setPreferredSize( new Dimension( 10, 10 ) );
1338 _incr_domain_structure_evalue_thr.setPreferredSize( new Dimension( 10, 10 ) );
1339 _incr_domain_structure_evalue_thr.setToolTipText( "Increase the E-value threshold by a factor of 10" );
1340 _decr_domain_structure_evalue_thr.setToolTipText( "Decrease the E-value threshold by a factor of 10" );
1341 _domain_structure_evalue_thr_tf = new JTextField( 3 );
1342 _domain_structure_evalue_thr_tf.setEditable( false );
1343 if ( !getConfiguration().isUseNativeUI() ) {
1344 _domain_structure_evalue_thr_tf.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
1345 _domain_structure_evalue_thr_tf.setBackground( getConfiguration().getGuiCheckboxTextColor() );
1346 _domain_structure_evalue_thr_tf.setBorder( null );
1348 final JPanel d1_panel = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
1349 final JPanel d2_panel = new JPanel( new GridLayout( 1, 3, 0, 0 ) );
1350 if ( !_configuration.isUseNativeUI() ) {
1351 d1_panel.setBackground( getBackground() );
1352 d2_panel.setBackground( getBackground() );
1356 addJButton( _zoom_out_domain_structure, d1_panel );
1357 addJButton( _zoom_in_domain_structure, d1_panel );
1358 addJButton( _decr_domain_structure_evalue_thr, d2_panel );
1359 addJTextField( _domain_structure_evalue_thr_tf, d2_panel );
1360 addJButton( _incr_domain_structure_evalue_thr, d2_panel );
1363 void setupSearchTools0() {
1364 final String tip = "Enter text to search for. Use ',' for multiple searches (logical OR) and '+' for logical AND.";
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( tip );
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( tip );
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 String tip = "Enter text to search for. Use ',' for multiple searches (logical OR) and '+' for logical AND.";
1426 final JLabel search_label = new JLabel( "Search (B):" );
1427 search_label.setFont( ControlPanel.jcb_bold_font );
1428 if ( !getConfiguration().isUseNativeUI() ) {
1429 search_label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1431 add( search_label );
1432 search_label.setToolTipText( tip );
1433 _search_found_label_1 = new JLabel();
1434 getSearchFoundCountsLabel1().setVisible( false );
1435 _search_found_label_1.setFont( ControlPanel.jcb_bold_font );
1436 if ( !getConfiguration().isUseNativeUI() ) {
1437 _search_found_label_1.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1439 _search_tf_1 = new JTextField( 3 );
1440 _search_tf_1.setToolTipText( tip );
1441 _search_tf_1.setEditable( true );
1442 if ( !getConfiguration().isUseNativeUI() ) {
1443 _search_tf_1.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
1444 _search_tf_1.setBackground( getConfiguration().getGuiCheckboxTextColor() );
1445 _search_tf_1.setBorder( null );
1447 _search_reset_button_1 = new JButton();
1448 getSearchResetButton1().setText( "Reset" );
1449 getSearchResetButton1().setEnabled( false );
1450 getSearchResetButton1().setVisible( false );
1451 final JPanel s_panel_1 = new JPanel( new BorderLayout() );
1452 final JPanel s_panel_2 = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
1453 s_panel_1.setBackground( getBackground() );
1455 s_panel_2.setBackground( getBackground() );
1457 final KeyAdapter key_adapter = new KeyAdapter() {
1460 public void keyReleased( final KeyEvent key_event ) {
1462 displayedPhylogenyMightHaveChanged( true );
1465 final ActionListener action_listener = new ActionListener() {
1468 public void actionPerformed( final ActionEvent e ) {
1470 setSearchFoundCountsOnLabel1( 0 );
1471 getSearchFoundCountsLabel1().setVisible( false );
1472 getSearchTextField1().setText( "" );
1473 getSearchResetButton1().setEnabled( false );
1474 getSearchResetButton1().setVisible( false );
1475 displayedPhylogenyMightHaveChanged( true );
1478 _search_reset_button_1.addActionListener( action_listener );
1479 _search_tf_1.addKeyListener( key_adapter );
1480 addJTextField( _search_tf_1, s_panel_1 );
1481 s_panel_2.add( _search_found_label_1 );
1482 addJButton( _search_reset_button_1, s_panel_2 );
1485 void showAnnotations() {
1486 if ( _show_annotation != null ) {
1487 _show_annotation.setSelected( true );
1489 if ( _color_according_to_annotation != null ) {
1490 _color_according_to_annotation.setSelected( true );
1492 if ( _color_acc_species != null ) {
1493 _color_acc_species.setSelected( false );
1495 if ( _color_acc_sequence != null ) {
1496 _color_acc_sequence.setSelected( false );
1498 _mainpanel.getCurrentTreePanel().repaint();
1502 * Fit entire tree into window.
1505 if ( ( _mainpanel.getCurrentScrollPane() == null ) || _mainpanel.getCurrentTreePanel().getPhylogeny().isEmpty() ) {
1508 getCurrentTreePanel().updateSetOfCollapsedExternalNodes();
1509 displayedPhylogenyMightHaveChanged( true );
1510 _mainpanel.getCurrentTreePanel().updateOvSettings();
1511 _mainpanel.getCurrentTreePanel().validate();
1512 _mainpanel.validate();
1513 _mainpanel.getCurrentTreePanel().calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
1514 _mainpanel.getSizeOfViewport().height,
1516 _mainpanel.getCurrentTreePanel().resetPreferredSize();
1517 _mainpanel.adjustJScrollPane();
1518 _mainpanel.getCurrentTreePanel().repaint();
1519 _mainpanel.getCurrentTreePanel().validate();
1520 _mainpanel.validate();
1521 _mainpanel.getCurrentTreePanel().calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
1522 _mainpanel.getSizeOfViewport().height,
1524 _mainpanel.getCurrentTreePanel().resetPreferredSize();
1525 _mainpanel.adjustJScrollPane();
1526 _mainpanel.getCurrentTreePanel().repaint();
1527 _mainpanel.getCurrentTreePanel().updateOvSizes();
1530 void showWholeAll() {
1531 for( final TreePanel tree_panel : _mainpanel.getTreePanels() ) {
1532 if ( tree_panel != null ) {
1533 tree_panel.validate();
1534 tree_panel.calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
1535 _mainpanel.getSizeOfViewport().height,
1537 tree_panel.resetPreferredSize();
1538 tree_panel.repaint();
1543 // Create header for click-to combo box.
1544 void startClickToOptions() {
1545 final JLabel spacer = new JLabel( "" );
1546 spacer.setFont( ControlPanel.jcb_font );
1548 _click_to_label = new JLabel( "Click on Node to:" );
1549 add( customizeLabel( _click_to_label, getConfiguration() ) );
1550 _click_to_combobox = new JComboBox<String>();
1551 _click_to_combobox.setFocusable( false );
1552 _click_to_combobox.setMaximumRowCount( 14 );
1553 _click_to_combobox.setFont( ControlPanel.js_font );
1554 if ( !_configuration.isUseNativeUI() ) {
1555 _click_to_combobox.setBackground( getConfiguration().getGuiBackgroundColor() );
1557 // don't add listener until all items are set (or each one will trigger
1559 // click_to_list.addActionListener(this);
1560 add( _click_to_combobox );
1561 // Correlates option names to titles
1562 _all_click_to_names = new HashMap<Integer, String>();
1563 _click_to_names = new ArrayList<String>();
1567 if ( getMainPanel().getTabbedPane().getTabCount() > 0 ) {
1568 if ( getCurrentTreePanel().isPhyHasBranchLengths()
1569 && ( getCurrentTreePanel().getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) {
1570 setDrawPhylogramEnabled( true );
1571 setDrawPhylogram( isDrawPhylogram() );
1574 setDrawPhylogramEnabled( false );
1575 setDrawPhylogram( false );
1577 if ( getMainPanel().getMainFrame() == null ) {
1578 // Must be "E" applet version.
1579 final ArchaeopteryxE e = ( ArchaeopteryxE ) ( ( MainPanelApplets ) getMainPanel() ).getApplet();
1580 e.setSelectedTypeInTypeMenu( e.getCurrentTreePanel().getPhylogenyGraphicsType() );
1583 getMainPanel().getMainFrame().setSelectedTypeInTypeMenu( getMainPanel().getCurrentTreePanel()
1584 .getPhylogenyGraphicsType() );
1586 getMainPanel().getCurrentTreePanel().updateSubSuperTreeButton();
1587 getMainPanel().getControlPanel().search0();
1588 getMainPanel().getControlPanel().search1();
1589 getMainPanel().getControlPanel().updateDomainStructureEvaluethresholdDisplay();
1590 getSequenceRelationTypeBox().removeAllItems();
1591 for( final SequenceRelation.SEQUENCE_RELATION_TYPE type : getMainPanel().getCurrentPhylogeny()
1592 .getRelevantSequenceRelationTypes() ) {
1593 _sequence_relation_type_box.addItem( type );
1595 getMainPanel().getCurrentTreePanel().repaint();
1596 //setSequenceRelationQueries( getMainPanel().getCurrentPhylogeny().getSequenceRelationQueries() );
1597 // according to GUILHEM the line above can be removed.
1602 * Uncollapse all nodes.
1604 void uncollapseAll( final TreePanel tp ) {
1605 final Phylogeny t = tp.getPhylogeny();
1606 if ( ( t != null ) && !t.isEmpty() ) {
1607 for( final PhylogenyNodeIterator iter = t.iteratorPreorder(); iter.hasNext(); ) {
1608 final PhylogenyNode node = iter.next();
1609 node.setCollapse( false );
1611 tp.resetNodeIdToDistToLeafMap();
1612 tp.updateSetOfCollapsedExternalNodes();
1613 t.recalculateNumberOfExternalDescendants( false );
1614 tp.setNodeInPreorderToNull();
1615 t.clearHashIdToNodeMap();
1620 void updateDomainStructureEvaluethresholdDisplay() {
1621 if ( _domain_structure_evalue_thr_tf != null ) {
1622 _domain_structure_evalue_thr_tf.setText( "10^"
1623 + getMainPanel().getCurrentTreePanel().getDomainStructureEvalueThreshold() );
1627 void zoomInX( final float factor, final float x_correction_factor ) {
1628 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar();
1629 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1630 treepanel.multiplyUrtFactor( 1f );
1631 if ( ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
1632 || ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
1633 || isDrawPhylogram( getMainPanel().getCurrentTabIndex() )
1634 || ( getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP ) ) {
1635 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1636 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
1637 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
1638 getMainPanel().adjustJScrollPane();
1639 treepanel.resetPreferredSize();
1640 getMainPanel().getCurrentScrollPane().getViewport().validate();
1641 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1642 - ( sb.getVisibleAmount() / 2.0 ) ) );
1645 final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue();
1646 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
1647 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
1648 getMainPanel().adjustJScrollPane();
1649 treepanel.resetPreferredSize();
1650 getMainPanel().getCurrentScrollPane().getViewport().validate();
1651 sb.setValue( sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount() );
1653 treepanel.resetPreferredSize();
1654 treepanel.updateOvSizes();
1657 void zoomInY( final float factor ) {
1658 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getVerticalScrollBar();
1659 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1660 treepanel.multiplyUrtFactor( 1.1f );
1661 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1662 treepanel.setYdistance( ( treepanel.getYdistance() * factor ) );
1663 getMainPanel().adjustJScrollPane();
1664 treepanel.resetPreferredSize();
1665 getMainPanel().getCurrentScrollPane().getViewport().validate();
1666 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1667 - ( sb.getVisibleAmount() / 2.0 ) ) );
1668 treepanel.resetPreferredSize();
1669 treepanel.updateOvSizes();
1672 void zoomOutX( final float factor, final float x_correction_factor ) {
1673 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1674 treepanel.multiplyUrtFactor( 1f );
1675 if ( ( treepanel.getXdistance() * factor ) > 0.0 ) {
1676 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar();
1677 if ( ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
1678 || ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
1679 || isDrawPhylogram( getMainPanel().getCurrentTabIndex() )
1680 || ( getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP ) ) {
1681 getMainPanel().adjustJScrollPane();
1682 treepanel.resetPreferredSize();
1683 getMainPanel().getCurrentScrollPane().getViewport().validate();
1684 final double x = ( sb.getMaximum() - sb.getMinimum() )
1685 / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1686 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
1687 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
1688 getMainPanel().adjustJScrollPane();
1689 treepanel.resetPreferredSize();
1690 getMainPanel().getCurrentScrollPane().getViewport().validate();
1691 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1692 - ( sb.getVisibleAmount() / 2.0 ) ) );
1695 final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue();
1696 treepanel.setXdistance( treepanel.getXdistance() * factor );
1697 treepanel.setXcorrectionFactor( treepanel.getXcorrectionFactor() * x_correction_factor );
1699 getMainPanel().adjustJScrollPane();
1700 treepanel.resetPreferredSize();
1701 getMainPanel().getCurrentScrollPane().getViewport().validate();
1702 sb.setValue( sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount() );
1705 treepanel.resetPreferredSize();
1706 treepanel.updateOvSizes();
1710 void zoomOutY( final float factor ) {
1711 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1712 treepanel.multiplyUrtFactor( 0.9f );
1713 if ( ( treepanel.getYdistance() * factor ) > 0.0 ) {
1714 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getVerticalScrollBar();
1715 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1716 treepanel.setYdistance( ( treepanel.getYdistance() * factor ) );
1717 getMainPanel().adjustJScrollPane();
1718 treepanel.resetPreferredSize();
1719 getMainPanel().getCurrentScrollPane().getViewport().validate();
1720 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1721 - ( sb.getVisibleAmount() / 2.0 ) ) );
1722 treepanel.resetPreferredSize();
1723 treepanel.updateOvSizes();
1727 private void addClickToOption( final int which, final String title ) {
1728 _click_to_combobox.addItem( title );
1729 _click_to_names.add( title );
1730 _all_click_to_names.put( new Integer( which ), title );
1731 if ( !_configuration.isUseNativeUI() ) {
1732 _click_to_combobox.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
1733 _click_to_combobox.setForeground( getConfiguration().getGuiButtonTextColor() );
1738 private void addSequenceRelationBlock() {
1739 final JLabel spacer = new JLabel( "" );
1740 spacer.setSize( 1, 1 );
1742 final JLabel mainLabel = new JLabel( "Sequence relations to display" );
1743 final JLabel typeLabel = customizeLabel( new JLabel( "(type) " ), getConfiguration() );
1744 typeLabel.setFont( ControlPanel.js_font.deriveFont( 7 ) );
1745 getSequenceRelationTypeBox().setFocusable( false );
1746 _sequence_relation_type_box.setFont( ControlPanel.js_font );
1747 if ( !_configuration.isUseNativeUI() ) {
1748 _sequence_relation_type_box.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
1749 _sequence_relation_type_box.setForeground( getConfiguration().getGuiButtonTextColor() );
1751 _sequence_relation_type_box.setRenderer( new ListCellRenderer<Object>() {
1754 public Component getListCellRendererComponent( final JList<?> list,
1757 final boolean isSelected,
1758 final boolean cellHasFocus ) {
1759 final Component component = new DefaultListCellRenderer().getListCellRendererComponent( list,
1764 if ( ( value != null ) && ( value instanceof SequenceRelation.SEQUENCE_RELATION_TYPE ) ) {
1765 ( ( DefaultListCellRenderer ) component ).setText( SequenceRelation
1766 .getPrintableNameByType( ( SequenceRelation.SEQUENCE_RELATION_TYPE ) value ) );
1771 final GridBagLayout gbl = new GridBagLayout();
1772 _sequence_relation_type_box.setMinimumSize( new Dimension( 115, 17 ) );
1773 _sequence_relation_type_box.setPreferredSize( new Dimension( 115, 20 ) );
1774 final JPanel horizGrid = new JPanel( gbl );
1775 horizGrid.setBackground( getBackground() );
1776 horizGrid.add( typeLabel );
1777 horizGrid.add( _sequence_relation_type_box );
1778 add( customizeLabel( mainLabel, getConfiguration() ) );
1780 add( getSequenceRelationBox() );
1781 if ( _configuration.doDisplayOption( Configuration.show_relation_confidence ) ) {
1782 addCheckbox( Configuration.show_relation_confidence,
1783 _configuration.getDisplayTitle( Configuration.show_relation_confidence ) );
1784 setCheckbox( Configuration.show_relation_confidence,
1785 _configuration.doCheckOption( Configuration.show_relation_confidence ) );
1787 }// addSequenceRelationBlock
1790 private List<Boolean> getIsDrawPhylogramList() {
1791 return _draw_phylogram;
1794 private void init() {
1795 _draw_phylogram = new ArrayList<Boolean>();
1796 setSpeciesColors( new HashMap<String, Color>() );
1797 setSequenceColors( new HashMap<String, Color>() );
1798 setAnnotationColors( new HashMap<String, Color>() );
1801 private boolean isDrawPhylogram( final int index ) {
1802 return getIsDrawPhylogramList().get( index );
1805 private void search0( final MainPanel main_panel, final Phylogeny tree, final String query_str ) {
1806 getSearchFoundCountsLabel0().setVisible( true );
1807 getSearchResetButton0().setEnabled( true );
1808 getSearchResetButton0().setVisible( true );
1809 String[] queries = null;
1810 List<PhylogenyNode> nodes = null;
1811 if ( query_str.indexOf( ',' ) >= 0 ) {
1812 queries = query_str.split( ",+" );
1815 queries = new String[ 1 ];
1816 queries[ 0 ] = query_str.trim();
1818 if ( ( queries != null ) && ( queries.length > 0 ) ) {
1819 nodes = new ArrayList<PhylogenyNode>();
1820 for( String query : queries ) {
1821 if ( ForesterUtil.isEmpty( query ) ) {
1824 query = query.trim();
1825 if ( query.indexOf( '+' ) >= 0 ) {
1826 nodes.addAll( PhylogenyMethods.searchDataLogicalAnd( query.split( "\\++" ),
1828 getOptions().isSearchCaseSensitive(),
1829 !getOptions().isMatchWholeTermsOnly(),
1830 isShowDomainArchitectures() ) );
1833 nodes.addAll( PhylogenyMethods.searchData( query,
1835 getOptions().isSearchCaseSensitive(),
1836 !getOptions().isMatchWholeTermsOnly(),
1837 isShowDomainArchitectures() ) );
1840 if ( getOptions().isInverseSearchResult() ) {
1841 final List<PhylogenyNode> all = PhylogenyMethods.obtainAllNodesAsList( tree );
1842 all.removeAll( nodes );
1846 if ( ( nodes != null ) && ( nodes.size() > 0 ) ) {
1847 main_panel.getCurrentTreePanel().setFoundNodes0( new HashSet<Long>() );
1848 for( final PhylogenyNode node : nodes ) {
1849 main_panel.getCurrentTreePanel().getFoundNodes0().add( node.getId() );
1851 setSearchFoundCountsOnLabel0( nodes.size() );
1854 setSearchFoundCountsOnLabel0( 0 );
1859 private void search1( final MainPanel main_panel, final Phylogeny tree, final String query_str ) {
1860 getSearchFoundCountsLabel1().setVisible( true );
1861 getSearchResetButton1().setEnabled( true );
1862 getSearchResetButton1().setVisible( true );
1863 String[] queries = null;
1864 List<PhylogenyNode> nodes = null;
1865 if ( query_str.indexOf( ',' ) >= 0 ) {
1866 queries = query_str.split( ",+" );
1869 queries = new String[ 1 ];
1870 queries[ 0 ] = query_str.trim();
1872 if ( ( queries != null ) && ( queries.length > 0 ) ) {
1873 nodes = new ArrayList<PhylogenyNode>();
1874 for( String query : queries ) {
1875 if ( ForesterUtil.isEmpty( query ) ) {
1878 query = query.trim();
1879 if ( query.indexOf( '+' ) >= 0 ) {
1880 nodes.addAll( PhylogenyMethods.searchDataLogicalAnd( query.split( "\\++" ),
1882 getOptions().isSearchCaseSensitive(),
1883 !getOptions().isMatchWholeTermsOnly(),
1884 isShowDomainArchitectures() ) );
1887 nodes.addAll( PhylogenyMethods.searchData( query,
1889 getOptions().isSearchCaseSensitive(),
1890 !getOptions().isMatchWholeTermsOnly(),
1891 isShowDomainArchitectures() ) );
1894 if ( getOptions().isInverseSearchResult() ) {
1895 final List<PhylogenyNode> all = PhylogenyMethods.obtainAllNodesAsList( tree );
1896 all.removeAll( nodes );
1900 if ( ( nodes != null ) && ( nodes.size() > 0 ) ) {
1901 main_panel.getCurrentTreePanel().setFoundNodes1( new HashSet<Long>() );
1902 for( final PhylogenyNode node : nodes ) {
1903 main_panel.getCurrentTreePanel().getFoundNodes1().add( node.getId() );
1905 setSearchFoundCountsOnLabel1( nodes.size() );
1908 setSearchFoundCountsOnLabel1( 0 );
1913 private void setDrawPhylogram( final int index, final boolean b ) {
1914 getIsDrawPhylogramList().set( index, b );
1917 private void setupClickToOptions() {
1918 final int default_option = _configuration.getDefaultDisplayClicktoOption();
1919 int selected_index = 0;
1921 if ( _configuration.doDisplayClickToOption( Configuration.display_node_data ) ) {
1922 _show_data_item = cb_index;
1923 addClickToOption( Configuration.display_node_data,
1924 _configuration.getClickToTitle( Configuration.display_node_data ) );
1925 if ( default_option == Configuration.display_node_data ) {
1926 selected_index = cb_index;
1930 if ( _configuration.doDisplayClickToOption( Configuration.collapse_uncollapse ) ) {
1931 _collapse_cb_item = cb_index;
1932 addClickToOption( Configuration.collapse_uncollapse,
1933 _configuration.getClickToTitle( Configuration.collapse_uncollapse ) );
1934 if ( default_option == Configuration.collapse_uncollapse ) {
1935 selected_index = cb_index;
1939 if ( _configuration.doDisplayClickToOption( Configuration.reroot ) ) {
1940 _reroot_cb_item = cb_index;
1941 addClickToOption( Configuration.reroot, _configuration.getClickToTitle( Configuration.reroot ) );
1942 if ( default_option == Configuration.reroot ) {
1943 selected_index = cb_index;
1947 if ( _configuration.doDisplayClickToOption( Configuration.subtree ) ) {
1948 _subtree_cb_item = cb_index;
1949 addClickToOption( Configuration.subtree, _configuration.getClickToTitle( Configuration.subtree ) );
1950 if ( default_option == Configuration.subtree ) {
1951 selected_index = cb_index;
1955 if ( _configuration.doDisplayClickToOption( Configuration.swap ) ) {
1956 _swap_cb_item = cb_index;
1957 addClickToOption( Configuration.swap, _configuration.getClickToTitle( Configuration.swap ) );
1958 if ( default_option == Configuration.swap ) {
1959 selected_index = cb_index;
1963 if ( _configuration.doDisplayClickToOption( Configuration.sort_descendents ) ) {
1964 _sort_descendents_item = cb_index;
1965 addClickToOption( Configuration.sort_descendents,
1966 _configuration.getClickToTitle( Configuration.sort_descendents ) );
1967 if ( default_option == Configuration.sort_descendents ) {
1968 selected_index = cb_index;
1972 if ( _configuration.doDisplayClickToOption( Configuration.color_node_font ) ) {
1973 _color_node_font_item = cb_index;
1974 addClickToOption( Configuration.color_node_font,
1975 _configuration.getClickToTitle( Configuration.color_node_font ) );
1976 if ( default_option == Configuration.color_node_font ) {
1977 selected_index = cb_index;
1981 if ( _configuration.doDisplayClickToOption( Configuration.change_node_font ) ) {
1982 _change_node_font_item = cb_index;
1983 addClickToOption( Configuration.change_node_font,
1984 _configuration.getClickToTitle( Configuration.change_node_font ) );
1985 if ( default_option == Configuration.change_node_font ) {
1986 selected_index = cb_index;
1990 if ( _configuration.doDisplayClickToOption( Configuration.color_subtree ) ) {
1991 _color_subtree_cb_item = cb_index;
1992 addClickToOption( Configuration.color_subtree, _configuration.getClickToTitle( Configuration.color_subtree ) );
1993 if ( default_option == Configuration.color_subtree ) {
1994 selected_index = cb_index;
1998 if ( _configuration.doDisplayClickToOption( Configuration.open_seq_web ) ) {
1999 _open_seq_web_item = cb_index;
2000 addClickToOption( Configuration.open_seq_web, _configuration.getClickToTitle( Configuration.open_seq_web ) );
2001 if ( default_option == Configuration.open_seq_web ) {
2002 selected_index = cb_index;
2006 if ( _configuration.doDisplayClickToOption( Configuration.open_pdb_web ) ) {
2007 _open_pdb_item = cb_index;
2008 addClickToOption( Configuration.open_pdb_web, _configuration.getClickToTitle( Configuration.open_pdb_web ) );
2009 if ( default_option == Configuration.open_pdb_web ) {
2010 selected_index = cb_index;
2014 if ( _configuration.doDisplayClickToOption( Configuration.open_tax_web ) ) {
2015 _open_tax_web_item = cb_index;
2016 addClickToOption( Configuration.open_tax_web, _configuration.getClickToTitle( Configuration.open_tax_web ) );
2017 if ( default_option == Configuration.open_tax_web ) {
2018 selected_index = cb_index;
2022 if ( _configuration.doDisplayClickToOption( Configuration.blast ) ) {
2023 _blast_item = cb_index;
2024 addClickToOption( Configuration.blast, _configuration.getClickToTitle( Configuration.blast ) );
2025 if ( default_option == Configuration.blast ) {
2026 selected_index = cb_index;
2030 if ( _configuration.doDisplayClickToOption( Configuration.select_nodes ) ) {
2031 _select_nodes_item = cb_index;
2032 addClickToOption( Configuration.select_nodes, _configuration.getClickToTitle( Configuration.select_nodes ) );
2033 if ( default_option == Configuration.select_nodes ) {
2034 selected_index = cb_index;
2038 if ( _configuration.doDisplayClickToOption( Configuration.get_ext_desc_data ) ) {
2039 _get_ext_desc_data = cb_index;
2040 if ( !ForesterUtil.isEmpty( getConfiguration().getLabelForGetExtDescendentsData() ) ) {
2041 addClickToOption( Configuration.get_ext_desc_data, getConfiguration()
2042 .getLabelForGetExtDescendentsData() );
2046 switch ( getConfiguration().getExtDescNodeDataToReturn() ) {
2051 s = "Sequence Accessors";
2053 case SEQUENCE_MOL_SEQ:
2054 s = "Molecular Sequence";
2056 case SEQUENCE_MOL_SEQ_FASTA:
2057 s = "Molecular Sequence (Fasta)";
2060 s = "Sequence Names";
2065 case SEQUENCE_SYMBOL:
2066 s = "Sequence Symbols";
2069 s = "Taxonomy Codes";
2071 case TAXONOMY_COMM0N_NAME:
2072 s = "Taxonomy Common Names";
2074 case TAXONOMY_SCIENTIFIC_NAME:
2075 s = "Scientific Names";
2078 s = "User Selected Data";
2081 throw new IllegalStateException( "dont know how to deal with "
2082 + getConfiguration().getExtDescNodeDataToReturn() );
2084 final String label = _configuration.getClickToTitle( Configuration.get_ext_desc_data ) + " " + s;
2085 addClickToOption( Configuration.get_ext_desc_data, label );
2087 if ( default_option == Configuration.get_ext_desc_data ) {
2088 selected_index = cb_index;
2092 if ( getOptions().isEditable() ) {
2093 if ( _configuration.doDisplayClickToOption( Configuration.cut_subtree ) ) {
2094 _cut_subtree_item = cb_index;
2095 addClickToOption( Configuration.cut_subtree, _configuration.getClickToTitle( Configuration.cut_subtree ) );
2096 if ( default_option == Configuration.cut_subtree ) {
2097 selected_index = cb_index;
2101 if ( _configuration.doDisplayClickToOption( Configuration.copy_subtree ) ) {
2102 _copy_subtree_item = cb_index;
2103 addClickToOption( Configuration.copy_subtree,
2104 _configuration.getClickToTitle( Configuration.copy_subtree ) );
2105 if ( default_option == Configuration.copy_subtree ) {
2106 selected_index = cb_index;
2110 if ( _configuration.doDisplayClickToOption( Configuration.paste_subtree ) ) {
2111 _paste_subtree_item = cb_index;
2112 addClickToOption( Configuration.paste_subtree,
2113 _configuration.getClickToTitle( Configuration.paste_subtree ) );
2114 if ( default_option == Configuration.paste_subtree ) {
2115 selected_index = cb_index;
2119 if ( _configuration.doDisplayClickToOption( Configuration.delete_subtree_or_node ) ) {
2120 _delete_node_or_subtree_item = cb_index;
2121 addClickToOption( Configuration.delete_subtree_or_node,
2122 _configuration.getClickToTitle( Configuration.delete_subtree_or_node ) );
2123 if ( default_option == Configuration.delete_subtree_or_node ) {
2124 selected_index = cb_index;
2128 if ( _configuration.doDisplayClickToOption( Configuration.add_new_node ) ) {
2129 _add_new_node_item = cb_index;
2130 addClickToOption( Configuration.add_new_node,
2131 _configuration.getClickToTitle( Configuration.add_new_node ) );
2132 if ( default_option == Configuration.add_new_node ) {
2133 selected_index = cb_index;
2137 if ( _configuration.doDisplayClickToOption( Configuration.edit_node_data ) ) {
2138 _edit_node_data_item = cb_index;
2139 addClickToOption( Configuration.edit_node_data,
2140 _configuration.getClickToTitle( Configuration.edit_node_data ) );
2141 if ( default_option == Configuration.edit_node_data ) {
2142 selected_index = cb_index;
2147 // Set default selection and its action
2148 _click_to_combobox.setSelectedIndex( selected_index );
2149 setClickToAction( selected_index );
2152 private void setupDisplayCheckboxes() {
2153 if ( _configuration.doDisplayOption( Configuration.display_as_phylogram ) ) {
2154 addCheckbox( Configuration.display_as_phylogram,
2155 _configuration.getDisplayTitle( Configuration.display_as_phylogram ) );
2156 setCheckbox( Configuration.display_as_phylogram,
2157 _configuration.doCheckOption( Configuration.display_as_phylogram ) );
2159 if ( _configuration.doDisplayOption( Configuration.dynamically_hide_data ) ) {
2160 addCheckbox( Configuration.dynamically_hide_data,
2161 _configuration.getDisplayTitle( Configuration.dynamically_hide_data ) );
2162 setCheckbox( Configuration.dynamically_hide_data,
2163 _configuration.doCheckOption( Configuration.dynamically_hide_data ) );
2165 if ( _configuration.doDisplayOption( Configuration.node_data_popup ) ) {
2166 addCheckbox( Configuration.node_data_popup, _configuration.getDisplayTitle( Configuration.node_data_popup ) );
2167 setCheckbox( Configuration.node_data_popup, _configuration.doCheckOption( Configuration.node_data_popup ) );
2169 if ( _configuration.doDisplayOption( Configuration.display_internal_data ) ) {
2170 addCheckbox( Configuration.display_internal_data,
2171 _configuration.getDisplayTitle( Configuration.display_internal_data ) );
2172 setCheckbox( Configuration.display_internal_data,
2173 _configuration.doCheckOption( Configuration.display_internal_data ) );
2175 if ( _configuration.doDisplayOption( Configuration.color_according_to_sequence ) ) {
2176 addCheckbox( Configuration.color_according_to_sequence,
2177 _configuration.getDisplayTitle( Configuration.color_according_to_sequence ) );
2178 setCheckbox( Configuration.color_according_to_sequence,
2179 _configuration.doCheckOption( Configuration.color_according_to_sequence ) );
2181 if ( _configuration.doDisplayOption( Configuration.color_according_to_species ) ) {
2182 addCheckbox( Configuration.color_according_to_species,
2183 _configuration.getDisplayTitle( Configuration.color_according_to_species ) );
2184 setCheckbox( Configuration.color_according_to_species,
2185 _configuration.doCheckOption( Configuration.color_according_to_species ) );
2187 if ( _configuration.doDisplayOption( Configuration.color_according_to_annotation ) ) {
2188 addCheckbox( Configuration.color_according_to_annotation,
2189 _configuration.getDisplayTitle( Configuration.color_according_to_annotation ) );
2190 setCheckbox( Configuration.color_according_to_annotation,
2191 _configuration.doCheckOption( Configuration.color_according_to_annotation ) );
2193 if ( _configuration.doDisplayOption( Configuration.use_style ) ) {
2194 addCheckbox( Configuration.use_style, _configuration.getDisplayTitle( Configuration.use_style ) );
2195 setCheckbox( Configuration.use_style, _configuration.doCheckOption( Configuration.use_style ) );
2197 if ( _configuration.doDisplayOption( Configuration.width_branches ) ) {
2198 addCheckbox( Configuration.width_branches, _configuration.getDisplayTitle( Configuration.width_branches ) );
2199 setCheckbox( Configuration.width_branches, _configuration.doCheckOption( Configuration.width_branches ) );
2201 final JLabel label = new JLabel( "Display Data:" );
2202 label.setFont( ControlPanel.jcb_bold_font );
2203 if ( !getConfiguration().isUseNativeUI() ) {
2204 label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
2207 if ( _configuration.doDisplayOption( Configuration.show_node_names ) ) {
2208 addCheckbox( Configuration.show_node_names, _configuration.getDisplayTitle( Configuration.show_node_names ) );
2209 setCheckbox( Configuration.show_node_names, _configuration.doCheckOption( Configuration.show_node_names ) );
2211 if ( _configuration.doDisplayOption( Configuration.show_tax_code ) ) {
2212 addCheckbox( Configuration.show_tax_code, _configuration.getDisplayTitle( Configuration.show_tax_code ) );
2213 setCheckbox( Configuration.show_tax_code, _configuration.doCheckOption( Configuration.show_tax_code ) );
2215 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_scientific_names ) ) {
2216 addCheckbox( Configuration.show_taxonomy_scientific_names,
2217 _configuration.getDisplayTitle( Configuration.show_taxonomy_scientific_names ) );
2218 setCheckbox( Configuration.show_taxonomy_scientific_names,
2219 _configuration.doCheckOption( Configuration.show_taxonomy_scientific_names ) );
2221 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_common_names ) ) {
2222 addCheckbox( Configuration.show_taxonomy_common_names,
2223 _configuration.getDisplayTitle( Configuration.show_taxonomy_common_names ) );
2224 setCheckbox( Configuration.show_taxonomy_common_names,
2225 _configuration.doCheckOption( Configuration.show_taxonomy_common_names ) );
2227 if ( _configuration.doDisplayOption( Configuration.show_seq_names ) ) {
2228 addCheckbox( Configuration.show_seq_names, _configuration.getDisplayTitle( Configuration.show_seq_names ) );
2229 setCheckbox( Configuration.show_seq_names, _configuration.doCheckOption( Configuration.show_seq_names ) );
2231 if ( _configuration.doDisplayOption( Configuration.show_gene_names ) ) {
2232 addCheckbox( Configuration.show_gene_names, _configuration.getDisplayTitle( Configuration.show_gene_names ) );
2233 setCheckbox( Configuration.show_gene_names, _configuration.doCheckOption( Configuration.show_gene_names ) );
2235 if ( _configuration.doDisplayOption( Configuration.show_seq_symbols ) ) {
2236 addCheckbox( Configuration.show_seq_symbols,
2237 _configuration.getDisplayTitle( Configuration.show_seq_symbols ) );
2238 setCheckbox( Configuration.show_seq_symbols, _configuration.doCheckOption( Configuration.show_seq_symbols ) );
2240 if ( _configuration.doDisplayOption( Configuration.show_sequence_acc ) ) {
2241 addCheckbox( Configuration.show_sequence_acc,
2242 _configuration.getDisplayTitle( Configuration.show_sequence_acc ) );
2243 setCheckbox( Configuration.show_sequence_acc,
2244 _configuration.doCheckOption( Configuration.show_sequence_acc ) );
2246 if ( _configuration.doDisplayOption( Configuration.show_annotation ) ) {
2247 addCheckbox( Configuration.show_annotation, _configuration.getDisplayTitle( Configuration.show_annotation ) );
2248 setCheckbox( Configuration.show_annotation, _configuration.doCheckOption( Configuration.show_annotation ) );
2250 if ( _configuration.doDisplayOption( Configuration.write_confidence_values ) ) {
2251 addCheckbox( Configuration.write_confidence_values,
2252 _configuration.getDisplayTitle( Configuration.write_confidence_values ) );
2253 setCheckbox( Configuration.write_confidence_values,
2254 _configuration.doCheckOption( Configuration.write_confidence_values ) );
2256 if ( _configuration.doDisplayOption( Configuration.write_branch_length_values ) ) {
2257 addCheckbox( Configuration.write_branch_length_values,
2258 _configuration.getDisplayTitle( Configuration.write_branch_length_values ) );
2259 setCheckbox( Configuration.write_branch_length_values,
2260 _configuration.doCheckOption( Configuration.write_branch_length_values ) );
2262 if ( _configuration.doDisplayOption( Configuration.show_binary_characters ) ) {
2263 addCheckbox( Configuration.show_binary_characters,
2264 _configuration.getDisplayTitle( Configuration.show_binary_characters ) );
2265 setCheckbox( Configuration.show_binary_characters,
2266 _configuration.doCheckOption( Configuration.show_binary_characters ) );
2268 if ( _configuration.doDisplayOption( Configuration.show_binary_character_counts ) ) {
2269 addCheckbox( Configuration.show_binary_character_counts,
2270 _configuration.getDisplayTitle( Configuration.show_binary_character_counts ) );
2271 setCheckbox( Configuration.show_binary_character_counts,
2272 _configuration.doCheckOption( Configuration.show_binary_character_counts ) );
2274 if ( _configuration.doDisplayOption( Configuration.show_domain_architectures ) ) {
2275 addCheckbox( Configuration.show_domain_architectures,
2276 _configuration.getDisplayTitle( Configuration.show_domain_architectures ) );
2277 setCheckbox( Configuration.show_domain_architectures,
2278 _configuration.doCheckOption( Configuration.show_domain_architectures ) );
2280 if ( _configuration.doDisplayOption( Configuration.show_mol_seqs ) ) {
2281 addCheckbox( Configuration.show_mol_seqs, _configuration.getDisplayTitle( Configuration.show_mol_seqs ) );
2282 setCheckbox( Configuration.show_mol_seqs, _configuration.doCheckOption( Configuration.show_mol_seqs ) );
2284 if ( _configuration.doDisplayOption( Configuration.write_events ) ) {
2285 addCheckbox( Configuration.write_events, _configuration.getDisplayTitle( Configuration.write_events ) );
2286 setCheckbox( Configuration.write_events, _configuration.doCheckOption( Configuration.write_events ) );
2288 if ( _configuration.doDisplayOption( Configuration.show_vector_data ) ) {
2289 addCheckbox( Configuration.show_vector_data,
2290 _configuration.getDisplayTitle( Configuration.show_vector_data ) );
2291 setCheckbox( Configuration.show_vector_data, _configuration.doCheckOption( Configuration.show_vector_data ) );
2293 if ( _configuration.doDisplayOption( Configuration.show_properties ) ) {
2294 addCheckbox( Configuration.show_properties, _configuration.getDisplayTitle( Configuration.show_properties ) );
2295 setCheckbox( Configuration.show_properties, _configuration.doCheckOption( Configuration.show_properties ) );
2297 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_images ) ) {
2298 addCheckbox( Configuration.show_taxonomy_images,
2299 _configuration.getDisplayTitle( Configuration.show_taxonomy_images ) );
2300 setCheckbox( Configuration.show_taxonomy_images,
2301 _configuration.doCheckOption( Configuration.show_taxonomy_images ) );
2305 private void setVisibilityOfDomainStrucureControls() {
2306 if ( _zoom_in_domain_structure != null ) {
2307 final MainFrame mf = getMainFrame();
2309 if ( isShowDomainArchitectures() ) {
2310 _domain_display_label.setVisible( true );
2311 _zoom_in_domain_structure.setVisible( true );
2312 _zoom_out_domain_structure.setVisible( true );
2313 _decr_domain_structure_evalue_thr.setVisible( true );
2314 _incr_domain_structure_evalue_thr.setVisible( true );
2315 _domain_structure_evalue_thr_tf.setVisible( true );
2316 if ( mf._right_line_up_domains_cbmi != null ) {
2317 mf._right_line_up_domains_cbmi.setVisible( true );
2319 if ( mf._show_domain_labels != null ) {
2320 mf._show_domain_labels.setVisible( true );
2324 _domain_display_label.setVisible( false );
2325 _zoom_in_domain_structure.setVisible( false );
2326 _zoom_out_domain_structure.setVisible( false );
2327 _decr_domain_structure_evalue_thr.setVisible( false );
2328 _incr_domain_structure_evalue_thr.setVisible( false );
2329 _domain_structure_evalue_thr_tf.setVisible( false );
2330 if ( mf._right_line_up_domains_cbmi != null ) {
2331 mf._right_line_up_domains_cbmi.setVisible( false );
2333 if ( mf._show_domain_labels != null ) {
2334 mf._show_domain_labels.setVisible( false );
2341 // This takes care of ArchaeopteryxE-issue.
2342 // Can, and will, return null prior to ArchaeopteryxE initialization completion.
2343 final private MainFrame getMainFrame() {
2344 MainFrame mf = getMainPanel().getMainFrame();
2346 // Must be "E" applet version.
2347 final ArchaeopteryxE e = ( ArchaeopteryxE ) ( ( MainPanelApplets ) getMainPanel() ).getApplet();
2348 if ( e.getMainPanel() == null ) {
2351 mf = e.getMainPanel().getMainFrame();
2356 void setVisibilityOfX() {
2357 final MainFrame mf = getMainFrame();
2359 if ( ( getCurrentTreePanel() != null ) && ( getCurrentTreePanel().getPhylogeny() != null ) ) {
2360 if ( AptxUtil.isHasAtLeastOneBranchWithSupportSD( getCurrentTreePanel().getPhylogeny() ) ) {
2361 if ( mf._show_confidence_stddev_cbmi != null ) {
2362 mf._show_confidence_stddev_cbmi.setVisible( true );
2366 if ( mf._show_confidence_stddev_cbmi != null ) {
2367 mf._show_confidence_stddev_cbmi.setVisible( false );
2370 if ( AptxUtil.isHasAtLeastOneNodeWithScientificName( getCurrentTreePanel().getPhylogeny() ) ) {
2371 if ( mf._abbreviate_scientific_names != null ) {
2372 mf._abbreviate_scientific_names.setVisible( true );
2376 if ( mf._abbreviate_scientific_names != null ) {
2377 mf._abbreviate_scientific_names.setVisible( false );
2380 if ( AptxUtil.isHasAtLeastOneNodeWithSequenceAnnotation( getCurrentTreePanel().getPhylogeny() ) ) {
2381 if ( mf._show_annotation_ref_source != null ) {
2382 mf._show_annotation_ref_source.setVisible( true );
2386 if ( mf._show_annotation_ref_source != null ) {
2387 mf._show_annotation_ref_source.setVisible( false );
2391 if ( isDrawPhylogram()
2392 || ( ( getCurrentTreePanel() != null ) && ( ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) || ( getCurrentTreePanel()
2393 .getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) ) ) {
2394 if ( mf._non_lined_up_cladograms_rbmi != null ) {
2395 mf._non_lined_up_cladograms_rbmi.setVisible( false );
2397 if ( mf._uniform_cladograms_rbmi != null ) {
2398 mf._uniform_cladograms_rbmi.setVisible( false );
2400 if ( mf._ext_node_dependent_cladogram_rbmi != null ) {
2401 mf._ext_node_dependent_cladogram_rbmi.setVisible( false );
2405 if ( mf._non_lined_up_cladograms_rbmi != null ) {
2406 mf._non_lined_up_cladograms_rbmi.setVisible( true );
2408 if ( mf._uniform_cladograms_rbmi != null ) {
2409 mf._uniform_cladograms_rbmi.setVisible( true );
2411 if ( mf._ext_node_dependent_cladogram_rbmi != null ) {
2412 mf._ext_node_dependent_cladogram_rbmi.setVisible( true );
2415 if ( isDrawPhylogram() ) {
2416 if ( mf._show_scale_cbmi != null ) {
2417 mf._show_scale_cbmi.setVisible( true );
2421 if ( mf._show_scale_cbmi != null ) {
2422 mf._show_scale_cbmi.setVisible( false );
2425 if ( getCurrentTreePanel() != null ) {
2426 if ( ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
2427 || ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) {
2428 if ( mf._label_direction_cbmi != null ) {
2429 mf._label_direction_cbmi.setVisible( true );
2433 if ( mf._label_direction_cbmi != null ) {
2434 mf._label_direction_cbmi.setVisible( false );
2441 void setVisibilityOfDomainStrucureCB() {
2443 if ( ( getCurrentTreePanel() != null )
2444 && ( ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) || ( getCurrentTreePanel()
2445 .getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) ) {
2446 if ( getMainPanel().getMainFrame()._right_line_up_domains_cbmi != null ) {
2447 getMainPanel().getMainFrame()._right_line_up_domains_cbmi.setVisible( false );
2449 if ( getMainPanel().getMainFrame()._show_domain_labels != null ) {
2450 getMainPanel().getMainFrame()._show_domain_labels.setVisible( false );
2453 else if ( isShowDomainArchitectures() ) {
2454 if ( getMainPanel().getMainFrame()._right_line_up_domains_cbmi != null ) {
2455 getMainPanel().getMainFrame()._right_line_up_domains_cbmi.setVisible( true );
2457 if ( getMainPanel().getMainFrame()._show_domain_labels != null ) {
2458 getMainPanel().getMainFrame()._show_domain_labels.setVisible( true );
2462 if ( getMainPanel().getMainFrame()._right_line_up_domains_cbmi != null ) {
2463 getMainPanel().getMainFrame()._right_line_up_domains_cbmi.setVisible( false );
2465 if ( getMainPanel().getMainFrame()._show_domain_labels != null ) {
2466 getMainPanel().getMainFrame()._show_domain_labels.setVisible( false );
2470 catch ( final Exception ignore ) {
2475 static JLabel customizeLabel( final JLabel label, final Configuration configuration ) {
2476 label.setFont( ControlPanel.jcb_bold_font );
2477 if ( !configuration.isUseNativeUI() ) {
2478 label.setForeground( configuration.getGuiCheckboxTextColor() );
2479 label.setBackground( configuration.getGuiBackgroundColor() );
2484 enum NodeClickAction {
2491 DELETE_NODE_OR_SUBTREE,