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_events;
146 private JCheckBox _show_gene_names;
147 private JCheckBox _show_node_names;
148 private JCheckBox _show_properties_cb;
149 private JCheckBox _show_seq_names;
150 private JCheckBox _show_seq_symbols;
151 private JCheckBox _show_sequence_acc;
152 private JComboBox<String> _show_sequence_relations;
153 private JCheckBox _show_taxo_code;
154 private JCheckBox _show_taxo_common_names;
155 private JCheckBox _show_taxo_images_cb;
156 private JCheckBox _show_taxo_scientific_names;
157 private JCheckBox _show_vector_data_cb;
158 private JButton _show_whole;
159 private int _sort_descendents_item;
160 private Map<String, Color> _species_colors;
161 private Map<String, Color> _sequence_colors;
162 private int _subtree_cb_item;
163 private int _swap_cb_item;
164 private JButton _uncollapse_all;
165 private JCheckBox _width_branches;
166 private JCheckBox _write_confidence;
167 private JButton _zoom_in_domain_structure;
168 private JButton _zoom_in_x;
169 private JButton _zoom_in_y;
170 private JLabel _zoom_label;
171 private JButton _zoom_out_domain_structure;
172 private JButton _zoom_out_x;
173 private JButton _zoom_out_y;
175 ControlPanel( final MainPanel ap, final Configuration configuration ) {
178 _configuration = configuration;
179 if ( !_configuration.isUseNativeUI() ) {
180 setBackground( getConfiguration().getGuiBackgroundColor() );
181 setBorder( BorderFactory.createRaisedBevelBorder() );
183 setLayout( new GridLayout( 0, 1, 2, 2 ) );
184 _order_of_appearance = true;
192 public void actionPerformed( final ActionEvent e ) {
194 if ( e.getSource() == _color_acc_sequence ) {
195 if ( _color_acc_species != null ) {
196 _color_acc_species.setSelected( false );
199 else if ( e.getSource() == _color_acc_species ) {
200 if ( _color_acc_sequence != null ) {
201 _color_acc_sequence.setSelected( false );
204 final TreePanel tp = getMainPanel().getCurrentTreePanel();
208 if ( e.getSource() == _click_to_combobox ) {
209 setClickToAction( _click_to_combobox.getSelectedIndex() );
210 getCurrentTreePanel().repaint();
212 else if ( e.getSource() == _show_binary_characters ) {
213 if ( ( _show_binary_character_counts != null ) && _show_binary_characters.isSelected() ) {
214 _show_binary_character_counts.setSelected( false );
216 displayedPhylogenyMightHaveChanged( true );
218 else if ( e.getSource() == _show_binary_character_counts ) {
219 if ( ( _show_binary_characters != null ) && _show_binary_character_counts.isSelected() ) {
220 _show_binary_characters.setSelected( false );
222 displayedPhylogenyMightHaveChanged( true );
224 else if ( e.getSource() == _show_domain_architectures ) {
227 displayedPhylogenyMightHaveChanged( true );
229 else if ( ( tp != null ) && ( tp.getPhylogeny() != null ) ) {
230 if ( e.getSource() == getDisplayAsPhylogramCb() ) {
231 setDrawPhylogram( getDisplayAsPhylogramCb().isSelected() );
235 else if ( e.getSource() == _zoom_in_x ) {
236 zoomInX( Constants.BUTTON_ZOOM_IN_FACTOR, Constants.BUTTON_ZOOM_IN_X_CORRECTION_FACTOR );
237 displayedPhylogenyMightHaveChanged( false );
239 else if ( e.getSource() == _zoom_in_y ) {
240 zoomInY( Constants.BUTTON_ZOOM_IN_FACTOR );
241 displayedPhylogenyMightHaveChanged( false );
243 else if ( e.getSource() == _zoom_out_x ) {
244 zoomOutX( Constants.BUTTON_ZOOM_OUT_FACTOR, Constants.BUTTON_ZOOM_OUT_X_CORRECTION_FACTOR );
245 displayedPhylogenyMightHaveChanged( false );
247 else if ( e.getSource() == _zoom_out_y ) {
248 zoomOutY( Constants.BUTTON_ZOOM_OUT_FACTOR );
249 displayedPhylogenyMightHaveChanged( false );
251 else if ( e.getSource() == _show_whole ) {
254 else if ( e.getSource() == _return_to_super_tree ) {
255 _mainpanel.getCurrentTreePanel().superTree();
258 else if ( e.getSource() == _order ) {
259 DESCENDANT_SORT_PRIORITY pri = DESCENDANT_SORT_PRIORITY.TAXONOMY;
260 if ( ( !isShowTaxonomyScientificNames() && !isShowTaxonomyCode() && !isShowTaxonomyCommonNames() ) ) {
261 if ( ( isShowSequenceAcc() || isShowSeqNames() || isShowSeqSymbols() ) ) {
262 pri = DESCENDANT_SORT_PRIORITY.SEQUENCE;
264 else if ( isShowNodeNames() ) {
265 pri = DESCENDANT_SORT_PRIORITY.NODE_NAME;
268 PhylogenyMethods.orderAppearance( tp.getPhylogeny().getRoot(), _order_of_appearance, true, pri );
269 _order_of_appearance = !_order_of_appearance;
270 tp.setNodeInPreorderToNull();
271 tp.getPhylogeny().externalNodesHaveChanged();
272 tp.getPhylogeny().clearHashIdToNodeMap();
273 tp.getPhylogeny().recalculateNumberOfExternalDescendants( true );
274 tp.resetNodeIdToDistToLeafMap();
275 tp.setEdited( true );
276 displayedPhylogenyMightHaveChanged( false );
278 else if ( e.getSource() == _uncollapse_all ) {
280 displayedPhylogenyMightHaveChanged( false );
282 else if ( e.getSource() == _zoom_in_domain_structure ) {
283 _mainpanel.getCurrentTreePanel().zoomInDomainStructure();
284 displayedPhylogenyMightHaveChanged( true );
286 else if ( e.getSource() == _zoom_out_domain_structure ) {
287 _mainpanel.getCurrentTreePanel().zoomOutDomainStructure();
288 displayedPhylogenyMightHaveChanged( true );
290 else if ( e.getSource() == _decr_domain_structure_evalue_thr ) {
291 _mainpanel.getCurrentTreePanel().decreaseDomainStructureEvalueThreshold();
292 displayedPhylogenyMightHaveChanged( true );
294 else if ( e.getSource() == _incr_domain_structure_evalue_thr ) {
295 _mainpanel.getCurrentTreePanel().increaseDomainStructureEvalueThreshold();
296 displayedPhylogenyMightHaveChanged( true );
298 else if ( e.getSource() == _search_tf_0 ) {
300 displayedPhylogenyMightHaveChanged( true );
302 else if ( e.getSource() == _search_tf_1 ) {
304 displayedPhylogenyMightHaveChanged( true );
306 else if ( ( _dynamically_hide_data != null ) && ( e.getSource() == _dynamically_hide_data )
307 && !_dynamically_hide_data.isSelected() ) {
308 setDynamicHidingIsOn( false );
309 displayedPhylogenyMightHaveChanged( true );
312 displayedPhylogenyMightHaveChanged( true );
316 tp.requestFocusInWindow();
319 catch ( final Exception ex ) {
320 AptxUtil.unexpectedException( ex );
322 catch ( final Error err ) {
323 AptxUtil.unexpectedError( err );
327 public JCheckBox getColorAccSpeciesCb() {
328 return _color_acc_species;
331 public JCheckBox getColorAccSequenceCb() {
332 return _color_acc_sequence;
335 public JCheckBox getUseVisualStylesCb() {
336 return _use_visual_styles_cb;
339 public JCheckBox getDisplayAsPhylogramCb() {
340 return _display_as_phylogram_cb;
343 public JCheckBox getDynamicallyHideData() {
344 return _dynamically_hide_data;
347 public JCheckBox getNodeDescPopupCb() {
348 return _node_desc_popup_cb;
351 public Sequence getSelectedQuerySequence() {
352 return _selected_query_seq;
355 public JComboBox<String> getSequenceRelationBox() {
356 if ( _show_sequence_relations == null ) {
357 _show_sequence_relations = new JComboBox<String>();
358 _show_sequence_relations.setFocusable( false );
359 _show_sequence_relations.setMaximumRowCount( 20 );
360 _show_sequence_relations.setFont( ControlPanel.js_font );
361 if ( !_configuration.isUseNativeUI() ) {
362 _show_sequence_relations.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
363 _show_sequence_relations.setForeground( getConfiguration().getGuiButtonTextColor() );
365 _show_sequence_relations.addItem( "-----" );
366 _show_sequence_relations.setToolTipText( "To display orthology information for selected query" );
368 return _show_sequence_relations;
372 public JComboBox<SEQUENCE_RELATION_TYPE> getSequenceRelationTypeBox() {
373 if ( _sequence_relation_type_box == null ) {
374 _sequence_relation_type_box = new JComboBox<SEQUENCE_RELATION_TYPE>();
375 for( final SequenceRelation.SEQUENCE_RELATION_TYPE type : SequenceRelation.SEQUENCE_RELATION_TYPE.values() ) {
376 _sequence_relation_type_box.addItem( type );
378 _sequence_relation_type_box.addActionListener( new ActionListener() {
381 public void actionPerformed( final ActionEvent e ) {
382 if ( _mainpanel.getCurrentPhylogeny() != null ) {
383 setSequenceRelationQueries( getMainPanel().getCurrentPhylogeny().getSequenceRelationQueries() );
388 return _sequence_relation_type_box;
391 public JCheckBox getShowEventsCb() {
395 public JCheckBox getWriteConfidenceCb() {
396 return _write_confidence;
399 public boolean isShowProperties() {
400 return ( ( _show_properties_cb != null ) && _show_properties_cb.isSelected() );
403 public boolean isShowTaxonomyImages() {
404 return ( ( _show_taxo_images_cb != null ) && _show_taxo_images_cb.isSelected() );
407 public boolean isShowVectorData() {
408 return ( ( _show_vector_data_cb != null ) && _show_vector_data_cb.isSelected() );
411 public void setSequenceRelationQueries( final Collection<Sequence> sequenceRelationQueries ) {
412 final JComboBox<String> box = getSequenceRelationBox();
413 while ( box.getItemCount() > 1 ) {
414 box.removeItemAt( 1 );
416 final HashMap<String, Sequence> sequencesByName = new HashMap<String, Sequence>();
417 final SequenceRelation.SEQUENCE_RELATION_TYPE relationType = ( SequenceRelation.SEQUENCE_RELATION_TYPE ) _sequence_relation_type_box
419 if ( relationType == null ) {
422 final ArrayList<String> sequenceNamesToAdd = new ArrayList<String>();
423 for( final Sequence seq : sequenceRelationQueries ) {
424 if ( seq.hasSequenceRelations() ) {
425 boolean fFoundForCurrentType = false;
426 for( final SequenceRelation sq : seq.getSequenceRelations() ) {
427 if ( sq.getType().equals( relationType ) ) {
428 fFoundForCurrentType = true;
432 if ( fFoundForCurrentType ) {
433 sequenceNamesToAdd.add( seq.getName() );
434 sequencesByName.put( seq.getName(), seq );
438 // sort sequences by name before adding them to the combo
439 final String[] sequenceNameArray = sequenceNamesToAdd.toArray( new String[ sequenceNamesToAdd.size() ] );
440 Arrays.sort( sequenceNameArray, String.CASE_INSENSITIVE_ORDER );
441 for( final String seqName : sequenceNameArray ) {
442 box.addItem( seqName );
444 for( final ItemListener oldItemListener : box.getItemListeners() ) {
445 box.removeItemListener( oldItemListener );
447 box.addItemListener( new ItemListener() {
450 public void itemStateChanged( final ItemEvent e ) {
451 _selected_query_seq = sequencesByName.get( e.getItem() );
452 _mainpanel.getCurrentTreePanel().repaint();
457 void activateButtonToReturnToSuperTree( int index ) {
460 _return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT + " " + index );
463 _return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT );
465 _return_to_super_tree.setForeground( getConfiguration().getGuiCheckboxAndButtonActiveColor() );
466 _return_to_super_tree.setEnabled( true );
470 * Add zoom and quick edit buttons. (Last modified 8/9/04)
473 final JLabel spacer = new JLabel( "" );
474 spacer.setOpaque( false );
476 final JPanel x_panel = new JPanel( new GridLayout( 1, 1, 0, 0 ) );
477 final JPanel y_panel = new JPanel( new GridLayout( 1, 3, 0, 0 ) );
478 final JPanel z_panel = new JPanel( new GridLayout( 1, 1, 0, 0 ) );
479 if ( !getConfiguration().isUseNativeUI() ) {
480 x_panel.setBackground( getBackground() );
481 y_panel.setBackground( getBackground() );
482 z_panel.setBackground( getBackground() );
484 add( _zoom_label = new JLabel( "Zoom:" ) );
485 customizeLabel( _zoom_label, getConfiguration() );
489 if ( getConfiguration().isUseNativeUI() ) {
490 _zoom_in_x = new JButton( "+" );
491 _zoom_out_x = new JButton( "-" );
494 _zoom_in_x = new JButton( "X+" );
495 _zoom_out_x = new JButton( "X-" );
497 _zoom_in_y = new JButton( "Y+" );
498 _zoom_out_y = new JButton( "Y-" );
499 _show_whole = new JButton( "F" );
500 _show_whole.setToolTipText( "To fit the complete phylogeny to the current display size [F or Home]" );
501 _zoom_in_x.setToolTipText( "To zoom in horizontally [Shift+cursor-right]" );
502 _zoom_in_y.setToolTipText( "To zoom in vertically [Shift+cursor-up]" );
503 _zoom_out_x.setToolTipText( "To zoom out horizontally [Shift+cursor-left]" );
504 _zoom_out_y.setToolTipText( "To zoom out vertically [Shift+cursor-down]" );
505 if ( getConfiguration().isUseNativeUI() && ForesterUtil.isMac() ) {
506 _zoom_out_x.setPreferredSize( new Dimension( 55, 10 ) );
507 _zoom_in_x.setPreferredSize( new Dimension( 55, 10 ) );
510 _zoom_out_x.setPreferredSize( new Dimension( 10, 10 ) );
511 _zoom_in_x.setPreferredSize( new Dimension( 10, 10 ) );
513 _zoom_out_y.setPreferredSize( new Dimension( 10, 10 ) );
514 _zoom_in_y.setPreferredSize( new Dimension( 10, 10 ) );
515 _show_whole.setPreferredSize( new Dimension( 10, 10 ) );
516 _return_to_super_tree = new JButton( RETURN_TO_SUPER_TREE_TEXT );
517 _return_to_super_tree.setEnabled( false );
518 _order = new JButton( "Order Subtrees" );
519 _uncollapse_all = new JButton( "Uncollapse All" );
520 addJButton( _zoom_in_y, x_panel );
521 addJButton( _zoom_out_x, y_panel );
522 addJButton( _show_whole, y_panel );
523 addJButton( _zoom_in_x, y_panel );
524 addJButton( _zoom_out_y, z_panel );
525 if ( getConfiguration().doDisplayOption( Configuration.show_domain_architectures ) ) {
526 setUpControlsForDomainStrucures();
528 final JLabel spacer2 = new JLabel( "" );
530 addJButton( _return_to_super_tree, this );
531 addJButton( _order, this );
532 addJButton( _uncollapse_all, this );
533 final JLabel spacer3 = new JLabel( "" );
535 setVisibilityOfDomainStrucureControls();
538 void addCheckbox( final int which, final String title ) {
539 final JPanel ch_panel = new JPanel( new BorderLayout( 0, 0 ) );
541 case Configuration.display_as_phylogram:
542 _display_as_phylogram_cb = new JCheckBox( title );
543 getDisplayAsPhylogramCb().setToolTipText( "To switch between phylogram and cladogram display" );
544 addJCheckBox( getDisplayAsPhylogramCb(), ch_panel );
547 case Configuration.display_internal_data:
548 _display_internal_data = new JCheckBox( title );
549 _display_internal_data.setToolTipText( "To allow or disallow display of internal labels" );
550 addJCheckBox( _display_internal_data, ch_panel );
553 case Configuration.color_according_to_species:
554 _color_acc_species = new JCheckBox( title );
555 _color_acc_species.setToolTipText( "To colorize node labels as a function of taxonomy" );
556 addJCheckBox( _color_acc_species, ch_panel );
559 case Configuration.color_according_to_sequence:
560 _color_acc_sequence = new JCheckBox( title );
561 _color_acc_sequence.setToolTipText( "To colorize node labels as a function of sequence name" );
562 addJCheckBox( _color_acc_sequence, ch_panel );
565 case Configuration.color_according_to_annotation:
566 _color_according_to_annotation = new JCheckBox( title );
567 _color_according_to_annotation
568 .setToolTipText( "To colorize sequence annotation labels as a function of sequence annotation" );
569 addJCheckBox( _color_according_to_annotation, ch_panel );
572 case Configuration.show_node_names:
573 _show_node_names = new JCheckBox( title );
574 addJCheckBox( _show_node_names, ch_panel );
577 case Configuration.show_taxonomy_scientific_names:
578 _show_taxo_scientific_names = new JCheckBox( title );
579 addJCheckBox( _show_taxo_scientific_names, ch_panel );
582 case Configuration.show_taxonomy_common_names:
583 _show_taxo_common_names = new JCheckBox( title );
584 addJCheckBox( _show_taxo_common_names, ch_panel );
587 case Configuration.show_tax_code:
588 _show_taxo_code = new JCheckBox( title );
589 addJCheckBox( _show_taxo_code, ch_panel );
592 case Configuration.show_taxonomy_images:
593 _show_taxo_images_cb = new JCheckBox( title );
594 addJCheckBox( _show_taxo_images_cb, ch_panel );
597 case Configuration.show_binary_characters:
598 _show_binary_characters = new JCheckBox( title );
599 addJCheckBox( _show_binary_characters, ch_panel );
602 case Configuration.show_annotation:
603 _show_annotation = new JCheckBox( title );
604 addJCheckBox( _show_annotation, ch_panel );
607 case Configuration.show_binary_character_counts:
608 _show_binary_character_counts = new JCheckBox( title );
609 addJCheckBox( _show_binary_character_counts, ch_panel );
612 case Configuration.write_confidence_values:
613 _write_confidence = new JCheckBox( title );
614 addJCheckBox( getWriteConfidenceCb(), ch_panel );
617 case Configuration.write_events:
618 _show_events = new JCheckBox( title );
619 addJCheckBox( getShowEventsCb(), ch_panel );
622 case Configuration.use_style:
623 _use_visual_styles_cb = new JCheckBox( title );
624 getUseVisualStylesCb()
625 .setToolTipText( "To use visual styles (node colors, fonts) and branch colors, if present" );
626 addJCheckBox( getUseVisualStylesCb(), ch_panel );
629 case Configuration.width_branches:
630 _width_branches = new JCheckBox( title );
631 _width_branches.setToolTipText( "To use branch width values, if present" );
632 addJCheckBox( _width_branches, ch_panel );
635 case Configuration.show_domain_architectures:
636 _show_domain_architectures = new JCheckBox( title );
637 addJCheckBox( _show_domain_architectures, ch_panel );
640 case Configuration.show_seq_names:
641 _show_seq_names = new JCheckBox( title );
642 addJCheckBox( _show_seq_names, ch_panel );
645 case Configuration.show_gene_names:
646 _show_gene_names = new JCheckBox( title );
647 addJCheckBox( _show_gene_names, ch_panel );
650 case Configuration.show_seq_symbols:
651 _show_seq_symbols = new JCheckBox( title );
652 addJCheckBox( _show_seq_symbols, ch_panel );
655 case Configuration.show_sequence_acc:
656 _show_sequence_acc = new JCheckBox( title );
657 addJCheckBox( _show_sequence_acc, ch_panel );
660 case Configuration.dynamically_hide_data:
661 _dynamically_hide_data = new JCheckBox( title );
662 getDynamicallyHideData().setToolTipText( "To hide labels depending on expected visibility" );
663 addJCheckBox( getDynamicallyHideData(), ch_panel );
666 case Configuration.node_data_popup:
667 _node_desc_popup_cb = new JCheckBox( title );
668 getNodeDescPopupCb().setToolTipText( "To enable mouse rollover display of basic node data" );
669 addJCheckBox( getNodeDescPopupCb(), ch_panel );
672 case Configuration.show_relation_confidence:
673 _seq_relation_confidence_switch = new JCheckBox( title );
674 addJCheckBox( _seq_relation_confidence_switch, ch_panel );
677 case Configuration.show_vector_data:
678 _show_vector_data_cb = new JCheckBox( title );
679 addJCheckBox( _show_vector_data_cb, ch_panel );
682 case Configuration.show_properties:
683 _show_properties_cb = new JCheckBox( title );
684 addJCheckBox( _show_properties_cb, ch_panel );
688 throw new RuntimeException( "unknown checkbox: " + which );
692 void addJButton( final JButton jb, final JPanel p ) {
693 jb.setFocusPainted( false );
694 jb.setFont( ControlPanel.jcb_font );
695 if ( !_configuration.isUseNativeUI() ) {
696 jb.setBorder( BorderFactory.createLineBorder( getConfiguration().getGuiButtonBorderColor() ) );
697 jb.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
698 jb.setForeground( getConfiguration().getGuiButtonTextColor() );
701 jb.addActionListener( this );
704 void addJCheckBox( final JCheckBox jcb, final JPanel p ) {
705 jcb.setFocusPainted( false );
706 jcb.setFont( ControlPanel.jcb_font );
707 if ( !_configuration.isUseNativeUI() ) {
708 jcb.setBackground( getConfiguration().getGuiBackgroundColor() );
709 jcb.setForeground( getConfiguration().getGuiCheckboxTextColor() );
711 p.add( jcb, "Center" );
712 jcb.addActionListener( this );
715 void addJTextField( final JTextField tf, final JPanel p ) {
716 if ( !_configuration.isUseNativeUI() ) {
717 tf.setForeground( getConfiguration().getGuiBackgroundColor() );
718 tf.setFont( ControlPanel.jcb_font );
721 tf.addActionListener( this );
724 void deactivateButtonToReturnToSuperTree() {
725 _return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT );
726 _return_to_super_tree.setForeground( getConfiguration().getGuiButtonTextColor() );
727 _return_to_super_tree.setEnabled( false );
730 void displayedPhylogenyMightHaveChanged( final boolean recalc_longest_ext_node_info ) {
731 if ( ( _mainpanel != null )
732 && ( ( _mainpanel.getCurrentPhylogeny() != null ) && !_mainpanel.getCurrentPhylogeny().isEmpty() ) ) {
733 if ( getOptions().isShowOverview() ) {
734 _mainpanel.getCurrentTreePanel().updateOvSizes();
736 _mainpanel.getCurrentTreePanel().recalculateMaxDistanceToRoot();
737 setVisibilityOfDomainStrucureControls();
738 updateDomainStructureEvaluethresholdDisplay();
739 _mainpanel.getCurrentTreePanel().calculateScaleDistance();
740 _mainpanel.getCurrentTreePanel().calcMaxDepth();
741 _mainpanel.adjustJScrollPane();
742 if ( recalc_longest_ext_node_info ) {
743 _mainpanel.getCurrentTreePanel().initNodeData();
744 _mainpanel.getCurrentTreePanel().calculateLongestExtNodeInfo();
746 _mainpanel.getCurrentTreePanel().repaint();
747 // _mainpanel.getCurrentTreePanel().setUpUrtFactors();
751 void endClickToOptions() {
752 _click_to_combobox.addActionListener( this );
756 * Indicates what action should be execute when a node is clicked
758 * @return the click-on action
760 NodeClickAction getActionWhenNodeClicked() {
761 return _action_when_node_clicked;
764 Map<Integer, String> getAllClickToItems() {
765 return _all_click_to_names;
768 Map<String, Color> getAnnotationColors() {
769 return _annotation_colors;
772 Configuration getConfiguration() {
773 return _configuration;
776 TreePanel getCurrentTreePanel() {
777 return getMainPanel().getCurrentTreePanel();
780 MainPanel getMainPanel() {
784 Options getOptions() {
785 return getMainPanel().getOptions();
788 JLabel getSearchFoundCountsLabel0() {
789 return _search_found_label_0;
792 JLabel getSearchFoundCountsLabel1() {
793 return _search_found_label_1;
796 JButton getSearchResetButton0() {
797 return _search_reset_button_0;
800 JButton getSearchResetButton1() {
801 return _search_reset_button_1;
804 JTextField getSearchTextField0() {
808 JTextField getSearchTextField1() {
812 List<String> getSingleClickToNames() {
813 return _click_to_names;
816 Map<String, Color> getSpeciesColors() {
817 return _species_colors;
820 Map<String, Color> getSequenceColors() {
821 return _sequence_colors;
824 boolean isAntialiasScreenText() {
828 boolean isColorAccordingToAnnotation() {
829 return ( ( _color_according_to_annotation != null ) && _color_according_to_annotation.isSelected() );
832 boolean isColorAccordingToTaxonomy() {
833 return ( ( _color_acc_species != null ) && _color_acc_species.isSelected() );
836 boolean isColorAccordingToSequence() {
837 return ( ( _color_acc_sequence != null ) && _color_acc_sequence.isSelected() );
840 boolean isUseVisualStyles() {
841 return ( ( ( getUseVisualStylesCb() != null ) && getUseVisualStylesCb().isSelected() ) || ( ( getUseVisualStylesCb() == null ) && _color_branches ) );
844 boolean isDrawPhylogram() {
845 return isDrawPhylogram( getMainPanel().getCurrentTabIndex() );
848 boolean isDynamicallyHideData() {
849 return ( ( getDynamicallyHideData() != null ) && getDynamicallyHideData().isSelected() );
853 return ( ( getShowEventsCb() != null ) && getShowEventsCb().isSelected() );
856 boolean isNodeDescPopup() {
857 return ( ( getNodeDescPopupCb() != null ) && getNodeDescPopupCb().isSelected() );
860 boolean isShowAnnotation() {
861 return ( ( _show_annotation != null ) && _show_annotation.isSelected() );
864 boolean isShowBinaryCharacterCounts() {
865 return ( ( _show_binary_character_counts != null ) && _show_binary_character_counts.isSelected() );
868 boolean isShowBinaryCharacters() {
869 return ( ( _show_binary_characters != null ) && _show_binary_characters.isSelected() );
872 boolean isShowConfidenceValues() {
873 return ( ( getWriteConfidenceCb() != null ) && getWriteConfidenceCb().isSelected() );
876 boolean isShowDomainArchitectures() {
877 return ( ( _show_domain_architectures != null ) && _show_domain_architectures.isSelected() );
880 boolean isShowGeneNames() {
881 return ( ( _show_gene_names != null ) && _show_gene_names.isSelected() );
884 boolean isShowInternalData() {
885 return ( ( _display_internal_data == null ) || _display_internal_data.isSelected() );
888 boolean isShowNodeNames() {
889 return ( ( _show_node_names != null ) && _show_node_names.isSelected() );
892 boolean isShowSeqNames() {
893 return ( ( _show_seq_names != null ) && _show_seq_names.isSelected() );
896 boolean isShowSeqSymbols() {
897 return ( ( _show_seq_symbols != null ) && _show_seq_symbols.isSelected() );
900 boolean isShowSequenceAcc() {
901 return ( ( _show_sequence_acc != null ) && _show_sequence_acc.isSelected() );
904 boolean isShowSequenceRelationConfidence() {
905 return ( ( _seq_relation_confidence_switch != null ) && ( _seq_relation_confidence_switch.isSelected() ) );
908 boolean isShowSequenceRelations() {
909 return ( ( _show_sequence_relations != null ) && ( _show_sequence_relations.getSelectedIndex() > 0 ) );
912 boolean isShowTaxonomyCode() {
913 return ( ( _show_taxo_code != null ) && _show_taxo_code.isSelected() );
916 boolean isShowTaxonomyCommonNames() {
917 return ( ( _show_taxo_common_names != null ) && _show_taxo_common_names.isSelected() );
920 boolean isShowTaxonomyScientificNames() {
921 return ( ( _show_taxo_scientific_names != null ) && _show_taxo_scientific_names.isSelected() );
924 boolean isWidthBranches() {
925 return ( ( _width_branches != null ) && _width_branches.isSelected() );
928 void phylogenyAdded( final Configuration configuration ) {
929 getIsDrawPhylogramList().add( configuration.isDrawAsPhylogram() );
932 void phylogenyRemoved( final int index ) {
933 getIsDrawPhylogramList().remove( index );
937 final MainPanel main_panel = getMainPanel();
938 final Phylogeny tree = main_panel.getCurrentPhylogeny();
939 if ( ( tree == null ) || tree.isEmpty() ) {
942 String query = getSearchTextField0().getText();
943 if ( query != null ) {
944 query = query.trim();
946 if ( !ForesterUtil.isEmpty( query ) ) {
947 search0( main_panel, tree, query );
950 getSearchFoundCountsLabel0().setVisible( false );
951 getSearchResetButton0().setEnabled( false );
952 getSearchResetButton0().setVisible( false );
958 final MainPanel main_panel = getMainPanel();
959 final Phylogeny tree = main_panel.getCurrentPhylogeny();
960 if ( ( tree == null ) || tree.isEmpty() ) {
963 String query = getSearchTextField1().getText();
964 if ( query != null ) {
965 query = query.trim();
967 if ( !ForesterUtil.isEmpty( query ) ) {
968 search1( main_panel, tree, query );
971 getSearchFoundCountsLabel1().setVisible( false );
972 getSearchResetButton1().setEnabled( false );
973 getSearchResetButton1().setVisible( false );
978 void searchReset0() {
979 if ( getMainPanel().getCurrentTreePanel() != null ) {
980 getMainPanel().getCurrentTreePanel().setFoundNodes0( null );
984 void searchReset1() {
985 if ( getMainPanel().getCurrentTreePanel() != null ) {
986 getMainPanel().getCurrentTreePanel().setFoundNodes1( null );
990 void setActionWhenNodeClicked( final NodeClickAction action ) {
991 _action_when_node_clicked = action;
994 void setAnnotationColors( final Map<String, Color> annotation_colors ) {
995 _annotation_colors = annotation_colors;
998 void setCheckbox( final int which, final boolean state ) {
1000 case Configuration.display_as_phylogram:
1001 if ( getDisplayAsPhylogramCb() != null ) {
1002 getDisplayAsPhylogramCb().setSelected( state );
1005 case Configuration.display_internal_data:
1006 if ( _display_internal_data != null ) {
1007 _display_internal_data.setSelected( state );
1010 case Configuration.color_according_to_species:
1011 if ( _color_acc_species != null ) {
1012 _color_acc_species.setSelected( state );
1015 case Configuration.color_according_to_sequence:
1016 if ( _color_acc_sequence != null ) {
1017 _color_acc_sequence.setSelected( state );
1020 case Configuration.color_according_to_annotation:
1021 if ( _color_according_to_annotation != null ) {
1022 _color_according_to_annotation.setSelected( state );
1025 case Configuration.show_node_names:
1026 if ( _show_node_names != null ) {
1027 _show_node_names.setSelected( state );
1030 case Configuration.show_taxonomy_scientific_names:
1031 if ( _show_taxo_scientific_names != null ) {
1032 _show_taxo_scientific_names.setSelected( state );
1035 case Configuration.show_taxonomy_common_names:
1036 if ( _show_taxo_common_names != null ) {
1037 _show_taxo_common_names.setSelected( state );
1040 case Configuration.show_tax_code:
1041 if ( _show_taxo_code != null ) {
1042 _show_taxo_code.setSelected( state );
1045 case Configuration.show_taxonomy_images:
1046 if ( _show_taxo_images_cb != null ) {
1047 _show_taxo_images_cb.setSelected( state );
1050 case Configuration.show_annotation:
1051 if ( _show_annotation != null ) {
1052 _show_annotation.setSelected( state );
1055 case Configuration.show_binary_characters:
1056 if ( _show_binary_characters != null ) {
1057 _show_binary_characters.setSelected( state );
1060 case Configuration.show_binary_character_counts:
1061 if ( _show_binary_character_counts != null ) {
1062 _show_binary_character_counts.setSelected( state );
1065 case Configuration.write_confidence_values:
1066 if ( getWriteConfidenceCb() != null ) {
1067 getWriteConfidenceCb().setSelected( state );
1070 case Configuration.write_events:
1071 if ( getShowEventsCb() != null ) {
1072 getShowEventsCb().setSelected( state );
1075 case Configuration.use_style:
1076 if ( getUseVisualStylesCb() != null ) {
1077 getUseVisualStylesCb().setSelected( state );
1080 case Configuration.width_branches:
1081 if ( _width_branches != null ) {
1082 _width_branches.setSelected( state );
1085 case Configuration.show_domain_architectures:
1086 if ( _show_domain_architectures != null ) {
1087 _show_domain_architectures.setSelected( state );
1090 case Configuration.show_seq_names:
1091 if ( _show_seq_names != null ) {
1092 _show_seq_names.setSelected( state );
1095 case Configuration.show_gene_names:
1096 if ( _show_gene_names != null ) {
1097 _show_gene_names.setSelected( state );
1100 case Configuration.show_seq_symbols:
1101 if ( _show_seq_symbols != null ) {
1102 _show_seq_symbols.setSelected( state );
1105 case Configuration.show_vector_data:
1106 if ( _show_vector_data_cb != null ) {
1107 _show_vector_data_cb.setSelected( state );
1110 case Configuration.show_properties:
1111 if ( _show_properties_cb != null ) {
1112 _show_properties_cb.setSelected( state );
1115 case Configuration.show_sequence_acc:
1116 if ( _show_sequence_acc != null ) {
1117 _show_sequence_acc.setSelected( state );
1120 case Configuration.dynamically_hide_data:
1121 if ( getDynamicallyHideData() != null ) {
1122 getDynamicallyHideData().setSelected( state );
1125 case Configuration.node_data_popup:
1126 if ( getNodeDescPopupCb() != null ) {
1127 getNodeDescPopupCb().setSelected( state );
1131 case Configuration.show_relation_confidence:
1132 if ( _seq_relation_confidence_switch != null ) {
1133 _seq_relation_confidence_switch.setSelected( state );
1138 throw new AssertionError( "unknown checkbox: " + which );
1143 * Set this checkbox state. Not all checkboxes have been instantiated
1144 * depending on the config.
1146 void setCheckbox( final JCheckBox cb, final boolean state ) {
1148 cb.setSelected( state );
1152 void setClickToAction( final int action ) {
1153 // Set click-to action
1154 if ( action == _show_data_item ) {
1155 setActionWhenNodeClicked( NodeClickAction.SHOW_DATA );
1157 else if ( action == _collapse_cb_item ) {
1158 setActionWhenNodeClicked( NodeClickAction.COLLAPSE );
1160 else if ( action == _reroot_cb_item ) {
1161 setActionWhenNodeClicked( NodeClickAction.REROOT );
1163 else if ( action == _subtree_cb_item ) {
1164 setActionWhenNodeClicked( NodeClickAction.SUBTREE );
1166 else if ( action == _swap_cb_item ) {
1167 setActionWhenNodeClicked( NodeClickAction.SWAP );
1169 else if ( action == _color_subtree_cb_item ) {
1170 setActionWhenNodeClicked( NodeClickAction.COLOR_SUBTREE );
1172 else if ( action == _open_seq_web_item ) {
1173 setActionWhenNodeClicked( NodeClickAction.OPEN_SEQ_WEB );
1175 else if ( action == _sort_descendents_item ) {
1176 setActionWhenNodeClicked( NodeClickAction.SORT_DESCENDENTS );
1178 else if ( action == _blast_item ) {
1179 setActionWhenNodeClicked( NodeClickAction.BLAST );
1181 else if ( action == _open_tax_web_item ) {
1182 setActionWhenNodeClicked( NodeClickAction.OPEN_TAX_WEB );
1184 else if ( action == _cut_subtree_item ) {
1185 setActionWhenNodeClicked( NodeClickAction.CUT_SUBTREE );
1187 else if ( action == _copy_subtree_item ) {
1188 setActionWhenNodeClicked( NodeClickAction.COPY_SUBTREE );
1190 else if ( action == _delete_node_or_subtree_item ) {
1191 setActionWhenNodeClicked( NodeClickAction.DELETE_NODE_OR_SUBTREE );
1193 else if ( action == _paste_subtree_item ) {
1194 setActionWhenNodeClicked( NodeClickAction.PASTE_SUBTREE );
1196 else if ( action == _add_new_node_item ) {
1197 setActionWhenNodeClicked( NodeClickAction.ADD_NEW_NODE );
1199 else if ( action == _edit_node_data_item ) {
1200 setActionWhenNodeClicked( NodeClickAction.EDIT_NODE_DATA );
1202 else if ( action == _select_nodes_item ) {
1203 setActionWhenNodeClicked( NodeClickAction.SELECT_NODES );
1205 else if ( action == _get_ext_desc_data ) {
1206 setActionWhenNodeClicked( NodeClickAction.GET_EXT_DESC_DATA );
1208 else if ( action == _open_pdb_item ) {
1209 setActionWhenNodeClicked( NodeClickAction.OPEN_PDB_WEB );
1211 else if ( action == _color_node_font_item ) {
1212 setActionWhenNodeClicked( NodeClickAction.COLOR_NODE_FONT );
1214 else if ( action == _change_node_font_item ) {
1215 setActionWhenNodeClicked( NodeClickAction.CHANGE_NODE_FONT );
1218 throw new RuntimeException( "unknown action: " + action );
1220 // make sure drop down is displaying the correct action
1221 // in case this was called from outside the class
1222 _click_to_combobox.setSelectedIndex( action );
1225 void setColorBranches( final boolean color_branches ) {
1226 _color_branches = color_branches;
1229 void setDrawPhylogram( final boolean b ) {
1230 getDisplayAsPhylogramCb().setSelected( b );
1231 setDrawPhylogram( getMainPanel().getCurrentTabIndex(), b );
1234 void setDrawPhylogramEnabled( final boolean b ) {
1235 getDisplayAsPhylogramCb().setEnabled( b );
1238 void setDynamicHidingIsOn( final boolean is_on ) {
1240 getDynamicallyHideData().setForeground( getConfiguration().getGuiCheckboxAndButtonActiveColor() );
1243 if ( !_configuration.isUseNativeUI() ) {
1244 getDynamicallyHideData().setForeground( getConfiguration().getGuiButtonTextColor() );
1247 getDynamicallyHideData().setForeground( Color.BLACK );
1252 void setSearchFoundCountsOnLabel0( final int counts ) {
1253 getSearchFoundCountsLabel0().setText( "Found: " + counts );
1256 void setSearchFoundCountsOnLabel1( final int counts ) {
1257 getSearchFoundCountsLabel1().setText( "Found: " + counts );
1260 void setShowEvents( final boolean show_events ) {
1261 if ( getShowEventsCb() == null ) {
1262 _show_events = new JCheckBox( "" );
1264 getShowEventsCb().setSelected( show_events );
1267 void setSpeciesColors( final Map<String, Color> species_colors ) {
1268 _species_colors = species_colors;
1271 void setSequenceColors( final Map<String, Color> sequence_colors ) {
1272 _sequence_colors = sequence_colors;
1277 * Set up the controls from the config settings. 11/26/05
1279 void setupControls() {
1280 // The tree display options:
1281 setupDisplayCheckboxes();
1283 // The sequence relation query selection combo-box
1284 if ( _configuration.displaySequenceRelations() ) {
1285 addSequenceRelationBlock();
1289 startClickToOptions();
1290 setupClickToOptions();
1291 endClickToOptions();
1292 // Zoom and quick edit buttons
1294 setupSearchTools0();
1295 setupSearchTools1();
1298 void setUpControlsForDomainStrucures() {
1299 _domain_display_label = new JLabel( "Domain Architectures:" );
1300 add( customizeLabel( _domain_display_label, getConfiguration() ) );
1301 add( _domain_display_label );
1302 _zoom_in_domain_structure = new JButton( "d+" );
1303 _zoom_out_domain_structure = new JButton( "d-" );
1304 _decr_domain_structure_evalue_thr = new JButton( "-" );
1305 _incr_domain_structure_evalue_thr = new JButton( "+" );
1306 _zoom_in_domain_structure.setPreferredSize( new Dimension( 10, 10 ) );
1307 _zoom_out_domain_structure.setPreferredSize( new Dimension( 10, 10 ) );
1308 _decr_domain_structure_evalue_thr.setPreferredSize( new Dimension( 10, 10 ) );
1309 _incr_domain_structure_evalue_thr.setPreferredSize( new Dimension( 10, 10 ) );
1310 _incr_domain_structure_evalue_thr.setToolTipText( "Increase the E-value threshold by a factor of 10" );
1311 _decr_domain_structure_evalue_thr.setToolTipText( "Decrease the E-value threshold by a factor of 10" );
1312 _domain_structure_evalue_thr_tf = new JTextField( 3 );
1313 _domain_structure_evalue_thr_tf.setEditable( false );
1314 if ( !getConfiguration().isUseNativeUI() ) {
1315 _domain_structure_evalue_thr_tf.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
1316 _domain_structure_evalue_thr_tf.setBackground( getConfiguration().getGuiCheckboxTextColor() );
1317 _domain_structure_evalue_thr_tf.setBorder( null );
1319 final JPanel d1_panel = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
1320 final JPanel d2_panel = new JPanel( new GridLayout( 1, 3, 0, 0 ) );
1321 if ( !_configuration.isUseNativeUI() ) {
1322 d1_panel.setBackground( getBackground() );
1323 d2_panel.setBackground( getBackground() );
1327 addJButton( _zoom_out_domain_structure, d1_panel );
1328 addJButton( _zoom_in_domain_structure, d1_panel );
1329 addJButton( _decr_domain_structure_evalue_thr, d2_panel );
1330 addJTextField( _domain_structure_evalue_thr_tf, d2_panel );
1331 addJButton( _incr_domain_structure_evalue_thr, d2_panel );
1334 void setupSearchTools0() {
1335 final String tip = "Enter text to search for. Use ',' for multiple searches (logical OR) and '+' for logical AND.";
1336 final JLabel search_label = new JLabel( "Search (A):" );
1337 search_label.setFont( ControlPanel.jcb_bold_font );
1338 if ( !getConfiguration().isUseNativeUI() ) {
1339 search_label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1341 add( search_label );
1342 search_label.setToolTipText( tip );
1343 _search_found_label_0 = new JLabel();
1344 getSearchFoundCountsLabel0().setVisible( false );
1345 _search_found_label_0.setFont( ControlPanel.jcb_bold_font );
1346 if ( !getConfiguration().isUseNativeUI() ) {
1347 _search_found_label_0.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1349 _search_tf_0 = new JTextField( 3 );
1350 _search_tf_0.setToolTipText( tip );
1351 _search_tf_0.setEditable( true );
1352 if ( !getConfiguration().isUseNativeUI() ) {
1353 _search_tf_0.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
1354 _search_tf_0.setBackground( getConfiguration().getGuiCheckboxTextColor() );
1355 _search_tf_0.setBorder( null );
1357 _search_reset_button_0 = new JButton();
1358 getSearchResetButton0().setText( "Reset" );
1359 getSearchResetButton0().setEnabled( false );
1360 getSearchResetButton0().setVisible( false );
1361 final JPanel s_panel_1 = new JPanel( new BorderLayout() );
1362 final JPanel s_panel_2 = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
1363 s_panel_1.setBackground( getBackground() );
1365 s_panel_2.setBackground( getBackground() );
1367 final KeyAdapter key_adapter = new KeyAdapter() {
1370 public void keyReleased( final KeyEvent key_event ) {
1372 displayedPhylogenyMightHaveChanged( true );
1375 final ActionListener action_listener = new ActionListener() {
1378 public void actionPerformed( final ActionEvent e ) {
1380 setSearchFoundCountsOnLabel0( 0 );
1381 getSearchFoundCountsLabel0().setVisible( false );
1382 getSearchTextField0().setText( "" );
1383 getSearchResetButton0().setEnabled( false );
1384 getSearchResetButton0().setVisible( false );
1385 displayedPhylogenyMightHaveChanged( true );
1388 _search_reset_button_0.addActionListener( action_listener );
1389 _search_tf_0.addKeyListener( key_adapter );
1390 addJTextField( _search_tf_0, s_panel_1 );
1391 s_panel_2.add( _search_found_label_0 );
1392 addJButton( _search_reset_button_0, s_panel_2 );
1395 void setupSearchTools1() {
1396 final String tip = "Enter text to search for. Use ',' for multiple searches (logical OR) and '+' for logical AND.";
1397 final JLabel search_label = new JLabel( "Search (B):" );
1398 search_label.setFont( ControlPanel.jcb_bold_font );
1399 if ( !getConfiguration().isUseNativeUI() ) {
1400 search_label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1402 add( search_label );
1403 search_label.setToolTipText( tip );
1404 _search_found_label_1 = new JLabel();
1405 getSearchFoundCountsLabel1().setVisible( false );
1406 _search_found_label_1.setFont( ControlPanel.jcb_bold_font );
1407 if ( !getConfiguration().isUseNativeUI() ) {
1408 _search_found_label_1.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1410 _search_tf_1 = new JTextField( 3 );
1411 _search_tf_1.setToolTipText( tip );
1412 _search_tf_1.setEditable( true );
1413 if ( !getConfiguration().isUseNativeUI() ) {
1414 _search_tf_1.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
1415 _search_tf_1.setBackground( getConfiguration().getGuiCheckboxTextColor() );
1416 _search_tf_1.setBorder( null );
1418 _search_reset_button_1 = new JButton();
1419 getSearchResetButton1().setText( "Reset" );
1420 getSearchResetButton1().setEnabled( false );
1421 getSearchResetButton1().setVisible( false );
1422 final JPanel s_panel_1 = new JPanel( new BorderLayout() );
1423 final JPanel s_panel_2 = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
1424 s_panel_1.setBackground( getBackground() );
1426 s_panel_2.setBackground( getBackground() );
1428 final KeyAdapter key_adapter = new KeyAdapter() {
1431 public void keyReleased( final KeyEvent key_event ) {
1433 displayedPhylogenyMightHaveChanged( true );
1436 final ActionListener action_listener = new ActionListener() {
1439 public void actionPerformed( final ActionEvent e ) {
1441 setSearchFoundCountsOnLabel1( 0 );
1442 getSearchFoundCountsLabel1().setVisible( false );
1443 getSearchTextField1().setText( "" );
1444 getSearchResetButton1().setEnabled( false );
1445 getSearchResetButton1().setVisible( false );
1446 displayedPhylogenyMightHaveChanged( true );
1449 _search_reset_button_1.addActionListener( action_listener );
1450 _search_tf_1.addKeyListener( key_adapter );
1451 addJTextField( _search_tf_1, s_panel_1 );
1452 s_panel_2.add( _search_found_label_1 );
1453 addJButton( _search_reset_button_1, s_panel_2 );
1456 void showAnnotations() {
1457 if ( _show_annotation != null ) {
1458 _show_annotation.setSelected( true );
1460 if ( _color_according_to_annotation != null ) {
1461 _color_according_to_annotation.setSelected( true );
1463 if ( _color_acc_species != null ) {
1464 _color_acc_species.setSelected( false );
1466 if ( _color_acc_sequence != null ) {
1467 _color_acc_sequence.setSelected( false );
1469 _mainpanel.getCurrentTreePanel().repaint();
1473 * Fit entire tree into window.
1476 if ( ( _mainpanel.getCurrentScrollPane() == null ) || _mainpanel.getCurrentTreePanel().getPhylogeny().isEmpty() ) {
1479 getCurrentTreePanel().updateSetOfCollapsedExternalNodes();
1480 displayedPhylogenyMightHaveChanged( true );
1481 _mainpanel.getCurrentTreePanel().updateOvSettings();
1482 _mainpanel.getCurrentTreePanel().validate();
1483 _mainpanel.validate();
1484 _mainpanel.getCurrentTreePanel().calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
1485 _mainpanel.getSizeOfViewport().height,
1487 _mainpanel.getCurrentTreePanel().resetPreferredSize();
1488 _mainpanel.adjustJScrollPane();
1489 _mainpanel.getCurrentTreePanel().repaint();
1490 _mainpanel.getCurrentTreePanel().validate();
1491 _mainpanel.validate();
1492 _mainpanel.getCurrentTreePanel().calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
1493 _mainpanel.getSizeOfViewport().height,
1495 _mainpanel.getCurrentTreePanel().resetPreferredSize();
1496 _mainpanel.adjustJScrollPane();
1497 _mainpanel.getCurrentTreePanel().repaint();
1498 _mainpanel.getCurrentTreePanel().updateOvSizes();
1501 void showWholeAll() {
1502 for( final TreePanel tree_panel : _mainpanel.getTreePanels() ) {
1503 if ( tree_panel != null ) {
1504 tree_panel.validate();
1505 tree_panel.calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
1506 _mainpanel.getSizeOfViewport().height,
1508 tree_panel.resetPreferredSize();
1509 tree_panel.repaint();
1514 // Create header for click-to combo box.
1515 void startClickToOptions() {
1516 final JLabel spacer = new JLabel( "" );
1517 spacer.setFont( ControlPanel.jcb_font );
1519 _click_to_label = new JLabel( "Click on Node to:" );
1520 add( customizeLabel( _click_to_label, getConfiguration() ) );
1521 _click_to_combobox = new JComboBox<String>();
1522 _click_to_combobox.setFocusable( false );
1523 _click_to_combobox.setMaximumRowCount( 14 );
1524 _click_to_combobox.setFont( ControlPanel.js_font );
1525 if ( !_configuration.isUseNativeUI() ) {
1526 _click_to_combobox.setBackground( getConfiguration().getGuiBackgroundColor() );
1528 // don't add listener until all items are set (or each one will trigger
1530 // click_to_list.addActionListener(this);
1531 add( _click_to_combobox );
1532 // Correlates option names to titles
1533 _all_click_to_names = new HashMap<Integer, String>();
1534 _click_to_names = new ArrayList<String>();
1538 if ( getMainPanel().getTabbedPane().getTabCount() > 0 ) {
1539 if ( getCurrentTreePanel().isPhyHasBranchLengths()
1540 && ( getCurrentTreePanel().getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) {
1541 setDrawPhylogramEnabled( true );
1542 setDrawPhylogram( isDrawPhylogram() );
1545 setDrawPhylogramEnabled( false );
1546 setDrawPhylogram( false );
1548 if ( getMainPanel().getMainFrame() == null ) {
1549 // Must be "E" applet version.
1550 final ArchaeopteryxE e = ( ArchaeopteryxE ) ( ( MainPanelApplets ) getMainPanel() ).getApplet();
1551 e.setSelectedTypeInTypeMenu( e.getCurrentTreePanel().getPhylogenyGraphicsType() );
1554 getMainPanel().getMainFrame().setSelectedTypeInTypeMenu( getMainPanel().getCurrentTreePanel()
1555 .getPhylogenyGraphicsType() );
1557 getMainPanel().getCurrentTreePanel().updateSubSuperTreeButton();
1558 getMainPanel().getControlPanel().search0();
1559 getMainPanel().getControlPanel().search1();
1560 getMainPanel().getControlPanel().updateDomainStructureEvaluethresholdDisplay();
1561 getSequenceRelationTypeBox().removeAllItems();
1562 for( final SequenceRelation.SEQUENCE_RELATION_TYPE type : getMainPanel().getCurrentPhylogeny()
1563 .getRelevantSequenceRelationTypes() ) {
1564 _sequence_relation_type_box.addItem( type );
1566 getMainPanel().getCurrentTreePanel().repaint();
1567 //setSequenceRelationQueries( getMainPanel().getCurrentPhylogeny().getSequenceRelationQueries() );
1568 // according to GUILHEM the line above can be removed.
1573 * Uncollapse all nodes.
1575 void uncollapseAll( final TreePanel tp ) {
1576 final Phylogeny t = tp.getPhylogeny();
1577 if ( ( t != null ) && !t.isEmpty() ) {
1578 for( final PhylogenyNodeIterator iter = t.iteratorPreorder(); iter.hasNext(); ) {
1579 final PhylogenyNode node = iter.next();
1580 node.setCollapse( false );
1582 tp.resetNodeIdToDistToLeafMap();
1583 tp.updateSetOfCollapsedExternalNodes();
1584 t.recalculateNumberOfExternalDescendants( false );
1585 tp.setNodeInPreorderToNull();
1586 t.clearHashIdToNodeMap();
1591 void updateDomainStructureEvaluethresholdDisplay() {
1592 if ( _domain_structure_evalue_thr_tf != null ) {
1593 _domain_structure_evalue_thr_tf.setText( "10^"
1594 + getMainPanel().getCurrentTreePanel().getDomainStructureEvalueThreshold() );
1598 void zoomInX( final float factor, final float x_correction_factor ) {
1599 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar();
1600 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1601 treepanel.multiplyUrtFactor( 1f );
1602 if ( ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
1603 || ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
1604 || isDrawPhylogram( getMainPanel().getCurrentTabIndex() )
1605 || ( getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP ) ) {
1606 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1607 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
1608 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
1609 getMainPanel().adjustJScrollPane();
1610 treepanel.resetPreferredSize();
1611 getMainPanel().getCurrentScrollPane().getViewport().validate();
1612 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1613 - ( sb.getVisibleAmount() / 2.0 ) ) );
1616 final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue();
1617 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
1618 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
1619 getMainPanel().adjustJScrollPane();
1620 treepanel.resetPreferredSize();
1621 getMainPanel().getCurrentScrollPane().getViewport().validate();
1622 sb.setValue( sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount() );
1624 treepanel.resetPreferredSize();
1625 treepanel.updateOvSizes();
1628 void zoomInY( final float factor ) {
1629 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getVerticalScrollBar();
1630 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1631 treepanel.multiplyUrtFactor( 1.1f );
1632 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1633 treepanel.setYdistance( ( treepanel.getYdistance() * factor ) );
1634 getMainPanel().adjustJScrollPane();
1635 treepanel.resetPreferredSize();
1636 getMainPanel().getCurrentScrollPane().getViewport().validate();
1637 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1638 - ( sb.getVisibleAmount() / 2.0 ) ) );
1639 treepanel.resetPreferredSize();
1640 treepanel.updateOvSizes();
1643 void zoomOutX( final float factor, final float x_correction_factor ) {
1644 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1645 treepanel.multiplyUrtFactor( 1f );
1646 if ( ( treepanel.getXdistance() * factor ) > 0.0 ) {
1647 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar();
1648 if ( ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
1649 || ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
1650 || isDrawPhylogram( getMainPanel().getCurrentTabIndex() )
1651 || ( getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP ) ) {
1652 getMainPanel().adjustJScrollPane();
1653 treepanel.resetPreferredSize();
1654 getMainPanel().getCurrentScrollPane().getViewport().validate();
1655 final double x = ( sb.getMaximum() - sb.getMinimum() )
1656 / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1657 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
1658 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
1659 getMainPanel().adjustJScrollPane();
1660 treepanel.resetPreferredSize();
1661 getMainPanel().getCurrentScrollPane().getViewport().validate();
1662 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1663 - ( sb.getVisibleAmount() / 2.0 ) ) );
1666 final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue();
1667 treepanel.setXdistance( treepanel.getXdistance() * factor );
1668 treepanel.setXcorrectionFactor( treepanel.getXcorrectionFactor() * x_correction_factor );
1670 getMainPanel().adjustJScrollPane();
1671 treepanel.resetPreferredSize();
1672 getMainPanel().getCurrentScrollPane().getViewport().validate();
1673 sb.setValue( sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount() );
1676 treepanel.resetPreferredSize();
1677 treepanel.updateOvSizes();
1681 void zoomOutY( final float factor ) {
1682 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1683 treepanel.multiplyUrtFactor( 0.9f );
1684 if ( ( treepanel.getYdistance() * factor ) > 0.0 ) {
1685 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getVerticalScrollBar();
1686 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1687 treepanel.setYdistance( ( treepanel.getYdistance() * 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 ) ) );
1693 treepanel.resetPreferredSize();
1694 treepanel.updateOvSizes();
1698 private void addClickToOption( final int which, final String title ) {
1699 _click_to_combobox.addItem( title );
1700 _click_to_names.add( title );
1701 _all_click_to_names.put( new Integer( which ), title );
1702 if ( !_configuration.isUseNativeUI() ) {
1703 _click_to_combobox.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
1704 _click_to_combobox.setForeground( getConfiguration().getGuiButtonTextColor() );
1709 private void addSequenceRelationBlock() {
1710 final JLabel spacer = new JLabel( "" );
1711 spacer.setSize( 1, 1 );
1713 final JLabel mainLabel = new JLabel( "Sequence relations to display" );
1714 final JLabel typeLabel = customizeLabel( new JLabel( "(type) " ), getConfiguration() );
1715 typeLabel.setFont( ControlPanel.js_font.deriveFont( 7 ) );
1716 getSequenceRelationTypeBox().setFocusable( false );
1717 _sequence_relation_type_box.setFont( ControlPanel.js_font );
1718 if ( !_configuration.isUseNativeUI() ) {
1719 _sequence_relation_type_box.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
1720 _sequence_relation_type_box.setForeground( getConfiguration().getGuiButtonTextColor() );
1722 _sequence_relation_type_box.setRenderer( new ListCellRenderer<Object>() {
1725 public Component getListCellRendererComponent( final JList<?> list,
1728 final boolean isSelected,
1729 final boolean cellHasFocus ) {
1730 final Component component = new DefaultListCellRenderer().getListCellRendererComponent( list,
1735 if ( ( value != null ) && ( value instanceof SequenceRelation.SEQUENCE_RELATION_TYPE ) ) {
1736 ( ( DefaultListCellRenderer ) component ).setText( SequenceRelation
1737 .getPrintableNameByType( ( SequenceRelation.SEQUENCE_RELATION_TYPE ) value ) );
1742 final GridBagLayout gbl = new GridBagLayout();
1743 _sequence_relation_type_box.setMinimumSize( new Dimension( 115, 17 ) );
1744 _sequence_relation_type_box.setPreferredSize( new Dimension( 115, 20 ) );
1745 final JPanel horizGrid = new JPanel( gbl );
1746 horizGrid.setBackground( getBackground() );
1747 horizGrid.add( typeLabel );
1748 horizGrid.add( _sequence_relation_type_box );
1749 add( customizeLabel( mainLabel, getConfiguration() ) );
1751 add( getSequenceRelationBox() );
1752 if ( _configuration.doDisplayOption( Configuration.show_relation_confidence ) ) {
1753 addCheckbox( Configuration.show_relation_confidence,
1754 _configuration.getDisplayTitle( Configuration.show_relation_confidence ) );
1755 setCheckbox( Configuration.show_relation_confidence,
1756 _configuration.doCheckOption( Configuration.show_relation_confidence ) );
1758 }// addSequenceRelationBlock
1761 private List<Boolean> getIsDrawPhylogramList() {
1762 return _draw_phylogram;
1765 private void init() {
1766 _draw_phylogram = new ArrayList<Boolean>();
1767 setSpeciesColors( new HashMap<String, Color>() );
1768 setSequenceColors( new HashMap<String, Color>() );
1769 setAnnotationColors( new HashMap<String, Color>() );
1772 private boolean isDrawPhylogram( final int index ) {
1773 return getIsDrawPhylogramList().get( index );
1776 private void search0( final MainPanel main_panel, final Phylogeny tree, final String query_str ) {
1777 getSearchFoundCountsLabel0().setVisible( true );
1778 getSearchResetButton0().setEnabled( true );
1779 getSearchResetButton0().setVisible( true );
1780 String[] queries = null;
1781 List<PhylogenyNode> nodes = null;
1782 if ( query_str.indexOf( ',' ) >= 0 ) {
1783 queries = query_str.split( ",+" );
1786 queries = new String[ 1 ];
1787 queries[ 0 ] = query_str.trim();
1789 if ( ( queries != null ) && ( queries.length > 0 ) ) {
1790 nodes = new ArrayList<PhylogenyNode>();
1791 for( String query : queries ) {
1792 if ( ForesterUtil.isEmpty( query ) ) {
1795 query = query.trim();
1796 if ( query.indexOf( '+' ) >= 0 ) {
1797 nodes.addAll( PhylogenyMethods.searchDataLogicalAnd( query.split( "\\++" ),
1799 getOptions().isSearchCaseSensitive(),
1800 !getOptions().isMatchWholeTermsOnly(),
1801 isShowDomainArchitectures() ) );
1804 nodes.addAll( PhylogenyMethods.searchData( query,
1806 getOptions().isSearchCaseSensitive(),
1807 !getOptions().isMatchWholeTermsOnly(),
1808 isShowDomainArchitectures() ) );
1811 if ( getOptions().isInverseSearchResult() ) {
1812 final List<PhylogenyNode> all = PhylogenyMethods.obtainAllNodesAsList( tree );
1813 all.removeAll( nodes );
1817 if ( ( nodes != null ) && ( nodes.size() > 0 ) ) {
1818 main_panel.getCurrentTreePanel().setFoundNodes0( new HashSet<Long>() );
1819 for( final PhylogenyNode node : nodes ) {
1820 main_panel.getCurrentTreePanel().getFoundNodes0().add( node.getId() );
1822 setSearchFoundCountsOnLabel0( nodes.size() );
1825 setSearchFoundCountsOnLabel0( 0 );
1830 private void search1( final MainPanel main_panel, final Phylogeny tree, final String query_str ) {
1831 getSearchFoundCountsLabel1().setVisible( true );
1832 getSearchResetButton1().setEnabled( true );
1833 getSearchResetButton1().setVisible( true );
1834 String[] queries = null;
1835 List<PhylogenyNode> nodes = null;
1836 if ( query_str.indexOf( ',' ) >= 0 ) {
1837 queries = query_str.split( ",+" );
1840 queries = new String[ 1 ];
1841 queries[ 0 ] = query_str.trim();
1843 if ( ( queries != null ) && ( queries.length > 0 ) ) {
1844 nodes = new ArrayList<PhylogenyNode>();
1845 for( String query : queries ) {
1846 if ( ForesterUtil.isEmpty( query ) ) {
1849 query = query.trim();
1850 if ( query.indexOf( '+' ) >= 0 ) {
1851 nodes.addAll( PhylogenyMethods.searchDataLogicalAnd( query.split( "\\++" ),
1853 getOptions().isSearchCaseSensitive(),
1854 !getOptions().isMatchWholeTermsOnly(),
1855 isShowDomainArchitectures() ) );
1858 nodes.addAll( PhylogenyMethods.searchData( query,
1860 getOptions().isSearchCaseSensitive(),
1861 !getOptions().isMatchWholeTermsOnly(),
1862 isShowDomainArchitectures() ) );
1865 if ( getOptions().isInverseSearchResult() ) {
1866 final List<PhylogenyNode> all = PhylogenyMethods.obtainAllNodesAsList( tree );
1867 all.removeAll( nodes );
1871 if ( ( nodes != null ) && ( nodes.size() > 0 ) ) {
1872 main_panel.getCurrentTreePanel().setFoundNodes1( new HashSet<Long>() );
1873 for( final PhylogenyNode node : nodes ) {
1874 main_panel.getCurrentTreePanel().getFoundNodes1().add( node.getId() );
1876 setSearchFoundCountsOnLabel1( nodes.size() );
1879 setSearchFoundCountsOnLabel1( 0 );
1884 private void setDrawPhylogram( final int index, final boolean b ) {
1885 getIsDrawPhylogramList().set( index, b );
1888 private void setupClickToOptions() {
1889 final int default_option = _configuration.getDefaultDisplayClicktoOption();
1890 int selected_index = 0;
1892 if ( _configuration.doDisplayClickToOption( Configuration.display_node_data ) ) {
1893 _show_data_item = cb_index;
1894 addClickToOption( Configuration.display_node_data,
1895 _configuration.getClickToTitle( Configuration.display_node_data ) );
1896 if ( default_option == Configuration.display_node_data ) {
1897 selected_index = cb_index;
1901 if ( _configuration.doDisplayClickToOption( Configuration.collapse_uncollapse ) ) {
1902 _collapse_cb_item = cb_index;
1903 addClickToOption( Configuration.collapse_uncollapse,
1904 _configuration.getClickToTitle( Configuration.collapse_uncollapse ) );
1905 if ( default_option == Configuration.collapse_uncollapse ) {
1906 selected_index = cb_index;
1910 if ( _configuration.doDisplayClickToOption( Configuration.reroot ) ) {
1911 _reroot_cb_item = cb_index;
1912 addClickToOption( Configuration.reroot, _configuration.getClickToTitle( Configuration.reroot ) );
1913 if ( default_option == Configuration.reroot ) {
1914 selected_index = cb_index;
1918 if ( _configuration.doDisplayClickToOption( Configuration.subtree ) ) {
1919 _subtree_cb_item = cb_index;
1920 addClickToOption( Configuration.subtree, _configuration.getClickToTitle( Configuration.subtree ) );
1921 if ( default_option == Configuration.subtree ) {
1922 selected_index = cb_index;
1926 if ( _configuration.doDisplayClickToOption( Configuration.swap ) ) {
1927 _swap_cb_item = cb_index;
1928 addClickToOption( Configuration.swap, _configuration.getClickToTitle( Configuration.swap ) );
1929 if ( default_option == Configuration.swap ) {
1930 selected_index = cb_index;
1934 if ( _configuration.doDisplayClickToOption( Configuration.sort_descendents ) ) {
1935 _sort_descendents_item = cb_index;
1936 addClickToOption( Configuration.sort_descendents,
1937 _configuration.getClickToTitle( Configuration.sort_descendents ) );
1938 if ( default_option == Configuration.sort_descendents ) {
1939 selected_index = cb_index;
1943 if ( _configuration.doDisplayClickToOption( Configuration.color_node_font ) ) {
1944 _color_node_font_item = cb_index;
1945 addClickToOption( Configuration.color_node_font,
1946 _configuration.getClickToTitle( Configuration.color_node_font ) );
1947 if ( default_option == Configuration.color_node_font ) {
1948 selected_index = cb_index;
1952 if ( _configuration.doDisplayClickToOption( Configuration.change_node_font ) ) {
1953 _change_node_font_item = cb_index;
1954 addClickToOption( Configuration.change_node_font,
1955 _configuration.getClickToTitle( Configuration.change_node_font ) );
1956 if ( default_option == Configuration.change_node_font ) {
1957 selected_index = cb_index;
1961 if ( _configuration.doDisplayClickToOption( Configuration.color_subtree ) ) {
1962 _color_subtree_cb_item = cb_index;
1963 addClickToOption( Configuration.color_subtree, _configuration.getClickToTitle( Configuration.color_subtree ) );
1964 if ( default_option == Configuration.color_subtree ) {
1965 selected_index = cb_index;
1969 if ( _configuration.doDisplayClickToOption( Configuration.open_seq_web ) ) {
1970 _open_seq_web_item = cb_index;
1971 addClickToOption( Configuration.open_seq_web, _configuration.getClickToTitle( Configuration.open_seq_web ) );
1972 if ( default_option == Configuration.open_seq_web ) {
1973 selected_index = cb_index;
1977 if ( _configuration.doDisplayClickToOption( Configuration.open_pdb_web ) ) {
1978 _open_pdb_item = cb_index;
1979 addClickToOption( Configuration.open_pdb_web, _configuration.getClickToTitle( Configuration.open_pdb_web ) );
1980 if ( default_option == Configuration.open_pdb_web ) {
1981 selected_index = cb_index;
1985 if ( _configuration.doDisplayClickToOption( Configuration.open_tax_web ) ) {
1986 _open_tax_web_item = cb_index;
1987 addClickToOption( Configuration.open_tax_web, _configuration.getClickToTitle( Configuration.open_tax_web ) );
1988 if ( default_option == Configuration.open_tax_web ) {
1989 selected_index = cb_index;
1993 if ( _configuration.doDisplayClickToOption( Configuration.blast ) ) {
1994 _blast_item = cb_index;
1995 addClickToOption( Configuration.blast, _configuration.getClickToTitle( Configuration.blast ) );
1996 if ( default_option == Configuration.blast ) {
1997 selected_index = cb_index;
2001 if ( _configuration.doDisplayClickToOption( Configuration.select_nodes ) ) {
2002 _select_nodes_item = cb_index;
2003 addClickToOption( Configuration.select_nodes, _configuration.getClickToTitle( Configuration.select_nodes ) );
2004 if ( default_option == Configuration.select_nodes ) {
2005 selected_index = cb_index;
2009 if ( _configuration.doDisplayClickToOption( Configuration.get_ext_desc_data ) ) {
2010 _get_ext_desc_data = cb_index;
2011 if ( !ForesterUtil.isEmpty( getConfiguration().getLabelForGetExtDescendentsData() ) ) {
2012 addClickToOption( Configuration.get_ext_desc_data, getConfiguration()
2013 .getLabelForGetExtDescendentsData() );
2017 switch ( getConfiguration().getExtDescNodeDataToReturn() ) {
2022 s = "Sequence Accessors";
2024 case SEQUENCE_MOL_SEQ:
2025 s = "Molecular Sequence";
2027 case SEQUENCE_MOL_SEQ_FASTA:
2028 s = "Molecular Sequence (Fasta)";
2031 s = "Sequence Names";
2036 case SEQUENCE_SYMBOL:
2037 s = "Sequence Symbols";
2040 s = "Taxonomy Codes";
2042 case TAXONOMY_COMM0N_NAME:
2043 s = "Taxonomy Common Names";
2045 case TAXONOMY_SCIENTIFIC_NAME:
2046 s = "Scientific Names";
2049 s = "User Selected Data";
2052 throw new IllegalStateException( "dont know how to deal with "
2053 + getConfiguration().getExtDescNodeDataToReturn() );
2055 final String label = _configuration.getClickToTitle( Configuration.get_ext_desc_data ) + " " + s;
2056 addClickToOption( Configuration.get_ext_desc_data, label );
2058 if ( default_option == Configuration.get_ext_desc_data ) {
2059 selected_index = cb_index;
2063 if ( getOptions().isEditable() ) {
2064 if ( _configuration.doDisplayClickToOption( Configuration.cut_subtree ) ) {
2065 _cut_subtree_item = cb_index;
2066 addClickToOption( Configuration.cut_subtree, _configuration.getClickToTitle( Configuration.cut_subtree ) );
2067 if ( default_option == Configuration.cut_subtree ) {
2068 selected_index = cb_index;
2072 if ( _configuration.doDisplayClickToOption( Configuration.copy_subtree ) ) {
2073 _copy_subtree_item = cb_index;
2074 addClickToOption( Configuration.copy_subtree,
2075 _configuration.getClickToTitle( Configuration.copy_subtree ) );
2076 if ( default_option == Configuration.copy_subtree ) {
2077 selected_index = cb_index;
2081 if ( _configuration.doDisplayClickToOption( Configuration.paste_subtree ) ) {
2082 _paste_subtree_item = cb_index;
2083 addClickToOption( Configuration.paste_subtree,
2084 _configuration.getClickToTitle( Configuration.paste_subtree ) );
2085 if ( default_option == Configuration.paste_subtree ) {
2086 selected_index = cb_index;
2090 if ( _configuration.doDisplayClickToOption( Configuration.delete_subtree_or_node ) ) {
2091 _delete_node_or_subtree_item = cb_index;
2092 addClickToOption( Configuration.delete_subtree_or_node,
2093 _configuration.getClickToTitle( Configuration.delete_subtree_or_node ) );
2094 if ( default_option == Configuration.delete_subtree_or_node ) {
2095 selected_index = cb_index;
2099 if ( _configuration.doDisplayClickToOption( Configuration.add_new_node ) ) {
2100 _add_new_node_item = cb_index;
2101 addClickToOption( Configuration.add_new_node,
2102 _configuration.getClickToTitle( Configuration.add_new_node ) );
2103 if ( default_option == Configuration.add_new_node ) {
2104 selected_index = cb_index;
2108 if ( _configuration.doDisplayClickToOption( Configuration.edit_node_data ) ) {
2109 _edit_node_data_item = cb_index;
2110 addClickToOption( Configuration.edit_node_data,
2111 _configuration.getClickToTitle( Configuration.edit_node_data ) );
2112 if ( default_option == Configuration.edit_node_data ) {
2113 selected_index = cb_index;
2118 // Set default selection and its action
2119 _click_to_combobox.setSelectedIndex( selected_index );
2120 setClickToAction( selected_index );
2123 private void setupDisplayCheckboxes() {
2124 if ( _configuration.doDisplayOption( Configuration.display_as_phylogram ) ) {
2125 addCheckbox( Configuration.display_as_phylogram,
2126 _configuration.getDisplayTitle( Configuration.display_as_phylogram ) );
2127 setCheckbox( Configuration.display_as_phylogram,
2128 _configuration.doCheckOption( Configuration.display_as_phylogram ) );
2130 if ( _configuration.doDisplayOption( Configuration.dynamically_hide_data ) ) {
2131 addCheckbox( Configuration.dynamically_hide_data,
2132 _configuration.getDisplayTitle( Configuration.dynamically_hide_data ) );
2133 setCheckbox( Configuration.dynamically_hide_data,
2134 _configuration.doCheckOption( Configuration.dynamically_hide_data ) );
2136 if ( _configuration.doDisplayOption( Configuration.node_data_popup ) ) {
2137 addCheckbox( Configuration.node_data_popup, _configuration.getDisplayTitle( Configuration.node_data_popup ) );
2138 setCheckbox( Configuration.node_data_popup, _configuration.doCheckOption( Configuration.node_data_popup ) );
2140 if ( _configuration.doDisplayOption( Configuration.display_internal_data ) ) {
2141 addCheckbox( Configuration.display_internal_data,
2142 _configuration.getDisplayTitle( Configuration.display_internal_data ) );
2143 setCheckbox( Configuration.display_internal_data,
2144 _configuration.doCheckOption( Configuration.display_internal_data ) );
2146 if ( _configuration.doDisplayOption( Configuration.color_according_to_sequence ) ) {
2147 addCheckbox( Configuration.color_according_to_sequence,
2148 _configuration.getDisplayTitle( Configuration.color_according_to_sequence ) );
2149 setCheckbox( Configuration.color_according_to_sequence,
2150 _configuration.doCheckOption( Configuration.color_according_to_sequence ) );
2152 if ( _configuration.doDisplayOption( Configuration.color_according_to_species ) ) {
2153 addCheckbox( Configuration.color_according_to_species,
2154 _configuration.getDisplayTitle( Configuration.color_according_to_species ) );
2155 setCheckbox( Configuration.color_according_to_species,
2156 _configuration.doCheckOption( Configuration.color_according_to_species ) );
2158 if ( _configuration.doDisplayOption( Configuration.color_according_to_annotation ) ) {
2159 addCheckbox( Configuration.color_according_to_annotation,
2160 _configuration.getDisplayTitle( Configuration.color_according_to_annotation ) );
2161 setCheckbox( Configuration.color_according_to_annotation,
2162 _configuration.doCheckOption( Configuration.color_according_to_annotation ) );
2164 if ( _configuration.doDisplayOption( Configuration.use_style ) ) {
2165 addCheckbox( Configuration.use_style, _configuration.getDisplayTitle( Configuration.use_style ) );
2166 setCheckbox( Configuration.use_style, _configuration.doCheckOption( Configuration.use_style ) );
2168 if ( _configuration.doDisplayOption( Configuration.width_branches ) ) {
2169 addCheckbox( Configuration.width_branches, _configuration.getDisplayTitle( Configuration.width_branches ) );
2170 setCheckbox( Configuration.width_branches, _configuration.doCheckOption( Configuration.width_branches ) );
2172 final JLabel label = new JLabel( "Display Data:" );
2173 label.setFont( ControlPanel.jcb_bold_font );
2174 if ( !getConfiguration().isUseNativeUI() ) {
2175 label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
2178 if ( _configuration.doDisplayOption( Configuration.show_node_names ) ) {
2179 addCheckbox( Configuration.show_node_names, _configuration.getDisplayTitle( Configuration.show_node_names ) );
2180 setCheckbox( Configuration.show_node_names, _configuration.doCheckOption( Configuration.show_node_names ) );
2182 if ( _configuration.doDisplayOption( Configuration.show_tax_code ) ) {
2183 addCheckbox( Configuration.show_tax_code, _configuration.getDisplayTitle( Configuration.show_tax_code ) );
2184 setCheckbox( Configuration.show_tax_code, _configuration.doCheckOption( Configuration.show_tax_code ) );
2186 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_scientific_names ) ) {
2187 addCheckbox( Configuration.show_taxonomy_scientific_names,
2188 _configuration.getDisplayTitle( Configuration.show_taxonomy_scientific_names ) );
2189 setCheckbox( Configuration.show_taxonomy_scientific_names,
2190 _configuration.doCheckOption( Configuration.show_taxonomy_scientific_names ) );
2192 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_common_names ) ) {
2193 addCheckbox( Configuration.show_taxonomy_common_names,
2194 _configuration.getDisplayTitle( Configuration.show_taxonomy_common_names ) );
2195 setCheckbox( Configuration.show_taxonomy_common_names,
2196 _configuration.doCheckOption( Configuration.show_taxonomy_common_names ) );
2198 if ( _configuration.doDisplayOption( Configuration.show_seq_names ) ) {
2199 addCheckbox( Configuration.show_seq_names, _configuration.getDisplayTitle( Configuration.show_seq_names ) );
2200 setCheckbox( Configuration.show_seq_names, _configuration.doCheckOption( Configuration.show_seq_names ) );
2202 if ( _configuration.doDisplayOption( Configuration.show_gene_names ) ) {
2203 addCheckbox( Configuration.show_gene_names, _configuration.getDisplayTitle( Configuration.show_gene_names ) );
2204 setCheckbox( Configuration.show_gene_names, _configuration.doCheckOption( Configuration.show_gene_names ) );
2206 if ( _configuration.doDisplayOption( Configuration.show_seq_symbols ) ) {
2207 addCheckbox( Configuration.show_seq_symbols,
2208 _configuration.getDisplayTitle( Configuration.show_seq_symbols ) );
2209 setCheckbox( Configuration.show_seq_symbols, _configuration.doCheckOption( Configuration.show_seq_symbols ) );
2211 if ( _configuration.doDisplayOption( Configuration.show_sequence_acc ) ) {
2212 addCheckbox( Configuration.show_sequence_acc,
2213 _configuration.getDisplayTitle( Configuration.show_sequence_acc ) );
2214 setCheckbox( Configuration.show_sequence_acc,
2215 _configuration.doCheckOption( Configuration.show_sequence_acc ) );
2217 if ( _configuration.doDisplayOption( Configuration.show_annotation ) ) {
2218 addCheckbox( Configuration.show_annotation, _configuration.getDisplayTitle( Configuration.show_annotation ) );
2219 setCheckbox( Configuration.show_annotation, _configuration.doCheckOption( Configuration.show_annotation ) );
2221 if ( _configuration.doDisplayOption( Configuration.show_binary_characters ) ) {
2222 addCheckbox( Configuration.show_binary_characters,
2223 _configuration.getDisplayTitle( Configuration.show_binary_characters ) );
2224 setCheckbox( Configuration.show_binary_characters,
2225 _configuration.doCheckOption( Configuration.show_binary_characters ) );
2227 if ( _configuration.doDisplayOption( Configuration.show_binary_character_counts ) ) {
2228 addCheckbox( Configuration.show_binary_character_counts,
2229 _configuration.getDisplayTitle( Configuration.show_binary_character_counts ) );
2230 setCheckbox( Configuration.show_binary_character_counts,
2231 _configuration.doCheckOption( Configuration.show_binary_character_counts ) );
2233 if ( _configuration.doDisplayOption( Configuration.show_domain_architectures ) ) {
2234 addCheckbox( Configuration.show_domain_architectures,
2235 _configuration.getDisplayTitle( Configuration.show_domain_architectures ) );
2236 setCheckbox( Configuration.show_domain_architectures,
2237 _configuration.doCheckOption( Configuration.show_domain_architectures ) );
2239 if ( _configuration.doDisplayOption( Configuration.write_confidence_values ) ) {
2240 addCheckbox( Configuration.write_confidence_values,
2241 _configuration.getDisplayTitle( Configuration.write_confidence_values ) );
2242 setCheckbox( Configuration.write_confidence_values,
2243 _configuration.doCheckOption( Configuration.write_confidence_values ) );
2245 if ( _configuration.doDisplayOption( Configuration.write_events ) ) {
2246 addCheckbox( Configuration.write_events, _configuration.getDisplayTitle( Configuration.write_events ) );
2247 setCheckbox( Configuration.write_events, _configuration.doCheckOption( Configuration.write_events ) );
2249 if ( _configuration.doDisplayOption( Configuration.show_vector_data ) ) {
2250 addCheckbox( Configuration.show_vector_data,
2251 _configuration.getDisplayTitle( Configuration.show_vector_data ) );
2252 setCheckbox( Configuration.show_vector_data, _configuration.doCheckOption( Configuration.show_vector_data ) );
2254 if ( _configuration.doDisplayOption( Configuration.show_properties ) ) {
2255 addCheckbox( Configuration.show_properties, _configuration.getDisplayTitle( Configuration.show_properties ) );
2256 setCheckbox( Configuration.show_properties, _configuration.doCheckOption( Configuration.show_properties ) );
2258 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_images ) ) {
2259 addCheckbox( Configuration.show_taxonomy_images,
2260 _configuration.getDisplayTitle( Configuration.show_taxonomy_images ) );
2261 setCheckbox( Configuration.show_taxonomy_images,
2262 _configuration.doCheckOption( Configuration.show_taxonomy_images ) );
2266 private void setVisibilityOfDomainStrucureControls() {
2267 if ( _zoom_in_domain_structure != null ) {
2268 if ( isShowDomainArchitectures() ) {
2269 _domain_display_label.setVisible( true );
2270 _zoom_in_domain_structure.setVisible( true );
2271 _zoom_out_domain_structure.setVisible( true );
2272 _decr_domain_structure_evalue_thr.setVisible( true );
2273 _incr_domain_structure_evalue_thr.setVisible( true );
2274 _domain_structure_evalue_thr_tf.setVisible( true );
2275 if ( getMainPanel().getMainFrame()._right_line_up_domains_cbmi != null ) {
2276 getMainPanel().getMainFrame()._right_line_up_domains_cbmi.setVisible( true );
2278 if ( getMainPanel().getMainFrame()._show_domain_labels != null ) {
2279 getMainPanel().getMainFrame()._show_domain_labels.setVisible( true );
2283 _domain_display_label.setVisible( false );
2284 _zoom_in_domain_structure.setVisible( false );
2285 _zoom_out_domain_structure.setVisible( false );
2286 _decr_domain_structure_evalue_thr.setVisible( false );
2287 _incr_domain_structure_evalue_thr.setVisible( false );
2288 _domain_structure_evalue_thr_tf.setVisible( false );
2289 if ( getMainPanel().getMainFrame()._right_line_up_domains_cbmi != null ) {
2290 getMainPanel().getMainFrame()._right_line_up_domains_cbmi.setVisible( false );
2292 if ( getMainPanel().getMainFrame()._show_domain_labels != null ) {
2293 getMainPanel().getMainFrame()._show_domain_labels.setVisible( false );
2299 void setVisibilityOfX() {
2301 if ( ( getCurrentTreePanel() != null ) && ( getCurrentTreePanel().getPhylogeny() != null ) ) {
2302 if ( AptxUtil.isHasAtLeastOneBranchWithSupportSD( getCurrentTreePanel().getPhylogeny() ) ) {
2303 if ( getMainPanel().getMainFrame()._show_confidence_stddev_cbmi != null ) {
2304 getMainPanel().getMainFrame()._show_confidence_stddev_cbmi.setVisible( true );
2308 if ( getMainPanel().getMainFrame()._show_confidence_stddev_cbmi != null ) {
2309 getMainPanel().getMainFrame()._show_confidence_stddev_cbmi.setVisible( false );
2312 if ( AptxUtil.isHasAtLeastOneNodeWithScientificName( getCurrentTreePanel().getPhylogeny() ) ) {
2313 if ( getMainPanel().getMainFrame()._abbreviate_scientific_names != null ) {
2314 getMainPanel().getMainFrame()._abbreviate_scientific_names.setVisible( true );
2318 if ( getMainPanel().getMainFrame()._abbreviate_scientific_names != null ) {
2319 getMainPanel().getMainFrame()._abbreviate_scientific_names.setVisible( false );
2322 if ( AptxUtil.isHasAtLeastOneNodeWithSequenceAnnotation( getCurrentTreePanel().getPhylogeny() ) ) {
2323 if ( getMainPanel().getMainFrame()._show_annotation_ref_source != null ) {
2324 getMainPanel().getMainFrame()._show_annotation_ref_source.setVisible( true );
2328 if ( getMainPanel().getMainFrame()._show_annotation_ref_source != null ) {
2329 getMainPanel().getMainFrame()._show_annotation_ref_source.setVisible( false );
2333 if ( isDrawPhylogram()
2334 || ( ( getCurrentTreePanel() != null ) && ( ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) || ( getCurrentTreePanel()
2335 .getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) ) ) {
2336 if ( getMainPanel().getMainFrame()._non_lined_up_cladograms_rbmi != null ) {
2337 getMainPanel().getMainFrame()._non_lined_up_cladograms_rbmi.setVisible( false );
2339 if ( getMainPanel().getMainFrame()._uniform_cladograms_rbmi != null ) {
2340 getMainPanel().getMainFrame()._uniform_cladograms_rbmi.setVisible( false );
2342 if ( getMainPanel().getMainFrame()._ext_node_dependent_cladogram_rbmi != null ) {
2343 getMainPanel().getMainFrame()._ext_node_dependent_cladogram_rbmi.setVisible( false );
2347 if ( getMainPanel().getMainFrame()._non_lined_up_cladograms_rbmi != null ) {
2348 getMainPanel().getMainFrame()._non_lined_up_cladograms_rbmi.setVisible( true );
2350 if ( getMainPanel().getMainFrame()._uniform_cladograms_rbmi != null ) {
2351 getMainPanel().getMainFrame()._uniform_cladograms_rbmi.setVisible( true );
2353 if ( getMainPanel().getMainFrame()._ext_node_dependent_cladogram_rbmi != null ) {
2354 getMainPanel().getMainFrame()._ext_node_dependent_cladogram_rbmi.setVisible( true );
2357 if ( isDrawPhylogram() ) {
2358 if ( getMainPanel().getMainFrame()._show_scale_cbmi != null ) {
2359 getMainPanel().getMainFrame()._show_scale_cbmi.setVisible( true );
2363 if ( getMainPanel().getMainFrame()._show_scale_cbmi != null ) {
2364 getMainPanel().getMainFrame()._show_scale_cbmi.setVisible( false );
2367 if ( getCurrentTreePanel() != null ) {
2368 if ( ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
2369 || ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) {
2370 if ( getMainPanel().getMainFrame()._label_direction_cbmi != null ) {
2371 getMainPanel().getMainFrame()._label_direction_cbmi.setVisible( true );
2373 if ( getMainPanel().getMainFrame()._show_branch_length_values_cbmi != null ) {
2374 getMainPanel().getMainFrame()._show_branch_length_values_cbmi.setVisible( false );
2378 if ( getMainPanel().getMainFrame()._label_direction_cbmi != null ) {
2379 getMainPanel().getMainFrame()._label_direction_cbmi.setVisible( false );
2381 if ( getMainPanel().getMainFrame()._show_branch_length_values_cbmi != null ) {
2382 getMainPanel().getMainFrame()._show_branch_length_values_cbmi.setVisible( true );
2387 catch ( final Exception ignore ) {
2392 void setVisibilityOfDomainStrucureCB() {
2394 if ( ( getCurrentTreePanel() != null )
2395 && ( ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) || ( getCurrentTreePanel()
2396 .getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) ) {
2397 if ( getMainPanel().getMainFrame()._right_line_up_domains_cbmi != null ) {
2398 getMainPanel().getMainFrame()._right_line_up_domains_cbmi.setVisible( false );
2400 if ( getMainPanel().getMainFrame()._show_domain_labels != null ) {
2401 getMainPanel().getMainFrame()._show_domain_labels.setVisible( false );
2404 else if ( isShowDomainArchitectures() ) {
2405 if ( getMainPanel().getMainFrame()._right_line_up_domains_cbmi != null ) {
2406 getMainPanel().getMainFrame()._right_line_up_domains_cbmi.setVisible( true );
2408 if ( getMainPanel().getMainFrame()._show_domain_labels != null ) {
2409 getMainPanel().getMainFrame()._show_domain_labels.setVisible( true );
2413 if ( getMainPanel().getMainFrame()._right_line_up_domains_cbmi != null ) {
2414 getMainPanel().getMainFrame()._right_line_up_domains_cbmi.setVisible( false );
2416 if ( getMainPanel().getMainFrame()._show_domain_labels != null ) {
2417 getMainPanel().getMainFrame()._show_domain_labels.setVisible( false );
2421 catch ( final Exception ignore ) {
2426 static JLabel customizeLabel( final JLabel label, final Configuration configuration ) {
2427 label.setFont( ControlPanel.jcb_bold_font );
2428 if ( !configuration.isUseNativeUI() ) {
2429 label.setForeground( configuration.getGuiCheckboxTextColor() );
2430 label.setBackground( configuration.getGuiBackgroundColor() );
2435 enum NodeClickAction {
2442 DELETE_NODE_OR_SUBTREE,
2459 public boolean isShowSequences() {
2460 // TODO Auto-generated method stub