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_seq_names;
101 private JCheckBox _show_seq_symbols;
102 private JCheckBox _show_gene_names;
103 private JCheckBox _show_sequence_acc;
104 private JCheckBox _node_desc_popup_cb;
105 private JCheckBox _dynamically_hide_data;
106 private JCheckBox _show_taxo_scientific_names;
107 private JCheckBox _show_taxo_common_names;
108 private JCheckBox _show_taxo_images_cb;
109 private JCheckBox _color_according_to_annotation;
110 private JCheckBox _display_as_phylogram_cb;
111 private JCheckBox _seq_relation_confidence_switch;
112 private JComboBox _show_sequence_relations;
113 private JComboBox _sequence_relation_type_box;
114 private JCheckBox _show_vector_data_cb;
115 private JCheckBox _show_properties_cb;
116 private JLabel _click_to_label;
117 private JLabel _zoom_label;
118 private JLabel _domain_display_label;
119 private JComboBox _click_to_combobox;
120 private Map<Integer, String> _all_click_to_names;
121 private List<String> _click_to_names;
122 // Indices for the click-to options in the combo box
123 private int _show_data_item;
124 private int _collapse_cb_item;
125 private int _reroot_cb_item;
126 private int _swap_cb_item;
127 private int _subtree_cb_item;
128 private int _color_subtree_cb_item;
129 private int _open_seq_web_item;
130 private int _sort_descendents_item;
131 private int _open_tax_web_item;
132 private int _cut_subtree_item;
133 private int _copy_subtree_item;
134 private int _delete_node_or_subtree_item;
135 private int _paste_subtree_item;
136 private int _add_new_node_item;
137 private int _edit_node_data_item;
138 private int _select_nodes_item;
139 private int _get_ext_desc_data;
140 private int _blast_item;
141 // zooming and quick tree manipulation buttons:
142 private JButton _zoom_in_x;
143 private JButton _zoom_in_y;
144 private JButton _zoom_out_x;
145 private JButton _zoom_out_y;
146 private JButton _show_whole;
147 private JButton _order;
148 private JButton _uncollapse_all;
149 private JButton _zoom_in_domain_structure;
150 private JButton _zoom_out_domain_structure;
151 private JButton _decr_domain_structure_evalue_thr;
152 private JButton _incr_domain_structure_evalue_thr;
153 private JButton _return_to_super_tree;
154 private JTextField _domain_structure_evalue_thr_tf;
155 private JTextField _search_tf;
156 private boolean _order_of_appearance;
157 private boolean _color_branches;
158 private NodeClickAction _action_when_node_clicked;
159 private List<Boolean> _draw_phylogram;
160 private Map<String, Color> _annotation_colors;
161 private Map<String, Color> _species_colors;
162 private JButton _search_reset_button;
163 private JLabel _search_found_label;
164 private Sequence _selected_query_seq;
166 ControlPanel( final MainPanel ap, final Configuration configuration ) {
169 _configuration = configuration;
170 if ( !_configuration.isUseNativeUI() ) {
171 setBackground( getConfiguration().getGuiBackgroundColor() );
172 setBorder( BorderFactory.createRaisedBevelBorder() );
174 setLayout( new GridLayout( 0, 1, 2, 2 ) );
175 _order_of_appearance = true;
183 public void actionPerformed( final ActionEvent e ) {
185 final TreePanel tp = getMainPanel().getCurrentTreePanel();
189 if ( e.getSource() == _click_to_combobox ) {
190 setClickToAction( _click_to_combobox.getSelectedIndex() );
191 getCurrentTreePanel().repaint();
193 else if ( e.getSource() == _show_binary_characters ) {
194 if ( ( _show_binary_character_counts != null ) && _show_binary_characters.isSelected() ) {
195 _show_binary_character_counts.setSelected( false );
197 displayedPhylogenyMightHaveChanged( true );
199 else if ( e.getSource() == _show_binary_character_counts ) {
200 if ( ( _show_binary_characters != null ) && _show_binary_character_counts.isSelected() ) {
201 _show_binary_characters.setSelected( false );
203 displayedPhylogenyMightHaveChanged( true );
205 else if ( e.getSource() == _show_domain_architectures ) {
207 displayedPhylogenyMightHaveChanged( false );
209 else if ( ( tp != null ) && ( tp.getPhylogeny() != null ) ) {
210 if ( e.getSource() == getDisplayAsPhylogramCb() ) {
211 setDrawPhylogram( getDisplayAsPhylogramCb().isSelected() );
215 else if ( e.getSource() == _zoom_in_x ) {
216 zoomInX( Constants.BUTTON_ZOOM_IN_FACTOR, Constants.BUTTON_ZOOM_IN_X_CORRECTION_FACTOR );
217 displayedPhylogenyMightHaveChanged( false );
219 else if ( e.getSource() == _zoom_in_y ) {
220 zoomInY( Constants.BUTTON_ZOOM_IN_FACTOR );
221 displayedPhylogenyMightHaveChanged( false );
223 else if ( e.getSource() == _zoom_out_x ) {
224 zoomOutX( Constants.BUTTON_ZOOM_OUT_FACTOR, Constants.BUTTON_ZOOM_OUT_X_CORRECTION_FACTOR );
225 displayedPhylogenyMightHaveChanged( false );
227 else if ( e.getSource() == _zoom_out_y ) {
228 zoomOutY( Constants.BUTTON_ZOOM_OUT_FACTOR );
229 displayedPhylogenyMightHaveChanged( false );
231 else if ( e.getSource() == _show_whole ) {
234 else if ( e.getSource() == _return_to_super_tree ) {
235 _mainpanel.getCurrentTreePanel().superTree();
238 else if ( e.getSource() == _order ) {
239 DESCENDANT_SORT_PRIORITY pri = DESCENDANT_SORT_PRIORITY.TAXONOMY;
240 if ( ( !isShowTaxonomyScientificNames() && !isShowTaxonomyCode() && !isShowTaxonomyCommonNames() ) ) {
241 if ( ( isShowSequenceAcc() || isShowSeqNames() || isShowSeqSymbols() ) ) {
242 pri = DESCENDANT_SORT_PRIORITY.SEQUENCE;
244 else if ( isShowNodeNames() ) {
245 pri = DESCENDANT_SORT_PRIORITY.NODE_NAME;
248 PhylogenyMethods.orderAppearance( tp.getPhylogeny().getRoot(), _order_of_appearance, true, pri );
249 _order_of_appearance = !_order_of_appearance;
250 tp.setNodeInPreorderToNull();
251 tp.getPhylogeny().externalNodesHaveChanged();
252 tp.getPhylogeny().clearHashIdToNodeMap();
253 tp.getPhylogeny().recalculateNumberOfExternalDescendants( true );
254 tp.resetNodeIdToDistToLeafMap();
255 tp.setEdited( true );
256 displayedPhylogenyMightHaveChanged( false );
258 else if ( e.getSource() == _uncollapse_all ) {
260 displayedPhylogenyMightHaveChanged( false );
262 else if ( e.getSource() == _zoom_in_domain_structure ) {
263 _mainpanel.getCurrentTreePanel().zoomInDomainStructure();
264 displayedPhylogenyMightHaveChanged( true );
266 else if ( e.getSource() == _zoom_out_domain_structure ) {
267 _mainpanel.getCurrentTreePanel().zoomOutDomainStructure();
268 displayedPhylogenyMightHaveChanged( true );
270 else if ( e.getSource() == _decr_domain_structure_evalue_thr ) {
271 _mainpanel.getCurrentTreePanel().decreaseDomainStructureEvalueThreshold();
272 displayedPhylogenyMightHaveChanged( true );
274 else if ( e.getSource() == _incr_domain_structure_evalue_thr ) {
275 _mainpanel.getCurrentTreePanel().increaseDomainStructureEvalueThreshold();
276 displayedPhylogenyMightHaveChanged( true );
278 else if ( e.getSource() == _search_tf ) {
280 displayedPhylogenyMightHaveChanged( true );
283 displayedPhylogenyMightHaveChanged( true );
287 tp.requestFocusInWindow();
290 catch ( final Exception ex ) {
291 AptxUtil.unexpectedException( ex );
293 catch ( final Error err ) {
294 AptxUtil.unexpectedError( err );
298 public JCheckBox getColorAccSpeciesCb() {
299 return _color_acc_species;
302 public JCheckBox getColorBranchesCb() {
303 return _color_branches_cb;
306 public JCheckBox getDisplayAsPhylogramCb() {
307 return _display_as_phylogram_cb;
310 public JCheckBox getDynamicallyHideData() {
311 return _dynamically_hide_data;
314 public JCheckBox getNodeDescPopupCb() {
315 return _node_desc_popup_cb;
318 public Sequence getSelectedQuerySequence() {
319 return _selected_query_seq;
322 public JComboBox getSequenceRelationBox() {
323 if ( _show_sequence_relations == null ) {
324 _show_sequence_relations = new JComboBox();
325 _show_sequence_relations.setFocusable( false );
326 _show_sequence_relations.setMaximumRowCount( 20 );
327 _show_sequence_relations.setFont( ControlPanel.js_font );
328 if ( !_configuration.isUseNativeUI() ) {
329 _show_sequence_relations.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
330 _show_sequence_relations.setForeground( getConfiguration().getGuiButtonTextColor() );
332 _show_sequence_relations.addItem( "-----" );
333 _show_sequence_relations.setToolTipText( "To display orthology information for selected query" );
335 return _show_sequence_relations;
339 public JComboBox getSequenceRelationTypeBox() {
340 if ( _sequence_relation_type_box == null ) {
341 _sequence_relation_type_box = new JComboBox();
342 for( final SequenceRelation.SEQUENCE_RELATION_TYPE type : SequenceRelation.SEQUENCE_RELATION_TYPE.values() ) {
343 _sequence_relation_type_box.addItem( type );
345 _sequence_relation_type_box.addActionListener( new ActionListener() {
348 public void actionPerformed( final ActionEvent e ) {
349 if ( _mainpanel.getCurrentPhylogeny() != null ) {
350 setSequenceRelationQueries( getMainPanel().getCurrentPhylogeny().getSequenceRelationQueries() );
355 return _sequence_relation_type_box;
358 public JCheckBox getShowEventsCb() {
362 public JCheckBox getWriteConfidenceCb() {
363 return _write_confidence;
366 public boolean isShowProperties() {
367 return ( ( _show_properties_cb != null ) && _show_properties_cb.isSelected() );
370 public boolean isShowTaxonomyImages() {
371 return ( ( _show_taxo_images_cb != null ) && _show_taxo_images_cb.isSelected() );
374 public boolean isShowVectorData() {
375 return ( ( _show_vector_data_cb != null ) && _show_vector_data_cb.isSelected() );
378 public void setSequenceRelationQueries( final Collection<Sequence> sequenceRelationQueries ) {
379 final JComboBox box = getSequenceRelationBox();
380 while ( box.getItemCount() > 1 ) {
381 box.removeItemAt( 1 );
383 final HashMap<String, Sequence> sequencesByName = new HashMap<String, Sequence>();
384 final SequenceRelation.SEQUENCE_RELATION_TYPE relationType = ( SequenceRelation.SEQUENCE_RELATION_TYPE ) _sequence_relation_type_box
386 if ( relationType == null ) {
389 final ArrayList<String> sequenceNamesToAdd = new ArrayList<String>();
390 for( final Sequence seq : sequenceRelationQueries ) {
391 if ( seq.hasSequenceRelations() ) {
392 boolean fFoundForCurrentType = false;
393 for( final SequenceRelation sq : seq.getSequenceRelations() ) {
394 if ( sq.getType().equals( relationType ) ) {
395 fFoundForCurrentType = true;
399 if ( fFoundForCurrentType ) {
400 sequenceNamesToAdd.add( seq.getName() );
401 sequencesByName.put( seq.getName(), seq );
405 // sort sequences by name before adding them to the combo
406 final String[] sequenceNameArray = sequenceNamesToAdd.toArray( new String[ sequenceNamesToAdd.size() ] );
407 Arrays.sort( sequenceNameArray, String.CASE_INSENSITIVE_ORDER );
408 for( final String seqName : sequenceNameArray ) {
409 box.addItem( seqName );
411 for( final ItemListener oldItemListener : box.getItemListeners() ) {
412 box.removeItemListener( oldItemListener );
414 box.addItemListener( new ItemListener() {
417 public void itemStateChanged( final ItemEvent e ) {
418 _selected_query_seq = sequencesByName.get( e.getItem() );
419 _mainpanel.getCurrentTreePanel().repaint();
424 void activateButtonToReturnToSuperTree( int index ) {
427 _return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT + " " + index );
430 _return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT );
432 _return_to_super_tree.setForeground( getConfiguration().getGuiCheckboxAndButtonActiveColor() );
433 _return_to_super_tree.setEnabled( true );
436 void showAnnotations() {
437 if ( _show_annotation != null ) {
438 _show_annotation.setSelected( true );
440 if ( _color_according_to_annotation != null ) {
441 _color_according_to_annotation.setSelected( true );
443 if ( _color_acc_species != null ) {
444 _color_acc_species.setSelected( false );
446 _mainpanel.getCurrentTreePanel().repaint();
450 * Add zoom and quick edit buttons. (Last modified 8/9/04)
453 final JLabel spacer = new JLabel( "" );
454 spacer.setOpaque( false );
456 final JPanel x_panel = new JPanel( new GridLayout( 1, 1, 0, 0 ) );
457 final JPanel y_panel = new JPanel( new GridLayout( 1, 3, 0, 0 ) );
458 final JPanel z_panel = new JPanel( new GridLayout( 1, 1, 0, 0 ) );
459 if ( !getConfiguration().isUseNativeUI() ) {
460 x_panel.setBackground( getBackground() );
461 y_panel.setBackground( getBackground() );
462 z_panel.setBackground( getBackground() );
464 add( _zoom_label = new JLabel( "Zoom:" ) );
465 customizeLabel( _zoom_label, getConfiguration() );
469 if ( getConfiguration().isUseNativeUI() ) {
470 _zoom_in_x = new JButton( "+" );
471 _zoom_out_x = new JButton( "-" );
474 _zoom_in_x = new JButton( "X+" );
475 _zoom_out_x = new JButton( "X-" );
477 _zoom_in_y = new JButton( "Y+" );
478 _zoom_out_y = new JButton( "Y-" );
479 _show_whole = new JButton( "F" );
480 _show_whole.setToolTipText( "To fit the complete phylogeny to the current display size [F or Home]" );
481 _zoom_in_x.setToolTipText( "To zoom in horizontally [Shift+cursor-right]" );
482 _zoom_in_y.setToolTipText( "To zoom in vertically [Shift+cursor-up]" );
483 _zoom_out_x.setToolTipText( "To zoom out horizontally [Shift+cursor-left]" );
484 _zoom_out_y.setToolTipText( "To zoom out vertically [Shift+cursor-down]" );
485 if ( getConfiguration().isUseNativeUI() && ForesterUtil.isMac() ) {
486 _zoom_out_x.setPreferredSize( new Dimension( 55, 10 ) );
487 _zoom_in_x.setPreferredSize( new Dimension( 55, 10 ) );
490 _zoom_out_x.setPreferredSize( new Dimension( 10, 10 ) );
491 _zoom_in_x.setPreferredSize( new Dimension( 10, 10 ) );
493 _zoom_out_y.setPreferredSize( new Dimension( 10, 10 ) );
494 _zoom_in_y.setPreferredSize( new Dimension( 10, 10 ) );
495 _show_whole.setPreferredSize( new Dimension( 10, 10 ) );
496 _return_to_super_tree = new JButton( RETURN_TO_SUPER_TREE_TEXT );
497 _return_to_super_tree.setEnabled( false );
498 _order = new JButton( "Order Subtrees" );
499 _uncollapse_all = new JButton( "Uncollapse All" );
500 addJButton( _zoom_in_y, x_panel );
501 addJButton( _zoom_out_x, y_panel );
502 addJButton( _show_whole, y_panel );
503 addJButton( _zoom_in_x, y_panel );
504 addJButton( _zoom_out_y, z_panel );
505 if ( getConfiguration().doDisplayOption( Configuration.show_domain_architectures ) ) {
506 setUpControlsForDomainStrucures();
508 final JLabel spacer2 = new JLabel( "" );
510 addJButton( _return_to_super_tree, this );
511 addJButton( _order, this );
512 addJButton( _uncollapse_all, this );
513 final JLabel spacer3 = new JLabel( "" );
515 setVisibilityOfDomainStrucureControls();
518 void addCheckbox( final int which, final String title ) {
519 final JPanel ch_panel = new JPanel( new BorderLayout( 0, 0 ) );
521 case Configuration.display_as_phylogram:
522 _display_as_phylogram_cb = new JCheckBox( title );
523 getDisplayAsPhylogramCb().setToolTipText( "To switch between phylogram and cladogram display" );
524 addJCheckBox( getDisplayAsPhylogramCb(), ch_panel );
527 case Configuration.display_internal_data:
528 _display_internal_data = new JCheckBox( title );
529 _display_internal_data.setToolTipText( "To allow or disallow display of internal labels" );
530 addJCheckBox( _display_internal_data, ch_panel );
533 case Configuration.color_according_to_species:
534 _color_acc_species = new JCheckBox( title );
536 .setToolTipText( "To colorize taxonomy and sequence labels as a function of taxonomy" );
537 addJCheckBox( _color_acc_species, ch_panel );
540 case Configuration.color_according_to_annotation:
541 _color_according_to_annotation = new JCheckBox( title );
542 _color_according_to_annotation
543 .setToolTipText( "To colorize sequence annotation labels as a function of sequence annotation" );
544 addJCheckBox( _color_according_to_annotation, ch_panel );
547 case Configuration.show_node_names:
548 _show_node_names = new JCheckBox( title );
549 addJCheckBox( _show_node_names, ch_panel );
552 case Configuration.show_taxonomy_scientific_names:
553 _show_taxo_scientific_names = new JCheckBox( title );
554 addJCheckBox( _show_taxo_scientific_names, ch_panel );
557 case Configuration.show_taxonomy_common_names:
558 _show_taxo_common_names = new JCheckBox( title );
559 addJCheckBox( _show_taxo_common_names, ch_panel );
562 case Configuration.show_tax_code:
563 _show_taxo_code = new JCheckBox( title );
564 addJCheckBox( _show_taxo_code, ch_panel );
567 case Configuration.show_taxonomy_images:
568 _show_taxo_images_cb = new JCheckBox( title );
569 addJCheckBox( _show_taxo_images_cb, ch_panel );
572 case Configuration.show_binary_characters:
573 _show_binary_characters = new JCheckBox( title );
574 addJCheckBox( _show_binary_characters, ch_panel );
577 case Configuration.show_annotation:
578 _show_annotation = new JCheckBox( title );
579 addJCheckBox( _show_annotation, ch_panel );
582 case Configuration.show_binary_character_counts:
583 _show_binary_character_counts = new JCheckBox( title );
584 addJCheckBox( _show_binary_character_counts, ch_panel );
587 case Configuration.write_confidence_values:
588 _write_confidence = new JCheckBox( title );
589 addJCheckBox( getWriteConfidenceCb(), ch_panel );
592 case Configuration.write_events:
593 _show_events = new JCheckBox( title );
594 addJCheckBox( getShowEventsCb(), ch_panel );
597 case Configuration.color_branches:
598 _color_branches_cb = new JCheckBox( title );
599 getColorBranchesCb().setToolTipText( "To use branch color values, if present" );
600 addJCheckBox( getColorBranchesCb(), ch_panel );
603 case Configuration.width_branches:
604 _width_branches = new JCheckBox( title );
605 _width_branches.setToolTipText( "To use branch width values, if present" );
606 addJCheckBox( _width_branches, ch_panel );
609 case Configuration.show_domain_architectures:
610 _show_domain_architectures = new JCheckBox( title );
611 addJCheckBox( _show_domain_architectures, ch_panel );
614 case Configuration.show_seq_names:
615 _show_seq_names = new JCheckBox( title );
616 addJCheckBox( _show_seq_names, ch_panel );
619 case Configuration.show_gene_names:
620 _show_gene_names = new JCheckBox( title );
621 addJCheckBox( _show_gene_names, ch_panel );
624 case Configuration.show_seq_symbols:
625 _show_seq_symbols = new JCheckBox( title );
626 addJCheckBox( _show_seq_symbols, ch_panel );
629 case Configuration.show_sequence_acc:
630 _show_sequence_acc = new JCheckBox( title );
631 addJCheckBox( _show_sequence_acc, ch_panel );
634 case Configuration.dynamically_hide_data:
635 _dynamically_hide_data = new JCheckBox( title );
636 getDynamicallyHideData().setToolTipText( "To hide labels depending on likely visibility" );
637 addJCheckBox( getDynamicallyHideData(), ch_panel );
640 case Configuration.node_data_popup:
641 _node_desc_popup_cb = new JCheckBox( title );
642 getNodeDescPopupCb().setToolTipText( "To enable mouse rollover display of basic node data" );
643 addJCheckBox( getNodeDescPopupCb(), ch_panel );
646 case Configuration.show_relation_confidence:
647 _seq_relation_confidence_switch = new JCheckBox( title );
648 addJCheckBox( _seq_relation_confidence_switch, ch_panel );
651 case Configuration.show_vector_data:
652 _show_vector_data_cb = new JCheckBox( title );
653 addJCheckBox( _show_vector_data_cb, ch_panel );
656 case Configuration.show_properties:
657 _show_properties_cb = new JCheckBox( title );
658 addJCheckBox( _show_properties_cb, ch_panel );
662 throw new RuntimeException( "unknown checkbox: " + which );
666 void addJButton( final JButton jb, final JPanel p ) {
667 jb.setFocusPainted( false );
668 jb.setFont( ControlPanel.jcb_font );
669 if ( !_configuration.isUseNativeUI() ) {
670 jb.setBorder( BorderFactory.createLineBorder( getConfiguration().getGuiButtonBorderColor() ) );
671 jb.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
672 jb.setForeground( getConfiguration().getGuiButtonTextColor() );
675 jb.addActionListener( this );
678 void addJCheckBox( final JCheckBox jcb, final JPanel p ) {
679 jcb.setFocusPainted( false );
680 jcb.setFont( ControlPanel.jcb_font );
681 if ( !_configuration.isUseNativeUI() ) {
682 jcb.setBackground( getConfiguration().getGuiBackgroundColor() );
683 jcb.setForeground( getConfiguration().getGuiCheckboxTextColor() );
685 p.add( jcb, "Center" );
686 jcb.addActionListener( this );
689 void addJTextField( final JTextField tf, final JPanel p ) {
690 if ( !_configuration.isUseNativeUI() ) {
691 tf.setForeground( getConfiguration().getGuiBackgroundColor() );
692 tf.setFont( ControlPanel.jcb_font );
695 tf.addActionListener( this );
698 void deactivateButtonToReturnToSuperTree() {
699 _return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT );
700 _return_to_super_tree.setForeground( getConfiguration().getGuiButtonTextColor() );
701 _return_to_super_tree.setEnabled( false );
704 void displayedPhylogenyMightHaveChanged( final boolean recalc_longest_ext_node_info ) {
705 if ( ( _mainpanel != null )
706 && ( ( _mainpanel.getCurrentPhylogeny() != null ) && !_mainpanel.getCurrentPhylogeny().isEmpty() ) ) {
707 if ( getOptions().isShowOverview() ) {
708 _mainpanel.getCurrentTreePanel().updateOvSizes();
710 _mainpanel.getCurrentTreePanel().recalculateMaxDistanceToRoot();
711 setVisibilityOfDomainStrucureControls();
712 updateDomainStructureEvaluethresholdDisplay();
713 _mainpanel.getCurrentTreePanel().calculateScaleDistance();
714 _mainpanel.getCurrentTreePanel().calcMaxDepth();
715 _mainpanel.adjustJScrollPane();
716 if ( recalc_longest_ext_node_info ) {
717 _mainpanel.getCurrentTreePanel().initNodeData();
718 _mainpanel.getCurrentTreePanel().calculateLongestExtNodeInfo();
720 _mainpanel.getCurrentTreePanel().repaint();
721 // _mainpanel.getCurrentTreePanel().setUpUrtFactors();
725 void endClickToOptions() {
726 _click_to_combobox.addActionListener( this );
730 * Indicates what action should be execute when a node is clicked
732 * @return the click-on action
734 NodeClickAction getActionWhenNodeClicked() {
735 return _action_when_node_clicked;
738 Map<Integer, String> getAllClickToItems() {
739 return _all_click_to_names;
742 Map<String, Color> getAnnotationColors() {
743 return _annotation_colors;
746 Configuration getConfiguration() {
747 return _configuration;
750 TreePanel getCurrentTreePanel() {
751 return getMainPanel().getCurrentTreePanel();
754 MainPanel getMainPanel() {
758 Options getOptions() {
759 return getMainPanel().getOptions();
762 JTextField getSearchTextField() {
766 List<String> getSingleClickToNames() {
767 return _click_to_names;
770 Map<String, Color> getSpeciesColors() {
771 return _species_colors;
774 boolean isAntialiasScreenText() {
778 boolean isColorAccordingToAnnotation() {
779 return ( ( _color_according_to_annotation != null ) && _color_according_to_annotation.isSelected() );
782 boolean isColorAccordingToTaxonomy() {
783 return ( ( _color_acc_species != null ) && _color_acc_species.isSelected() );
786 boolean isColorBranches() {
787 return ( ( ( getColorBranchesCb() != null ) && getColorBranchesCb().isSelected() ) || ( ( getColorBranchesCb() == null ) && _color_branches ) );
790 boolean isDrawPhylogram() {
791 return isDrawPhylogram( getMainPanel().getCurrentTabIndex() );
794 boolean isDynamicallyHideData() {
795 return ( ( getDynamicallyHideData() != null ) && getDynamicallyHideData().isSelected() );
799 return ( ( getShowEventsCb() != null ) && getShowEventsCb().isSelected() );
802 boolean isNodeDescPopup() {
803 return ( ( getNodeDescPopupCb() != null ) && getNodeDescPopupCb().isSelected() );
806 boolean isShowAnnotation() {
807 return ( ( _show_annotation != null ) && _show_annotation.isSelected() );
810 boolean isShowBinaryCharacterCounts() {
811 return ( ( _show_binary_character_counts != null ) && _show_binary_character_counts.isSelected() );
814 boolean isShowBinaryCharacters() {
815 return ( ( _show_binary_characters != null ) && _show_binary_characters.isSelected() );
818 boolean isShowConfidenceValues() {
819 return ( ( getWriteConfidenceCb() != null ) && getWriteConfidenceCb().isSelected() );
822 boolean isShowDomainArchitectures() {
823 return ( ( _show_domain_architectures != null ) && _show_domain_architectures.isSelected() );
826 boolean isShowSeqNames() {
827 return ( ( _show_seq_names != null ) && _show_seq_names.isSelected() );
830 boolean isShowSeqSymbols() {
831 return ( ( _show_seq_symbols != null ) && _show_seq_symbols.isSelected() );
834 boolean isShowInternalData() {
835 return ( ( _display_internal_data == null ) || _display_internal_data.isSelected() );
838 boolean isShowNodeNames() {
839 return ( ( _show_node_names != null ) && _show_node_names.isSelected() );
842 boolean isShowSequenceAcc() {
843 return ( ( _show_sequence_acc != null ) && _show_sequence_acc.isSelected() );
846 boolean isShowGeneNames() {
847 return ( ( _show_gene_names != null ) && _show_gene_names.isSelected() );
850 boolean isShowSequenceRelationConfidence() {
851 return ( ( _seq_relation_confidence_switch != null ) && ( _seq_relation_confidence_switch.isSelected() ) );
854 boolean isShowSequenceRelations() {
855 return ( ( _show_sequence_relations != null ) && ( _show_sequence_relations.getSelectedIndex() > 0 ) );
858 boolean isShowTaxonomyCode() {
859 return ( ( _show_taxo_code != null ) && _show_taxo_code.isSelected() );
862 boolean isShowTaxonomyCommonNames() {
863 return ( ( _show_taxo_common_names != null ) && _show_taxo_common_names.isSelected() );
866 boolean isShowTaxonomyScientificNames() {
867 return ( ( _show_taxo_scientific_names != null ) && _show_taxo_scientific_names.isSelected() );
870 boolean isWidthBranches() {
871 return ( ( _width_branches != null ) && _width_branches.isSelected() );
874 void phylogenyAdded( final Configuration configuration ) {
875 getIsDrawPhylogramList().add( configuration.isDrawAsPhylogram() );
878 void phylogenyRemoved( final int index ) {
879 getIsDrawPhylogramList().remove( index );
883 final MainPanel main_panel = getMainPanel();
884 final Phylogeny tree = main_panel.getCurrentPhylogeny();
885 if ( ( tree == null ) || tree.isEmpty() ) {
888 String query = getSearchTextField().getText();
889 if ( query != null ) {
890 query = query.trim();
893 getSearchFoundCountsLabel().setVisible( false );
894 getSearchResetButton().setEnabled( false );
895 getSearchResetButton().setVisible( false );
898 if ( !ForesterUtil.isEmpty( query ) ) {
899 search( main_panel, tree, query );
902 getSearchFoundCountsLabel().setVisible( false );
903 getSearchResetButton().setEnabled( false );
904 getSearchResetButton().setVisible( false );
909 void setActionWhenNodeClicked( final NodeClickAction action ) {
910 _action_when_node_clicked = action;
913 void setAnnotationColors( final Map<String, Color> annotation_colors ) {
914 _annotation_colors = annotation_colors;
917 void setCheckbox( final int which, final boolean state ) {
919 case Configuration.display_as_phylogram:
920 if ( getDisplayAsPhylogramCb() != null ) {
921 getDisplayAsPhylogramCb().setSelected( state );
924 case Configuration.display_internal_data:
925 if ( _display_internal_data != null ) {
926 _display_internal_data.setSelected( state );
929 case Configuration.color_according_to_species:
930 if ( _color_acc_species != null ) {
931 _color_acc_species.setSelected( state );
934 case Configuration.color_according_to_annotation:
935 if ( _color_according_to_annotation != null ) {
936 _color_according_to_annotation.setSelected( state );
939 case Configuration.show_node_names:
940 if ( _show_node_names != null ) {
941 _show_node_names.setSelected( state );
944 case Configuration.show_taxonomy_scientific_names:
945 if ( _show_taxo_scientific_names != null ) {
946 _show_taxo_scientific_names.setSelected( state );
949 case Configuration.show_taxonomy_common_names:
950 if ( _show_taxo_common_names != null ) {
951 _show_taxo_common_names.setSelected( state );
954 case Configuration.show_tax_code:
955 if ( _show_taxo_code != null ) {
956 _show_taxo_code.setSelected( state );
959 case Configuration.show_taxonomy_images:
960 if ( _show_taxo_images_cb != null ) {
961 _show_taxo_images_cb.setSelected( state );
964 case Configuration.show_annotation:
965 if ( _show_annotation != null ) {
966 _show_annotation.setSelected( state );
969 case Configuration.show_binary_characters:
970 if ( _show_binary_characters != null ) {
971 _show_binary_characters.setSelected( state );
974 case Configuration.show_binary_character_counts:
975 if ( _show_binary_character_counts != null ) {
976 _show_binary_character_counts.setSelected( state );
979 case Configuration.write_confidence_values:
980 if ( getWriteConfidenceCb() != null ) {
981 getWriteConfidenceCb().setSelected( state );
984 case Configuration.write_events:
985 if ( getShowEventsCb() != null ) {
986 getShowEventsCb().setSelected( state );
989 case Configuration.color_branches:
990 if ( getColorBranchesCb() != null ) {
991 getColorBranchesCb().setSelected( state );
994 case Configuration.width_branches:
995 if ( _width_branches != null ) {
996 _width_branches.setSelected( state );
999 case Configuration.show_domain_architectures:
1000 if ( _show_domain_architectures != null ) {
1001 _show_domain_architectures.setSelected( state );
1004 case Configuration.show_seq_names:
1005 if ( _show_seq_names != null ) {
1006 _show_seq_names.setSelected( state );
1009 case Configuration.show_gene_names:
1010 if ( _show_gene_names != null ) {
1011 _show_gene_names.setSelected( state );
1014 case Configuration.show_seq_symbols:
1015 if ( _show_seq_symbols != null ) {
1016 _show_seq_symbols.setSelected( state );
1019 case Configuration.show_vector_data:
1020 if ( _show_vector_data_cb != null ) {
1021 _show_vector_data_cb.setSelected( state );
1024 case Configuration.show_properties:
1025 if ( _show_properties_cb != null ) {
1026 _show_properties_cb.setSelected( state );
1029 case Configuration.show_sequence_acc:
1030 if ( _show_sequence_acc != null ) {
1031 _show_sequence_acc.setSelected( state );
1034 case Configuration.dynamically_hide_data:
1035 if ( getDynamicallyHideData() != null ) {
1036 getDynamicallyHideData().setSelected( state );
1039 case Configuration.node_data_popup:
1040 if ( getNodeDescPopupCb() != null ) {
1041 getNodeDescPopupCb().setSelected( state );
1045 case Configuration.show_relation_confidence:
1046 if ( _seq_relation_confidence_switch != null ) {
1047 _seq_relation_confidence_switch.setSelected( state );
1052 throw new AssertionError( "unknown checkbox: " + which );
1057 * Set this checkbox state. Not all checkboxes have been instantiated
1058 * depending on the config.
1060 void setCheckbox( final JCheckBox cb, final boolean state ) {
1062 cb.setSelected( state );
1066 void setClickToAction( final int action ) {
1067 // Set click-to action
1068 if ( action == _show_data_item ) {
1069 setActionWhenNodeClicked( NodeClickAction.SHOW_DATA );
1071 else if ( action == _collapse_cb_item ) {
1072 setActionWhenNodeClicked( NodeClickAction.COLLAPSE );
1074 else if ( action == _reroot_cb_item ) {
1075 setActionWhenNodeClicked( NodeClickAction.REROOT );
1077 else if ( action == _subtree_cb_item ) {
1078 setActionWhenNodeClicked( NodeClickAction.SUBTREE );
1080 else if ( action == _swap_cb_item ) {
1081 setActionWhenNodeClicked( NodeClickAction.SWAP );
1083 else if ( action == _color_subtree_cb_item ) {
1084 setActionWhenNodeClicked( NodeClickAction.COLOR_SUBTREE );
1086 else if ( action == _open_seq_web_item ) {
1087 setActionWhenNodeClicked( NodeClickAction.OPEN_SEQ_WEB );
1089 else if ( action == _sort_descendents_item ) {
1090 setActionWhenNodeClicked( NodeClickAction.SORT_DESCENDENTS );
1092 else if ( action == _blast_item ) {
1093 setActionWhenNodeClicked( NodeClickAction.BLAST );
1095 else if ( action == _open_tax_web_item ) {
1096 setActionWhenNodeClicked( NodeClickAction.OPEN_TAX_WEB );
1098 else if ( action == _cut_subtree_item ) {
1099 setActionWhenNodeClicked( NodeClickAction.CUT_SUBTREE );
1101 else if ( action == _copy_subtree_item ) {
1102 setActionWhenNodeClicked( NodeClickAction.COPY_SUBTREE );
1104 else if ( action == _delete_node_or_subtree_item ) {
1105 setActionWhenNodeClicked( NodeClickAction.DELETE_NODE_OR_SUBTREE );
1107 else if ( action == _paste_subtree_item ) {
1108 setActionWhenNodeClicked( NodeClickAction.PASTE_SUBTREE );
1110 else if ( action == _add_new_node_item ) {
1111 setActionWhenNodeClicked( NodeClickAction.ADD_NEW_NODE );
1113 else if ( action == _edit_node_data_item ) {
1114 setActionWhenNodeClicked( NodeClickAction.EDIT_NODE_DATA );
1116 else if ( action == _select_nodes_item ) {
1117 setActionWhenNodeClicked( NodeClickAction.SELECT_NODES );
1119 else if ( action == _get_ext_desc_data ) {
1120 setActionWhenNodeClicked( NodeClickAction.GET_EXT_DESC_DATA );
1123 throw new RuntimeException( "unknown action: " + action );
1125 // make sure drop down is displaying the correct action
1126 // in case this was called from outside the class
1127 _click_to_combobox.setSelectedIndex( action );
1130 void setColorBranches( final boolean color_branches ) {
1131 _color_branches = color_branches;
1134 void setDrawPhylogram( final boolean b ) {
1135 getDisplayAsPhylogramCb().setSelected( b );
1136 setDrawPhylogram( getMainPanel().getCurrentTabIndex(), b );
1139 void setDrawPhylogramEnabled( final boolean b ) {
1140 getDisplayAsPhylogramCb().setEnabled( b );
1143 void setDynamicHidingIsOn( final boolean is_on ) {
1144 // if ( !_configuration.isUseNativeUI() ) {
1146 getDynamicallyHideData().setForeground( getConfiguration().getGuiCheckboxAndButtonActiveColor() );
1149 if ( !_configuration.isUseNativeUI() ) {
1150 getDynamicallyHideData().setForeground( getConfiguration().getGuiButtonTextColor() );
1153 getDynamicallyHideData().setForeground( Color.BLACK );
1159 void setShowEvents( final boolean show_events ) {
1160 if ( getShowEventsCb() == null ) {
1161 _show_events = new JCheckBox( "" );
1163 getShowEventsCb().setSelected( show_events );
1166 void setSpeciesColors( final Map<String, Color> species_colors ) {
1167 _species_colors = species_colors;
1172 * Set up the controls from the config settings. 11/26/05
1174 void setupControls() {
1175 // The tree display options:
1176 setupDisplayCheckboxes();
1178 // The sequence relation query selection combo-box
1179 if ( _configuration.displaySequenceRelations() ) {
1180 addSequenceRelationBlock();
1184 startClickToOptions();
1185 setupClickToOptions();
1186 endClickToOptions();
1187 // Zoom and quick edit buttons
1192 void setUpControlsForDomainStrucures() {
1193 _domain_display_label = new JLabel( "Domain Display:" );
1194 add( customizeLabel( _domain_display_label, getConfiguration() ) );
1195 add( _domain_display_label );
1196 _zoom_in_domain_structure = new JButton( "d+" );
1197 _zoom_out_domain_structure = new JButton( "d-" );
1198 _decr_domain_structure_evalue_thr = new JButton( "-" );
1199 _incr_domain_structure_evalue_thr = new JButton( "+" );
1200 _zoom_in_domain_structure.setPreferredSize( new Dimension( 10, 10 ) );
1201 _zoom_out_domain_structure.setPreferredSize( new Dimension( 10, 10 ) );
1202 _decr_domain_structure_evalue_thr.setPreferredSize( new Dimension( 10, 10 ) );
1203 _incr_domain_structure_evalue_thr.setPreferredSize( new Dimension( 10, 10 ) );
1204 _incr_domain_structure_evalue_thr.setToolTipText( "Increase the E-value threshold by a factor of 10" );
1205 _decr_domain_structure_evalue_thr.setToolTipText( "Decrease the E-value threshold by a factor of 10" );
1206 _domain_structure_evalue_thr_tf = new JTextField( 3 );
1207 _domain_structure_evalue_thr_tf.setEditable( false );
1208 if ( !getConfiguration().isUseNativeUI() ) {
1209 _domain_structure_evalue_thr_tf.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
1210 _domain_structure_evalue_thr_tf.setBackground( getConfiguration().getGuiCheckboxTextColor() );
1211 _domain_structure_evalue_thr_tf.setBorder( null );
1213 final JPanel d1_panel = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
1214 final JPanel d2_panel = new JPanel( new GridLayout( 1, 3, 0, 0 ) );
1215 if ( !_configuration.isUseNativeUI() ) {
1216 d1_panel.setBackground( getBackground() );
1217 d2_panel.setBackground( getBackground() );
1221 addJButton( _zoom_out_domain_structure, d1_panel );
1222 addJButton( _zoom_in_domain_structure, d1_panel );
1223 addJButton( _decr_domain_structure_evalue_thr, d2_panel );
1224 addJTextField( _domain_structure_evalue_thr_tf, d2_panel );
1225 addJButton( _incr_domain_structure_evalue_thr, d2_panel );
1228 void setupSearchTools() {
1229 final String tip = "Enter text to search for. Use ',' for multiple searches (logical OR) and '+' for logical AND.";
1230 final JLabel search_label = new JLabel( "Search:" );
1231 search_label.setFont( ControlPanel.jcb_bold_font );
1232 if ( !getConfiguration().isUseNativeUI() ) {
1233 search_label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1235 add( search_label );
1236 search_label.setToolTipText( tip );
1237 _search_found_label = new JLabel();
1238 getSearchFoundCountsLabel().setVisible( false );
1239 _search_found_label.setFont( ControlPanel.jcb_bold_font );
1240 if ( !getConfiguration().isUseNativeUI() ) {
1241 _search_found_label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1243 _search_tf = new JTextField( 3 );
1244 _search_tf.setToolTipText( tip );
1245 _search_tf.setEditable( true );
1246 if ( !getConfiguration().isUseNativeUI() ) {
1247 _search_tf.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
1248 _search_tf.setBackground( getConfiguration().getGuiCheckboxTextColor() );
1249 _search_tf.setBorder( null );
1251 _search_reset_button = new JButton();
1252 getSearchResetButton().setText( "Reset" );
1253 getSearchResetButton().setEnabled( false );
1254 getSearchResetButton().setVisible( false );
1255 final JPanel s_panel_1 = new JPanel( new BorderLayout() );
1256 final JPanel s_panel_2 = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
1257 s_panel_1.setBackground( getBackground() );
1259 s_panel_2.setBackground( getBackground() );
1261 final KeyAdapter key_adapter = new KeyAdapter() {
1264 public void keyReleased( final KeyEvent key_event ) {
1266 displayedPhylogenyMightHaveChanged( true );
1269 final ActionListener action_listener = new ActionListener() {
1272 public void actionPerformed( final ActionEvent e ) {
1274 setSearchFoundCountsOnLabel( 0 );
1275 getSearchFoundCountsLabel().setVisible( false );
1276 getSearchTextField().setText( "" );
1277 getSearchResetButton().setEnabled( false );
1278 getSearchResetButton().setVisible( false );
1279 displayedPhylogenyMightHaveChanged( true );
1282 _search_reset_button.addActionListener( action_listener );
1283 _search_tf.addKeyListener( key_adapter );
1284 addJTextField( _search_tf, s_panel_1 );
1285 s_panel_2.add( _search_found_label );
1286 addJButton( _search_reset_button, s_panel_2 );
1290 * Fit entire tree into window.
1293 if ( ( _mainpanel.getCurrentScrollPane() == null ) || _mainpanel.getCurrentTreePanel().getPhylogeny().isEmpty() ) {
1296 getCurrentTreePanel().updateSetOfCollapsedExternalNodes();
1297 displayedPhylogenyMightHaveChanged( true );
1298 _mainpanel.getCurrentTreePanel().updateOvSettings();
1299 _mainpanel.getCurrentTreePanel().validate();
1300 _mainpanel.validate();
1301 _mainpanel.getCurrentTreePanel().calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
1302 _mainpanel.getSizeOfViewport().height,
1304 _mainpanel.getCurrentTreePanel().resetPreferredSize();
1305 _mainpanel.adjustJScrollPane();
1306 _mainpanel.getCurrentTreePanel().repaint();
1307 _mainpanel.getCurrentTreePanel().validate();
1308 _mainpanel.validate();
1309 _mainpanel.getCurrentTreePanel().calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
1310 _mainpanel.getSizeOfViewport().height,
1312 _mainpanel.getCurrentTreePanel().resetPreferredSize();
1313 _mainpanel.adjustJScrollPane();
1314 _mainpanel.getCurrentTreePanel().repaint();
1315 _mainpanel.getCurrentTreePanel().updateOvSizes();
1318 void showWholeAll() {
1319 for( final TreePanel tree_panel : _mainpanel.getTreePanels() ) {
1320 if ( tree_panel != null ) {
1321 tree_panel.validate();
1322 tree_panel.calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
1323 _mainpanel.getSizeOfViewport().height,
1325 tree_panel.resetPreferredSize();
1326 tree_panel.repaint();
1331 // Create header for click-to combo box.
1332 void startClickToOptions() {
1333 final JLabel spacer = new JLabel( "" );
1334 spacer.setFont( ControlPanel.jcb_font );
1336 _click_to_label = new JLabel( "Click on Node to:" );
1337 add( customizeLabel( _click_to_label, getConfiguration() ) );
1338 _click_to_combobox = new JComboBox();
1339 _click_to_combobox.setFocusable( false );
1340 _click_to_combobox.setMaximumRowCount( 14 );
1341 _click_to_combobox.setFont( ControlPanel.js_font );
1342 if ( !_configuration.isUseNativeUI() ) {
1343 _click_to_combobox.setBackground( getConfiguration().getGuiBackgroundColor() );
1345 // don't add listener until all items are set (or each one will trigger
1347 // click_to_list.addActionListener(this);
1348 add( _click_to_combobox );
1349 // Correlates option names to titles
1350 _all_click_to_names = new HashMap<Integer, String>();
1351 _click_to_names = new ArrayList<String>();
1355 if ( getMainPanel().getTabbedPane().getTabCount() > 0 ) {
1356 if ( getCurrentTreePanel().isPhyHasBranchLengths()
1357 && ( getCurrentTreePanel().getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) {
1358 setDrawPhylogramEnabled( true );
1359 setDrawPhylogram( isDrawPhylogram() );
1362 setDrawPhylogramEnabled( false );
1363 setDrawPhylogram( false );
1365 if ( getMainPanel().getMainFrame() == null ) {
1366 // Must be "E" applet version.
1367 final ArchaeopteryxE e = ( ArchaeopteryxE ) ( ( MainPanelApplets ) getMainPanel() ).getApplet();
1368 e.setSelectedTypeInTypeMenu( e.getCurrentTreePanel().getPhylogenyGraphicsType() );
1371 getMainPanel().getMainFrame().setSelectedTypeInTypeMenu( getMainPanel().getCurrentTreePanel()
1372 .getPhylogenyGraphicsType() );
1374 getMainPanel().getCurrentTreePanel().updateSubSuperTreeButton();
1375 getMainPanel().getControlPanel().search();
1376 getSequenceRelationTypeBox().removeAllItems();
1377 for( final SequenceRelation.SEQUENCE_RELATION_TYPE type : getMainPanel().getCurrentPhylogeny()
1378 .getRelevantSequenceRelationTypes() ) {
1379 _sequence_relation_type_box.addItem( type );
1381 //setSequenceRelationQueries( getMainPanel().getCurrentPhylogeny().getSequenceRelationQueries() );
1382 // according to GUILHEM the line above can be removed.
1387 * Uncollapse all nodes.
1389 void uncollapseAll( final TreePanel tp ) {
1390 final Phylogeny t = tp.getPhylogeny();
1391 if ( ( t != null ) && !t.isEmpty() ) {
1392 for( final PhylogenyNodeIterator iter = t.iteratorPreorder(); iter.hasNext(); ) {
1393 final PhylogenyNode node = iter.next();
1394 node.setCollapse( false );
1396 tp.resetNodeIdToDistToLeafMap();
1397 tp.updateSetOfCollapsedExternalNodes();
1398 t.recalculateNumberOfExternalDescendants( false );
1399 tp.setNodeInPreorderToNull();
1400 t.clearHashIdToNodeMap();
1405 void updateDomainStructureEvaluethresholdDisplay() {
1406 if ( _domain_structure_evalue_thr_tf != null ) {
1407 _domain_structure_evalue_thr_tf.setText( "10^"
1408 + getMainPanel().getCurrentTreePanel().getDomainStructureEvalueThreshold() );
1412 void zoomInX( final float factor, final float x_correction_factor ) {
1413 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar();
1414 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1415 treepanel.multiplyUrtFactor( 1f );
1416 if ( ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
1417 || ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
1418 || isDrawPhylogram( getMainPanel().getCurrentTabIndex() )
1419 || ( getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP ) ) {
1420 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1421 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
1422 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
1423 getMainPanel().adjustJScrollPane();
1424 treepanel.resetPreferredSize();
1425 getMainPanel().getCurrentScrollPane().getViewport().validate();
1426 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1427 - ( sb.getVisibleAmount() / 2.0 ) ) );
1430 final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue();
1431 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
1432 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
1433 getMainPanel().adjustJScrollPane();
1434 treepanel.resetPreferredSize();
1435 getMainPanel().getCurrentScrollPane().getViewport().validate();
1436 sb.setValue( sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount() );
1438 treepanel.resetPreferredSize();
1439 treepanel.updateOvSizes();
1442 void zoomInY( final float factor ) {
1443 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getVerticalScrollBar();
1444 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1445 treepanel.multiplyUrtFactor( 1.1f );
1446 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1447 treepanel.setYdistance( ( treepanel.getYdistance() * factor ) );
1448 getMainPanel().adjustJScrollPane();
1449 treepanel.resetPreferredSize();
1450 getMainPanel().getCurrentScrollPane().getViewport().validate();
1451 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1452 - ( sb.getVisibleAmount() / 2.0 ) ) );
1453 treepanel.resetPreferredSize();
1454 treepanel.updateOvSizes();
1457 void zoomOutX( final float factor, final float x_correction_factor ) {
1458 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1459 treepanel.multiplyUrtFactor( 1f );
1460 if ( ( treepanel.getXdistance() * factor ) > 0.0 ) {
1461 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar();
1462 if ( ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
1463 || ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
1464 || isDrawPhylogram( getMainPanel().getCurrentTabIndex() )
1465 || ( getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP ) ) {
1466 getMainPanel().adjustJScrollPane();
1467 treepanel.resetPreferredSize();
1468 getMainPanel().getCurrentScrollPane().getViewport().validate();
1469 final double x = ( sb.getMaximum() - sb.getMinimum() )
1470 / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1471 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
1472 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
1473 getMainPanel().adjustJScrollPane();
1474 treepanel.resetPreferredSize();
1475 getMainPanel().getCurrentScrollPane().getViewport().validate();
1476 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1477 - ( sb.getVisibleAmount() / 2.0 ) ) );
1480 final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue();
1481 treepanel.setXdistance( treepanel.getXdistance() * factor );
1482 treepanel.setXcorrectionFactor( treepanel.getXcorrectionFactor() * x_correction_factor );
1484 getMainPanel().adjustJScrollPane();
1485 treepanel.resetPreferredSize();
1486 getMainPanel().getCurrentScrollPane().getViewport().validate();
1487 sb.setValue( sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount() );
1490 treepanel.resetPreferredSize();
1491 treepanel.updateOvSizes();
1495 void zoomOutY( final float factor ) {
1496 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1497 treepanel.multiplyUrtFactor( 0.9f );
1498 if ( ( treepanel.getYdistance() * factor ) > 0.0 ) {
1499 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getVerticalScrollBar();
1500 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1501 treepanel.setYdistance( ( treepanel.getYdistance() * factor ) );
1502 getMainPanel().adjustJScrollPane();
1503 treepanel.resetPreferredSize();
1504 getMainPanel().getCurrentScrollPane().getViewport().validate();
1505 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1506 - ( sb.getVisibleAmount() / 2.0 ) ) );
1507 treepanel.resetPreferredSize();
1508 treepanel.updateOvSizes();
1512 private void addClickToOption( final int which, final String title ) {
1513 _click_to_combobox.addItem( title );
1514 _click_to_names.add( title );
1515 _all_click_to_names.put( new Integer( which ), title );
1516 if ( !_configuration.isUseNativeUI() ) {
1517 _click_to_combobox.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
1518 _click_to_combobox.setForeground( getConfiguration().getGuiButtonTextColor() );
1523 private void addSequenceRelationBlock() {
1524 final JLabel spacer = new JLabel( "" );
1525 spacer.setSize( 1, 1 );
1527 final JLabel mainLabel = new JLabel( "Sequence relations to display" );
1528 final JLabel typeLabel = customizeLabel( new JLabel( "(type) " ), getConfiguration() );
1529 typeLabel.setFont( ControlPanel.js_font.deriveFont( 7 ) );
1530 getSequenceRelationTypeBox().setFocusable( false );
1531 _sequence_relation_type_box.setFont( ControlPanel.js_font );
1532 if ( !_configuration.isUseNativeUI() ) {
1533 _sequence_relation_type_box.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
1534 _sequence_relation_type_box.setForeground( getConfiguration().getGuiButtonTextColor() );
1536 _sequence_relation_type_box.setRenderer( new ListCellRenderer() {
1539 public Component getListCellRendererComponent( final JList list,
1542 final boolean isSelected,
1543 final boolean cellHasFocus ) {
1544 final Component component = new DefaultListCellRenderer().getListCellRendererComponent( list,
1549 if ( ( value != null ) && ( value instanceof SequenceRelation.SEQUENCE_RELATION_TYPE ) ) {
1550 ( ( DefaultListCellRenderer ) component ).setText( SequenceRelation
1551 .getPrintableNameByType( ( SequenceRelation.SEQUENCE_RELATION_TYPE ) value ) );
1556 final GridBagLayout gbl = new GridBagLayout();
1557 _sequence_relation_type_box.setMinimumSize( new Dimension( 115, 17 ) );
1558 _sequence_relation_type_box.setPreferredSize( new Dimension( 115, 20 ) );
1559 final JPanel horizGrid = new JPanel( gbl );
1560 horizGrid.setBackground( getBackground() );
1561 horizGrid.add( typeLabel );
1562 horizGrid.add( _sequence_relation_type_box );
1563 add( customizeLabel( mainLabel, getConfiguration() ) );
1565 add( getSequenceRelationBox() );
1566 if ( _configuration.doDisplayOption( Configuration.show_relation_confidence ) ) {
1567 addCheckbox( Configuration.show_relation_confidence,
1568 _configuration.getDisplayTitle( Configuration.show_relation_confidence ) );
1569 setCheckbox( Configuration.show_relation_confidence,
1570 _configuration.doCheckOption( Configuration.show_relation_confidence ) );
1572 }// addSequenceRelationBlock
1575 private List<Boolean> getIsDrawPhylogramList() {
1576 return _draw_phylogram;
1579 JLabel getSearchFoundCountsLabel() {
1580 return _search_found_label;
1583 JButton getSearchResetButton() {
1584 return _search_reset_button;
1587 private void init() {
1588 _draw_phylogram = new ArrayList<Boolean>();
1589 setSpeciesColors( new HashMap<String, Color>() );
1590 setAnnotationColors( new HashMap<String, Color>() );
1593 private boolean isDrawPhylogram( final int index ) {
1594 return getIsDrawPhylogramList().get( index );
1597 private void search( final MainPanel main_panel, final Phylogeny tree, final String query_str ) {
1598 getSearchFoundCountsLabel().setVisible( true );
1599 getSearchResetButton().setEnabled( true );
1600 getSearchResetButton().setVisible( true );
1601 String[] queries = null;
1602 List<PhylogenyNode> nodes = null;
1603 if ( query_str.indexOf( ',' ) >= 0 ) {
1604 queries = query_str.split( ",+" );
1607 queries = new String[ 1 ];
1608 queries[ 0 ] = query_str.trim();
1610 if ( ( queries != null ) && ( queries.length > 0 ) ) {
1611 nodes = new ArrayList<PhylogenyNode>();
1612 for( String query : queries ) {
1613 if ( ForesterUtil.isEmpty( query ) ) {
1616 query = query.trim();
1617 if ( query.indexOf( '+' ) >= 0 ) {
1618 nodes.addAll( PhylogenyMethods.searchDataLogicalAnd( query.split( "\\++" ),
1620 getOptions().isSearchCaseSensitive(),
1621 !getOptions().isMatchWholeTermsOnly(),
1622 isShowDomainArchitectures() ) );
1625 nodes.addAll( PhylogenyMethods.searchData( query,
1627 getOptions().isSearchCaseSensitive(),
1628 !getOptions().isMatchWholeTermsOnly(),
1629 isShowDomainArchitectures() ) );
1632 if ( getOptions().isInverseSearchResult() ) {
1633 final List<PhylogenyNode> all = PhylogenyMethods.obtainAllNodesAsList( tree );
1634 all.removeAll( nodes );
1638 if ( ( nodes != null ) && ( nodes.size() > 0 ) ) {
1639 main_panel.getCurrentTreePanel().setFoundNodes( new HashSet<Long>() );
1640 for( final PhylogenyNode node : nodes ) {
1641 main_panel.getCurrentTreePanel().getFoundNodes().add( node.getId() );
1643 setSearchFoundCountsOnLabel( nodes.size() );
1646 setSearchFoundCountsOnLabel( 0 );
1651 void searchReset() {
1652 if ( getMainPanel().getCurrentTreePanel() != null ) {
1653 getMainPanel().getCurrentTreePanel().setFoundNodes( null );
1657 private void setDrawPhylogram( final int index, final boolean b ) {
1658 getIsDrawPhylogramList().set( index, b );
1661 void setSearchFoundCountsOnLabel( final int counts ) {
1662 getSearchFoundCountsLabel().setText( "Found: " + counts );
1665 private void setupClickToOptions() {
1666 final int default_option = _configuration.getDefaultDisplayClicktoOption();
1667 int selected_index = 0;
1669 if ( _configuration.doDisplayClickToOption( Configuration.display_node_data ) ) {
1670 _show_data_item = cb_index;
1671 addClickToOption( Configuration.display_node_data,
1672 _configuration.getClickToTitle( Configuration.display_node_data ) );
1673 if ( default_option == Configuration.display_node_data ) {
1674 selected_index = cb_index;
1678 if ( _configuration.doDisplayClickToOption( Configuration.collapse_uncollapse ) ) {
1679 _collapse_cb_item = cb_index;
1680 addClickToOption( Configuration.collapse_uncollapse,
1681 _configuration.getClickToTitle( Configuration.collapse_uncollapse ) );
1682 if ( default_option == Configuration.collapse_uncollapse ) {
1683 selected_index = cb_index;
1687 if ( _configuration.doDisplayClickToOption( Configuration.reroot ) ) {
1688 _reroot_cb_item = cb_index;
1689 addClickToOption( Configuration.reroot, _configuration.getClickToTitle( Configuration.reroot ) );
1690 if ( default_option == Configuration.reroot ) {
1691 selected_index = cb_index;
1695 if ( _configuration.doDisplayClickToOption( Configuration.subtree ) ) {
1696 _subtree_cb_item = cb_index;
1697 addClickToOption( Configuration.subtree, _configuration.getClickToTitle( Configuration.subtree ) );
1698 if ( default_option == Configuration.subtree ) {
1699 selected_index = cb_index;
1703 if ( _configuration.doDisplayClickToOption( Configuration.swap ) ) {
1704 _swap_cb_item = cb_index;
1705 addClickToOption( Configuration.swap, _configuration.getClickToTitle( Configuration.swap ) );
1706 if ( default_option == Configuration.swap ) {
1707 selected_index = cb_index;
1711 if ( _configuration.doDisplayClickToOption( Configuration.sort_descendents ) ) {
1712 _sort_descendents_item = cb_index;
1713 addClickToOption( Configuration.sort_descendents,
1714 _configuration.getClickToTitle( Configuration.sort_descendents ) );
1715 if ( default_option == Configuration.sort_descendents ) {
1716 selected_index = cb_index;
1720 if ( _configuration.doDisplayClickToOption( Configuration.color_subtree ) ) {
1721 _color_subtree_cb_item = cb_index;
1722 addClickToOption( Configuration.color_subtree, _configuration.getClickToTitle( Configuration.color_subtree ) );
1723 if ( default_option == Configuration.color_subtree ) {
1724 selected_index = cb_index;
1728 if ( _configuration.doDisplayClickToOption( Configuration.open_seq_web ) ) {
1729 _open_seq_web_item = cb_index;
1730 addClickToOption( Configuration.open_seq_web, _configuration.getClickToTitle( Configuration.open_seq_web ) );
1731 if ( default_option == Configuration.open_seq_web ) {
1732 selected_index = cb_index;
1736 if ( _configuration.doDisplayClickToOption( Configuration.open_tax_web ) ) {
1737 _open_tax_web_item = cb_index;
1738 addClickToOption( Configuration.open_tax_web, _configuration.getClickToTitle( Configuration.open_tax_web ) );
1739 if ( default_option == Configuration.open_tax_web ) {
1740 selected_index = cb_index;
1744 if ( _configuration.doDisplayClickToOption( Configuration.blast ) ) {
1745 _blast_item = cb_index;
1746 addClickToOption( Configuration.blast, _configuration.getClickToTitle( Configuration.blast ) );
1747 if ( default_option == Configuration.blast ) {
1748 selected_index = cb_index;
1752 if ( _configuration.doDisplayClickToOption( Configuration.select_nodes ) ) {
1753 _select_nodes_item = cb_index;
1754 addClickToOption( Configuration.select_nodes, _configuration.getClickToTitle( Configuration.select_nodes ) );
1755 if ( default_option == Configuration.select_nodes ) {
1756 selected_index = cb_index;
1760 if ( _configuration.doDisplayClickToOption( Configuration.get_ext_desc_data ) ) {
1761 _get_ext_desc_data = cb_index;
1762 if ( !ForesterUtil.isEmpty( getConfiguration().getLabelForGetExtDescendentsData() ) ) {
1763 addClickToOption( Configuration.get_ext_desc_data, getConfiguration()
1764 .getLabelForGetExtDescendentsData() );
1768 switch ( getConfiguration().getExtDescNodeDataToReturn() ) {
1773 s = "Sequence Accessors";
1775 case SEQUENCE_MOL_SEQ:
1776 s = "Molecular Sequence";
1778 case SEQUENCE_MOL_SEQ_FASTA:
1779 s = "Molecular Sequence (Fasta)";
1782 s = "Sequence Names";
1787 case SEQUENCE_SYMBOL:
1788 s = "Sequence Symbols";
1791 s = "Taxonomy Codes";
1793 case TAXONOMY_COMM0N_NAME:
1794 s = "Taxonomy Common Names";
1796 case TAXONOMY_SCIENTIFIC_NAME:
1797 s = "Scientific Names";
1800 s = "User Selected Data";
1803 final String label = _configuration.getClickToTitle( Configuration.get_ext_desc_data ) + " " + s;
1804 addClickToOption( Configuration.get_ext_desc_data, label );
1806 if ( default_option == Configuration.get_ext_desc_data ) {
1807 selected_index = cb_index;
1811 if ( getOptions().isEditable() ) {
1812 if ( _configuration.doDisplayClickToOption( Configuration.cut_subtree ) ) {
1813 _cut_subtree_item = cb_index;
1814 addClickToOption( Configuration.cut_subtree, _configuration.getClickToTitle( Configuration.cut_subtree ) );
1815 if ( default_option == Configuration.cut_subtree ) {
1816 selected_index = cb_index;
1820 if ( _configuration.doDisplayClickToOption( Configuration.copy_subtree ) ) {
1821 _copy_subtree_item = cb_index;
1822 addClickToOption( Configuration.copy_subtree,
1823 _configuration.getClickToTitle( Configuration.copy_subtree ) );
1824 if ( default_option == Configuration.copy_subtree ) {
1825 selected_index = cb_index;
1829 if ( _configuration.doDisplayClickToOption( Configuration.paste_subtree ) ) {
1830 _paste_subtree_item = cb_index;
1831 addClickToOption( Configuration.paste_subtree,
1832 _configuration.getClickToTitle( Configuration.paste_subtree ) );
1833 if ( default_option == Configuration.paste_subtree ) {
1834 selected_index = cb_index;
1838 if ( _configuration.doDisplayClickToOption( Configuration.delete_subtree_or_node ) ) {
1839 _delete_node_or_subtree_item = cb_index;
1840 addClickToOption( Configuration.delete_subtree_or_node,
1841 _configuration.getClickToTitle( Configuration.delete_subtree_or_node ) );
1842 if ( default_option == Configuration.delete_subtree_or_node ) {
1843 selected_index = cb_index;
1847 if ( _configuration.doDisplayClickToOption( Configuration.add_new_node ) ) {
1848 _add_new_node_item = cb_index;
1849 addClickToOption( Configuration.add_new_node,
1850 _configuration.getClickToTitle( Configuration.add_new_node ) );
1851 if ( default_option == Configuration.add_new_node ) {
1852 selected_index = cb_index;
1856 if ( _configuration.doDisplayClickToOption( Configuration.edit_node_data ) ) {
1857 _edit_node_data_item = cb_index;
1858 addClickToOption( Configuration.edit_node_data,
1859 _configuration.getClickToTitle( Configuration.edit_node_data ) );
1860 if ( default_option == Configuration.edit_node_data ) {
1861 selected_index = cb_index;
1866 // Set default selection and its action
1867 _click_to_combobox.setSelectedIndex( selected_index );
1868 setClickToAction( selected_index );
1871 private void setupDisplayCheckboxes() {
1872 if ( _configuration.doDisplayOption( Configuration.display_as_phylogram ) ) {
1873 addCheckbox( Configuration.display_as_phylogram,
1874 _configuration.getDisplayTitle( Configuration.display_as_phylogram ) );
1875 setCheckbox( Configuration.display_as_phylogram,
1876 _configuration.doCheckOption( Configuration.display_as_phylogram ) );
1878 if ( _configuration.doDisplayOption( Configuration.dynamically_hide_data ) ) {
1879 addCheckbox( Configuration.dynamically_hide_data,
1880 _configuration.getDisplayTitle( Configuration.dynamically_hide_data ) );
1881 setCheckbox( Configuration.dynamically_hide_data,
1882 _configuration.doCheckOption( Configuration.dynamically_hide_data ) );
1884 if ( _configuration.doDisplayOption( Configuration.node_data_popup ) ) {
1885 addCheckbox( Configuration.node_data_popup, _configuration.getDisplayTitle( Configuration.node_data_popup ) );
1886 setCheckbox( Configuration.node_data_popup, _configuration.doCheckOption( Configuration.node_data_popup ) );
1888 if ( _configuration.doDisplayOption( Configuration.display_internal_data ) ) {
1889 addCheckbox( Configuration.display_internal_data,
1890 _configuration.getDisplayTitle( Configuration.display_internal_data ) );
1891 setCheckbox( Configuration.display_internal_data,
1892 _configuration.doCheckOption( Configuration.display_internal_data ) );
1894 if ( _configuration.doDisplayOption( Configuration.color_according_to_species ) ) {
1895 addCheckbox( Configuration.color_according_to_species,
1896 _configuration.getDisplayTitle( Configuration.color_according_to_species ) );
1897 setCheckbox( Configuration.color_according_to_species,
1898 _configuration.doCheckOption( Configuration.color_according_to_species ) );
1900 if ( _configuration.doDisplayOption( Configuration.color_according_to_annotation ) ) {
1901 addCheckbox( Configuration.color_according_to_annotation,
1902 _configuration.getDisplayTitle( Configuration.color_according_to_annotation ) );
1903 setCheckbox( Configuration.color_according_to_annotation,
1904 _configuration.doCheckOption( Configuration.color_according_to_annotation ) );
1906 if ( _configuration.doDisplayOption( Configuration.color_branches ) ) {
1907 addCheckbox( Configuration.color_branches, _configuration.getDisplayTitle( Configuration.color_branches ) );
1908 setCheckbox( Configuration.color_branches, _configuration.doCheckOption( Configuration.color_branches ) );
1910 if ( _configuration.doDisplayOption( Configuration.width_branches ) ) {
1911 addCheckbox( Configuration.width_branches, _configuration.getDisplayTitle( Configuration.width_branches ) );
1912 setCheckbox( Configuration.width_branches, _configuration.doCheckOption( Configuration.width_branches ) );
1914 final JLabel label = new JLabel( "Display Data:" );
1915 label.setFont( ControlPanel.jcb_bold_font );
1916 if ( !getConfiguration().isUseNativeUI() ) {
1917 label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1920 if ( _configuration.doDisplayOption( Configuration.show_node_names ) ) {
1921 addCheckbox( Configuration.show_node_names, _configuration.getDisplayTitle( Configuration.show_node_names ) );
1922 setCheckbox( Configuration.show_node_names, _configuration.doCheckOption( Configuration.show_node_names ) );
1924 if ( _configuration.doDisplayOption( Configuration.show_tax_code ) ) {
1925 addCheckbox( Configuration.show_tax_code, _configuration.getDisplayTitle( Configuration.show_tax_code ) );
1926 setCheckbox( Configuration.show_tax_code, _configuration.doCheckOption( Configuration.show_tax_code ) );
1928 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_scientific_names ) ) {
1929 addCheckbox( Configuration.show_taxonomy_scientific_names,
1930 _configuration.getDisplayTitle( Configuration.show_taxonomy_scientific_names ) );
1931 setCheckbox( Configuration.show_taxonomy_scientific_names,
1932 _configuration.doCheckOption( Configuration.show_taxonomy_scientific_names ) );
1934 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_common_names ) ) {
1935 addCheckbox( Configuration.show_taxonomy_common_names,
1936 _configuration.getDisplayTitle( Configuration.show_taxonomy_common_names ) );
1937 setCheckbox( Configuration.show_taxonomy_common_names,
1938 _configuration.doCheckOption( Configuration.show_taxonomy_common_names ) );
1940 if ( _configuration.doDisplayOption( Configuration.show_seq_names ) ) {
1941 addCheckbox( Configuration.show_seq_names, _configuration.getDisplayTitle( Configuration.show_seq_names ) );
1942 setCheckbox( Configuration.show_seq_names, _configuration.doCheckOption( Configuration.show_seq_names ) );
1944 if ( _configuration.doDisplayOption( Configuration.show_gene_names ) ) {
1945 addCheckbox( Configuration.show_gene_names, _configuration.getDisplayTitle( Configuration.show_gene_names ) );
1946 setCheckbox( Configuration.show_gene_names, _configuration.doCheckOption( Configuration.show_gene_names ) );
1948 if ( _configuration.doDisplayOption( Configuration.show_seq_symbols ) ) {
1949 addCheckbox( Configuration.show_seq_symbols,
1950 _configuration.getDisplayTitle( Configuration.show_seq_symbols ) );
1951 setCheckbox( Configuration.show_seq_symbols, _configuration.doCheckOption( Configuration.show_seq_symbols ) );
1953 if ( _configuration.doDisplayOption( Configuration.show_sequence_acc ) ) {
1954 addCheckbox( Configuration.show_sequence_acc,
1955 _configuration.getDisplayTitle( Configuration.show_sequence_acc ) );
1956 setCheckbox( Configuration.show_sequence_acc,
1957 _configuration.doCheckOption( Configuration.show_sequence_acc ) );
1959 if ( _configuration.doDisplayOption( Configuration.show_annotation ) ) {
1960 addCheckbox( Configuration.show_annotation, _configuration.getDisplayTitle( Configuration.show_annotation ) );
1961 setCheckbox( Configuration.show_annotation, _configuration.doCheckOption( Configuration.show_annotation ) );
1963 if ( _configuration.doDisplayOption( Configuration.show_binary_characters ) ) {
1964 addCheckbox( Configuration.show_binary_characters,
1965 _configuration.getDisplayTitle( Configuration.show_binary_characters ) );
1966 setCheckbox( Configuration.show_binary_characters,
1967 _configuration.doCheckOption( Configuration.show_binary_characters ) );
1969 if ( _configuration.doDisplayOption( Configuration.show_binary_character_counts ) ) {
1970 addCheckbox( Configuration.show_binary_character_counts,
1971 _configuration.getDisplayTitle( Configuration.show_binary_character_counts ) );
1972 setCheckbox( Configuration.show_binary_character_counts,
1973 _configuration.doCheckOption( Configuration.show_binary_character_counts ) );
1975 if ( _configuration.doDisplayOption( Configuration.show_domain_architectures ) ) {
1976 addCheckbox( Configuration.show_domain_architectures,
1977 _configuration.getDisplayTitle( Configuration.show_domain_architectures ) );
1978 setCheckbox( Configuration.show_domain_architectures,
1979 _configuration.doCheckOption( Configuration.show_domain_architectures ) );
1981 if ( _configuration.doDisplayOption( Configuration.write_confidence_values ) ) {
1982 addCheckbox( Configuration.write_confidence_values,
1983 _configuration.getDisplayTitle( Configuration.write_confidence_values ) );
1984 setCheckbox( Configuration.write_confidence_values,
1985 _configuration.doCheckOption( Configuration.write_confidence_values ) );
1987 if ( _configuration.doDisplayOption( Configuration.write_events ) ) {
1988 addCheckbox( Configuration.write_events, _configuration.getDisplayTitle( Configuration.write_events ) );
1989 setCheckbox( Configuration.write_events, _configuration.doCheckOption( Configuration.write_events ) );
1991 if ( _configuration.doDisplayOption( Configuration.show_vector_data ) ) {
1992 addCheckbox( Configuration.show_vector_data,
1993 _configuration.getDisplayTitle( Configuration.show_vector_data ) );
1994 setCheckbox( Configuration.show_vector_data, _configuration.doCheckOption( Configuration.show_vector_data ) );
1996 if ( _configuration.doDisplayOption( Configuration.show_properties ) ) {
1997 addCheckbox( Configuration.show_properties, _configuration.getDisplayTitle( Configuration.show_properties ) );
1998 setCheckbox( Configuration.show_properties, _configuration.doCheckOption( Configuration.show_properties ) );
2000 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_images ) ) {
2001 addCheckbox( Configuration.show_taxonomy_images,
2002 _configuration.getDisplayTitle( Configuration.show_taxonomy_images ) );
2003 setCheckbox( Configuration.show_taxonomy_images,
2004 _configuration.doCheckOption( Configuration.show_taxonomy_images ) );
2008 private void setVisibilityOfDomainStrucureControls() {
2009 if ( _zoom_in_domain_structure != null ) {
2010 if ( isShowDomainArchitectures() ) {
2011 _domain_display_label.setVisible( true );
2012 _zoom_in_domain_structure.setVisible( true );
2013 _zoom_out_domain_structure.setVisible( true );
2014 _decr_domain_structure_evalue_thr.setVisible( true );
2015 _incr_domain_structure_evalue_thr.setVisible( true );
2016 _domain_structure_evalue_thr_tf.setVisible( true );
2019 _domain_display_label.setVisible( false );
2020 _zoom_in_domain_structure.setVisible( false );
2021 _zoom_out_domain_structure.setVisible( false );
2022 _decr_domain_structure_evalue_thr.setVisible( false );
2023 _incr_domain_structure_evalue_thr.setVisible( false );
2024 _domain_structure_evalue_thr_tf.setVisible( false );
2029 static JLabel customizeLabel( final JLabel label, final Configuration configuration ) {
2030 label.setFont( ControlPanel.jcb_bold_font );
2031 if ( !configuration.isUseNativeUI() ) {
2032 label.setForeground( configuration.getGuiCheckboxTextColor() );
2033 label.setBackground( configuration.getGuiBackgroundColor() );
2038 enum NodeClickAction {
2049 DELETE_NODE_OR_SUBTREE,