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.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 );
435 void showAnnotations() {
436 if ( _show_annotation != null ) {
437 _show_annotation.setSelected( true );
439 if ( _color_according_to_annotation != null ) {
440 _color_according_to_annotation.setSelected( true );
442 if ( _color_acc_species != null ) {
443 _color_acc_species.setSelected( false );
445 _mainpanel.getCurrentTreePanel().repaint();
449 * Add zoom and quick edit buttons. (Last modified 8/9/04)
452 final JLabel spacer = new JLabel( "" );
453 spacer.setOpaque( false );
455 final JPanel x_panel = new JPanel( new GridLayout( 1, 1, 0, 0 ) );
456 final JPanel y_panel = new JPanel( new GridLayout( 1, 3, 0, 0 ) );
457 final JPanel z_panel = new JPanel( new GridLayout( 1, 1, 0, 0 ) );
458 if ( !getConfiguration().isUseNativeUI() ) {
459 x_panel.setBackground( getBackground() );
460 y_panel.setBackground( getBackground() );
461 z_panel.setBackground( getBackground() );
463 add( _zoom_label = new JLabel( "Zoom:" ) );
464 customizeLabel( _zoom_label, getConfiguration() );
468 if ( getConfiguration().isUseNativeUI() ) {
469 _zoom_in_x = new JButton( "+" );
470 _zoom_out_x = new JButton( "-" );
473 _zoom_in_x = new JButton( "X+" );
474 _zoom_out_x = new JButton( "X-" );
476 _zoom_in_y = new JButton( "Y+" );
477 _zoom_out_y = new JButton( "Y-" );
478 _show_whole = new JButton( "F" );
479 _show_whole.setToolTipText( "To fit the complete phylogeny to the current display size [F or Home]" );
480 _zoom_in_x.setToolTipText( "To zoom in horizontally [Shift+cursor-right]" );
481 _zoom_in_y.setToolTipText( "To zoom in vertically [Shift+cursor-up]" );
482 _zoom_out_x.setToolTipText( "To zoom out horizontally [Shift+cursor-left]" );
483 _zoom_out_y.setToolTipText( "To zoom out vertically [Shift+cursor-down]" );
484 if ( getConfiguration().isUseNativeUI() && ForesterUtil.isMac() ) {
485 _zoom_out_x.setPreferredSize( new Dimension( 55, 10 ) );
486 _zoom_in_x.setPreferredSize( new Dimension( 55, 10 ) );
489 _zoom_out_x.setPreferredSize( new Dimension( 10, 10 ) );
490 _zoom_in_x.setPreferredSize( new Dimension( 10, 10 ) );
492 _zoom_out_y.setPreferredSize( new Dimension( 10, 10 ) );
493 _zoom_in_y.setPreferredSize( new Dimension( 10, 10 ) );
494 _show_whole.setPreferredSize( new Dimension( 10, 10 ) );
495 _return_to_super_tree = new JButton( RETURN_TO_SUPER_TREE_TEXT );
496 _return_to_super_tree.setEnabled( false );
497 _order = new JButton( "Order Subtrees" );
498 _uncollapse_all = new JButton( "Uncollapse All" );
499 addJButton( _zoom_in_y, x_panel );
500 addJButton( _zoom_out_x, y_panel );
501 addJButton( _show_whole, y_panel );
502 addJButton( _zoom_in_x, y_panel );
503 addJButton( _zoom_out_y, z_panel );
504 if ( getConfiguration().doDisplayOption( Configuration.show_domain_architectures ) ) {
505 setUpControlsForDomainStrucures();
507 final JLabel spacer2 = new JLabel( "" );
509 addJButton( _return_to_super_tree, this );
510 addJButton( _order, this );
511 addJButton( _uncollapse_all, this );
512 final JLabel spacer3 = new JLabel( "" );
514 setVisibilityOfDomainStrucureControls();
517 void addCheckbox( final int which, final String title ) {
518 final JPanel ch_panel = new JPanel( new BorderLayout( 0, 0 ) );
520 case Configuration.display_as_phylogram:
521 _display_as_phylogram_cb = new JCheckBox( title );
522 getDisplayAsPhylogramCb().setToolTipText( "To switch between phylogram and cladogram display" );
523 addJCheckBox( getDisplayAsPhylogramCb(), ch_panel );
526 case Configuration.display_internal_data:
527 _display_internal_data = new JCheckBox( title );
528 _display_internal_data.setToolTipText( "To allow or disallow display of internal labels" );
529 addJCheckBox( _display_internal_data, ch_panel );
532 case Configuration.color_according_to_species:
533 _color_acc_species = new JCheckBox( title );
535 .setToolTipText( "To colorize taxonomy and sequence labels as a function of taxonomy" );
536 addJCheckBox( _color_acc_species, ch_panel );
539 case Configuration.color_according_to_annotation:
540 _color_according_to_annotation = new JCheckBox( title );
541 _color_according_to_annotation
542 .setToolTipText( "To colorize sequence annotation labels as a function of sequence annotation" );
543 addJCheckBox( _color_according_to_annotation, ch_panel );
546 case Configuration.show_node_names:
547 _show_node_names = new JCheckBox( title );
548 addJCheckBox( _show_node_names, ch_panel );
551 case Configuration.show_taxonomy_scientific_names:
552 _show_taxo_scientific_names = new JCheckBox( title );
553 addJCheckBox( _show_taxo_scientific_names, ch_panel );
556 case Configuration.show_taxonomy_common_names:
557 _show_taxo_common_names = new JCheckBox( title );
558 addJCheckBox( _show_taxo_common_names, ch_panel );
561 case Configuration.show_tax_code:
562 _show_taxo_code = new JCheckBox( title );
563 addJCheckBox( _show_taxo_code, ch_panel );
566 case Configuration.show_taxonomy_images:
567 _show_taxo_images_cb = new JCheckBox( title );
568 addJCheckBox( _show_taxo_images_cb, ch_panel );
571 case Configuration.show_binary_characters:
572 _show_binary_characters = new JCheckBox( title );
573 addJCheckBox( _show_binary_characters, ch_panel );
576 case Configuration.show_annotation:
577 _show_annotation = new JCheckBox( title );
578 addJCheckBox( _show_annotation, ch_panel );
581 case Configuration.show_binary_character_counts:
582 _show_binary_character_counts = new JCheckBox( title );
583 addJCheckBox( _show_binary_character_counts, ch_panel );
586 case Configuration.write_confidence_values:
587 _write_confidence = new JCheckBox( title );
588 addJCheckBox( getWriteConfidenceCb(), ch_panel );
591 case Configuration.write_events:
592 _show_events = new JCheckBox( title );
593 addJCheckBox( getShowEventsCb(), ch_panel );
596 case Configuration.color_branches:
597 _color_branches_cb = new JCheckBox( title );
598 getColorBranchesCb().setToolTipText( "To use branch color values, if present" );
599 addJCheckBox( getColorBranchesCb(), ch_panel );
602 case Configuration.width_branches:
603 _width_branches = new JCheckBox( title );
604 _width_branches.setToolTipText( "To use branch width values, if present" );
605 addJCheckBox( _width_branches, ch_panel );
608 case Configuration.show_domain_architectures:
609 _show_domain_architectures = new JCheckBox( title );
610 addJCheckBox( _show_domain_architectures, ch_panel );
613 case Configuration.show_gene_names:
614 _show_gene_names = new JCheckBox( title );
615 addJCheckBox( _show_gene_names, ch_panel );
618 case Configuration.show_gene_symbols:
619 _show_gene_symbols = new JCheckBox( title );
620 addJCheckBox( _show_gene_symbols, ch_panel );
623 case Configuration.show_sequence_acc:
624 _show_sequence_acc = new JCheckBox( title );
625 addJCheckBox( _show_sequence_acc, ch_panel );
628 case Configuration.dynamically_hide_data:
629 _dynamically_hide_data = new JCheckBox( title );
630 getDynamicallyHideData().setToolTipText( "To hide labels depending on likely visibility" );
631 addJCheckBox( getDynamicallyHideData(), ch_panel );
634 case Configuration.node_data_popup:
635 _node_desc_popup_cb = new JCheckBox( title );
636 getNodeDescPopupCb().setToolTipText( "To enable mouse rollover display of basic node data" );
637 addJCheckBox( getNodeDescPopupCb(), ch_panel );
640 case Configuration.show_relation_confidence:
641 _seq_relation_confidence_switch = new JCheckBox( title );
642 addJCheckBox( _seq_relation_confidence_switch, ch_panel );
645 case Configuration.show_vector_data:
646 _show_vector_data_cb = new JCheckBox( title );
647 addJCheckBox( _show_vector_data_cb, ch_panel );
650 case Configuration.show_properties:
651 _show_properties_cb = new JCheckBox( title );
652 addJCheckBox( _show_properties_cb, ch_panel );
656 throw new RuntimeException( "unknown checkbox: " + which );
660 void addJButton( final JButton jb, final JPanel p ) {
661 jb.setFocusPainted( false );
662 jb.setFont( ControlPanel.jcb_font );
663 if ( !_configuration.isUseNativeUI() ) {
664 jb.setBorder( BorderFactory.createLineBorder( getConfiguration().getGuiButtonBorderColor() ) );
665 jb.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
666 jb.setForeground( getConfiguration().getGuiButtonTextColor() );
669 jb.addActionListener( this );
672 void addJCheckBox( final JCheckBox jcb, final JPanel p ) {
673 jcb.setFocusPainted( false );
674 jcb.setFont( ControlPanel.jcb_font );
675 if ( !_configuration.isUseNativeUI() ) {
676 jcb.setBackground( getConfiguration().getGuiBackgroundColor() );
677 jcb.setForeground( getConfiguration().getGuiCheckboxTextColor() );
679 p.add( jcb, "Center" );
680 jcb.addActionListener( this );
683 void addJTextField( final JTextField tf, final JPanel p ) {
684 if ( !_configuration.isUseNativeUI() ) {
685 tf.setForeground( getConfiguration().getGuiBackgroundColor() );
686 tf.setFont( ControlPanel.jcb_font );
689 tf.addActionListener( this );
692 void deactivateButtonToReturnToSuperTree() {
693 _return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT );
694 _return_to_super_tree.setForeground( getConfiguration().getGuiButtonTextColor() );
695 _return_to_super_tree.setEnabled( false );
698 void displayedPhylogenyMightHaveChanged( final boolean recalc_longest_ext_node_info ) {
699 if ( ( _mainpanel != null )
700 && ( ( _mainpanel.getCurrentPhylogeny() != null ) && !_mainpanel.getCurrentPhylogeny().isEmpty() ) ) {
701 if ( getOptions().isShowOverview() ) {
702 _mainpanel.getCurrentTreePanel().updateOvSizes();
704 _mainpanel.getCurrentTreePanel().recalculateMaxDistanceToRoot();
705 setVisibilityOfDomainStrucureControls();
706 updateDomainStructureEvaluethresholdDisplay();
707 _mainpanel.getCurrentTreePanel().calculateScaleDistance();
708 _mainpanel.getCurrentTreePanel().calcMaxDepth();
709 _mainpanel.adjustJScrollPane();
710 if ( recalc_longest_ext_node_info ) {
711 _mainpanel.getCurrentTreePanel().initNodeData();
712 _mainpanel.getCurrentTreePanel().calculateLongestExtNodeInfo();
714 _mainpanel.getCurrentTreePanel().repaint();
715 // _mainpanel.getCurrentTreePanel().setUpUrtFactors();
719 void endClickToOptions() {
720 _click_to_combobox.addActionListener( this );
724 * Indicates what action should be execute when a node is clicked
726 * @return the click-on action
728 NodeClickAction getActionWhenNodeClicked() {
729 return _action_when_node_clicked;
732 Map<Integer, String> getAllClickToItems() {
733 return _all_click_to_names;
736 Map<String, Color> getAnnotationColors() {
737 return _annotation_colors;
740 Configuration getConfiguration() {
741 return _configuration;
744 TreePanel getCurrentTreePanel() {
745 return getMainPanel().getCurrentTreePanel();
748 MainPanel getMainPanel() {
752 Options getOptions() {
753 return getMainPanel().getOptions();
756 JTextField getSearchTextField() {
760 List<String> getSingleClickToNames() {
761 return _click_to_names;
764 Map<String, Color> getSpeciesColors() {
765 return _species_colors;
768 boolean isAntialiasScreenText() {
772 boolean isColorAccordingToAnnotation() {
773 return ( ( _color_according_to_annotation != null ) && _color_according_to_annotation.isSelected() );
776 boolean isColorAccordingToTaxonomy() {
777 return ( ( _color_acc_species != null ) && _color_acc_species.isSelected() );
780 boolean isColorBranches() {
781 return ( ( ( getColorBranchesCb() != null ) && getColorBranchesCb().isSelected() ) || ( ( getColorBranchesCb() == null ) && _color_branches ) );
784 boolean isDrawPhylogram() {
785 return isDrawPhylogram( getMainPanel().getCurrentTabIndex() );
788 boolean isDynamicallyHideData() {
789 return ( ( getDynamicallyHideData() != null ) && getDynamicallyHideData().isSelected() );
793 return ( ( getShowEventsCb() != null ) && getShowEventsCb().isSelected() );
796 boolean isNodeDescPopup() {
797 return ( ( getNodeDescPopupCb() != null ) && getNodeDescPopupCb().isSelected() );
800 boolean isShowAnnotation() {
801 return ( ( _show_annotation != null ) && _show_annotation.isSelected() );
804 boolean isShowBinaryCharacterCounts() {
805 return ( ( _show_binary_character_counts != null ) && _show_binary_character_counts.isSelected() );
808 boolean isShowBinaryCharacters() {
809 return ( ( _show_binary_characters != null ) && _show_binary_characters.isSelected() );
812 boolean isShowConfidenceValues() {
813 return ( ( getWriteConfidenceCb() != null ) && getWriteConfidenceCb().isSelected() );
816 boolean isShowDomainArchitectures() {
817 return ( ( _show_domain_architectures != null ) && _show_domain_architectures.isSelected() );
820 boolean isShowGeneNames() {
821 return ( ( _show_gene_names != null ) && _show_gene_names.isSelected() );
824 boolean isShowGeneSymbols() {
825 return ( ( _show_gene_symbols != null ) && _show_gene_symbols.isSelected() );
828 boolean isShowInternalData() {
829 return ( ( _display_internal_data == null ) || _display_internal_data.isSelected() );
832 boolean isShowNodeNames() {
833 return ( ( _show_node_names != null ) && _show_node_names.isSelected() );
836 boolean isShowSequenceAcc() {
837 return ( ( _show_sequence_acc != null ) && _show_sequence_acc.isSelected() );
840 boolean isShowSequenceRelationConfidence() {
841 return ( ( _seq_relation_confidence_switch != null ) && ( _seq_relation_confidence_switch.isSelected() ) );
844 boolean isShowSequenceRelations() {
845 return ( ( _show_sequence_relations != null ) && ( _show_sequence_relations.getSelectedIndex() > 0 ) );
848 boolean isShowTaxonomyCode() {
849 return ( ( _show_taxo_code != null ) && _show_taxo_code.isSelected() );
852 boolean isShowTaxonomyCommonNames() {
853 return ( ( _show_taxo_common_names != null ) && _show_taxo_common_names.isSelected() );
856 boolean isShowTaxonomyScientificNames() {
857 return ( ( _show_taxo_scientific_names != null ) && _show_taxo_scientific_names.isSelected() );
860 boolean isWidthBranches() {
861 return ( ( _width_branches != null ) && _width_branches.isSelected() );
864 void phylogenyAdded( final Configuration configuration ) {
865 getIsDrawPhylogramList().add( configuration.isDrawAsPhylogram() );
868 void phylogenyRemoved( final int index ) {
869 getIsDrawPhylogramList().remove( index );
873 final MainPanel main_panel = getMainPanel();
874 final Phylogeny tree = main_panel.getCurrentPhylogeny();
875 if ( ( tree == null ) || tree.isEmpty() ) {
878 String query = getSearchTextField().getText();
879 if ( query != null ) {
880 query = query.trim();
883 getSearchFoundCountsLabel().setVisible( false );
884 getSearchResetButton().setEnabled( false );
885 getSearchResetButton().setVisible( false );
888 if ( !ForesterUtil.isEmpty( query ) ) {
889 search( main_panel, tree, query );
892 getSearchFoundCountsLabel().setVisible( false );
893 getSearchResetButton().setEnabled( false );
894 getSearchResetButton().setVisible( false );
899 void setActionWhenNodeClicked( final NodeClickAction action ) {
900 _action_when_node_clicked = action;
903 void setAnnotationColors( final Map<String, Color> annotation_colors ) {
904 _annotation_colors = annotation_colors;
907 void setCheckbox( final int which, final boolean state ) {
909 case Configuration.display_as_phylogram:
910 if ( getDisplayAsPhylogramCb() != null ) {
911 getDisplayAsPhylogramCb().setSelected( state );
914 case Configuration.display_internal_data:
915 if ( _display_internal_data != null ) {
916 _display_internal_data.setSelected( state );
919 case Configuration.color_according_to_species:
920 if ( _color_acc_species != null ) {
921 _color_acc_species.setSelected( state );
924 case Configuration.color_according_to_annotation:
925 if ( _color_according_to_annotation != null ) {
926 _color_according_to_annotation.setSelected( state );
929 case Configuration.show_node_names:
930 if ( _show_node_names != null ) {
931 _show_node_names.setSelected( state );
934 case Configuration.show_taxonomy_scientific_names:
935 if ( _show_taxo_scientific_names != null ) {
936 _show_taxo_scientific_names.setSelected( state );
939 case Configuration.show_taxonomy_common_names:
940 if ( _show_taxo_common_names != null ) {
941 _show_taxo_common_names.setSelected( state );
944 case Configuration.show_tax_code:
945 if ( _show_taxo_code != null ) {
946 _show_taxo_code.setSelected( state );
949 case Configuration.show_taxonomy_images:
950 if ( _show_taxo_images_cb != null ) {
951 _show_taxo_images_cb.setSelected( state );
954 case Configuration.show_annotation:
955 if ( _show_annotation != null ) {
956 _show_annotation.setSelected( state );
959 case Configuration.show_binary_characters:
960 if ( _show_binary_characters != null ) {
961 _show_binary_characters.setSelected( state );
964 case Configuration.show_binary_character_counts:
965 if ( _show_binary_character_counts != null ) {
966 _show_binary_character_counts.setSelected( state );
969 case Configuration.write_confidence_values:
970 if ( getWriteConfidenceCb() != null ) {
971 getWriteConfidenceCb().setSelected( state );
974 case Configuration.write_events:
975 if ( getShowEventsCb() != null ) {
976 getShowEventsCb().setSelected( state );
979 case Configuration.color_branches:
980 if ( getColorBranchesCb() != null ) {
981 getColorBranchesCb().setSelected( state );
984 case Configuration.width_branches:
985 if ( _width_branches != null ) {
986 _width_branches.setSelected( state );
989 case Configuration.show_domain_architectures:
990 if ( _show_domain_architectures != null ) {
991 _show_domain_architectures.setSelected( state );
994 case Configuration.show_gene_names:
995 if ( _show_gene_names != null ) {
996 _show_gene_names.setSelected( state );
999 case Configuration.show_gene_symbols:
1000 if ( _show_gene_symbols != null ) {
1001 _show_gene_symbols.setSelected( state );
1004 case Configuration.show_vector_data:
1005 if ( _show_vector_data_cb != null ) {
1006 _show_vector_data_cb.setSelected( state );
1009 case Configuration.show_properties:
1010 if ( _show_properties_cb != null ) {
1011 _show_properties_cb.setSelected( state );
1014 case Configuration.show_sequence_acc:
1015 if ( _show_sequence_acc != null ) {
1016 _show_sequence_acc.setSelected( state );
1019 case Configuration.dynamically_hide_data:
1020 if ( getDynamicallyHideData() != null ) {
1021 getDynamicallyHideData().setSelected( state );
1024 case Configuration.node_data_popup:
1025 if ( getNodeDescPopupCb() != null ) {
1026 getNodeDescPopupCb().setSelected( state );
1030 case Configuration.show_relation_confidence:
1031 if ( _seq_relation_confidence_switch != null ) {
1032 _seq_relation_confidence_switch.setSelected( state );
1037 throw new AssertionError( "unknown checkbox: " + which );
1042 * Set this checkbox state. Not all checkboxes have been instantiated
1043 * depending on the config.
1045 void setCheckbox( final JCheckBox cb, final boolean state ) {
1047 cb.setSelected( state );
1051 void setClickToAction( final int action ) {
1052 // Set click-to action
1053 if ( action == _show_data_item ) {
1054 setActionWhenNodeClicked( NodeClickAction.SHOW_DATA );
1056 else if ( action == _collapse_cb_item ) {
1057 setActionWhenNodeClicked( NodeClickAction.COLLAPSE );
1059 else if ( action == _reroot_cb_item ) {
1060 setActionWhenNodeClicked( NodeClickAction.REROOT );
1062 else if ( action == _subtree_cb_item ) {
1063 setActionWhenNodeClicked( NodeClickAction.SUBTREE );
1065 else if ( action == _swap_cb_item ) {
1066 setActionWhenNodeClicked( NodeClickAction.SWAP );
1068 else if ( action == _color_subtree_cb_item ) {
1069 setActionWhenNodeClicked( NodeClickAction.COLOR_SUBTREE );
1071 else if ( action == _open_seq_web_item ) {
1072 setActionWhenNodeClicked( NodeClickAction.OPEN_SEQ_WEB );
1074 else if ( action == _sort_descendents_item ) {
1075 setActionWhenNodeClicked( NodeClickAction.SORT_DESCENDENTS );
1077 else if ( action == _blast_item ) {
1078 setActionWhenNodeClicked( NodeClickAction.BLAST );
1080 else if ( action == _open_tax_web_item ) {
1081 setActionWhenNodeClicked( NodeClickAction.OPEN_TAX_WEB );
1083 else if ( action == _cut_subtree_item ) {
1084 setActionWhenNodeClicked( NodeClickAction.CUT_SUBTREE );
1086 else if ( action == _copy_subtree_item ) {
1087 setActionWhenNodeClicked( NodeClickAction.COPY_SUBTREE );
1089 else if ( action == _delete_node_or_subtree_item ) {
1090 setActionWhenNodeClicked( NodeClickAction.DELETE_NODE_OR_SUBTREE );
1092 else if ( action == _paste_subtree_item ) {
1093 setActionWhenNodeClicked( NodeClickAction.PASTE_SUBTREE );
1095 else if ( action == _add_new_node_item ) {
1096 setActionWhenNodeClicked( NodeClickAction.ADD_NEW_NODE );
1098 else if ( action == _edit_node_data_item ) {
1099 setActionWhenNodeClicked( NodeClickAction.EDIT_NODE_DATA );
1101 else if ( action == _select_nodes_item ) {
1102 setActionWhenNodeClicked( NodeClickAction.SELECT_NODES );
1104 else if ( action == _get_ext_desc_data ) {
1105 setActionWhenNodeClicked( NodeClickAction.GET_EXT_DESC_DATA );
1108 throw new RuntimeException( "unknown action: " + action );
1110 // make sure drop down is displaying the correct action
1111 // in case this was called from outside the class
1112 _click_to_combobox.setSelectedIndex( action );
1115 void setColorBranches( final boolean color_branches ) {
1116 _color_branches = color_branches;
1119 void setDrawPhylogram( final boolean b ) {
1120 getDisplayAsPhylogramCb().setSelected( b );
1121 setDrawPhylogram( getMainPanel().getCurrentTabIndex(), b );
1124 void setDrawPhylogramEnabled( final boolean b ) {
1125 getDisplayAsPhylogramCb().setEnabled( b );
1128 void setDynamicHidingIsOn( final boolean is_on ) {
1129 // if ( !_configuration.isUseNativeUI() ) {
1131 getDynamicallyHideData().setForeground( getConfiguration().getGuiCheckboxAndButtonActiveColor() );
1134 if ( !_configuration.isUseNativeUI() ) {
1135 getDynamicallyHideData().setForeground( getConfiguration().getGuiButtonTextColor() );
1138 getDynamicallyHideData().setForeground( Color.BLACK );
1144 void setShowEvents( final boolean show_events ) {
1145 if ( getShowEventsCb() == null ) {
1146 _show_events = new JCheckBox( "" );
1148 getShowEventsCb().setSelected( show_events );
1151 void setSpeciesColors( final Map<String, Color> species_colors ) {
1152 _species_colors = species_colors;
1157 * Set up the controls from the config settings. 11/26/05
1159 void setupControls() {
1160 // The tree display options:
1161 setupDisplayCheckboxes();
1163 // The sequence relation query selection combo-box
1164 if ( _configuration.displaySequenceRelations() ) {
1165 addSequenceRelationBlock();
1169 startClickToOptions();
1170 setupClickToOptions();
1171 endClickToOptions();
1172 // Zoom and quick edit buttons
1177 void setUpControlsForDomainStrucures() {
1178 _domain_display_label = new JLabel( "Domain Display:" );
1179 add( customizeLabel( _domain_display_label, getConfiguration() ) );
1180 add( _domain_display_label );
1181 _zoom_in_domain_structure = new JButton( "d+" );
1182 _zoom_out_domain_structure = new JButton( "d-" );
1183 _decr_domain_structure_evalue_thr = new JButton( "-" );
1184 _incr_domain_structure_evalue_thr = new JButton( "+" );
1185 _zoom_in_domain_structure.setPreferredSize( new Dimension( 10, 10 ) );
1186 _zoom_out_domain_structure.setPreferredSize( new Dimension( 10, 10 ) );
1187 _decr_domain_structure_evalue_thr.setPreferredSize( new Dimension( 10, 10 ) );
1188 _incr_domain_structure_evalue_thr.setPreferredSize( new Dimension( 10, 10 ) );
1189 _incr_domain_structure_evalue_thr.setToolTipText( "Increase the E-value threshold by a factor of 10" );
1190 _decr_domain_structure_evalue_thr.setToolTipText( "Decrease the E-value threshold by a factor of 10" );
1191 _domain_structure_evalue_thr_tf = new JTextField( 3 );
1192 _domain_structure_evalue_thr_tf.setEditable( false );
1193 if ( !getConfiguration().isUseNativeUI() ) {
1194 _domain_structure_evalue_thr_tf.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
1195 _domain_structure_evalue_thr_tf.setBackground( getConfiguration().getGuiCheckboxTextColor() );
1196 _domain_structure_evalue_thr_tf.setBorder( null );
1198 final JPanel d1_panel = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
1199 final JPanel d2_panel = new JPanel( new GridLayout( 1, 3, 0, 0 ) );
1200 if ( !_configuration.isUseNativeUI() ) {
1201 d1_panel.setBackground( getBackground() );
1202 d2_panel.setBackground( getBackground() );
1206 addJButton( _zoom_out_domain_structure, d1_panel );
1207 addJButton( _zoom_in_domain_structure, d1_panel );
1208 addJButton( _decr_domain_structure_evalue_thr, d2_panel );
1209 addJTextField( _domain_structure_evalue_thr_tf, d2_panel );
1210 addJButton( _incr_domain_structure_evalue_thr, d2_panel );
1213 void setupSearchTools() {
1214 final String tip = "Enter text to search for. Use ',' for multiple searches (logical OR) and '+' for logical AND.";
1215 final JLabel search_label = new JLabel( "Search:" );
1216 search_label.setFont( ControlPanel.jcb_bold_font );
1217 if ( !getConfiguration().isUseNativeUI() ) {
1218 search_label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1220 add( search_label );
1221 search_label.setToolTipText( tip );
1222 _search_found_label = new JLabel();
1223 getSearchFoundCountsLabel().setVisible( false );
1224 _search_found_label.setFont( ControlPanel.jcb_bold_font );
1225 if ( !getConfiguration().isUseNativeUI() ) {
1226 _search_found_label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1228 _search_tf = new JTextField( 3 );
1229 _search_tf.setToolTipText( tip );
1230 _search_tf.setEditable( true );
1231 if ( !getConfiguration().isUseNativeUI() ) {
1232 _search_tf.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
1233 _search_tf.setBackground( getConfiguration().getGuiCheckboxTextColor() );
1234 _search_tf.setBorder( null );
1236 _search_reset_button = new JButton();
1237 getSearchResetButton().setText( "Reset" );
1238 getSearchResetButton().setEnabled( false );
1239 getSearchResetButton().setVisible( false );
1240 final JPanel s_panel_1 = new JPanel( new BorderLayout() );
1241 final JPanel s_panel_2 = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
1242 s_panel_1.setBackground( getBackground() );
1244 s_panel_2.setBackground( getBackground() );
1246 final KeyAdapter key_adapter = new KeyAdapter() {
1249 public void keyReleased( final KeyEvent key_event ) {
1251 displayedPhylogenyMightHaveChanged( true );
1254 final ActionListener action_listener = new ActionListener() {
1257 public void actionPerformed( final ActionEvent e ) {
1259 setSearchFoundCountsOnLabel( 0 );
1260 getSearchFoundCountsLabel().setVisible( false );
1261 getSearchTextField().setText( "" );
1262 getSearchResetButton().setEnabled( false );
1263 getSearchResetButton().setVisible( false );
1264 displayedPhylogenyMightHaveChanged( true );
1267 _search_reset_button.addActionListener( action_listener );
1268 _search_tf.addKeyListener( key_adapter );
1269 addJTextField( _search_tf, s_panel_1 );
1270 s_panel_2.add( _search_found_label );
1271 addJButton( _search_reset_button, s_panel_2 );
1275 * Fit entire tree into window.
1278 if ( ( _mainpanel.getCurrentScrollPane() == null ) || _mainpanel.getCurrentTreePanel().getPhylogeny().isEmpty() ) {
1281 getCurrentTreePanel().updateSetOfCollapsedExternalNodes();
1282 displayedPhylogenyMightHaveChanged( true );
1283 _mainpanel.getCurrentTreePanel().updateOvSettings();
1284 _mainpanel.getCurrentTreePanel().validate();
1285 _mainpanel.validate();
1286 _mainpanel.getCurrentTreePanel().calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
1287 _mainpanel.getSizeOfViewport().height,
1289 _mainpanel.getCurrentTreePanel().resetPreferredSize();
1290 _mainpanel.adjustJScrollPane();
1291 _mainpanel.getCurrentTreePanel().repaint();
1292 _mainpanel.getCurrentTreePanel().validate();
1293 _mainpanel.validate();
1294 _mainpanel.getCurrentTreePanel().calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
1295 _mainpanel.getSizeOfViewport().height,
1297 _mainpanel.getCurrentTreePanel().resetPreferredSize();
1298 _mainpanel.adjustJScrollPane();
1299 _mainpanel.getCurrentTreePanel().repaint();
1300 _mainpanel.getCurrentTreePanel().updateOvSizes();
1303 void showWholeAll() {
1304 for( final TreePanel tree_panel : _mainpanel.getTreePanels() ) {
1305 if ( tree_panel != null ) {
1306 tree_panel.validate();
1307 tree_panel.calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
1308 _mainpanel.getSizeOfViewport().height,
1310 tree_panel.resetPreferredSize();
1311 tree_panel.repaint();
1316 // Create header for click-to combo box.
1317 void startClickToOptions() {
1318 final JLabel spacer = new JLabel( "" );
1319 spacer.setFont( ControlPanel.jcb_font );
1321 _click_to_label = new JLabel( "Click on Node to:" );
1322 add( customizeLabel( _click_to_label, getConfiguration() ) );
1323 _click_to_combobox = new JComboBox();
1324 _click_to_combobox.setFocusable( false );
1325 _click_to_combobox.setMaximumRowCount( 14 );
1326 _click_to_combobox.setFont( ControlPanel.js_font );
1327 if ( !_configuration.isUseNativeUI() ) {
1328 _click_to_combobox.setBackground( getConfiguration().getGuiBackgroundColor() );
1330 // don't add listener until all items are set (or each one will trigger
1332 // click_to_list.addActionListener(this);
1333 add( _click_to_combobox );
1334 // Correlates option names to titles
1335 _all_click_to_names = new HashMap<Integer, String>();
1336 _click_to_names = new ArrayList<String>();
1340 if ( getMainPanel().getTabbedPane().getTabCount() > 0 ) {
1341 if ( getCurrentTreePanel().isPhyHasBranchLengths()
1342 && ( getCurrentTreePanel().getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) {
1343 setDrawPhylogramEnabled( true );
1344 setDrawPhylogram( isDrawPhylogram() );
1347 setDrawPhylogramEnabled( false );
1348 setDrawPhylogram( false );
1350 if ( getMainPanel().getMainFrame() == null ) {
1351 // Must be "E" applet version.
1352 final ArchaeopteryxE e = ( ArchaeopteryxE ) ( ( MainPanelApplets ) getMainPanel() ).getApplet();
1353 e.setSelectedTypeInTypeMenu( e.getCurrentTreePanel().getPhylogenyGraphicsType() );
1356 getMainPanel().getMainFrame().setSelectedTypeInTypeMenu( getMainPanel().getCurrentTreePanel()
1357 .getPhylogenyGraphicsType() );
1359 getMainPanel().getCurrentTreePanel().updateSubSuperTreeButton();
1360 getMainPanel().getControlPanel().search();
1361 getSequenceRelationTypeBox().removeAllItems();
1362 for( final SequenceRelation.SEQUENCE_RELATION_TYPE type : getMainPanel().getCurrentPhylogeny()
1363 .getRelevantSequenceRelationTypes() ) {
1364 _sequence_relation_type_box.addItem( type );
1366 //setSequenceRelationQueries( getMainPanel().getCurrentPhylogeny().getSequenceRelationQueries() );
1367 // according to GUILHEM the line above can be removed.
1372 * Uncollapse all nodes.
1374 void uncollapseAll( final TreePanel tp ) {
1375 final Phylogeny t = tp.getPhylogeny();
1376 if ( ( t != null ) && !t.isEmpty() ) {
1377 for( final PhylogenyNodeIterator iter = t.iteratorPreorder(); iter.hasNext(); ) {
1378 final PhylogenyNode node = iter.next();
1379 node.setCollapse( false );
1381 tp.resetNodeIdToDistToLeafMap();
1382 tp.updateSetOfCollapsedExternalNodes();
1383 t.recalculateNumberOfExternalDescendants( false );
1384 tp.setNodeInPreorderToNull();
1385 t.clearHashIdToNodeMap();
1390 void updateDomainStructureEvaluethresholdDisplay() {
1391 if ( _domain_structure_evalue_thr_tf != null ) {
1392 _domain_structure_evalue_thr_tf.setText( "10^"
1393 + getMainPanel().getCurrentTreePanel().getDomainStructureEvalueThreshold() );
1397 void zoomInX( final float factor, final float x_correction_factor ) {
1398 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar();
1399 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1400 treepanel.multiplyUrtFactor( 1f );
1401 if ( ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
1402 || ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
1403 || isDrawPhylogram( getMainPanel().getCurrentTabIndex() )
1404 || ( getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP ) ) {
1405 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1406 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
1407 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
1408 getMainPanel().adjustJScrollPane();
1409 treepanel.resetPreferredSize();
1410 getMainPanel().getCurrentScrollPane().getViewport().validate();
1411 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1412 - ( sb.getVisibleAmount() / 2.0 ) ) );
1415 final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue();
1416 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
1417 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
1418 getMainPanel().adjustJScrollPane();
1419 treepanel.resetPreferredSize();
1420 getMainPanel().getCurrentScrollPane().getViewport().validate();
1421 sb.setValue( sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount() );
1423 treepanel.resetPreferredSize();
1424 treepanel.updateOvSizes();
1427 void zoomInY( final float factor ) {
1428 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getVerticalScrollBar();
1429 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1430 treepanel.multiplyUrtFactor( 1.1f );
1431 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1432 treepanel.setYdistance( ( treepanel.getYdistance() * factor ) );
1433 getMainPanel().adjustJScrollPane();
1434 treepanel.resetPreferredSize();
1435 getMainPanel().getCurrentScrollPane().getViewport().validate();
1436 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1437 - ( sb.getVisibleAmount() / 2.0 ) ) );
1438 treepanel.resetPreferredSize();
1439 treepanel.updateOvSizes();
1442 void zoomOutX( final float factor, final float x_correction_factor ) {
1443 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1444 treepanel.multiplyUrtFactor( 1f );
1445 if ( ( treepanel.getXdistance() * factor ) > 0.0 ) {
1446 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar();
1447 if ( ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
1448 || ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
1449 || isDrawPhylogram( getMainPanel().getCurrentTabIndex() )
1450 || ( getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP ) ) {
1451 getMainPanel().adjustJScrollPane();
1452 treepanel.resetPreferredSize();
1453 getMainPanel().getCurrentScrollPane().getViewport().validate();
1454 final double x = ( sb.getMaximum() - sb.getMinimum() )
1455 / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1456 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
1457 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
1458 getMainPanel().adjustJScrollPane();
1459 treepanel.resetPreferredSize();
1460 getMainPanel().getCurrentScrollPane().getViewport().validate();
1461 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1462 - ( sb.getVisibleAmount() / 2.0 ) ) );
1465 final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue();
1466 treepanel.setXdistance( treepanel.getXdistance() * factor );
1467 treepanel.setXcorrectionFactor( treepanel.getXcorrectionFactor() * x_correction_factor );
1469 getMainPanel().adjustJScrollPane();
1470 treepanel.resetPreferredSize();
1471 getMainPanel().getCurrentScrollPane().getViewport().validate();
1472 sb.setValue( sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount() );
1475 treepanel.resetPreferredSize();
1476 treepanel.updateOvSizes();
1480 void zoomOutY( final float factor ) {
1481 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1482 treepanel.multiplyUrtFactor( 0.9f );
1483 if ( ( treepanel.getYdistance() * factor ) > 0.0 ) {
1484 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getVerticalScrollBar();
1485 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1486 treepanel.setYdistance( ( treepanel.getYdistance() * factor ) );
1487 getMainPanel().adjustJScrollPane();
1488 treepanel.resetPreferredSize();
1489 getMainPanel().getCurrentScrollPane().getViewport().validate();
1490 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1491 - ( sb.getVisibleAmount() / 2.0 ) ) );
1492 treepanel.resetPreferredSize();
1493 treepanel.updateOvSizes();
1497 private void addClickToOption( final int which, final String title ) {
1498 _click_to_combobox.addItem( title );
1499 _click_to_names.add( title );
1500 _all_click_to_names.put( new Integer( which ), title );
1501 if ( !_configuration.isUseNativeUI() ) {
1502 _click_to_combobox.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
1503 _click_to_combobox.setForeground( getConfiguration().getGuiButtonTextColor() );
1508 private void addSequenceRelationBlock() {
1509 final JLabel spacer = new JLabel( "" );
1510 spacer.setSize( 1, 1 );
1512 final JLabel mainLabel = new JLabel( "Sequence relations to display" );
1513 final JLabel typeLabel = customizeLabel( new JLabel( "(type) " ), getConfiguration() );
1514 typeLabel.setFont( ControlPanel.js_font.deriveFont( 7 ) );
1515 getSequenceRelationTypeBox().setFocusable( false );
1516 _sequence_relation_type_box.setFont( ControlPanel.js_font );
1517 if ( !_configuration.isUseNativeUI() ) {
1518 _sequence_relation_type_box.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
1519 _sequence_relation_type_box.setForeground( getConfiguration().getGuiButtonTextColor() );
1521 _sequence_relation_type_box.setRenderer( new ListCellRenderer() {
1524 public Component getListCellRendererComponent( final JList list,
1527 final boolean isSelected,
1528 final boolean cellHasFocus ) {
1529 final Component component = new DefaultListCellRenderer().getListCellRendererComponent( list,
1534 if ( ( value != null ) && ( value instanceof SequenceRelation.SEQUENCE_RELATION_TYPE ) ) {
1535 ( ( DefaultListCellRenderer ) component ).setText( SequenceRelation
1536 .getPrintableNameByType( ( SequenceRelation.SEQUENCE_RELATION_TYPE ) value ) );
1541 final GridBagLayout gbl = new GridBagLayout();
1542 _sequence_relation_type_box.setMinimumSize( new Dimension( 115, 17 ) );
1543 _sequence_relation_type_box.setPreferredSize( new Dimension( 115, 20 ) );
1544 final JPanel horizGrid = new JPanel( gbl );
1545 horizGrid.setBackground( getBackground() );
1546 horizGrid.add( typeLabel );
1547 horizGrid.add( _sequence_relation_type_box );
1548 add( customizeLabel( mainLabel, getConfiguration() ) );
1550 add( getSequenceRelationBox() );
1551 if ( _configuration.doDisplayOption( Configuration.show_relation_confidence ) ) {
1552 addCheckbox( Configuration.show_relation_confidence,
1553 _configuration.getDisplayTitle( Configuration.show_relation_confidence ) );
1554 setCheckbox( Configuration.show_relation_confidence,
1555 _configuration.doCheckOption( Configuration.show_relation_confidence ) );
1557 }// addSequenceRelationBlock
1560 private List<Boolean> getIsDrawPhylogramList() {
1561 return _draw_phylogram;
1564 JLabel getSearchFoundCountsLabel() {
1565 return _search_found_label;
1568 JButton getSearchResetButton() {
1569 return _search_reset_button;
1572 private void init() {
1573 _draw_phylogram = new ArrayList<Boolean>();
1574 setSpeciesColors( new HashMap<String, Color>() );
1575 setAnnotationColors( new HashMap<String, Color>() );
1578 private boolean isDrawPhylogram( final int index ) {
1579 return getIsDrawPhylogramList().get( index );
1582 private void search( final MainPanel main_panel, final Phylogeny tree, final String query_str ) {
1583 getSearchFoundCountsLabel().setVisible( true );
1584 getSearchResetButton().setEnabled( true );
1585 getSearchResetButton().setVisible( true );
1586 String[] queries = null;
1587 List<PhylogenyNode> nodes = null;
1588 if ( query_str.indexOf( ',' ) >= 0 ) {
1589 queries = query_str.split( ",+" );
1592 queries = new String[ 1 ];
1593 queries[ 0 ] = query_str.trim();
1595 if ( ( queries != null ) && ( queries.length > 0 ) ) {
1596 nodes = new ArrayList<PhylogenyNode>();
1597 for( String query : queries ) {
1598 if ( ForesterUtil.isEmpty( query ) ) {
1601 query = query.trim();
1602 if ( query.indexOf( '+' ) >= 0 ) {
1603 nodes.addAll( PhylogenyMethods.searchDataLogicalAnd( query.split( "\\++" ),
1605 getOptions().isSearchCaseSensitive(),
1606 !getOptions().isMatchWholeTermsOnly(),
1607 isShowDomainArchitectures() ) );
1610 nodes.addAll( PhylogenyMethods.searchData( query,
1612 getOptions().isSearchCaseSensitive(),
1613 !getOptions().isMatchWholeTermsOnly(),
1614 isShowDomainArchitectures() ) );
1617 if ( getOptions().isInverseSearchResult() ) {
1618 final List<PhylogenyNode> all = PhylogenyMethods.obtainAllNodesAsList( tree );
1619 all.removeAll( nodes );
1623 if ( ( nodes != null ) && ( nodes.size() > 0 ) ) {
1624 main_panel.getCurrentTreePanel().setFoundNodes( new HashSet<Long>() );
1625 for( final PhylogenyNode node : nodes ) {
1626 main_panel.getCurrentTreePanel().getFoundNodes().add( node.getId() );
1628 setSearchFoundCountsOnLabel( nodes.size() );
1631 setSearchFoundCountsOnLabel( 0 );
1636 void searchReset() {
1637 if ( getMainPanel().getCurrentTreePanel() != null ) {
1638 getMainPanel().getCurrentTreePanel().setFoundNodes( null );
1642 private void setDrawPhylogram( final int index, final boolean b ) {
1643 getIsDrawPhylogramList().set( index, b );
1646 void setSearchFoundCountsOnLabel( final int counts ) {
1647 getSearchFoundCountsLabel().setText( "Found: " + counts );
1650 private void setupClickToOptions() {
1651 final int default_option = _configuration.getDefaultDisplayClicktoOption();
1652 int selected_index = 0;
1654 if ( _configuration.doDisplayClickToOption( Configuration.display_node_data ) ) {
1655 _show_data_item = cb_index;
1656 addClickToOption( Configuration.display_node_data,
1657 _configuration.getClickToTitle( Configuration.display_node_data ) );
1658 if ( default_option == Configuration.display_node_data ) {
1659 selected_index = cb_index;
1663 if ( _configuration.doDisplayClickToOption( Configuration.collapse_uncollapse ) ) {
1664 _collapse_cb_item = cb_index;
1665 addClickToOption( Configuration.collapse_uncollapse,
1666 _configuration.getClickToTitle( Configuration.collapse_uncollapse ) );
1667 if ( default_option == Configuration.collapse_uncollapse ) {
1668 selected_index = cb_index;
1672 if ( _configuration.doDisplayClickToOption( Configuration.reroot ) ) {
1673 _reroot_cb_item = cb_index;
1674 addClickToOption( Configuration.reroot, _configuration.getClickToTitle( Configuration.reroot ) );
1675 if ( default_option == Configuration.reroot ) {
1676 selected_index = cb_index;
1680 if ( _configuration.doDisplayClickToOption( Configuration.subtree ) ) {
1681 _subtree_cb_item = cb_index;
1682 addClickToOption( Configuration.subtree, _configuration.getClickToTitle( Configuration.subtree ) );
1683 if ( default_option == Configuration.subtree ) {
1684 selected_index = cb_index;
1688 if ( _configuration.doDisplayClickToOption( Configuration.swap ) ) {
1689 _swap_cb_item = cb_index;
1690 addClickToOption( Configuration.swap, _configuration.getClickToTitle( Configuration.swap ) );
1691 if ( default_option == Configuration.swap ) {
1692 selected_index = cb_index;
1696 if ( _configuration.doDisplayClickToOption( Configuration.sort_descendents ) ) {
1697 _sort_descendents_item = cb_index;
1698 addClickToOption( Configuration.sort_descendents,
1699 _configuration.getClickToTitle( Configuration.sort_descendents ) );
1700 if ( default_option == Configuration.sort_descendents ) {
1701 selected_index = cb_index;
1705 if ( _configuration.doDisplayClickToOption( Configuration.color_subtree ) ) {
1706 _color_subtree_cb_item = cb_index;
1707 addClickToOption( Configuration.color_subtree, _configuration.getClickToTitle( Configuration.color_subtree ) );
1708 if ( default_option == Configuration.color_subtree ) {
1709 selected_index = cb_index;
1713 if ( _configuration.doDisplayClickToOption( Configuration.open_seq_web ) ) {
1714 _open_seq_web_item = cb_index;
1715 addClickToOption( Configuration.open_seq_web, _configuration.getClickToTitle( Configuration.open_seq_web ) );
1716 if ( default_option == Configuration.open_seq_web ) {
1717 selected_index = cb_index;
1721 if ( _configuration.doDisplayClickToOption( Configuration.open_tax_web ) ) {
1722 _open_tax_web_item = cb_index;
1723 addClickToOption( Configuration.open_tax_web, _configuration.getClickToTitle( Configuration.open_tax_web ) );
1724 if ( default_option == Configuration.open_tax_web ) {
1725 selected_index = cb_index;
1729 if ( _configuration.doDisplayClickToOption( Configuration.blast ) ) {
1730 _blast_item = cb_index;
1731 addClickToOption( Configuration.blast, _configuration.getClickToTitle( Configuration.blast ) );
1732 if ( default_option == Configuration.blast ) {
1733 selected_index = cb_index;
1737 if ( _configuration.doDisplayClickToOption( Configuration.select_nodes ) ) {
1738 _select_nodes_item = cb_index;
1739 addClickToOption( Configuration.select_nodes, _configuration.getClickToTitle( Configuration.select_nodes ) );
1740 if ( default_option == Configuration.select_nodes ) {
1741 selected_index = cb_index;
1745 if ( _configuration.doDisplayClickToOption( Configuration.get_ext_desc_data ) ) {
1746 _get_ext_desc_data = cb_index;
1747 if ( !ForesterUtil.isEmpty( getConfiguration().getLabelForGetExtDescendentsData() ) ) {
1748 addClickToOption( Configuration.get_ext_desc_data, getConfiguration()
1749 .getLabelForGetExtDescendentsData() );
1753 switch ( getConfiguration().getExtDescNodeDataToReturn() ) {
1758 s = "Sequence Accessors";
1760 case SEQUENCE_MOL_SEQ:
1761 s = "Molecular Sequence";
1763 case SEQUENCE_MOL_SEQ_FASTA:
1764 s = "Molecular Sequence (Fasta)";
1767 s = "Sequence Names";
1769 case SEQUENCE_SYMBOL:
1770 s = "Sequence Symbols";
1773 s = "Taxonomy Codes";
1775 case TAXONOMY_COMM0N_NAME:
1776 s = "Taxonomy Common Names";
1778 case TAXONOMY_SCIENTIFIC_NAME:
1779 s = "Scientific Names";
1782 s = "User Selected Data";
1785 final String label = _configuration.getClickToTitle( Configuration.get_ext_desc_data ) + " " + s;
1786 addClickToOption( Configuration.get_ext_desc_data, label );
1788 if ( default_option == Configuration.get_ext_desc_data ) {
1789 selected_index = cb_index;
1793 if ( getOptions().isEditable() ) {
1794 if ( _configuration.doDisplayClickToOption( Configuration.cut_subtree ) ) {
1795 _cut_subtree_item = cb_index;
1796 addClickToOption( Configuration.cut_subtree, _configuration.getClickToTitle( Configuration.cut_subtree ) );
1797 if ( default_option == Configuration.cut_subtree ) {
1798 selected_index = cb_index;
1802 if ( _configuration.doDisplayClickToOption( Configuration.copy_subtree ) ) {
1803 _copy_subtree_item = cb_index;
1804 addClickToOption( Configuration.copy_subtree,
1805 _configuration.getClickToTitle( Configuration.copy_subtree ) );
1806 if ( default_option == Configuration.copy_subtree ) {
1807 selected_index = cb_index;
1811 if ( _configuration.doDisplayClickToOption( Configuration.paste_subtree ) ) {
1812 _paste_subtree_item = cb_index;
1813 addClickToOption( Configuration.paste_subtree,
1814 _configuration.getClickToTitle( Configuration.paste_subtree ) );
1815 if ( default_option == Configuration.paste_subtree ) {
1816 selected_index = cb_index;
1820 if ( _configuration.doDisplayClickToOption( Configuration.delete_subtree_or_node ) ) {
1821 _delete_node_or_subtree_item = cb_index;
1822 addClickToOption( Configuration.delete_subtree_or_node,
1823 _configuration.getClickToTitle( Configuration.delete_subtree_or_node ) );
1824 if ( default_option == Configuration.delete_subtree_or_node ) {
1825 selected_index = cb_index;
1829 if ( _configuration.doDisplayClickToOption( Configuration.add_new_node ) ) {
1830 _add_new_node_item = cb_index;
1831 addClickToOption( Configuration.add_new_node,
1832 _configuration.getClickToTitle( Configuration.add_new_node ) );
1833 if ( default_option == Configuration.add_new_node ) {
1834 selected_index = cb_index;
1838 if ( _configuration.doDisplayClickToOption( Configuration.edit_node_data ) ) {
1839 _edit_node_data_item = cb_index;
1840 addClickToOption( Configuration.edit_node_data,
1841 _configuration.getClickToTitle( Configuration.edit_node_data ) );
1842 if ( default_option == Configuration.edit_node_data ) {
1843 selected_index = cb_index;
1848 // Set default selection and its action
1849 _click_to_combobox.setSelectedIndex( selected_index );
1850 setClickToAction( selected_index );
1853 private void setupDisplayCheckboxes() {
1854 if ( _configuration.doDisplayOption( Configuration.display_as_phylogram ) ) {
1855 addCheckbox( Configuration.display_as_phylogram,
1856 _configuration.getDisplayTitle( Configuration.display_as_phylogram ) );
1857 setCheckbox( Configuration.display_as_phylogram,
1858 _configuration.doCheckOption( Configuration.display_as_phylogram ) );
1860 if ( _configuration.doDisplayOption( Configuration.dynamically_hide_data ) ) {
1861 addCheckbox( Configuration.dynamically_hide_data,
1862 _configuration.getDisplayTitle( Configuration.dynamically_hide_data ) );
1863 setCheckbox( Configuration.dynamically_hide_data,
1864 _configuration.doCheckOption( Configuration.dynamically_hide_data ) );
1866 if ( _configuration.doDisplayOption( Configuration.node_data_popup ) ) {
1867 addCheckbox( Configuration.node_data_popup, _configuration.getDisplayTitle( Configuration.node_data_popup ) );
1868 setCheckbox( Configuration.node_data_popup, _configuration.doCheckOption( Configuration.node_data_popup ) );
1870 if ( _configuration.doDisplayOption( Configuration.display_internal_data ) ) {
1871 addCheckbox( Configuration.display_internal_data,
1872 _configuration.getDisplayTitle( Configuration.display_internal_data ) );
1873 setCheckbox( Configuration.display_internal_data,
1874 _configuration.doCheckOption( Configuration.display_internal_data ) );
1876 if ( _configuration.doDisplayOption( Configuration.color_according_to_species ) ) {
1877 addCheckbox( Configuration.color_according_to_species,
1878 _configuration.getDisplayTitle( Configuration.color_according_to_species ) );
1879 setCheckbox( Configuration.color_according_to_species,
1880 _configuration.doCheckOption( Configuration.color_according_to_species ) );
1882 if ( _configuration.doDisplayOption( Configuration.color_according_to_annotation ) ) {
1883 addCheckbox( Configuration.color_according_to_annotation,
1884 _configuration.getDisplayTitle( Configuration.color_according_to_annotation ) );
1885 setCheckbox( Configuration.color_according_to_annotation,
1886 _configuration.doCheckOption( Configuration.color_according_to_annotation ) );
1888 if ( _configuration.doDisplayOption( Configuration.color_branches ) ) {
1889 addCheckbox( Configuration.color_branches, _configuration.getDisplayTitle( Configuration.color_branches ) );
1890 setCheckbox( Configuration.color_branches, _configuration.doCheckOption( Configuration.color_branches ) );
1892 if ( _configuration.doDisplayOption( Configuration.width_branches ) ) {
1893 addCheckbox( Configuration.width_branches, _configuration.getDisplayTitle( Configuration.width_branches ) );
1894 setCheckbox( Configuration.width_branches, _configuration.doCheckOption( Configuration.width_branches ) );
1896 final JLabel label = new JLabel( "Display Data:" );
1897 label.setFont( ControlPanel.jcb_bold_font );
1898 if ( !getConfiguration().isUseNativeUI() ) {
1899 label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1902 if ( _configuration.doDisplayOption( Configuration.show_node_names ) ) {
1903 addCheckbox( Configuration.show_node_names, _configuration.getDisplayTitle( Configuration.show_node_names ) );
1904 setCheckbox( Configuration.show_node_names, _configuration.doCheckOption( Configuration.show_node_names ) );
1906 if ( _configuration.doDisplayOption( Configuration.show_tax_code ) ) {
1907 addCheckbox( Configuration.show_tax_code, _configuration.getDisplayTitle( Configuration.show_tax_code ) );
1908 setCheckbox( Configuration.show_tax_code, _configuration.doCheckOption( Configuration.show_tax_code ) );
1910 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_scientific_names ) ) {
1911 addCheckbox( Configuration.show_taxonomy_scientific_names,
1912 _configuration.getDisplayTitle( Configuration.show_taxonomy_scientific_names ) );
1913 setCheckbox( Configuration.show_taxonomy_scientific_names,
1914 _configuration.doCheckOption( Configuration.show_taxonomy_scientific_names ) );
1916 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_common_names ) ) {
1917 addCheckbox( Configuration.show_taxonomy_common_names,
1918 _configuration.getDisplayTitle( Configuration.show_taxonomy_common_names ) );
1919 setCheckbox( Configuration.show_taxonomy_common_names,
1920 _configuration.doCheckOption( Configuration.show_taxonomy_common_names ) );
1922 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_images ) ) {
1923 addCheckbox( Configuration.show_taxonomy_images,
1924 _configuration.getDisplayTitle( Configuration.show_taxonomy_images ) );
1925 setCheckbox( Configuration.show_taxonomy_images,
1926 _configuration.doCheckOption( Configuration.show_taxonomy_images ) );
1928 if ( _configuration.doDisplayOption( Configuration.show_gene_symbols ) ) {
1929 addCheckbox( Configuration.show_gene_symbols,
1930 _configuration.getDisplayTitle( Configuration.show_gene_symbols ) );
1931 setCheckbox( Configuration.show_gene_symbols,
1932 _configuration.doCheckOption( Configuration.show_gene_symbols ) );
1934 if ( _configuration.doDisplayOption( Configuration.show_gene_names ) ) {
1935 addCheckbox( Configuration.show_gene_names, _configuration.getDisplayTitle( Configuration.show_gene_names ) );
1936 setCheckbox( Configuration.show_gene_names, _configuration.doCheckOption( Configuration.show_gene_names ) );
1938 if ( _configuration.doDisplayOption( Configuration.show_sequence_acc ) ) {
1939 addCheckbox( Configuration.show_sequence_acc,
1940 _configuration.getDisplayTitle( Configuration.show_sequence_acc ) );
1941 setCheckbox( Configuration.show_sequence_acc,
1942 _configuration.doCheckOption( Configuration.show_sequence_acc ) );
1944 if ( _configuration.doDisplayOption( Configuration.show_annotation ) ) {
1945 addCheckbox( Configuration.show_annotation, _configuration.getDisplayTitle( Configuration.show_annotation ) );
1946 setCheckbox( Configuration.show_annotation, _configuration.doCheckOption( Configuration.show_annotation ) );
1948 if ( _configuration.doDisplayOption( Configuration.show_binary_characters ) ) {
1949 addCheckbox( Configuration.show_binary_characters,
1950 _configuration.getDisplayTitle( Configuration.show_binary_characters ) );
1951 setCheckbox( Configuration.show_binary_characters,
1952 _configuration.doCheckOption( Configuration.show_binary_characters ) );
1954 if ( _configuration.doDisplayOption( Configuration.show_binary_character_counts ) ) {
1955 addCheckbox( Configuration.show_binary_character_counts,
1956 _configuration.getDisplayTitle( Configuration.show_binary_character_counts ) );
1957 setCheckbox( Configuration.show_binary_character_counts,
1958 _configuration.doCheckOption( Configuration.show_binary_character_counts ) );
1960 if ( _configuration.doDisplayOption( Configuration.show_domain_architectures ) ) {
1961 addCheckbox( Configuration.show_domain_architectures,
1962 _configuration.getDisplayTitle( Configuration.show_domain_architectures ) );
1963 setCheckbox( Configuration.show_domain_architectures,
1964 _configuration.doCheckOption( Configuration.show_domain_architectures ) );
1966 if ( _configuration.doDisplayOption( Configuration.write_confidence_values ) ) {
1967 addCheckbox( Configuration.write_confidence_values,
1968 _configuration.getDisplayTitle( Configuration.write_confidence_values ) );
1969 setCheckbox( Configuration.write_confidence_values,
1970 _configuration.doCheckOption( Configuration.write_confidence_values ) );
1972 if ( _configuration.doDisplayOption( Configuration.write_events ) ) {
1973 addCheckbox( Configuration.write_events, _configuration.getDisplayTitle( Configuration.write_events ) );
1974 setCheckbox( Configuration.write_events, _configuration.doCheckOption( Configuration.write_events ) );
1976 if ( _configuration.doDisplayOption( Configuration.show_vector_data ) ) {
1977 addCheckbox( Configuration.show_vector_data,
1978 _configuration.getDisplayTitle( Configuration.show_vector_data ) );
1979 setCheckbox( Configuration.show_vector_data, _configuration.doCheckOption( Configuration.show_vector_data ) );
1981 if ( _configuration.doDisplayOption( Configuration.show_properties ) ) {
1982 addCheckbox( Configuration.show_properties, _configuration.getDisplayTitle( Configuration.show_properties ) );
1983 setCheckbox( Configuration.show_properties, _configuration.doCheckOption( Configuration.show_properties ) );
1987 private void setVisibilityOfDomainStrucureControls() {
1988 if ( _zoom_in_domain_structure != null ) {
1989 if ( isShowDomainArchitectures() ) {
1990 _domain_display_label.setVisible( true );
1991 _zoom_in_domain_structure.setVisible( true );
1992 _zoom_out_domain_structure.setVisible( true );
1993 _decr_domain_structure_evalue_thr.setVisible( true );
1994 _incr_domain_structure_evalue_thr.setVisible( true );
1995 _domain_structure_evalue_thr_tf.setVisible( true );
1998 _domain_display_label.setVisible( false );
1999 _zoom_in_domain_structure.setVisible( false );
2000 _zoom_out_domain_structure.setVisible( false );
2001 _decr_domain_structure_evalue_thr.setVisible( false );
2002 _incr_domain_structure_evalue_thr.setVisible( false );
2003 _domain_structure_evalue_thr_tf.setVisible( false );
2008 static JLabel customizeLabel( final JLabel label, final Configuration configuration ) {
2009 label.setFont( ControlPanel.jcb_bold_font );
2010 if ( !configuration.isUseNativeUI() ) {
2011 label.setForeground( configuration.getGuiCheckboxTextColor() );
2012 label.setBackground( configuration.getGuiBackgroundColor() );
2017 enum NodeClickAction {
2028 DELETE_NODE_OR_SUBTREE,