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: www.phylosoft.org/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.iterators.PhylogenyNodeIterator;
69 import org.forester.util.ForesterUtil;
71 final class ControlPanel extends JPanel implements ActionListener {
73 private static final String RETURN_TO_SUPER_TREE_TEXT = "Back to Super Tree";
74 final static Font jcb_font = new Font( Configuration.getDefaultFontFamilyName(),
77 final static Font js_font = new Font( Configuration.getDefaultFontFamilyName(),
80 final static Font jcb_bold_font = new Font( Configuration.getDefaultFontFamilyName(),
83 private static final long serialVersionUID = -8463483932821545633L;
84 private final MainPanel _mainpanel;
85 // The settings from the conf file
86 private final Configuration _configuration;
88 private JCheckBox _display_internal_data;
89 private JCheckBox _show_node_names;
90 private JCheckBox _show_taxo_code;
91 private JCheckBox _write_confidence;
92 private JCheckBox _show_events;
93 private JCheckBox _color_acc_species;
94 private JCheckBox _color_branches_cb;
95 private JCheckBox _width_branches;
96 private JCheckBox _show_domain_architectures;
97 private JCheckBox _show_annotation;
98 private JCheckBox _show_binary_characters;
99 private JCheckBox _show_binary_character_counts;
100 private JCheckBox _show_gene_names;
101 private JCheckBox _show_gene_symbols;
102 private JCheckBox _show_sequence_acc;
103 private JCheckBox _node_desc_popup_cb;
104 private JCheckBox _dynamically_hide_data;
105 private JCheckBox _show_taxo_scientific_names;
106 private JCheckBox _show_taxo_common_names;
107 private JCheckBox _show_taxo_images_cb;
108 private JCheckBox _color_according_to_annotation;
109 private JCheckBox _display_as_phylogram_cb;
110 private JCheckBox _seq_relation_confidence_switch;
111 private JComboBox _show_sequence_relations;
112 private JComboBox _sequence_relation_type_box;
113 private JCheckBox _show_vector_data_cb;
114 private JCheckBox _show_properties_cb;
115 private JLabel _click_to_label;
116 private JLabel _zoom_label;
117 private JLabel _domain_display_label;
118 private JComboBox _click_to_combobox;
119 private Map<Integer, String> _all_click_to_names;
120 private List<String> _click_to_names;
121 // Indices for the click-to options in the combo box
122 private int _show_data_item;
123 private int _collapse_cb_item;
124 private int _reroot_cb_item;
125 private int _swap_cb_item;
126 private int _subtree_cb_item;
127 private int _color_subtree_cb_item;
128 private int _open_seq_web_item;
129 private int _sort_descendents_item;
130 private int _open_tax_web_item;
131 private int _cut_subtree_item;
132 private int _copy_subtree_item;
133 private int _delete_node_or_subtree_item;
134 private int _paste_subtree_item;
135 private int _add_new_node_item;
136 private int _edit_node_data_item;
137 private int _select_nodes_item;
138 private int _get_ext_desc_data;
139 private int _blast_item;
140 // zooming and quick tree manipulation buttons:
141 private JButton _zoom_in_x;
142 private JButton _zoom_in_y;
143 private JButton _zoom_out_x;
144 private JButton _zoom_out_y;
145 private JButton _show_whole;
146 private JButton _order;
147 private JButton _uncollapse_all;
148 private JButton _zoom_in_domain_structure;
149 private JButton _zoom_out_domain_structure;
150 private JButton _decr_domain_structure_evalue_thr;
151 private JButton _incr_domain_structure_evalue_thr;
152 private JButton _return_to_super_tree;
153 private JTextField _domain_structure_evalue_thr_tf;
154 private JTextField _search_tf;
155 private boolean _order_of_appearance;
156 private boolean _color_branches;
157 private NodeClickAction _action_when_node_clicked;
158 private List<Boolean> _draw_phylogram;
159 private Map<String, Color> _annotation_colors;
160 private Map<String, Color> _species_colors;
161 private JButton _search_reset_button;
162 private JLabel _search_found_label;
163 private Sequence _selected_query_seq;
165 ControlPanel( final MainPanel ap, final Configuration configuration ) {
168 _configuration = configuration;
169 if ( !_configuration.isUseNativeUI() ) {
170 setBackground( getConfiguration().getGuiBackgroundColor() );
171 setBorder( BorderFactory.createRaisedBevelBorder() );
173 setLayout( new GridLayout( 0, 1, 2, 2 ) );
174 _order_of_appearance = true;
182 public void actionPerformed( final ActionEvent e ) {
184 final TreePanel tp = getMainPanel().getCurrentTreePanel();
188 if ( e.getSource() == _click_to_combobox ) {
189 setClickToAction( _click_to_combobox.getSelectedIndex() );
190 getCurrentTreePanel().repaint();
192 else if ( e.getSource() == _show_binary_characters ) {
193 if ( ( _show_binary_character_counts != null ) && _show_binary_characters.isSelected() ) {
194 _show_binary_character_counts.setSelected( false );
196 displayedPhylogenyMightHaveChanged( true );
198 else if ( e.getSource() == _show_binary_character_counts ) {
199 if ( ( _show_binary_characters != null ) && _show_binary_character_counts.isSelected() ) {
200 _show_binary_characters.setSelected( false );
202 displayedPhylogenyMightHaveChanged( true );
204 else if ( e.getSource() == _show_domain_architectures ) {
206 displayedPhylogenyMightHaveChanged( false );
208 else if ( ( tp != null ) && ( tp.getPhylogeny() != null ) ) {
209 if ( e.getSource() == getDisplayAsPhylogramCb() ) {
210 setDrawPhylogram( getDisplayAsPhylogramCb().isSelected() );
214 else if ( e.getSource() == _zoom_in_x ) {
215 zoomInX( Constants.BUTTON_ZOOM_IN_FACTOR, Constants.BUTTON_ZOOM_IN_X_CORRECTION_FACTOR );
216 displayedPhylogenyMightHaveChanged( false );
218 else if ( e.getSource() == _zoom_in_y ) {
219 zoomInY( Constants.BUTTON_ZOOM_IN_FACTOR );
220 displayedPhylogenyMightHaveChanged( false );
222 else if ( e.getSource() == _zoom_out_x ) {
223 zoomOutX( Constants.BUTTON_ZOOM_OUT_FACTOR, Constants.BUTTON_ZOOM_OUT_X_CORRECTION_FACTOR );
224 displayedPhylogenyMightHaveChanged( false );
226 else if ( e.getSource() == _zoom_out_y ) {
227 zoomOutY( Constants.BUTTON_ZOOM_OUT_FACTOR );
228 displayedPhylogenyMightHaveChanged( false );
230 else if ( e.getSource() == _show_whole ) {
233 else if ( e.getSource() == _return_to_super_tree ) {
234 _mainpanel.getCurrentTreePanel().superTree();
237 else if ( e.getSource() == _order ) {
238 DESCENDANT_SORT_PRIORITY pri = DESCENDANT_SORT_PRIORITY.TAXONOMY;
239 if ( ( !isShowTaxonomyScientificNames() && !isShowTaxonomyCode() && !isShowTaxonomyCommonNames() ) ) {
240 if ( ( isShowSequenceAcc() || isShowGeneNames() || isShowGeneSymbols() ) ) {
241 pri = DESCENDANT_SORT_PRIORITY.SEQUENCE;
243 else if ( isShowNodeNames() ) {
244 pri = DESCENDANT_SORT_PRIORITY.NODE_NAME;
247 PhylogenyMethods.orderAppearance( tp.getPhylogeny().getRoot(), _order_of_appearance, true, pri );
248 _order_of_appearance = !_order_of_appearance;
249 tp.setNodeInPreorderToNull();
250 tp.getPhylogeny().externalNodesHaveChanged();
251 tp.getPhylogeny().clearHashIdToNodeMap();
252 tp.getPhylogeny().recalculateNumberOfExternalDescendants( true );
253 tp.resetNodeIdToDistToLeafMap();
254 tp.setEdited( true );
255 displayedPhylogenyMightHaveChanged( false );
257 else if ( e.getSource() == _uncollapse_all ) {
259 displayedPhylogenyMightHaveChanged( false );
261 else if ( e.getSource() == _zoom_in_domain_structure ) {
262 _mainpanel.getCurrentTreePanel().zoomInDomainStructure();
263 displayedPhylogenyMightHaveChanged( true );
265 else if ( e.getSource() == _zoom_out_domain_structure ) {
266 _mainpanel.getCurrentTreePanel().zoomOutDomainStructure();
267 displayedPhylogenyMightHaveChanged( true );
269 else if ( e.getSource() == _decr_domain_structure_evalue_thr ) {
270 _mainpanel.getCurrentTreePanel().decreaseDomainStructureEvalueThreshold();
271 displayedPhylogenyMightHaveChanged( true );
273 else if ( e.getSource() == _incr_domain_structure_evalue_thr ) {
274 _mainpanel.getCurrentTreePanel().increaseDomainStructureEvalueThreshold();
275 displayedPhylogenyMightHaveChanged( true );
277 else if ( e.getSource() == _search_tf ) {
279 displayedPhylogenyMightHaveChanged( true );
282 displayedPhylogenyMightHaveChanged( true );
286 tp.requestFocusInWindow();
289 catch ( final Exception ex ) {
290 AptxUtil.unexpectedException( ex );
292 catch ( final Error err ) {
293 AptxUtil.unexpectedError( err );
297 public JCheckBox getColorAccSpeciesCb() {
298 return _color_acc_species;
301 public JCheckBox getColorBranchesCb() {
302 return _color_branches_cb;
305 public JCheckBox getDisplayAsPhylogramCb() {
306 return _display_as_phylogram_cb;
309 public JCheckBox getDynamicallyHideData() {
310 return _dynamically_hide_data;
313 public JCheckBox getNodeDescPopupCb() {
314 return _node_desc_popup_cb;
317 public Sequence getSelectedQuerySequence() {
318 return _selected_query_seq;
321 public JComboBox getSequenceRelationBox() {
322 if ( _show_sequence_relations == null ) {
323 _show_sequence_relations = new JComboBox();
324 _show_sequence_relations.setFocusable( false );
325 _show_sequence_relations.setMaximumRowCount( 20 );
326 _show_sequence_relations.setFont( ControlPanel.js_font );
327 if ( !_configuration.isUseNativeUI() ) {
328 _show_sequence_relations.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
329 _show_sequence_relations.setForeground( getConfiguration().getGuiButtonTextColor() );
331 _show_sequence_relations.addItem( "-----" );
332 _show_sequence_relations.setToolTipText( "To display orthology information for selected query" );
334 return _show_sequence_relations;
338 public JComboBox getSequenceRelationTypeBox() {
339 if ( _sequence_relation_type_box == null ) {
340 _sequence_relation_type_box = new JComboBox();
341 for( final SequenceRelation.SEQUENCE_RELATION_TYPE type : SequenceRelation.SEQUENCE_RELATION_TYPE.values() ) {
342 _sequence_relation_type_box.addItem( type );
344 _sequence_relation_type_box.addActionListener( new ActionListener() {
347 public void actionPerformed( final ActionEvent e ) {
348 if ( _mainpanel.getCurrentPhylogeny() != null ) {
349 setSequenceRelationQueries( getMainPanel().getCurrentPhylogeny().getSequenceRelationQueries() );
354 return _sequence_relation_type_box;
357 public JCheckBox getShowEventsCb() {
361 public JCheckBox getWriteConfidenceCb() {
362 return _write_confidence;
365 public boolean isShowProperties() {
366 return ( ( _show_properties_cb != null ) && _show_properties_cb.isSelected() );
369 public boolean isShowTaxonomyImages() {
370 return ( ( _show_taxo_images_cb != null ) && _show_taxo_images_cb.isSelected() );
373 public boolean isShowVectorData() {
374 return ( ( _show_vector_data_cb != null ) && _show_vector_data_cb.isSelected() );
377 public void setSequenceRelationQueries( final Collection<Sequence> sequenceRelationQueries ) {
378 final JComboBox box = getSequenceRelationBox();
379 while ( box.getItemCount() > 1 ) {
380 box.removeItemAt( 1 );
382 final HashMap<String, Sequence> sequencesByName = new HashMap<String, Sequence>();
383 final SequenceRelation.SEQUENCE_RELATION_TYPE relationType = ( SequenceRelation.SEQUENCE_RELATION_TYPE ) _sequence_relation_type_box
385 if ( relationType == null ) {
388 final ArrayList<String> sequenceNamesToAdd = new ArrayList<String>();
389 for( final Sequence seq : sequenceRelationQueries ) {
390 if ( seq.hasSequenceRelations() ) {
391 boolean fFoundForCurrentType = false;
392 for( final SequenceRelation sq : seq.getSequenceRelations() ) {
393 if ( sq.getType().equals( relationType ) ) {
394 fFoundForCurrentType = true;
398 if ( fFoundForCurrentType ) {
399 sequenceNamesToAdd.add( seq.getName() );
400 sequencesByName.put( seq.getName(), seq );
404 // sort sequences by name before adding them to the combo
405 final String[] sequenceNameArray = sequenceNamesToAdd.toArray( new String[ sequenceNamesToAdd.size() ] );
406 Arrays.sort( sequenceNameArray, String.CASE_INSENSITIVE_ORDER );
407 for( final String seqName : sequenceNameArray ) {
408 box.addItem( seqName );
410 for( final ItemListener oldItemListener : box.getItemListeners() ) {
411 box.removeItemListener( oldItemListener );
413 box.addItemListener( new ItemListener() {
416 public void itemStateChanged( final ItemEvent e ) {
417 _selected_query_seq = sequencesByName.get( e.getItem() );
418 _mainpanel.getCurrentTreePanel().repaint();
423 void activateButtonToReturnToSuperTree( int index ) {
426 _return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT + " " + index );
429 _return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT );
431 _return_to_super_tree.setForeground( getConfiguration().getGuiCheckboxAndButtonActiveColor() );
432 _return_to_super_tree.setEnabled( true );
436 * Add zoom and quick edit buttons. (Last modified 8/9/04)
439 final JLabel spacer = new JLabel( "" );
440 spacer.setOpaque( false );
442 final JPanel x_panel = new JPanel( new GridLayout( 1, 1, 0, 0 ) );
443 final JPanel y_panel = new JPanel( new GridLayout( 1, 3, 0, 0 ) );
444 final JPanel z_panel = new JPanel( new GridLayout( 1, 1, 0, 0 ) );
445 if ( !getConfiguration().isUseNativeUI() ) {
446 x_panel.setBackground( getBackground() );
447 y_panel.setBackground( getBackground() );
448 z_panel.setBackground( getBackground() );
450 add( _zoom_label = new JLabel( "Zoom:" ) );
451 customizeLabel( _zoom_label, getConfiguration() );
455 if ( getConfiguration().isUseNativeUI() ) {
456 _zoom_in_x = new JButton( "+" );
457 _zoom_out_x = new JButton( "-" );
460 _zoom_in_x = new JButton( "X+" );
461 _zoom_out_x = new JButton( "X-" );
463 _zoom_in_y = new JButton( "Y+" );
464 _zoom_out_y = new JButton( "Y-" );
465 _show_whole = new JButton( "F" );
466 _show_whole.setToolTipText( "To fit the complete phylogeny to the current display size [Backspace]" );
467 _zoom_in_x.setToolTipText( "To zoom in horizontally [Shift+Right]" );
468 _zoom_in_y.setToolTipText( "To zoom in vertically [Shift+Up]" );
469 _zoom_out_x.setToolTipText( "To zoom out horizontally [Shift+Left]" );
470 _zoom_out_y.setToolTipText( "To zoom out vertically [Shift+Down]" );
471 if ( getConfiguration().isUseNativeUI() && AptxUtil.isMac() ) {
472 _zoom_out_x.setPreferredSize( new Dimension( 55, 10 ) );
473 _zoom_in_x.setPreferredSize( new Dimension( 55, 10 ) );
476 _zoom_out_x.setPreferredSize( new Dimension( 10, 10 ) );
477 _zoom_in_x.setPreferredSize( new Dimension( 10, 10 ) );
479 _zoom_out_y.setPreferredSize( new Dimension( 10, 10 ) );
480 _zoom_in_y.setPreferredSize( new Dimension( 10, 10 ) );
481 _show_whole.setPreferredSize( new Dimension( 10, 10 ) );
482 _return_to_super_tree = new JButton( RETURN_TO_SUPER_TREE_TEXT );
483 _return_to_super_tree.setEnabled( false );
484 _order = new JButton( "Order Subtrees" );
485 _uncollapse_all = new JButton( "Uncollapse All" );
486 addJButton( _zoom_in_y, x_panel );
487 addJButton( _zoom_out_x, y_panel );
488 addJButton( _show_whole, y_panel );
489 addJButton( _zoom_in_x, y_panel );
490 addJButton( _zoom_out_y, z_panel );
491 if ( getConfiguration().doDisplayOption( Configuration.show_domain_architectures ) ) {
492 setUpControlsForDomainStrucures();
494 final JLabel spacer2 = new JLabel( "" );
496 addJButton( _return_to_super_tree, this );
497 addJButton( _order, this );
498 addJButton( _uncollapse_all, this );
499 final JLabel spacer3 = new JLabel( "" );
501 setVisibilityOfDomainStrucureControls();
504 void addCheckbox( final int which, final String title ) {
505 final JPanel ch_panel = new JPanel( new BorderLayout( 0, 0 ) );
507 case Configuration.display_as_phylogram:
508 _display_as_phylogram_cb = new JCheckBox( title );
509 getDisplayAsPhylogramCb().setToolTipText( "To switch between phylogram and cladogram display" );
510 addJCheckBox( getDisplayAsPhylogramCb(), ch_panel );
513 case Configuration.display_internal_data:
514 _display_internal_data = new JCheckBox( title );
515 _display_internal_data.setToolTipText( "To allow or disallow display of internal labels" );
516 addJCheckBox( _display_internal_data, ch_panel );
519 case Configuration.color_according_to_species:
520 _color_acc_species = new JCheckBox( title );
522 .setToolTipText( "To colorize taxonomy and sequence labels as a function of taxonomy" );
523 addJCheckBox( _color_acc_species, ch_panel );
526 case Configuration.color_according_to_annotation:
527 _color_according_to_annotation = new JCheckBox( title );
528 _color_according_to_annotation
529 .setToolTipText( "To colorize sequence annotation labels as a function of sequence annotation" );
530 addJCheckBox( _color_according_to_annotation, ch_panel );
533 case Configuration.show_node_names:
534 _show_node_names = new JCheckBox( title );
535 addJCheckBox( _show_node_names, ch_panel );
538 case Configuration.show_taxonomy_scientific_names:
539 _show_taxo_scientific_names = new JCheckBox( title );
540 addJCheckBox( _show_taxo_scientific_names, ch_panel );
543 case Configuration.show_taxonomy_common_names:
544 _show_taxo_common_names = new JCheckBox( title );
545 addJCheckBox( _show_taxo_common_names, ch_panel );
548 case Configuration.show_tax_code:
549 _show_taxo_code = new JCheckBox( title );
550 addJCheckBox( _show_taxo_code, ch_panel );
553 case Configuration.show_taxonomy_images:
554 _show_taxo_images_cb = new JCheckBox( title );
555 addJCheckBox( _show_taxo_images_cb, ch_panel );
558 case Configuration.show_binary_characters:
559 _show_binary_characters = new JCheckBox( title );
560 addJCheckBox( _show_binary_characters, ch_panel );
563 case Configuration.show_annotation:
564 _show_annotation = new JCheckBox( title );
565 addJCheckBox( _show_annotation, ch_panel );
568 case Configuration.show_binary_character_counts:
569 _show_binary_character_counts = new JCheckBox( title );
570 addJCheckBox( _show_binary_character_counts, ch_panel );
573 case Configuration.write_confidence_values:
574 _write_confidence = new JCheckBox( title );
575 addJCheckBox( getWriteConfidenceCb(), ch_panel );
578 case Configuration.write_events:
579 _show_events = new JCheckBox( title );
580 addJCheckBox( getShowEventsCb(), ch_panel );
583 case Configuration.color_branches:
584 _color_branches_cb = new JCheckBox( title );
585 getColorBranchesCb().setToolTipText( "To use branch color values, if present" );
586 addJCheckBox( getColorBranchesCb(), ch_panel );
589 case Configuration.width_branches:
590 _width_branches = new JCheckBox( title );
591 _width_branches.setToolTipText( "To use branch width values, if present" );
592 addJCheckBox( _width_branches, ch_panel );
595 case Configuration.show_domain_architectures:
596 _show_domain_architectures = new JCheckBox( title );
597 addJCheckBox( _show_domain_architectures, ch_panel );
600 case Configuration.show_gene_names:
601 _show_gene_names = new JCheckBox( title );
602 addJCheckBox( _show_gene_names, ch_panel );
605 case Configuration.show_gene_symbols:
606 _show_gene_symbols = new JCheckBox( title );
607 addJCheckBox( _show_gene_symbols, ch_panel );
610 case Configuration.show_sequence_acc:
611 _show_sequence_acc = new JCheckBox( title );
612 addJCheckBox( _show_sequence_acc, ch_panel );
615 case Configuration.dynamically_hide_data:
616 _dynamically_hide_data = new JCheckBox( title );
617 getDynamicallyHideData().setToolTipText( "To hide labels depending on likely visibility" );
618 addJCheckBox( getDynamicallyHideData(), ch_panel );
621 case Configuration.node_data_popup:
622 _node_desc_popup_cb = new JCheckBox( title );
623 getNodeDescPopupCb().setToolTipText( "To enable mouse rollover display of basic node data" );
624 addJCheckBox( getNodeDescPopupCb(), ch_panel );
627 case Configuration.show_relation_confidence:
628 _seq_relation_confidence_switch = new JCheckBox( title );
629 addJCheckBox( _seq_relation_confidence_switch, ch_panel );
632 case Configuration.show_vector_data:
633 _show_vector_data_cb = new JCheckBox( title );
634 addJCheckBox( _show_vector_data_cb, ch_panel );
637 case Configuration.show_properties:
638 _show_properties_cb = new JCheckBox( title );
639 addJCheckBox( _show_properties_cb, ch_panel );
643 throw new RuntimeException( "unknown checkbox: " + which );
647 void addJButton( final JButton jb, final JPanel p ) {
648 jb.setFocusPainted( false );
649 jb.setFont( ControlPanel.jcb_font );
650 if ( !_configuration.isUseNativeUI() ) {
651 jb.setBorder( BorderFactory.createLineBorder( getConfiguration().getGuiButtonBorderColor() ) );
652 jb.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
653 jb.setForeground( getConfiguration().getGuiButtonTextColor() );
656 jb.addActionListener( this );
659 void addJCheckBox( final JCheckBox jcb, final JPanel p ) {
660 jcb.setFocusPainted( false );
661 jcb.setFont( ControlPanel.jcb_font );
662 if ( !_configuration.isUseNativeUI() ) {
663 jcb.setBackground( getConfiguration().getGuiBackgroundColor() );
664 jcb.setForeground( getConfiguration().getGuiCheckboxTextColor() );
666 p.add( jcb, "Center" );
667 jcb.addActionListener( this );
670 void addJTextField( final JTextField tf, final JPanel p ) {
671 if ( !_configuration.isUseNativeUI() ) {
672 tf.setForeground( getConfiguration().getGuiBackgroundColor() );
673 tf.setFont( ControlPanel.jcb_font );
676 tf.addActionListener( this );
679 void deactivateButtonToReturnToSuperTree() {
680 _return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT );
681 _return_to_super_tree.setForeground( getConfiguration().getGuiButtonTextColor() );
682 _return_to_super_tree.setEnabled( false );
685 void displayedPhylogenyMightHaveChanged( final boolean recalc_longest_ext_node_info ) {
686 if ( ( _mainpanel != null )
687 && ( ( _mainpanel.getCurrentPhylogeny() != null ) && !_mainpanel.getCurrentPhylogeny().isEmpty() ) ) {
688 if ( getOptions().isShowOverview() ) {
689 _mainpanel.getCurrentTreePanel().updateOvSizes();
691 _mainpanel.getCurrentTreePanel().recalculateMaxDistanceToRoot();
692 setVisibilityOfDomainStrucureControls();
693 updateDomainStructureEvaluethresholdDisplay();
694 _mainpanel.getCurrentTreePanel().calculateScaleDistance();
695 _mainpanel.getCurrentTreePanel().calcMaxDepth();
696 _mainpanel.adjustJScrollPane();
697 if ( recalc_longest_ext_node_info ) {
698 _mainpanel.getCurrentTreePanel().initNodeData();
699 _mainpanel.getCurrentTreePanel().calculateLongestExtNodeInfo();
701 _mainpanel.getCurrentTreePanel().repaint();
702 // _mainpanel.getCurrentTreePanel().setUpUrtFactors();
706 void endClickToOptions() {
707 _click_to_combobox.addActionListener( this );
711 * Indicates what action should be execute when a node is clicked
713 * @return the click-on action
715 NodeClickAction getActionWhenNodeClicked() {
716 return _action_when_node_clicked;
719 Map<Integer, String> getAllClickToItems() {
720 return _all_click_to_names;
723 Map<String, Color> getAnnotationColors() {
724 return _annotation_colors;
727 Configuration getConfiguration() {
728 return _configuration;
731 TreePanel getCurrentTreePanel() {
732 return getMainPanel().getCurrentTreePanel();
735 MainPanel getMainPanel() {
739 Options getOptions() {
740 return getMainPanel().getOptions();
743 JTextField getSearchTextField() {
747 List<String> getSingleClickToNames() {
748 return _click_to_names;
751 Map<String, Color> getSpeciesColors() {
752 return _species_colors;
755 boolean isAntialiasScreenText() {
759 boolean isColorAccordingToAnnotation() {
760 return ( ( _color_according_to_annotation != null ) && _color_according_to_annotation.isSelected() );
763 boolean isColorAccordingToTaxonomy() {
764 return ( ( _color_acc_species != null ) && _color_acc_species.isSelected() );
767 boolean isColorBranches() {
768 return ( ( ( getColorBranchesCb() != null ) && getColorBranchesCb().isSelected() ) || ( ( getColorBranchesCb() == null ) && _color_branches ) );
771 boolean isDrawPhylogram() {
772 return isDrawPhylogram( getMainPanel().getCurrentTabIndex() );
775 boolean isDynamicallyHideData() {
776 return ( ( getDynamicallyHideData() != null ) && getDynamicallyHideData().isSelected() );
780 return ( ( getShowEventsCb() != null ) && getShowEventsCb().isSelected() );
783 boolean isNodeDescPopup() {
784 return ( ( getNodeDescPopupCb() != null ) && getNodeDescPopupCb().isSelected() );
787 boolean isShowAnnotation() {
788 return ( ( _show_annotation != null ) && _show_annotation.isSelected() );
791 boolean isShowBinaryCharacterCounts() {
792 return ( ( _show_binary_character_counts != null ) && _show_binary_character_counts.isSelected() );
795 boolean isShowBinaryCharacters() {
796 return ( ( _show_binary_characters != null ) && _show_binary_characters.isSelected() );
799 boolean isShowConfidenceValues() {
800 return ( ( getWriteConfidenceCb() != null ) && getWriteConfidenceCb().isSelected() );
803 boolean isShowDomainArchitectures() {
804 return ( ( _show_domain_architectures != null ) && _show_domain_architectures.isSelected() );
807 boolean isShowGeneNames() {
808 return ( ( _show_gene_names != null ) && _show_gene_names.isSelected() );
811 boolean isShowGeneSymbols() {
812 return ( ( _show_gene_symbols != null ) && _show_gene_symbols.isSelected() );
815 boolean isShowInternalData() {
816 return ( ( _display_internal_data == null ) || _display_internal_data.isSelected() );
819 boolean isShowNodeNames() {
820 return ( ( _show_node_names != null ) && _show_node_names.isSelected() );
823 boolean isShowSequenceAcc() {
824 return ( ( _show_sequence_acc != null ) && _show_sequence_acc.isSelected() );
827 boolean isShowSequenceRelationConfidence() {
828 return ( ( _seq_relation_confidence_switch != null ) && ( _seq_relation_confidence_switch.isSelected() ) );
831 boolean isShowSequenceRelations() {
832 return ( ( _show_sequence_relations != null ) && ( _show_sequence_relations.getSelectedIndex() > 0 ) );
835 boolean isShowTaxonomyCode() {
836 return ( ( _show_taxo_code != null ) && _show_taxo_code.isSelected() );
839 boolean isShowTaxonomyCommonNames() {
840 return ( ( _show_taxo_common_names != null ) && _show_taxo_common_names.isSelected() );
843 boolean isShowTaxonomyScientificNames() {
844 return ( ( _show_taxo_scientific_names != null ) && _show_taxo_scientific_names.isSelected() );
847 boolean isWidthBranches() {
848 return ( ( _width_branches != null ) && _width_branches.isSelected() );
851 void phylogenyAdded( final Configuration configuration ) {
852 getIsDrawPhylogramList().add( configuration.isDrawAsPhylogram() );
855 void phylogenyRemoved( final int index ) {
856 getIsDrawPhylogramList().remove( index );
860 final MainPanel main_panel = getMainPanel();
861 final Phylogeny tree = main_panel.getCurrentPhylogeny();
862 if ( ( tree == null ) || tree.isEmpty() ) {
865 String query = getSearchTextField().getText();
866 if ( query != null ) {
867 query = query.trim();
870 getSearchFoundCountsLabel().setVisible( false );
871 getSearchResetButton().setEnabled( false );
872 getSearchResetButton().setVisible( false );
875 if ( !ForesterUtil.isEmpty( query ) ) {
876 search( main_panel, tree, query );
879 getSearchFoundCountsLabel().setVisible( false );
880 getSearchResetButton().setEnabled( false );
881 getSearchResetButton().setVisible( false );
886 void setActionWhenNodeClicked( final NodeClickAction action ) {
887 _action_when_node_clicked = action;
890 void setAnnotationColors( final Map<String, Color> annotation_colors ) {
891 _annotation_colors = annotation_colors;
894 void setCheckbox( final int which, final boolean state ) {
896 case Configuration.display_as_phylogram:
897 if ( getDisplayAsPhylogramCb() != null ) {
898 getDisplayAsPhylogramCb().setSelected( state );
901 case Configuration.display_internal_data:
902 if ( _display_internal_data != null ) {
903 _display_internal_data.setSelected( state );
906 case Configuration.color_according_to_species:
907 if ( _color_acc_species != null ) {
908 _color_acc_species.setSelected( state );
911 case Configuration.color_according_to_annotation:
912 if ( _color_according_to_annotation != null ) {
913 _color_according_to_annotation.setSelected( state );
916 case Configuration.show_node_names:
917 if ( _show_node_names != null ) {
918 _show_node_names.setSelected( state );
921 case Configuration.show_taxonomy_scientific_names:
922 if ( _show_taxo_scientific_names != null ) {
923 _show_taxo_scientific_names.setSelected( state );
926 case Configuration.show_taxonomy_common_names:
927 if ( _show_taxo_common_names != null ) {
928 _show_taxo_common_names.setSelected( state );
931 case Configuration.show_tax_code:
932 if ( _show_taxo_code != null ) {
933 _show_taxo_code.setSelected( state );
936 case Configuration.show_taxonomy_images:
937 if ( _show_taxo_images_cb != null ) {
938 _show_taxo_images_cb.setSelected( state );
941 case Configuration.show_annotation:
942 if ( _show_annotation != null ) {
943 _show_annotation.setSelected( state );
946 case Configuration.show_binary_characters:
947 if ( _show_binary_characters != null ) {
948 _show_binary_characters.setSelected( state );
951 case Configuration.show_binary_character_counts:
952 if ( _show_binary_character_counts != null ) {
953 _show_binary_character_counts.setSelected( state );
956 case Configuration.write_confidence_values:
957 if ( getWriteConfidenceCb() != null ) {
958 getWriteConfidenceCb().setSelected( state );
961 case Configuration.write_events:
962 if ( getShowEventsCb() != null ) {
963 getShowEventsCb().setSelected( state );
966 case Configuration.color_branches:
967 if ( getColorBranchesCb() != null ) {
968 getColorBranchesCb().setSelected( state );
971 case Configuration.width_branches:
972 if ( _width_branches != null ) {
973 _width_branches.setSelected( state );
976 case Configuration.show_domain_architectures:
977 if ( _show_domain_architectures != null ) {
978 _show_domain_architectures.setSelected( state );
981 case Configuration.show_gene_names:
982 if ( _show_gene_names != null ) {
983 _show_gene_names.setSelected( state );
986 case Configuration.show_gene_symbols:
987 if ( _show_gene_symbols != null ) {
988 _show_gene_symbols.setSelected( state );
991 case Configuration.show_vector_data:
992 if ( _show_vector_data_cb != null ) {
993 _show_vector_data_cb.setSelected( state );
996 case Configuration.show_properties:
997 if ( _show_properties_cb != null ) {
998 _show_properties_cb.setSelected( state );
1001 case Configuration.show_sequence_acc:
1002 if ( _show_sequence_acc != null ) {
1003 _show_sequence_acc.setSelected( state );
1006 case Configuration.dynamically_hide_data:
1007 if ( getDynamicallyHideData() != null ) {
1008 getDynamicallyHideData().setSelected( state );
1011 case Configuration.node_data_popup:
1012 if ( getNodeDescPopupCb() != null ) {
1013 getNodeDescPopupCb().setSelected( state );
1017 case Configuration.show_relation_confidence:
1018 if ( _seq_relation_confidence_switch != null ) {
1019 _seq_relation_confidence_switch.setSelected( state );
1024 throw new AssertionError( "unknown checkbox: " + which );
1029 * Set this checkbox state. Not all checkboxes have been instantiated
1030 * depending on the config.
1032 void setCheckbox( final JCheckBox cb, final boolean state ) {
1034 cb.setSelected( state );
1038 void setClickToAction( final int action ) {
1039 // Set click-to action
1040 if ( action == _show_data_item ) {
1041 setActionWhenNodeClicked( NodeClickAction.SHOW_DATA );
1043 else if ( action == _collapse_cb_item ) {
1044 setActionWhenNodeClicked( NodeClickAction.COLLAPSE );
1046 else if ( action == _reroot_cb_item ) {
1047 setActionWhenNodeClicked( NodeClickAction.REROOT );
1049 else if ( action == _subtree_cb_item ) {
1050 setActionWhenNodeClicked( NodeClickAction.SUBTREE );
1052 else if ( action == _swap_cb_item ) {
1053 setActionWhenNodeClicked( NodeClickAction.SWAP );
1055 else if ( action == _color_subtree_cb_item ) {
1056 setActionWhenNodeClicked( NodeClickAction.COLOR_SUBTREE );
1058 else if ( action == _open_seq_web_item ) {
1059 setActionWhenNodeClicked( NodeClickAction.OPEN_SEQ_WEB );
1061 else if ( action == _sort_descendents_item ) {
1062 setActionWhenNodeClicked( NodeClickAction.SORT_DESCENDENTS );
1064 else if ( action == _blast_item ) {
1065 setActionWhenNodeClicked( NodeClickAction.BLAST );
1067 else if ( action == _open_tax_web_item ) {
1068 setActionWhenNodeClicked( NodeClickAction.OPEN_TAX_WEB );
1070 else if ( action == _cut_subtree_item ) {
1071 setActionWhenNodeClicked( NodeClickAction.CUT_SUBTREE );
1073 else if ( action == _copy_subtree_item ) {
1074 setActionWhenNodeClicked( NodeClickAction.COPY_SUBTREE );
1076 else if ( action == _delete_node_or_subtree_item ) {
1077 setActionWhenNodeClicked( NodeClickAction.DELETE_NODE_OR_SUBTREE );
1079 else if ( action == _paste_subtree_item ) {
1080 setActionWhenNodeClicked( NodeClickAction.PASTE_SUBTREE );
1082 else if ( action == _add_new_node_item ) {
1083 setActionWhenNodeClicked( NodeClickAction.ADD_NEW_NODE );
1085 else if ( action == _edit_node_data_item ) {
1086 setActionWhenNodeClicked( NodeClickAction.EDIT_NODE_DATA );
1088 else if ( action == _select_nodes_item ) {
1089 setActionWhenNodeClicked( NodeClickAction.SELECT_NODES );
1091 else if ( action == _get_ext_desc_data ) {
1092 setActionWhenNodeClicked( NodeClickAction.GET_EXT_DESC_DATA );
1095 throw new RuntimeException( "unknown action: " + action );
1097 // make sure drop down is displaying the correct action
1098 // in case this was called from outside the class
1099 _click_to_combobox.setSelectedIndex( action );
1102 void setColorBranches( final boolean color_branches ) {
1103 _color_branches = color_branches;
1106 void setDrawPhylogram( final boolean b ) {
1107 getDisplayAsPhylogramCb().setSelected( b );
1108 setDrawPhylogram( getMainPanel().getCurrentTabIndex(), b );
1111 void setDrawPhylogramEnabled( final boolean b ) {
1112 getDisplayAsPhylogramCb().setEnabled( b );
1115 void setDynamicHidingIsOn( final boolean is_on ) {
1116 // if ( !_configuration.isUseNativeUI() ) {
1118 getDynamicallyHideData().setForeground( getConfiguration().getGuiCheckboxAndButtonActiveColor() );
1121 if ( !_configuration.isUseNativeUI() ) {
1122 getDynamicallyHideData().setForeground( getConfiguration().getGuiButtonTextColor() );
1125 getDynamicallyHideData().setForeground( Color.BLACK );
1131 void setShowEvents( final boolean show_events ) {
1132 if ( getShowEventsCb() == null ) {
1133 _show_events = new JCheckBox( "" );
1135 getShowEventsCb().setSelected( show_events );
1138 void setSpeciesColors( final Map<String, Color> species_colors ) {
1139 _species_colors = species_colors;
1144 * Set up the controls from the config settings. 11/26/05
1146 void setupControls() {
1147 // The tree display options:
1148 setupDisplayCheckboxes();
1150 // The sequence relation query selection combo-box
1151 if ( _configuration.displaySequenceRelations() ) {
1152 addSequenceRelationBlock();
1156 startClickToOptions();
1157 setupClickToOptions();
1158 endClickToOptions();
1159 // Zoom and quick edit buttons
1164 void setUpControlsForDomainStrucures() {
1165 _domain_display_label = new JLabel( "Domain Display:" );
1166 add( customizeLabel( _domain_display_label, getConfiguration() ) );
1167 add( _domain_display_label );
1168 _zoom_in_domain_structure = new JButton( "d+" );
1169 _zoom_out_domain_structure = new JButton( "d-" );
1170 _decr_domain_structure_evalue_thr = new JButton( "-" );
1171 _incr_domain_structure_evalue_thr = new JButton( "+" );
1172 _zoom_in_domain_structure.setPreferredSize( new Dimension( 10, 10 ) );
1173 _zoom_out_domain_structure.setPreferredSize( new Dimension( 10, 10 ) );
1174 _decr_domain_structure_evalue_thr.setPreferredSize( new Dimension( 10, 10 ) );
1175 _incr_domain_structure_evalue_thr.setPreferredSize( new Dimension( 10, 10 ) );
1176 _incr_domain_structure_evalue_thr.setToolTipText( "Increase the E-value threshold by a factor of 10" );
1177 _decr_domain_structure_evalue_thr.setToolTipText( "Decrease the E-value threshold by a factor of 10" );
1178 _domain_structure_evalue_thr_tf = new JTextField( 3 );
1179 _domain_structure_evalue_thr_tf.setEditable( false );
1180 if ( !getConfiguration().isUseNativeUI() ) {
1181 _domain_structure_evalue_thr_tf.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
1182 _domain_structure_evalue_thr_tf.setBackground( getConfiguration().getGuiCheckboxTextColor() );
1183 _domain_structure_evalue_thr_tf.setBorder( null );
1185 final JPanel d1_panel = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
1186 final JPanel d2_panel = new JPanel( new GridLayout( 1, 3, 0, 0 ) );
1187 if ( !_configuration.isUseNativeUI() ) {
1188 d1_panel.setBackground( getBackground() );
1189 d2_panel.setBackground( getBackground() );
1193 addJButton( _zoom_out_domain_structure, d1_panel );
1194 addJButton( _zoom_in_domain_structure, d1_panel );
1195 addJButton( _decr_domain_structure_evalue_thr, d2_panel );
1196 addJTextField( _domain_structure_evalue_thr_tf, d2_panel );
1197 addJButton( _incr_domain_structure_evalue_thr, d2_panel );
1200 void setupSearchTools() {
1201 final String tip = "Enter text to search for. Use ',' for multiple searches (logical OR) and '+' for logical AND.";
1202 final JLabel search_label = new JLabel( "Search:" );
1203 search_label.setFont( ControlPanel.jcb_bold_font );
1204 if ( !getConfiguration().isUseNativeUI() ) {
1205 search_label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1207 add( search_label );
1208 search_label.setToolTipText( tip );
1209 _search_found_label = new JLabel();
1210 getSearchFoundCountsLabel().setVisible( false );
1211 _search_found_label.setFont( ControlPanel.jcb_bold_font );
1212 if ( !getConfiguration().isUseNativeUI() ) {
1213 _search_found_label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1215 _search_tf = new JTextField( 3 );
1216 _search_tf.setToolTipText( tip );
1217 _search_tf.setEditable( true );
1218 if ( !getConfiguration().isUseNativeUI() ) {
1219 _search_tf.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
1220 _search_tf.setBackground( getConfiguration().getGuiCheckboxTextColor() );
1221 _search_tf.setBorder( null );
1223 _search_reset_button = new JButton();
1224 getSearchResetButton().setText( "Reset" );
1225 getSearchResetButton().setEnabled( false );
1226 getSearchResetButton().setVisible( false );
1227 final JPanel s_panel_1 = new JPanel( new BorderLayout() );
1228 final JPanel s_panel_2 = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
1229 s_panel_1.setBackground( getBackground() );
1231 s_panel_2.setBackground( getBackground() );
1233 final KeyAdapter key_adapter = new KeyAdapter() {
1236 public void keyReleased( final KeyEvent key_event ) {
1238 displayedPhylogenyMightHaveChanged( true );
1241 final ActionListener action_listener = new ActionListener() {
1244 public void actionPerformed( final ActionEvent e ) {
1246 setSearchFoundCountsOnLabel( 0 );
1247 getSearchFoundCountsLabel().setVisible( false );
1248 getSearchTextField().setText( "" );
1249 getSearchResetButton().setEnabled( false );
1250 getSearchResetButton().setVisible( false );
1251 displayedPhylogenyMightHaveChanged( true );
1254 _search_reset_button.addActionListener( action_listener );
1255 _search_tf.addKeyListener( key_adapter );
1256 addJTextField( _search_tf, s_panel_1 );
1257 s_panel_2.add( _search_found_label );
1258 addJButton( _search_reset_button, s_panel_2 );
1262 * Fit entire tree into window.
1265 if ( ( _mainpanel.getCurrentScrollPane() == null ) || _mainpanel.getCurrentTreePanel().getPhylogeny().isEmpty() ) {
1268 getCurrentTreePanel().updateSetOfCollapsedExternalNodes();
1269 displayedPhylogenyMightHaveChanged( true );
1270 _mainpanel.getCurrentTreePanel().updateOvSettings();
1271 _mainpanel.getCurrentTreePanel().validate();
1272 _mainpanel.validate();
1273 _mainpanel.getCurrentTreePanel().setParametersForPainting( _mainpanel.getSizeOfViewport().width,
1274 _mainpanel.getSizeOfViewport().height,
1276 _mainpanel.getCurrentTreePanel().resetPreferredSize();
1277 _mainpanel.adjustJScrollPane();
1278 _mainpanel.getCurrentTreePanel().repaint();
1279 _mainpanel.getCurrentTreePanel().validate();
1280 _mainpanel.validate();
1281 _mainpanel.getCurrentTreePanel().setParametersForPainting( _mainpanel.getSizeOfViewport().width,
1282 _mainpanel.getSizeOfViewport().height,
1284 _mainpanel.getCurrentTreePanel().resetPreferredSize();
1285 _mainpanel.adjustJScrollPane();
1286 _mainpanel.getCurrentTreePanel().repaint();
1287 _mainpanel.getCurrentTreePanel().updateOvSizes();
1290 void showWholeAll() {
1291 for( final TreePanel tree_panel : _mainpanel.getTreePanels() ) {
1292 if ( tree_panel != null ) {
1293 tree_panel.validate();
1294 tree_panel.setParametersForPainting( _mainpanel.getSizeOfViewport().width,
1295 _mainpanel.getSizeOfViewport().height,
1297 tree_panel.resetPreferredSize();
1298 tree_panel.repaint();
1303 // Create header for click-to combo box.
1304 void startClickToOptions() {
1305 final JLabel spacer = new JLabel( "" );
1306 spacer.setFont( ControlPanel.jcb_font );
1308 _click_to_label = new JLabel( "Click on Node to:" );
1309 add( customizeLabel( _click_to_label, getConfiguration() ) );
1310 _click_to_combobox = new JComboBox();
1311 _click_to_combobox.setFocusable( false );
1312 _click_to_combobox.setMaximumRowCount( 14 );
1313 _click_to_combobox.setFont( ControlPanel.js_font );
1314 if ( !_configuration.isUseNativeUI() ) {
1315 _click_to_combobox.setBackground( getConfiguration().getGuiBackgroundColor() );
1317 // don't add listener until all items are set (or each one will trigger
1319 // click_to_list.addActionListener(this);
1320 add( _click_to_combobox );
1321 // Correlates option names to titles
1322 _all_click_to_names = new HashMap<Integer, String>();
1323 _click_to_names = new ArrayList<String>();
1327 if ( getMainPanel().getTabbedPane().getTabCount() > 0 ) {
1328 if ( getCurrentTreePanel().isPhyHasBranchLengths()
1329 && ( getCurrentTreePanel().getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) {
1330 setDrawPhylogramEnabled( true );
1331 setDrawPhylogram( isDrawPhylogram() );
1334 setDrawPhylogramEnabled( false );
1335 setDrawPhylogram( false );
1337 if ( getMainPanel().getMainFrame() == null ) {
1338 // Must be "E" applet version.
1339 final ArchaeopteryxE e = ( ArchaeopteryxE ) ( ( MainPanelApplets ) getMainPanel() ).getApplet();
1340 e.setSelectedTypeInTypeMenu( e.getCurrentTreePanel().getPhylogenyGraphicsType() );
1343 getMainPanel().getMainFrame().setSelectedTypeInTypeMenu( getMainPanel().getCurrentTreePanel()
1344 .getPhylogenyGraphicsType() );
1346 getMainPanel().getCurrentTreePanel().updateSubSuperTreeButton();
1347 getMainPanel().getControlPanel().search();
1348 getSequenceRelationTypeBox().removeAllItems();
1349 for( final SequenceRelation.SEQUENCE_RELATION_TYPE type : getMainPanel().getCurrentPhylogeny()
1350 .getRelevantSequenceRelationTypes() ) {
1351 _sequence_relation_type_box.addItem( type );
1353 //setSequenceRelationQueries( getMainPanel().getCurrentPhylogeny().getSequenceRelationQueries() );
1354 // according to GUILHEM the line above can be removed.
1359 * Uncollapse all nodes.
1361 void uncollapseAll( final TreePanel tp ) {
1362 final Phylogeny t = tp.getPhylogeny();
1363 if ( ( t != null ) && !t.isEmpty() ) {
1364 for( final PhylogenyNodeIterator iter = t.iteratorPreorder(); iter.hasNext(); ) {
1365 final PhylogenyNode node = iter.next();
1366 node.setCollapse( false );
1368 tp.resetNodeIdToDistToLeafMap();
1369 tp.updateSetOfCollapsedExternalNodes();
1370 t.recalculateNumberOfExternalDescendants( false );
1371 tp.setNodeInPreorderToNull();
1372 t.clearHashIdToNodeMap();
1377 void updateDomainStructureEvaluethresholdDisplay() {
1378 if ( _domain_structure_evalue_thr_tf != null ) {
1379 _domain_structure_evalue_thr_tf.setText( "10^"
1380 + getMainPanel().getCurrentTreePanel().getDomainStructureEvalueThreshold() );
1384 void zoomInX( final float factor, final float x_correction_factor ) {
1385 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar();
1386 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1387 treepanel.multiplyUrtFactor( 1f );
1388 if ( ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
1389 || ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
1390 || isDrawPhylogram( getMainPanel().getCurrentTabIndex() )
1391 || ( getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP ) ) {
1392 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1393 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
1394 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
1395 getMainPanel().adjustJScrollPane();
1396 treepanel.resetPreferredSize();
1397 getMainPanel().getCurrentScrollPane().getViewport().validate();
1398 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1399 - ( sb.getVisibleAmount() / 2.0 ) ) );
1402 final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue();
1403 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
1404 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
1405 getMainPanel().adjustJScrollPane();
1406 treepanel.resetPreferredSize();
1407 getMainPanel().getCurrentScrollPane().getViewport().validate();
1408 sb.setValue( sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount() );
1410 treepanel.resetPreferredSize();
1411 treepanel.updateOvSizes();
1414 void zoomInY( final float factor ) {
1415 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getVerticalScrollBar();
1416 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1417 treepanel.multiplyUrtFactor( 1.1f );
1418 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1419 treepanel.setYdistance( ( treepanel.getYdistance() * factor ) );
1420 getMainPanel().adjustJScrollPane();
1421 treepanel.resetPreferredSize();
1422 getMainPanel().getCurrentScrollPane().getViewport().validate();
1423 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1424 - ( sb.getVisibleAmount() / 2.0 ) ) );
1425 treepanel.resetPreferredSize();
1426 treepanel.updateOvSizes();
1429 void zoomOutX( final float factor, final float x_correction_factor ) {
1430 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1431 treepanel.multiplyUrtFactor( 1f );
1432 if ( ( treepanel.getXdistance() * factor ) > 0.0 ) {
1433 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar();
1434 if ( ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
1435 || ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
1436 || isDrawPhylogram( getMainPanel().getCurrentTabIndex() )
1437 || ( getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP ) ) {
1438 getMainPanel().adjustJScrollPane();
1439 treepanel.resetPreferredSize();
1440 getMainPanel().getCurrentScrollPane().getViewport().validate();
1441 final double x = ( sb.getMaximum() - sb.getMinimum() )
1442 / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1443 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
1444 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
1445 getMainPanel().adjustJScrollPane();
1446 treepanel.resetPreferredSize();
1447 getMainPanel().getCurrentScrollPane().getViewport().validate();
1448 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1449 - ( sb.getVisibleAmount() / 2.0 ) ) );
1452 final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue();
1453 treepanel.setXdistance( treepanel.getXdistance() * factor );
1454 treepanel.setXcorrectionFactor( treepanel.getXcorrectionFactor() * x_correction_factor );
1456 getMainPanel().adjustJScrollPane();
1457 treepanel.resetPreferredSize();
1458 getMainPanel().getCurrentScrollPane().getViewport().validate();
1459 sb.setValue( sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount() );
1462 treepanel.resetPreferredSize();
1463 treepanel.updateOvSizes();
1467 void zoomOutY( final float factor ) {
1468 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1469 treepanel.multiplyUrtFactor( 0.9f );
1470 if ( ( treepanel.getYdistance() * factor ) > 0.0 ) {
1471 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getVerticalScrollBar();
1472 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1473 treepanel.setYdistance( ( treepanel.getYdistance() * factor ) );
1474 getMainPanel().adjustJScrollPane();
1475 treepanel.resetPreferredSize();
1476 getMainPanel().getCurrentScrollPane().getViewport().validate();
1477 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1478 - ( sb.getVisibleAmount() / 2.0 ) ) );
1479 treepanel.resetPreferredSize();
1480 treepanel.updateOvSizes();
1484 private void addClickToOption( final int which, final String title ) {
1485 _click_to_combobox.addItem( title );
1486 _click_to_names.add( title );
1487 _all_click_to_names.put( new Integer( which ), title );
1488 if ( !_configuration.isUseNativeUI() ) {
1489 _click_to_combobox.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
1490 _click_to_combobox.setForeground( getConfiguration().getGuiButtonTextColor() );
1495 private void addSequenceRelationBlock() {
1496 final JLabel spacer = new JLabel( "" );
1497 spacer.setSize( 1, 1 );
1499 final JLabel mainLabel = new JLabel( "Sequence relations to display" );
1500 final JLabel typeLabel = customizeLabel( new JLabel( "(type) " ), getConfiguration() );
1501 typeLabel.setFont( ControlPanel.js_font.deriveFont( 7 ) );
1502 getSequenceRelationTypeBox().setFocusable( false );
1503 _sequence_relation_type_box.setFont( ControlPanel.js_font );
1504 if ( !_configuration.isUseNativeUI() ) {
1505 _sequence_relation_type_box.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
1506 _sequence_relation_type_box.setForeground( getConfiguration().getGuiButtonTextColor() );
1508 _sequence_relation_type_box.setRenderer( new ListCellRenderer() {
1511 public Component getListCellRendererComponent( final JList list,
1514 final boolean isSelected,
1515 final boolean cellHasFocus ) {
1516 final Component component = new DefaultListCellRenderer().getListCellRendererComponent( list,
1521 if ( ( value != null ) && ( value instanceof SequenceRelation.SEQUENCE_RELATION_TYPE ) ) {
1522 ( ( DefaultListCellRenderer ) component ).setText( SequenceRelation
1523 .getPrintableNameByType( ( SequenceRelation.SEQUENCE_RELATION_TYPE ) value ) );
1528 final GridBagLayout gbl = new GridBagLayout();
1529 _sequence_relation_type_box.setMinimumSize( new Dimension( 115, 17 ) );
1530 _sequence_relation_type_box.setPreferredSize( new Dimension( 115, 20 ) );
1531 final JPanel horizGrid = new JPanel( gbl );
1532 horizGrid.setBackground( getBackground() );
1533 horizGrid.add( typeLabel );
1534 horizGrid.add( _sequence_relation_type_box );
1535 add( customizeLabel( mainLabel, getConfiguration() ) );
1537 add( getSequenceRelationBox() );
1538 if ( _configuration.doDisplayOption( Configuration.show_relation_confidence ) ) {
1539 addCheckbox( Configuration.show_relation_confidence,
1540 _configuration.getDisplayTitle( Configuration.show_relation_confidence ) );
1541 setCheckbox( Configuration.show_relation_confidence,
1542 _configuration.doCheckOption( Configuration.show_relation_confidence ) );
1544 }// addSequenceRelationBlock
1547 private List<Boolean> getIsDrawPhylogramList() {
1548 return _draw_phylogram;
1551 JLabel getSearchFoundCountsLabel() {
1552 return _search_found_label;
1555 JButton getSearchResetButton() {
1556 return _search_reset_button;
1559 private void init() {
1560 _draw_phylogram = new ArrayList<Boolean>();
1561 setSpeciesColors( new HashMap<String, Color>() );
1562 setAnnotationColors( new HashMap<String, Color>() );
1565 private boolean isDrawPhylogram( final int index ) {
1566 return getIsDrawPhylogramList().get( index );
1569 private void search( final MainPanel main_panel, final Phylogeny tree, final String query_str ) {
1570 getSearchFoundCountsLabel().setVisible( true );
1571 getSearchResetButton().setEnabled( true );
1572 getSearchResetButton().setVisible( true );
1573 String[] queries = null;
1574 List<PhylogenyNode> nodes = null;
1575 if ( query_str.indexOf( ',' ) >= 0 ) {
1576 queries = query_str.split( ",+" );
1579 queries = new String[ 1 ];
1580 queries[ 0 ] = query_str.trim();
1582 if ( ( queries != null ) && ( queries.length > 0 ) ) {
1583 nodes = new ArrayList<PhylogenyNode>();
1584 for( String query : queries ) {
1585 if ( ForesterUtil.isEmpty( query ) ) {
1588 query = query.trim();
1589 if ( query.indexOf( '+' ) >= 0 ) {
1590 nodes.addAll( PhylogenyMethods.searchDataLogicalAnd( query.split( "\\++" ),
1592 getOptions().isSearchCaseSensitive(),
1593 !getOptions().isMatchWholeTermsOnly(),
1594 isShowDomainArchitectures() ) );
1597 nodes.addAll( PhylogenyMethods.searchData( query,
1599 getOptions().isSearchCaseSensitive(),
1600 !getOptions().isMatchWholeTermsOnly(),
1601 isShowDomainArchitectures() ) );
1604 if ( getOptions().isInverseSearchResult() ) {
1605 final List<PhylogenyNode> all = PhylogenyMethods.obtainAllNodesAsList( tree );
1606 all.removeAll( nodes );
1610 if ( ( nodes != null ) && ( nodes.size() > 0 ) ) {
1611 main_panel.getCurrentTreePanel().setFoundNodes( new HashSet<Integer>() );
1612 for( final PhylogenyNode node : nodes ) {
1613 main_panel.getCurrentTreePanel().getFoundNodes().add( node.getId() );
1615 setSearchFoundCountsOnLabel( nodes.size() );
1618 setSearchFoundCountsOnLabel( 0 );
1623 void searchReset() {
1624 if ( getMainPanel().getCurrentTreePanel() != null ) {
1625 getMainPanel().getCurrentTreePanel().setFoundNodes( null );
1629 private void setDrawPhylogram( final int index, final boolean b ) {
1630 getIsDrawPhylogramList().set( index, b );
1633 void setSearchFoundCountsOnLabel( final int counts ) {
1634 getSearchFoundCountsLabel().setText( "Found: " + counts );
1637 private void setupClickToOptions() {
1638 final int default_option = _configuration.getDefaultDisplayClicktoOption();
1639 int selected_index = 0;
1641 if ( _configuration.doDisplayClickToOption( Configuration.display_node_data ) ) {
1642 _show_data_item = cb_index;
1643 addClickToOption( Configuration.display_node_data,
1644 _configuration.getClickToTitle( Configuration.display_node_data ) );
1645 if ( default_option == Configuration.display_node_data ) {
1646 selected_index = cb_index;
1650 if ( _configuration.doDisplayClickToOption( Configuration.collapse_uncollapse ) ) {
1651 _collapse_cb_item = cb_index;
1652 addClickToOption( Configuration.collapse_uncollapse,
1653 _configuration.getClickToTitle( Configuration.collapse_uncollapse ) );
1654 if ( default_option == Configuration.collapse_uncollapse ) {
1655 selected_index = cb_index;
1659 if ( _configuration.doDisplayClickToOption( Configuration.reroot ) ) {
1660 _reroot_cb_item = cb_index;
1661 addClickToOption( Configuration.reroot, _configuration.getClickToTitle( Configuration.reroot ) );
1662 if ( default_option == Configuration.reroot ) {
1663 selected_index = cb_index;
1667 if ( _configuration.doDisplayClickToOption( Configuration.subtree ) ) {
1668 _subtree_cb_item = cb_index;
1669 addClickToOption( Configuration.subtree, _configuration.getClickToTitle( Configuration.subtree ) );
1670 if ( default_option == Configuration.subtree ) {
1671 selected_index = cb_index;
1675 if ( _configuration.doDisplayClickToOption( Configuration.swap ) ) {
1676 _swap_cb_item = cb_index;
1677 addClickToOption( Configuration.swap, _configuration.getClickToTitle( Configuration.swap ) );
1678 if ( default_option == Configuration.swap ) {
1679 selected_index = cb_index;
1683 if ( _configuration.doDisplayClickToOption( Configuration.sort_descendents ) ) {
1684 _sort_descendents_item = cb_index;
1685 addClickToOption( Configuration.sort_descendents,
1686 _configuration.getClickToTitle( Configuration.sort_descendents ) );
1687 if ( default_option == Configuration.sort_descendents ) {
1688 selected_index = cb_index;
1692 if ( _configuration.doDisplayClickToOption( Configuration.color_subtree ) ) {
1693 _color_subtree_cb_item = cb_index;
1694 addClickToOption( Configuration.color_subtree, _configuration.getClickToTitle( Configuration.color_subtree ) );
1695 if ( default_option == Configuration.color_subtree ) {
1696 selected_index = cb_index;
1700 if ( _configuration.doDisplayClickToOption( Configuration.open_seq_web ) ) {
1701 _open_seq_web_item = cb_index;
1702 addClickToOption( Configuration.open_seq_web, _configuration.getClickToTitle( Configuration.open_seq_web ) );
1703 if ( default_option == Configuration.open_seq_web ) {
1704 selected_index = cb_index;
1708 if ( _configuration.doDisplayClickToOption( Configuration.open_tax_web ) ) {
1709 _open_tax_web_item = cb_index;
1710 addClickToOption( Configuration.open_tax_web, _configuration.getClickToTitle( Configuration.open_tax_web ) );
1711 if ( default_option == Configuration.open_tax_web ) {
1712 selected_index = cb_index;
1716 if ( _configuration.doDisplayClickToOption( Configuration.blast ) ) {
1717 _blast_item = cb_index;
1718 addClickToOption( Configuration.blast, _configuration.getClickToTitle( Configuration.blast ) );
1719 if ( default_option == Configuration.blast ) {
1720 selected_index = cb_index;
1724 if ( _configuration.doDisplayClickToOption( Configuration.get_ext_desc_data ) ) {
1725 _get_ext_desc_data = cb_index;
1726 if ( !ForesterUtil.isEmpty( getConfiguration().getLabelForGetExtDescendentsData() ) ) {
1727 addClickToOption( Configuration.get_ext_desc_data, getConfiguration()
1728 .getLabelForGetExtDescendentsData() );
1732 switch ( getConfiguration().getExtDescNodeDataToReturn() ) {
1737 s = "Sequence Accessors";
1739 case SEQUENCE_MOL_SEQ:
1740 s = "Molecular Sequence";
1743 s = "Sequence Names";
1745 case SEQUENCE_SYMBOL:
1746 s = "Sequence Symbols";
1749 s = "Taxonomy Codes";
1751 case TAXONOMY_SCIENTIFIC_NAME:
1752 s = "Scientific Names";
1755 s = "User Selected Data";
1758 final String label = _configuration.getClickToTitle( Configuration.get_ext_desc_data ) + " " + s;
1759 addClickToOption( Configuration.get_ext_desc_data, label );
1761 if ( default_option == Configuration.get_ext_desc_data ) {
1762 selected_index = cb_index;
1766 if ( getOptions().isEditable() ) {
1767 if ( _configuration.doDisplayClickToOption( Configuration.cut_subtree ) ) {
1768 _cut_subtree_item = cb_index;
1769 addClickToOption( Configuration.cut_subtree, _configuration.getClickToTitle( Configuration.cut_subtree ) );
1770 if ( default_option == Configuration.cut_subtree ) {
1771 selected_index = cb_index;
1775 if ( _configuration.doDisplayClickToOption( Configuration.copy_subtree ) ) {
1776 _copy_subtree_item = cb_index;
1777 addClickToOption( Configuration.copy_subtree,
1778 _configuration.getClickToTitle( Configuration.copy_subtree ) );
1779 if ( default_option == Configuration.copy_subtree ) {
1780 selected_index = cb_index;
1784 if ( _configuration.doDisplayClickToOption( Configuration.paste_subtree ) ) {
1785 _paste_subtree_item = cb_index;
1786 addClickToOption( Configuration.paste_subtree,
1787 _configuration.getClickToTitle( Configuration.paste_subtree ) );
1788 if ( default_option == Configuration.paste_subtree ) {
1789 selected_index = cb_index;
1793 if ( _configuration.doDisplayClickToOption( Configuration.delete_subtree_or_node ) ) {
1794 _delete_node_or_subtree_item = cb_index;
1795 addClickToOption( Configuration.delete_subtree_or_node,
1796 _configuration.getClickToTitle( Configuration.delete_subtree_or_node ) );
1797 if ( default_option == Configuration.delete_subtree_or_node ) {
1798 selected_index = cb_index;
1802 if ( _configuration.doDisplayClickToOption( Configuration.add_new_node ) ) {
1803 _add_new_node_item = cb_index;
1804 addClickToOption( Configuration.add_new_node,
1805 _configuration.getClickToTitle( Configuration.add_new_node ) );
1806 if ( default_option == Configuration.add_new_node ) {
1807 selected_index = cb_index;
1811 if ( _configuration.doDisplayClickToOption( Configuration.edit_node_data ) ) {
1812 _edit_node_data_item = cb_index;
1813 addClickToOption( Configuration.edit_node_data,
1814 _configuration.getClickToTitle( Configuration.edit_node_data ) );
1815 if ( default_option == Configuration.edit_node_data ) {
1816 selected_index = cb_index;
1820 if ( _configuration.doDisplayClickToOption( Configuration.select_nodes ) ) {
1821 _select_nodes_item = cb_index;
1822 addClickToOption( Configuration.select_nodes,
1823 _configuration.getClickToTitle( Configuration.select_nodes ) );
1824 if ( default_option == Configuration.select_nodes ) {
1825 selected_index = cb_index;
1830 // Set default selection and its action
1831 _click_to_combobox.setSelectedIndex( selected_index );
1832 setClickToAction( selected_index );
1835 private void setupDisplayCheckboxes() {
1836 if ( _configuration.doDisplayOption( Configuration.display_as_phylogram ) ) {
1837 addCheckbox( Configuration.display_as_phylogram,
1838 _configuration.getDisplayTitle( Configuration.display_as_phylogram ) );
1839 setCheckbox( Configuration.display_as_phylogram,
1840 _configuration.doCheckOption( Configuration.display_as_phylogram ) );
1842 if ( _configuration.doDisplayOption( Configuration.dynamically_hide_data ) ) {
1843 addCheckbox( Configuration.dynamically_hide_data,
1844 _configuration.getDisplayTitle( Configuration.dynamically_hide_data ) );
1845 setCheckbox( Configuration.dynamically_hide_data,
1846 _configuration.doCheckOption( Configuration.dynamically_hide_data ) );
1848 if ( _configuration.doDisplayOption( Configuration.node_data_popup ) ) {
1849 addCheckbox( Configuration.node_data_popup, _configuration.getDisplayTitle( Configuration.node_data_popup ) );
1850 setCheckbox( Configuration.node_data_popup, _configuration.doCheckOption( Configuration.node_data_popup ) );
1852 if ( _configuration.doDisplayOption( Configuration.display_internal_data ) ) {
1853 addCheckbox( Configuration.display_internal_data,
1854 _configuration.getDisplayTitle( Configuration.display_internal_data ) );
1855 setCheckbox( Configuration.display_internal_data,
1856 _configuration.doCheckOption( Configuration.display_internal_data ) );
1858 if ( _configuration.doDisplayOption( Configuration.color_according_to_species ) ) {
1859 addCheckbox( Configuration.color_according_to_species,
1860 _configuration.getDisplayTitle( Configuration.color_according_to_species ) );
1861 setCheckbox( Configuration.color_according_to_species,
1862 _configuration.doCheckOption( Configuration.color_according_to_species ) );
1864 if ( _configuration.doDisplayOption( Configuration.color_according_to_annotation ) ) {
1865 addCheckbox( Configuration.color_according_to_annotation,
1866 _configuration.getDisplayTitle( Configuration.color_according_to_annotation ) );
1867 setCheckbox( Configuration.color_according_to_annotation,
1868 _configuration.doCheckOption( Configuration.color_according_to_annotation ) );
1870 if ( _configuration.doDisplayOption( Configuration.color_branches ) ) {
1871 addCheckbox( Configuration.color_branches, _configuration.getDisplayTitle( Configuration.color_branches ) );
1872 setCheckbox( Configuration.color_branches, _configuration.doCheckOption( Configuration.color_branches ) );
1874 if ( _configuration.doDisplayOption( Configuration.width_branches ) ) {
1875 addCheckbox( Configuration.width_branches, _configuration.getDisplayTitle( Configuration.width_branches ) );
1876 setCheckbox( Configuration.width_branches, _configuration.doCheckOption( Configuration.width_branches ) );
1878 final JLabel label = new JLabel( "Display Data:" );
1879 label.setFont( ControlPanel.jcb_bold_font );
1880 if ( !getConfiguration().isUseNativeUI() ) {
1881 label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1884 if ( _configuration.doDisplayOption( Configuration.show_node_names ) ) {
1885 addCheckbox( Configuration.show_node_names, _configuration.getDisplayTitle( Configuration.show_node_names ) );
1886 setCheckbox( Configuration.show_node_names, _configuration.doCheckOption( Configuration.show_node_names ) );
1888 if ( _configuration.doDisplayOption( Configuration.show_tax_code ) ) {
1889 addCheckbox( Configuration.show_tax_code, _configuration.getDisplayTitle( Configuration.show_tax_code ) );
1890 setCheckbox( Configuration.show_tax_code, _configuration.doCheckOption( Configuration.show_tax_code ) );
1892 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_scientific_names ) ) {
1893 addCheckbox( Configuration.show_taxonomy_scientific_names,
1894 _configuration.getDisplayTitle( Configuration.show_taxonomy_scientific_names ) );
1895 setCheckbox( Configuration.show_taxonomy_scientific_names,
1896 _configuration.doCheckOption( Configuration.show_taxonomy_scientific_names ) );
1898 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_common_names ) ) {
1899 addCheckbox( Configuration.show_taxonomy_common_names,
1900 _configuration.getDisplayTitle( Configuration.show_taxonomy_common_names ) );
1901 setCheckbox( Configuration.show_taxonomy_common_names,
1902 _configuration.doCheckOption( Configuration.show_taxonomy_common_names ) );
1904 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_images ) ) {
1905 addCheckbox( Configuration.show_taxonomy_images,
1906 _configuration.getDisplayTitle( Configuration.show_taxonomy_images ) );
1907 setCheckbox( Configuration.show_taxonomy_images,
1908 _configuration.doCheckOption( Configuration.show_taxonomy_images ) );
1910 if ( _configuration.doDisplayOption( Configuration.show_gene_symbols ) ) {
1911 addCheckbox( Configuration.show_gene_symbols,
1912 _configuration.getDisplayTitle( Configuration.show_gene_symbols ) );
1913 setCheckbox( Configuration.show_gene_symbols,
1914 _configuration.doCheckOption( Configuration.show_gene_symbols ) );
1916 if ( _configuration.doDisplayOption( Configuration.show_gene_names ) ) {
1917 addCheckbox( Configuration.show_gene_names, _configuration.getDisplayTitle( Configuration.show_gene_names ) );
1918 setCheckbox( Configuration.show_gene_names, _configuration.doCheckOption( Configuration.show_gene_names ) );
1920 if ( _configuration.doDisplayOption( Configuration.show_sequence_acc ) ) {
1921 addCheckbox( Configuration.show_sequence_acc,
1922 _configuration.getDisplayTitle( Configuration.show_sequence_acc ) );
1923 setCheckbox( Configuration.show_sequence_acc,
1924 _configuration.doCheckOption( Configuration.show_sequence_acc ) );
1926 if ( _configuration.doDisplayOption( Configuration.show_annotation ) ) {
1927 addCheckbox( Configuration.show_annotation, _configuration.getDisplayTitle( Configuration.show_annotation ) );
1928 setCheckbox( Configuration.show_annotation, _configuration.doCheckOption( Configuration.show_annotation ) );
1930 if ( _configuration.doDisplayOption( Configuration.show_binary_characters ) ) {
1931 addCheckbox( Configuration.show_binary_characters,
1932 _configuration.getDisplayTitle( Configuration.show_binary_characters ) );
1933 setCheckbox( Configuration.show_binary_characters,
1934 _configuration.doCheckOption( Configuration.show_binary_characters ) );
1936 if ( _configuration.doDisplayOption( Configuration.show_binary_character_counts ) ) {
1937 addCheckbox( Configuration.show_binary_character_counts,
1938 _configuration.getDisplayTitle( Configuration.show_binary_character_counts ) );
1939 setCheckbox( Configuration.show_binary_character_counts,
1940 _configuration.doCheckOption( Configuration.show_binary_character_counts ) );
1942 if ( _configuration.doDisplayOption( Configuration.show_domain_architectures ) ) {
1943 addCheckbox( Configuration.show_domain_architectures,
1944 _configuration.getDisplayTitle( Configuration.show_domain_architectures ) );
1945 setCheckbox( Configuration.show_domain_architectures,
1946 _configuration.doCheckOption( Configuration.show_domain_architectures ) );
1948 if ( _configuration.doDisplayOption( Configuration.write_confidence_values ) ) {
1949 addCheckbox( Configuration.write_confidence_values,
1950 _configuration.getDisplayTitle( Configuration.write_confidence_values ) );
1951 setCheckbox( Configuration.write_confidence_values,
1952 _configuration.doCheckOption( Configuration.write_confidence_values ) );
1954 if ( _configuration.doDisplayOption( Configuration.write_events ) ) {
1955 addCheckbox( Configuration.write_events, _configuration.getDisplayTitle( Configuration.write_events ) );
1956 setCheckbox( Configuration.write_events, _configuration.doCheckOption( Configuration.write_events ) );
1958 if ( _configuration.doDisplayOption( Configuration.show_vector_data ) ) {
1959 addCheckbox( Configuration.show_vector_data,
1960 _configuration.getDisplayTitle( Configuration.show_vector_data ) );
1961 setCheckbox( Configuration.show_vector_data, _configuration.doCheckOption( Configuration.show_vector_data ) );
1963 if ( _configuration.doDisplayOption( Configuration.show_properties ) ) {
1964 addCheckbox( Configuration.show_properties, _configuration.getDisplayTitle( Configuration.show_properties ) );
1965 setCheckbox( Configuration.show_properties, _configuration.doCheckOption( Configuration.show_properties ) );
1969 private void setVisibilityOfDomainStrucureControls() {
1970 if ( _zoom_in_domain_structure != null ) {
1971 if ( isShowDomainArchitectures() ) {
1972 _domain_display_label.setVisible( true );
1973 _zoom_in_domain_structure.setVisible( true );
1974 _zoom_out_domain_structure.setVisible( true );
1975 _decr_domain_structure_evalue_thr.setVisible( true );
1976 _incr_domain_structure_evalue_thr.setVisible( true );
1977 _domain_structure_evalue_thr_tf.setVisible( true );
1980 _domain_display_label.setVisible( false );
1981 _zoom_in_domain_structure.setVisible( false );
1982 _zoom_out_domain_structure.setVisible( false );
1983 _decr_domain_structure_evalue_thr.setVisible( false );
1984 _incr_domain_structure_evalue_thr.setVisible( false );
1985 _domain_structure_evalue_thr_tf.setVisible( false );
1990 static JLabel customizeLabel( final JLabel label, final Configuration configuration ) {
1991 label.setFont( ControlPanel.jcb_bold_font );
1992 if ( !configuration.isUseNativeUI() ) {
1993 label.setForeground( configuration.getGuiCheckboxTextColor() );
1994 label.setBackground( configuration.getGuiBackgroundColor() );
1999 enum NodeClickAction {
2010 DELETE_NODE_OR_SUBTREE,