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 _show_annotation.setSelected( true );
437 _color_according_to_annotation.setSelected( true );
438 _color_acc_species.setSelected( false );
439 _mainpanel.getCurrentTreePanel().repaint();
443 * Add zoom and quick edit buttons. (Last modified 8/9/04)
446 final JLabel spacer = new JLabel( "" );
447 spacer.setOpaque( false );
449 final JPanel x_panel = new JPanel( new GridLayout( 1, 1, 0, 0 ) );
450 final JPanel y_panel = new JPanel( new GridLayout( 1, 3, 0, 0 ) );
451 final JPanel z_panel = new JPanel( new GridLayout( 1, 1, 0, 0 ) );
452 if ( !getConfiguration().isUseNativeUI() ) {
453 x_panel.setBackground( getBackground() );
454 y_panel.setBackground( getBackground() );
455 z_panel.setBackground( getBackground() );
457 add( _zoom_label = new JLabel( "Zoom:" ) );
458 customizeLabel( _zoom_label, getConfiguration() );
462 if ( getConfiguration().isUseNativeUI() ) {
463 _zoom_in_x = new JButton( "+" );
464 _zoom_out_x = new JButton( "-" );
467 _zoom_in_x = new JButton( "X+" );
468 _zoom_out_x = new JButton( "X-" );
470 _zoom_in_y = new JButton( "Y+" );
471 _zoom_out_y = new JButton( "Y-" );
472 _show_whole = new JButton( "F" );
473 _show_whole.setToolTipText( "To fit the complete phylogeny to the current display size [F or Home]" );
474 _zoom_in_x.setToolTipText( "To zoom in horizontally [Shift+cursor-right]" );
475 _zoom_in_y.setToolTipText( "To zoom in vertically [Shift+cursor-up]" );
476 _zoom_out_x.setToolTipText( "To zoom out horizontally [Shift+cursor-left]" );
477 _zoom_out_y.setToolTipText( "To zoom out vertically [Shift+cursor-down]" );
478 if ( getConfiguration().isUseNativeUI() && ForesterUtil.isMac() ) {
479 _zoom_out_x.setPreferredSize( new Dimension( 55, 10 ) );
480 _zoom_in_x.setPreferredSize( new Dimension( 55, 10 ) );
483 _zoom_out_x.setPreferredSize( new Dimension( 10, 10 ) );
484 _zoom_in_x.setPreferredSize( new Dimension( 10, 10 ) );
486 _zoom_out_y.setPreferredSize( new Dimension( 10, 10 ) );
487 _zoom_in_y.setPreferredSize( new Dimension( 10, 10 ) );
488 _show_whole.setPreferredSize( new Dimension( 10, 10 ) );
489 _return_to_super_tree = new JButton( RETURN_TO_SUPER_TREE_TEXT );
490 _return_to_super_tree.setEnabled( false );
491 _order = new JButton( "Order Subtrees" );
492 _uncollapse_all = new JButton( "Uncollapse All" );
493 addJButton( _zoom_in_y, x_panel );
494 addJButton( _zoom_out_x, y_panel );
495 addJButton( _show_whole, y_panel );
496 addJButton( _zoom_in_x, y_panel );
497 addJButton( _zoom_out_y, z_panel );
498 if ( getConfiguration().doDisplayOption( Configuration.show_domain_architectures ) ) {
499 setUpControlsForDomainStrucures();
501 final JLabel spacer2 = new JLabel( "" );
503 addJButton( _return_to_super_tree, this );
504 addJButton( _order, this );
505 addJButton( _uncollapse_all, this );
506 final JLabel spacer3 = new JLabel( "" );
508 setVisibilityOfDomainStrucureControls();
511 void addCheckbox( final int which, final String title ) {
512 final JPanel ch_panel = new JPanel( new BorderLayout( 0, 0 ) );
514 case Configuration.display_as_phylogram:
515 _display_as_phylogram_cb = new JCheckBox( title );
516 getDisplayAsPhylogramCb().setToolTipText( "To switch between phylogram and cladogram display" );
517 addJCheckBox( getDisplayAsPhylogramCb(), ch_panel );
520 case Configuration.display_internal_data:
521 _display_internal_data = new JCheckBox( title );
522 _display_internal_data.setToolTipText( "To allow or disallow display of internal labels" );
523 addJCheckBox( _display_internal_data, ch_panel );
526 case Configuration.color_according_to_species:
527 _color_acc_species = new JCheckBox( title );
529 .setToolTipText( "To colorize taxonomy and sequence labels as a function of taxonomy" );
530 addJCheckBox( _color_acc_species, ch_panel );
533 case Configuration.color_according_to_annotation:
534 _color_according_to_annotation = new JCheckBox( title );
535 _color_according_to_annotation
536 .setToolTipText( "To colorize sequence annotation labels as a function of sequence annotation" );
537 addJCheckBox( _color_according_to_annotation, ch_panel );
540 case Configuration.show_node_names:
541 _show_node_names = new JCheckBox( title );
542 addJCheckBox( _show_node_names, ch_panel );
545 case Configuration.show_taxonomy_scientific_names:
546 _show_taxo_scientific_names = new JCheckBox( title );
547 addJCheckBox( _show_taxo_scientific_names, ch_panel );
550 case Configuration.show_taxonomy_common_names:
551 _show_taxo_common_names = new JCheckBox( title );
552 addJCheckBox( _show_taxo_common_names, ch_panel );
555 case Configuration.show_tax_code:
556 _show_taxo_code = new JCheckBox( title );
557 addJCheckBox( _show_taxo_code, ch_panel );
560 case Configuration.show_taxonomy_images:
561 _show_taxo_images_cb = new JCheckBox( title );
562 addJCheckBox( _show_taxo_images_cb, ch_panel );
565 case Configuration.show_binary_characters:
566 _show_binary_characters = new JCheckBox( title );
567 addJCheckBox( _show_binary_characters, ch_panel );
570 case Configuration.show_annotation:
571 _show_annotation = new JCheckBox( title );
572 addJCheckBox( _show_annotation, ch_panel );
575 case Configuration.show_binary_character_counts:
576 _show_binary_character_counts = new JCheckBox( title );
577 addJCheckBox( _show_binary_character_counts, ch_panel );
580 case Configuration.write_confidence_values:
581 _write_confidence = new JCheckBox( title );
582 addJCheckBox( getWriteConfidenceCb(), ch_panel );
585 case Configuration.write_events:
586 _show_events = new JCheckBox( title );
587 addJCheckBox( getShowEventsCb(), ch_panel );
590 case Configuration.color_branches:
591 _color_branches_cb = new JCheckBox( title );
592 getColorBranchesCb().setToolTipText( "To use branch color values, if present" );
593 addJCheckBox( getColorBranchesCb(), ch_panel );
596 case Configuration.width_branches:
597 _width_branches = new JCheckBox( title );
598 _width_branches.setToolTipText( "To use branch width values, if present" );
599 addJCheckBox( _width_branches, ch_panel );
602 case Configuration.show_domain_architectures:
603 _show_domain_architectures = new JCheckBox( title );
604 addJCheckBox( _show_domain_architectures, ch_panel );
607 case Configuration.show_gene_names:
608 _show_gene_names = new JCheckBox( title );
609 addJCheckBox( _show_gene_names, ch_panel );
612 case Configuration.show_gene_symbols:
613 _show_gene_symbols = new JCheckBox( title );
614 addJCheckBox( _show_gene_symbols, ch_panel );
617 case Configuration.show_sequence_acc:
618 _show_sequence_acc = new JCheckBox( title );
619 addJCheckBox( _show_sequence_acc, ch_panel );
622 case Configuration.dynamically_hide_data:
623 _dynamically_hide_data = new JCheckBox( title );
624 getDynamicallyHideData().setToolTipText( "To hide labels depending on likely visibility" );
625 addJCheckBox( getDynamicallyHideData(), ch_panel );
628 case Configuration.node_data_popup:
629 _node_desc_popup_cb = new JCheckBox( title );
630 getNodeDescPopupCb().setToolTipText( "To enable mouse rollover display of basic node data" );
631 addJCheckBox( getNodeDescPopupCb(), ch_panel );
634 case Configuration.show_relation_confidence:
635 _seq_relation_confidence_switch = new JCheckBox( title );
636 addJCheckBox( _seq_relation_confidence_switch, ch_panel );
639 case Configuration.show_vector_data:
640 _show_vector_data_cb = new JCheckBox( title );
641 addJCheckBox( _show_vector_data_cb, ch_panel );
644 case Configuration.show_properties:
645 _show_properties_cb = new JCheckBox( title );
646 addJCheckBox( _show_properties_cb, ch_panel );
650 throw new RuntimeException( "unknown checkbox: " + which );
654 void addJButton( final JButton jb, final JPanel p ) {
655 jb.setFocusPainted( false );
656 jb.setFont( ControlPanel.jcb_font );
657 if ( !_configuration.isUseNativeUI() ) {
658 jb.setBorder( BorderFactory.createLineBorder( getConfiguration().getGuiButtonBorderColor() ) );
659 jb.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
660 jb.setForeground( getConfiguration().getGuiButtonTextColor() );
663 jb.addActionListener( this );
666 void addJCheckBox( final JCheckBox jcb, final JPanel p ) {
667 jcb.setFocusPainted( false );
668 jcb.setFont( ControlPanel.jcb_font );
669 if ( !_configuration.isUseNativeUI() ) {
670 jcb.setBackground( getConfiguration().getGuiBackgroundColor() );
671 jcb.setForeground( getConfiguration().getGuiCheckboxTextColor() );
673 p.add( jcb, "Center" );
674 jcb.addActionListener( this );
677 void addJTextField( final JTextField tf, final JPanel p ) {
678 if ( !_configuration.isUseNativeUI() ) {
679 tf.setForeground( getConfiguration().getGuiBackgroundColor() );
680 tf.setFont( ControlPanel.jcb_font );
683 tf.addActionListener( this );
686 void deactivateButtonToReturnToSuperTree() {
687 _return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT );
688 _return_to_super_tree.setForeground( getConfiguration().getGuiButtonTextColor() );
689 _return_to_super_tree.setEnabled( false );
692 void displayedPhylogenyMightHaveChanged( final boolean recalc_longest_ext_node_info ) {
693 if ( ( _mainpanel != null )
694 && ( ( _mainpanel.getCurrentPhylogeny() != null ) && !_mainpanel.getCurrentPhylogeny().isEmpty() ) ) {
695 if ( getOptions().isShowOverview() ) {
696 _mainpanel.getCurrentTreePanel().updateOvSizes();
698 _mainpanel.getCurrentTreePanel().recalculateMaxDistanceToRoot();
699 setVisibilityOfDomainStrucureControls();
700 updateDomainStructureEvaluethresholdDisplay();
701 _mainpanel.getCurrentTreePanel().calculateScaleDistance();
702 _mainpanel.getCurrentTreePanel().calcMaxDepth();
703 _mainpanel.adjustJScrollPane();
704 if ( recalc_longest_ext_node_info ) {
705 _mainpanel.getCurrentTreePanel().initNodeData();
706 _mainpanel.getCurrentTreePanel().calculateLongestExtNodeInfo();
708 _mainpanel.getCurrentTreePanel().repaint();
709 // _mainpanel.getCurrentTreePanel().setUpUrtFactors();
713 void endClickToOptions() {
714 _click_to_combobox.addActionListener( this );
718 * Indicates what action should be execute when a node is clicked
720 * @return the click-on action
722 NodeClickAction getActionWhenNodeClicked() {
723 return _action_when_node_clicked;
726 Map<Integer, String> getAllClickToItems() {
727 return _all_click_to_names;
730 Map<String, Color> getAnnotationColors() {
731 return _annotation_colors;
734 Configuration getConfiguration() {
735 return _configuration;
738 TreePanel getCurrentTreePanel() {
739 return getMainPanel().getCurrentTreePanel();
742 MainPanel getMainPanel() {
746 Options getOptions() {
747 return getMainPanel().getOptions();
750 JTextField getSearchTextField() {
754 List<String> getSingleClickToNames() {
755 return _click_to_names;
758 Map<String, Color> getSpeciesColors() {
759 return _species_colors;
762 boolean isAntialiasScreenText() {
766 boolean isColorAccordingToAnnotation() {
767 return ( ( _color_according_to_annotation != null ) && _color_according_to_annotation.isSelected() );
770 boolean isColorAccordingToTaxonomy() {
771 return ( ( _color_acc_species != null ) && _color_acc_species.isSelected() );
774 boolean isColorBranches() {
775 return ( ( ( getColorBranchesCb() != null ) && getColorBranchesCb().isSelected() ) || ( ( getColorBranchesCb() == null ) && _color_branches ) );
778 boolean isDrawPhylogram() {
779 return isDrawPhylogram( getMainPanel().getCurrentTabIndex() );
782 boolean isDynamicallyHideData() {
783 return ( ( getDynamicallyHideData() != null ) && getDynamicallyHideData().isSelected() );
787 return ( ( getShowEventsCb() != null ) && getShowEventsCb().isSelected() );
790 boolean isNodeDescPopup() {
791 return ( ( getNodeDescPopupCb() != null ) && getNodeDescPopupCb().isSelected() );
794 boolean isShowAnnotation() {
795 return ( ( _show_annotation != null ) && _show_annotation.isSelected() );
798 boolean isShowBinaryCharacterCounts() {
799 return ( ( _show_binary_character_counts != null ) && _show_binary_character_counts.isSelected() );
802 boolean isShowBinaryCharacters() {
803 return ( ( _show_binary_characters != null ) && _show_binary_characters.isSelected() );
806 boolean isShowConfidenceValues() {
807 return ( ( getWriteConfidenceCb() != null ) && getWriteConfidenceCb().isSelected() );
810 boolean isShowDomainArchitectures() {
811 return ( ( _show_domain_architectures != null ) && _show_domain_architectures.isSelected() );
814 boolean isShowGeneNames() {
815 return ( ( _show_gene_names != null ) && _show_gene_names.isSelected() );
818 boolean isShowGeneSymbols() {
819 return ( ( _show_gene_symbols != null ) && _show_gene_symbols.isSelected() );
822 boolean isShowInternalData() {
823 return ( ( _display_internal_data == null ) || _display_internal_data.isSelected() );
826 boolean isShowNodeNames() {
827 return ( ( _show_node_names != null ) && _show_node_names.isSelected() );
830 boolean isShowSequenceAcc() {
831 return ( ( _show_sequence_acc != null ) && _show_sequence_acc.isSelected() );
834 boolean isShowSequenceRelationConfidence() {
835 return ( ( _seq_relation_confidence_switch != null ) && ( _seq_relation_confidence_switch.isSelected() ) );
838 boolean isShowSequenceRelations() {
839 return ( ( _show_sequence_relations != null ) && ( _show_sequence_relations.getSelectedIndex() > 0 ) );
842 boolean isShowTaxonomyCode() {
843 return ( ( _show_taxo_code != null ) && _show_taxo_code.isSelected() );
846 boolean isShowTaxonomyCommonNames() {
847 return ( ( _show_taxo_common_names != null ) && _show_taxo_common_names.isSelected() );
850 boolean isShowTaxonomyScientificNames() {
851 return ( ( _show_taxo_scientific_names != null ) && _show_taxo_scientific_names.isSelected() );
854 boolean isWidthBranches() {
855 return ( ( _width_branches != null ) && _width_branches.isSelected() );
858 void phylogenyAdded( final Configuration configuration ) {
859 getIsDrawPhylogramList().add( configuration.isDrawAsPhylogram() );
862 void phylogenyRemoved( final int index ) {
863 getIsDrawPhylogramList().remove( index );
867 final MainPanel main_panel = getMainPanel();
868 final Phylogeny tree = main_panel.getCurrentPhylogeny();
869 if ( ( tree == null ) || tree.isEmpty() ) {
872 String query = getSearchTextField().getText();
873 if ( query != null ) {
874 query = query.trim();
877 getSearchFoundCountsLabel().setVisible( false );
878 getSearchResetButton().setEnabled( false );
879 getSearchResetButton().setVisible( false );
882 if ( !ForesterUtil.isEmpty( query ) ) {
883 search( main_panel, tree, query );
886 getSearchFoundCountsLabel().setVisible( false );
887 getSearchResetButton().setEnabled( false );
888 getSearchResetButton().setVisible( false );
893 void setActionWhenNodeClicked( final NodeClickAction action ) {
894 _action_when_node_clicked = action;
897 void setAnnotationColors( final Map<String, Color> annotation_colors ) {
898 _annotation_colors = annotation_colors;
901 void setCheckbox( final int which, final boolean state ) {
903 case Configuration.display_as_phylogram:
904 if ( getDisplayAsPhylogramCb() != null ) {
905 getDisplayAsPhylogramCb().setSelected( state );
908 case Configuration.display_internal_data:
909 if ( _display_internal_data != null ) {
910 _display_internal_data.setSelected( state );
913 case Configuration.color_according_to_species:
914 if ( _color_acc_species != null ) {
915 _color_acc_species.setSelected( state );
918 case Configuration.color_according_to_annotation:
919 if ( _color_according_to_annotation != null ) {
920 _color_according_to_annotation.setSelected( state );
923 case Configuration.show_node_names:
924 if ( _show_node_names != null ) {
925 _show_node_names.setSelected( state );
928 case Configuration.show_taxonomy_scientific_names:
929 if ( _show_taxo_scientific_names != null ) {
930 _show_taxo_scientific_names.setSelected( state );
933 case Configuration.show_taxonomy_common_names:
934 if ( _show_taxo_common_names != null ) {
935 _show_taxo_common_names.setSelected( state );
938 case Configuration.show_tax_code:
939 if ( _show_taxo_code != null ) {
940 _show_taxo_code.setSelected( state );
943 case Configuration.show_taxonomy_images:
944 if ( _show_taxo_images_cb != null ) {
945 _show_taxo_images_cb.setSelected( state );
948 case Configuration.show_annotation:
949 if ( _show_annotation != null ) {
950 _show_annotation.setSelected( state );
953 case Configuration.show_binary_characters:
954 if ( _show_binary_characters != null ) {
955 _show_binary_characters.setSelected( state );
958 case Configuration.show_binary_character_counts:
959 if ( _show_binary_character_counts != null ) {
960 _show_binary_character_counts.setSelected( state );
963 case Configuration.write_confidence_values:
964 if ( getWriteConfidenceCb() != null ) {
965 getWriteConfidenceCb().setSelected( state );
968 case Configuration.write_events:
969 if ( getShowEventsCb() != null ) {
970 getShowEventsCb().setSelected( state );
973 case Configuration.color_branches:
974 if ( getColorBranchesCb() != null ) {
975 getColorBranchesCb().setSelected( state );
978 case Configuration.width_branches:
979 if ( _width_branches != null ) {
980 _width_branches.setSelected( state );
983 case Configuration.show_domain_architectures:
984 if ( _show_domain_architectures != null ) {
985 _show_domain_architectures.setSelected( state );
988 case Configuration.show_gene_names:
989 if ( _show_gene_names != null ) {
990 _show_gene_names.setSelected( state );
993 case Configuration.show_gene_symbols:
994 if ( _show_gene_symbols != null ) {
995 _show_gene_symbols.setSelected( state );
998 case Configuration.show_vector_data:
999 if ( _show_vector_data_cb != null ) {
1000 _show_vector_data_cb.setSelected( state );
1003 case Configuration.show_properties:
1004 if ( _show_properties_cb != null ) {
1005 _show_properties_cb.setSelected( state );
1008 case Configuration.show_sequence_acc:
1009 if ( _show_sequence_acc != null ) {
1010 _show_sequence_acc.setSelected( state );
1013 case Configuration.dynamically_hide_data:
1014 if ( getDynamicallyHideData() != null ) {
1015 getDynamicallyHideData().setSelected( state );
1018 case Configuration.node_data_popup:
1019 if ( getNodeDescPopupCb() != null ) {
1020 getNodeDescPopupCb().setSelected( state );
1024 case Configuration.show_relation_confidence:
1025 if ( _seq_relation_confidence_switch != null ) {
1026 _seq_relation_confidence_switch.setSelected( state );
1031 throw new AssertionError( "unknown checkbox: " + which );
1036 * Set this checkbox state. Not all checkboxes have been instantiated
1037 * depending on the config.
1039 void setCheckbox( final JCheckBox cb, final boolean state ) {
1041 cb.setSelected( state );
1045 void setClickToAction( final int action ) {
1046 // Set click-to action
1047 if ( action == _show_data_item ) {
1048 setActionWhenNodeClicked( NodeClickAction.SHOW_DATA );
1050 else if ( action == _collapse_cb_item ) {
1051 setActionWhenNodeClicked( NodeClickAction.COLLAPSE );
1053 else if ( action == _reroot_cb_item ) {
1054 setActionWhenNodeClicked( NodeClickAction.REROOT );
1056 else if ( action == _subtree_cb_item ) {
1057 setActionWhenNodeClicked( NodeClickAction.SUBTREE );
1059 else if ( action == _swap_cb_item ) {
1060 setActionWhenNodeClicked( NodeClickAction.SWAP );
1062 else if ( action == _color_subtree_cb_item ) {
1063 setActionWhenNodeClicked( NodeClickAction.COLOR_SUBTREE );
1065 else if ( action == _open_seq_web_item ) {
1066 setActionWhenNodeClicked( NodeClickAction.OPEN_SEQ_WEB );
1068 else if ( action == _sort_descendents_item ) {
1069 setActionWhenNodeClicked( NodeClickAction.SORT_DESCENDENTS );
1071 else if ( action == _blast_item ) {
1072 setActionWhenNodeClicked( NodeClickAction.BLAST );
1074 else if ( action == _open_tax_web_item ) {
1075 setActionWhenNodeClicked( NodeClickAction.OPEN_TAX_WEB );
1077 else if ( action == _cut_subtree_item ) {
1078 setActionWhenNodeClicked( NodeClickAction.CUT_SUBTREE );
1080 else if ( action == _copy_subtree_item ) {
1081 setActionWhenNodeClicked( NodeClickAction.COPY_SUBTREE );
1083 else if ( action == _delete_node_or_subtree_item ) {
1084 setActionWhenNodeClicked( NodeClickAction.DELETE_NODE_OR_SUBTREE );
1086 else if ( action == _paste_subtree_item ) {
1087 setActionWhenNodeClicked( NodeClickAction.PASTE_SUBTREE );
1089 else if ( action == _add_new_node_item ) {
1090 setActionWhenNodeClicked( NodeClickAction.ADD_NEW_NODE );
1092 else if ( action == _edit_node_data_item ) {
1093 setActionWhenNodeClicked( NodeClickAction.EDIT_NODE_DATA );
1095 else if ( action == _select_nodes_item ) {
1096 setActionWhenNodeClicked( NodeClickAction.SELECT_NODES );
1098 else if ( action == _get_ext_desc_data ) {
1099 setActionWhenNodeClicked( NodeClickAction.GET_EXT_DESC_DATA );
1102 throw new RuntimeException( "unknown action: " + action );
1104 // make sure drop down is displaying the correct action
1105 // in case this was called from outside the class
1106 _click_to_combobox.setSelectedIndex( action );
1109 void setColorBranches( final boolean color_branches ) {
1110 _color_branches = color_branches;
1113 void setDrawPhylogram( final boolean b ) {
1114 getDisplayAsPhylogramCb().setSelected( b );
1115 setDrawPhylogram( getMainPanel().getCurrentTabIndex(), b );
1118 void setDrawPhylogramEnabled( final boolean b ) {
1119 getDisplayAsPhylogramCb().setEnabled( b );
1122 void setDynamicHidingIsOn( final boolean is_on ) {
1123 // if ( !_configuration.isUseNativeUI() ) {
1125 getDynamicallyHideData().setForeground( getConfiguration().getGuiCheckboxAndButtonActiveColor() );
1128 if ( !_configuration.isUseNativeUI() ) {
1129 getDynamicallyHideData().setForeground( getConfiguration().getGuiButtonTextColor() );
1132 getDynamicallyHideData().setForeground( Color.BLACK );
1138 void setShowEvents( final boolean show_events ) {
1139 if ( getShowEventsCb() == null ) {
1140 _show_events = new JCheckBox( "" );
1142 getShowEventsCb().setSelected( show_events );
1145 void setSpeciesColors( final Map<String, Color> species_colors ) {
1146 _species_colors = species_colors;
1151 * Set up the controls from the config settings. 11/26/05
1153 void setupControls() {
1154 // The tree display options:
1155 setupDisplayCheckboxes();
1157 // The sequence relation query selection combo-box
1158 if ( _configuration.displaySequenceRelations() ) {
1159 addSequenceRelationBlock();
1163 startClickToOptions();
1164 setupClickToOptions();
1165 endClickToOptions();
1166 // Zoom and quick edit buttons
1171 void setUpControlsForDomainStrucures() {
1172 _domain_display_label = new JLabel( "Domain Display:" );
1173 add( customizeLabel( _domain_display_label, getConfiguration() ) );
1174 add( _domain_display_label );
1175 _zoom_in_domain_structure = new JButton( "d+" );
1176 _zoom_out_domain_structure = new JButton( "d-" );
1177 _decr_domain_structure_evalue_thr = new JButton( "-" );
1178 _incr_domain_structure_evalue_thr = new JButton( "+" );
1179 _zoom_in_domain_structure.setPreferredSize( new Dimension( 10, 10 ) );
1180 _zoom_out_domain_structure.setPreferredSize( new Dimension( 10, 10 ) );
1181 _decr_domain_structure_evalue_thr.setPreferredSize( new Dimension( 10, 10 ) );
1182 _incr_domain_structure_evalue_thr.setPreferredSize( new Dimension( 10, 10 ) );
1183 _incr_domain_structure_evalue_thr.setToolTipText( "Increase the E-value threshold by a factor of 10" );
1184 _decr_domain_structure_evalue_thr.setToolTipText( "Decrease the E-value threshold by a factor of 10" );
1185 _domain_structure_evalue_thr_tf = new JTextField( 3 );
1186 _domain_structure_evalue_thr_tf.setEditable( false );
1187 if ( !getConfiguration().isUseNativeUI() ) {
1188 _domain_structure_evalue_thr_tf.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
1189 _domain_structure_evalue_thr_tf.setBackground( getConfiguration().getGuiCheckboxTextColor() );
1190 _domain_structure_evalue_thr_tf.setBorder( null );
1192 final JPanel d1_panel = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
1193 final JPanel d2_panel = new JPanel( new GridLayout( 1, 3, 0, 0 ) );
1194 if ( !_configuration.isUseNativeUI() ) {
1195 d1_panel.setBackground( getBackground() );
1196 d2_panel.setBackground( getBackground() );
1200 addJButton( _zoom_out_domain_structure, d1_panel );
1201 addJButton( _zoom_in_domain_structure, d1_panel );
1202 addJButton( _decr_domain_structure_evalue_thr, d2_panel );
1203 addJTextField( _domain_structure_evalue_thr_tf, d2_panel );
1204 addJButton( _incr_domain_structure_evalue_thr, d2_panel );
1207 void setupSearchTools() {
1208 final String tip = "Enter text to search for. Use ',' for multiple searches (logical OR) and '+' for logical AND.";
1209 final JLabel search_label = new JLabel( "Search:" );
1210 search_label.setFont( ControlPanel.jcb_bold_font );
1211 if ( !getConfiguration().isUseNativeUI() ) {
1212 search_label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1214 add( search_label );
1215 search_label.setToolTipText( tip );
1216 _search_found_label = new JLabel();
1217 getSearchFoundCountsLabel().setVisible( false );
1218 _search_found_label.setFont( ControlPanel.jcb_bold_font );
1219 if ( !getConfiguration().isUseNativeUI() ) {
1220 _search_found_label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1222 _search_tf = new JTextField( 3 );
1223 _search_tf.setToolTipText( tip );
1224 _search_tf.setEditable( true );
1225 if ( !getConfiguration().isUseNativeUI() ) {
1226 _search_tf.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
1227 _search_tf.setBackground( getConfiguration().getGuiCheckboxTextColor() );
1228 _search_tf.setBorder( null );
1230 _search_reset_button = new JButton();
1231 getSearchResetButton().setText( "Reset" );
1232 getSearchResetButton().setEnabled( false );
1233 getSearchResetButton().setVisible( false );
1234 final JPanel s_panel_1 = new JPanel( new BorderLayout() );
1235 final JPanel s_panel_2 = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
1236 s_panel_1.setBackground( getBackground() );
1238 s_panel_2.setBackground( getBackground() );
1240 final KeyAdapter key_adapter = new KeyAdapter() {
1243 public void keyReleased( final KeyEvent key_event ) {
1245 displayedPhylogenyMightHaveChanged( true );
1248 final ActionListener action_listener = new ActionListener() {
1251 public void actionPerformed( final ActionEvent e ) {
1253 setSearchFoundCountsOnLabel( 0 );
1254 getSearchFoundCountsLabel().setVisible( false );
1255 getSearchTextField().setText( "" );
1256 getSearchResetButton().setEnabled( false );
1257 getSearchResetButton().setVisible( false );
1258 displayedPhylogenyMightHaveChanged( true );
1261 _search_reset_button.addActionListener( action_listener );
1262 _search_tf.addKeyListener( key_adapter );
1263 addJTextField( _search_tf, s_panel_1 );
1264 s_panel_2.add( _search_found_label );
1265 addJButton( _search_reset_button, s_panel_2 );
1269 * Fit entire tree into window.
1272 if ( ( _mainpanel.getCurrentScrollPane() == null ) || _mainpanel.getCurrentTreePanel().getPhylogeny().isEmpty() ) {
1275 getCurrentTreePanel().updateSetOfCollapsedExternalNodes();
1276 displayedPhylogenyMightHaveChanged( true );
1277 _mainpanel.getCurrentTreePanel().updateOvSettings();
1278 _mainpanel.getCurrentTreePanel().validate();
1279 _mainpanel.validate();
1280 _mainpanel.getCurrentTreePanel().calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
1281 _mainpanel.getSizeOfViewport().height,
1283 _mainpanel.getCurrentTreePanel().resetPreferredSize();
1284 _mainpanel.adjustJScrollPane();
1285 _mainpanel.getCurrentTreePanel().repaint();
1286 _mainpanel.getCurrentTreePanel().validate();
1287 _mainpanel.validate();
1288 _mainpanel.getCurrentTreePanel().calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
1289 _mainpanel.getSizeOfViewport().height,
1291 _mainpanel.getCurrentTreePanel().resetPreferredSize();
1292 _mainpanel.adjustJScrollPane();
1293 _mainpanel.getCurrentTreePanel().repaint();
1294 _mainpanel.getCurrentTreePanel().updateOvSizes();
1297 void showWholeAll() {
1298 for( final TreePanel tree_panel : _mainpanel.getTreePanels() ) {
1299 if ( tree_panel != null ) {
1300 tree_panel.validate();
1301 tree_panel.calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
1302 _mainpanel.getSizeOfViewport().height,
1304 tree_panel.resetPreferredSize();
1305 tree_panel.repaint();
1310 // Create header for click-to combo box.
1311 void startClickToOptions() {
1312 final JLabel spacer = new JLabel( "" );
1313 spacer.setFont( ControlPanel.jcb_font );
1315 _click_to_label = new JLabel( "Click on Node to:" );
1316 add( customizeLabel( _click_to_label, getConfiguration() ) );
1317 _click_to_combobox = new JComboBox();
1318 _click_to_combobox.setFocusable( false );
1319 _click_to_combobox.setMaximumRowCount( 14 );
1320 _click_to_combobox.setFont( ControlPanel.js_font );
1321 if ( !_configuration.isUseNativeUI() ) {
1322 _click_to_combobox.setBackground( getConfiguration().getGuiBackgroundColor() );
1324 // don't add listener until all items are set (or each one will trigger
1326 // click_to_list.addActionListener(this);
1327 add( _click_to_combobox );
1328 // Correlates option names to titles
1329 _all_click_to_names = new HashMap<Integer, String>();
1330 _click_to_names = new ArrayList<String>();
1334 if ( getMainPanel().getTabbedPane().getTabCount() > 0 ) {
1335 if ( getCurrentTreePanel().isPhyHasBranchLengths()
1336 && ( getCurrentTreePanel().getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) {
1337 setDrawPhylogramEnabled( true );
1338 setDrawPhylogram( isDrawPhylogram() );
1341 setDrawPhylogramEnabled( false );
1342 setDrawPhylogram( false );
1344 if ( getMainPanel().getMainFrame() == null ) {
1345 // Must be "E" applet version.
1346 final ArchaeopteryxE e = ( ArchaeopteryxE ) ( ( MainPanelApplets ) getMainPanel() ).getApplet();
1347 e.setSelectedTypeInTypeMenu( e.getCurrentTreePanel().getPhylogenyGraphicsType() );
1350 getMainPanel().getMainFrame().setSelectedTypeInTypeMenu( getMainPanel().getCurrentTreePanel()
1351 .getPhylogenyGraphicsType() );
1353 getMainPanel().getCurrentTreePanel().updateSubSuperTreeButton();
1354 getMainPanel().getControlPanel().search();
1355 getSequenceRelationTypeBox().removeAllItems();
1356 for( final SequenceRelation.SEQUENCE_RELATION_TYPE type : getMainPanel().getCurrentPhylogeny()
1357 .getRelevantSequenceRelationTypes() ) {
1358 _sequence_relation_type_box.addItem( type );
1360 //setSequenceRelationQueries( getMainPanel().getCurrentPhylogeny().getSequenceRelationQueries() );
1361 // according to GUILHEM the line above can be removed.
1366 * Uncollapse all nodes.
1368 void uncollapseAll( final TreePanel tp ) {
1369 final Phylogeny t = tp.getPhylogeny();
1370 if ( ( t != null ) && !t.isEmpty() ) {
1371 for( final PhylogenyNodeIterator iter = t.iteratorPreorder(); iter.hasNext(); ) {
1372 final PhylogenyNode node = iter.next();
1373 node.setCollapse( false );
1375 tp.resetNodeIdToDistToLeafMap();
1376 tp.updateSetOfCollapsedExternalNodes();
1377 t.recalculateNumberOfExternalDescendants( false );
1378 tp.setNodeInPreorderToNull();
1379 t.clearHashIdToNodeMap();
1384 void updateDomainStructureEvaluethresholdDisplay() {
1385 if ( _domain_structure_evalue_thr_tf != null ) {
1386 _domain_structure_evalue_thr_tf.setText( "10^"
1387 + getMainPanel().getCurrentTreePanel().getDomainStructureEvalueThreshold() );
1391 void zoomInX( final float factor, final float x_correction_factor ) {
1392 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar();
1393 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1394 treepanel.multiplyUrtFactor( 1f );
1395 if ( ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
1396 || ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
1397 || isDrawPhylogram( getMainPanel().getCurrentTabIndex() )
1398 || ( getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP ) ) {
1399 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1400 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
1401 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
1402 getMainPanel().adjustJScrollPane();
1403 treepanel.resetPreferredSize();
1404 getMainPanel().getCurrentScrollPane().getViewport().validate();
1405 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1406 - ( sb.getVisibleAmount() / 2.0 ) ) );
1409 final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue();
1410 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
1411 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
1412 getMainPanel().adjustJScrollPane();
1413 treepanel.resetPreferredSize();
1414 getMainPanel().getCurrentScrollPane().getViewport().validate();
1415 sb.setValue( sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount() );
1417 treepanel.resetPreferredSize();
1418 treepanel.updateOvSizes();
1421 void zoomInY( final float factor ) {
1422 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getVerticalScrollBar();
1423 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1424 treepanel.multiplyUrtFactor( 1.1f );
1425 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1426 treepanel.setYdistance( ( treepanel.getYdistance() * factor ) );
1427 getMainPanel().adjustJScrollPane();
1428 treepanel.resetPreferredSize();
1429 getMainPanel().getCurrentScrollPane().getViewport().validate();
1430 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1431 - ( sb.getVisibleAmount() / 2.0 ) ) );
1432 treepanel.resetPreferredSize();
1433 treepanel.updateOvSizes();
1436 void zoomOutX( final float factor, final float x_correction_factor ) {
1437 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1438 treepanel.multiplyUrtFactor( 1f );
1439 if ( ( treepanel.getXdistance() * factor ) > 0.0 ) {
1440 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar();
1441 if ( ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
1442 || ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
1443 || isDrawPhylogram( getMainPanel().getCurrentTabIndex() )
1444 || ( getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP ) ) {
1445 getMainPanel().adjustJScrollPane();
1446 treepanel.resetPreferredSize();
1447 getMainPanel().getCurrentScrollPane().getViewport().validate();
1448 final double x = ( sb.getMaximum() - sb.getMinimum() )
1449 / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1450 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
1451 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
1452 getMainPanel().adjustJScrollPane();
1453 treepanel.resetPreferredSize();
1454 getMainPanel().getCurrentScrollPane().getViewport().validate();
1455 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1456 - ( sb.getVisibleAmount() / 2.0 ) ) );
1459 final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue();
1460 treepanel.setXdistance( treepanel.getXdistance() * factor );
1461 treepanel.setXcorrectionFactor( treepanel.getXcorrectionFactor() * x_correction_factor );
1463 getMainPanel().adjustJScrollPane();
1464 treepanel.resetPreferredSize();
1465 getMainPanel().getCurrentScrollPane().getViewport().validate();
1466 sb.setValue( sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount() );
1469 treepanel.resetPreferredSize();
1470 treepanel.updateOvSizes();
1474 void zoomOutY( final float factor ) {
1475 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1476 treepanel.multiplyUrtFactor( 0.9f );
1477 if ( ( treepanel.getYdistance() * factor ) > 0.0 ) {
1478 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getVerticalScrollBar();
1479 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1480 treepanel.setYdistance( ( treepanel.getYdistance() * factor ) );
1481 getMainPanel().adjustJScrollPane();
1482 treepanel.resetPreferredSize();
1483 getMainPanel().getCurrentScrollPane().getViewport().validate();
1484 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1485 - ( sb.getVisibleAmount() / 2.0 ) ) );
1486 treepanel.resetPreferredSize();
1487 treepanel.updateOvSizes();
1491 private void addClickToOption( final int which, final String title ) {
1492 _click_to_combobox.addItem( title );
1493 _click_to_names.add( title );
1494 _all_click_to_names.put( new Integer( which ), title );
1495 if ( !_configuration.isUseNativeUI() ) {
1496 _click_to_combobox.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
1497 _click_to_combobox.setForeground( getConfiguration().getGuiButtonTextColor() );
1502 private void addSequenceRelationBlock() {
1503 final JLabel spacer = new JLabel( "" );
1504 spacer.setSize( 1, 1 );
1506 final JLabel mainLabel = new JLabel( "Sequence relations to display" );
1507 final JLabel typeLabel = customizeLabel( new JLabel( "(type) " ), getConfiguration() );
1508 typeLabel.setFont( ControlPanel.js_font.deriveFont( 7 ) );
1509 getSequenceRelationTypeBox().setFocusable( false );
1510 _sequence_relation_type_box.setFont( ControlPanel.js_font );
1511 if ( !_configuration.isUseNativeUI() ) {
1512 _sequence_relation_type_box.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
1513 _sequence_relation_type_box.setForeground( getConfiguration().getGuiButtonTextColor() );
1515 _sequence_relation_type_box.setRenderer( new ListCellRenderer() {
1518 public Component getListCellRendererComponent( final JList list,
1521 final boolean isSelected,
1522 final boolean cellHasFocus ) {
1523 final Component component = new DefaultListCellRenderer().getListCellRendererComponent( list,
1528 if ( ( value != null ) && ( value instanceof SequenceRelation.SEQUENCE_RELATION_TYPE ) ) {
1529 ( ( DefaultListCellRenderer ) component ).setText( SequenceRelation
1530 .getPrintableNameByType( ( SequenceRelation.SEQUENCE_RELATION_TYPE ) value ) );
1535 final GridBagLayout gbl = new GridBagLayout();
1536 _sequence_relation_type_box.setMinimumSize( new Dimension( 115, 17 ) );
1537 _sequence_relation_type_box.setPreferredSize( new Dimension( 115, 20 ) );
1538 final JPanel horizGrid = new JPanel( gbl );
1539 horizGrid.setBackground( getBackground() );
1540 horizGrid.add( typeLabel );
1541 horizGrid.add( _sequence_relation_type_box );
1542 add( customizeLabel( mainLabel, getConfiguration() ) );
1544 add( getSequenceRelationBox() );
1545 if ( _configuration.doDisplayOption( Configuration.show_relation_confidence ) ) {
1546 addCheckbox( Configuration.show_relation_confidence,
1547 _configuration.getDisplayTitle( Configuration.show_relation_confidence ) );
1548 setCheckbox( Configuration.show_relation_confidence,
1549 _configuration.doCheckOption( Configuration.show_relation_confidence ) );
1551 }// addSequenceRelationBlock
1554 private List<Boolean> getIsDrawPhylogramList() {
1555 return _draw_phylogram;
1558 JLabel getSearchFoundCountsLabel() {
1559 return _search_found_label;
1562 JButton getSearchResetButton() {
1563 return _search_reset_button;
1566 private void init() {
1567 _draw_phylogram = new ArrayList<Boolean>();
1568 setSpeciesColors( new HashMap<String, Color>() );
1569 setAnnotationColors( new HashMap<String, Color>() );
1572 private boolean isDrawPhylogram( final int index ) {
1573 return getIsDrawPhylogramList().get( index );
1576 private void search( final MainPanel main_panel, final Phylogeny tree, final String query_str ) {
1577 getSearchFoundCountsLabel().setVisible( true );
1578 getSearchResetButton().setEnabled( true );
1579 getSearchResetButton().setVisible( true );
1580 String[] queries = null;
1581 List<PhylogenyNode> nodes = null;
1582 if ( query_str.indexOf( ',' ) >= 0 ) {
1583 queries = query_str.split( ",+" );
1586 queries = new String[ 1 ];
1587 queries[ 0 ] = query_str.trim();
1589 if ( ( queries != null ) && ( queries.length > 0 ) ) {
1590 nodes = new ArrayList<PhylogenyNode>();
1591 for( String query : queries ) {
1592 if ( ForesterUtil.isEmpty( query ) ) {
1595 query = query.trim();
1596 if ( query.indexOf( '+' ) >= 0 ) {
1597 nodes.addAll( PhylogenyMethods.searchDataLogicalAnd( query.split( "\\++" ),
1599 getOptions().isSearchCaseSensitive(),
1600 !getOptions().isMatchWholeTermsOnly(),
1601 isShowDomainArchitectures() ) );
1604 nodes.addAll( PhylogenyMethods.searchData( query,
1606 getOptions().isSearchCaseSensitive(),
1607 !getOptions().isMatchWholeTermsOnly(),
1608 isShowDomainArchitectures() ) );
1611 if ( getOptions().isInverseSearchResult() ) {
1612 final List<PhylogenyNode> all = PhylogenyMethods.obtainAllNodesAsList( tree );
1613 all.removeAll( nodes );
1617 if ( ( nodes != null ) && ( nodes.size() > 0 ) ) {
1618 main_panel.getCurrentTreePanel().setFoundNodes( new HashSet<Long>() );
1619 for( final PhylogenyNode node : nodes ) {
1620 main_panel.getCurrentTreePanel().getFoundNodes().add( node.getId() );
1622 setSearchFoundCountsOnLabel( nodes.size() );
1625 setSearchFoundCountsOnLabel( 0 );
1630 void searchReset() {
1631 if ( getMainPanel().getCurrentTreePanel() != null ) {
1632 getMainPanel().getCurrentTreePanel().setFoundNodes( null );
1636 private void setDrawPhylogram( final int index, final boolean b ) {
1637 getIsDrawPhylogramList().set( index, b );
1640 void setSearchFoundCountsOnLabel( final int counts ) {
1641 getSearchFoundCountsLabel().setText( "Found: " + counts );
1644 private void setupClickToOptions() {
1645 final int default_option = _configuration.getDefaultDisplayClicktoOption();
1646 int selected_index = 0;
1648 if ( _configuration.doDisplayClickToOption( Configuration.display_node_data ) ) {
1649 _show_data_item = cb_index;
1650 addClickToOption( Configuration.display_node_data,
1651 _configuration.getClickToTitle( Configuration.display_node_data ) );
1652 if ( default_option == Configuration.display_node_data ) {
1653 selected_index = cb_index;
1657 if ( _configuration.doDisplayClickToOption( Configuration.collapse_uncollapse ) ) {
1658 _collapse_cb_item = cb_index;
1659 addClickToOption( Configuration.collapse_uncollapse,
1660 _configuration.getClickToTitle( Configuration.collapse_uncollapse ) );
1661 if ( default_option == Configuration.collapse_uncollapse ) {
1662 selected_index = cb_index;
1666 if ( _configuration.doDisplayClickToOption( Configuration.reroot ) ) {
1667 _reroot_cb_item = cb_index;
1668 addClickToOption( Configuration.reroot, _configuration.getClickToTitle( Configuration.reroot ) );
1669 if ( default_option == Configuration.reroot ) {
1670 selected_index = cb_index;
1674 if ( _configuration.doDisplayClickToOption( Configuration.subtree ) ) {
1675 _subtree_cb_item = cb_index;
1676 addClickToOption( Configuration.subtree, _configuration.getClickToTitle( Configuration.subtree ) );
1677 if ( default_option == Configuration.subtree ) {
1678 selected_index = cb_index;
1682 if ( _configuration.doDisplayClickToOption( Configuration.swap ) ) {
1683 _swap_cb_item = cb_index;
1684 addClickToOption( Configuration.swap, _configuration.getClickToTitle( Configuration.swap ) );
1685 if ( default_option == Configuration.swap ) {
1686 selected_index = cb_index;
1690 if ( _configuration.doDisplayClickToOption( Configuration.sort_descendents ) ) {
1691 _sort_descendents_item = cb_index;
1692 addClickToOption( Configuration.sort_descendents,
1693 _configuration.getClickToTitle( Configuration.sort_descendents ) );
1694 if ( default_option == Configuration.sort_descendents ) {
1695 selected_index = cb_index;
1699 if ( _configuration.doDisplayClickToOption( Configuration.color_subtree ) ) {
1700 _color_subtree_cb_item = cb_index;
1701 addClickToOption( Configuration.color_subtree, _configuration.getClickToTitle( Configuration.color_subtree ) );
1702 if ( default_option == Configuration.color_subtree ) {
1703 selected_index = cb_index;
1707 if ( _configuration.doDisplayClickToOption( Configuration.open_seq_web ) ) {
1708 _open_seq_web_item = cb_index;
1709 addClickToOption( Configuration.open_seq_web, _configuration.getClickToTitle( Configuration.open_seq_web ) );
1710 if ( default_option == Configuration.open_seq_web ) {
1711 selected_index = cb_index;
1715 if ( _configuration.doDisplayClickToOption( Configuration.open_tax_web ) ) {
1716 _open_tax_web_item = cb_index;
1717 addClickToOption( Configuration.open_tax_web, _configuration.getClickToTitle( Configuration.open_tax_web ) );
1718 if ( default_option == Configuration.open_tax_web ) {
1719 selected_index = cb_index;
1723 if ( _configuration.doDisplayClickToOption( Configuration.blast ) ) {
1724 _blast_item = cb_index;
1725 addClickToOption( Configuration.blast, _configuration.getClickToTitle( Configuration.blast ) );
1726 if ( default_option == Configuration.blast ) {
1727 selected_index = cb_index;
1731 if ( _configuration.doDisplayClickToOption( Configuration.get_ext_desc_data ) ) {
1732 _get_ext_desc_data = cb_index;
1733 if ( !ForesterUtil.isEmpty( getConfiguration().getLabelForGetExtDescendentsData() ) ) {
1734 addClickToOption( Configuration.get_ext_desc_data, getConfiguration()
1735 .getLabelForGetExtDescendentsData() );
1739 switch ( getConfiguration().getExtDescNodeDataToReturn() ) {
1744 s = "Sequence Accessors";
1746 case SEQUENCE_MOL_SEQ:
1747 s = "Molecular Sequence";
1749 case SEQUENCE_MOL_SEQ_FASTA:
1750 s = "Molecular Sequence (Fasta)";
1753 s = "Sequence Names";
1755 case SEQUENCE_SYMBOL:
1756 s = "Sequence Symbols";
1759 s = "Taxonomy Codes";
1761 case TAXONOMY_SCIENTIFIC_NAME:
1762 s = "Scientific Names";
1765 s = "User Selected Data";
1768 final String label = _configuration.getClickToTitle( Configuration.get_ext_desc_data ) + " " + s;
1769 addClickToOption( Configuration.get_ext_desc_data, label );
1771 if ( default_option == Configuration.get_ext_desc_data ) {
1772 selected_index = cb_index;
1776 if ( getOptions().isEditable() ) {
1777 if ( _configuration.doDisplayClickToOption( Configuration.cut_subtree ) ) {
1778 _cut_subtree_item = cb_index;
1779 addClickToOption( Configuration.cut_subtree, _configuration.getClickToTitle( Configuration.cut_subtree ) );
1780 if ( default_option == Configuration.cut_subtree ) {
1781 selected_index = cb_index;
1785 if ( _configuration.doDisplayClickToOption( Configuration.copy_subtree ) ) {
1786 _copy_subtree_item = cb_index;
1787 addClickToOption( Configuration.copy_subtree,
1788 _configuration.getClickToTitle( Configuration.copy_subtree ) );
1789 if ( default_option == Configuration.copy_subtree ) {
1790 selected_index = cb_index;
1794 if ( _configuration.doDisplayClickToOption( Configuration.paste_subtree ) ) {
1795 _paste_subtree_item = cb_index;
1796 addClickToOption( Configuration.paste_subtree,
1797 _configuration.getClickToTitle( Configuration.paste_subtree ) );
1798 if ( default_option == Configuration.paste_subtree ) {
1799 selected_index = cb_index;
1803 if ( _configuration.doDisplayClickToOption( Configuration.delete_subtree_or_node ) ) {
1804 _delete_node_or_subtree_item = cb_index;
1805 addClickToOption( Configuration.delete_subtree_or_node,
1806 _configuration.getClickToTitle( Configuration.delete_subtree_or_node ) );
1807 if ( default_option == Configuration.delete_subtree_or_node ) {
1808 selected_index = cb_index;
1812 if ( _configuration.doDisplayClickToOption( Configuration.add_new_node ) ) {
1813 _add_new_node_item = cb_index;
1814 addClickToOption( Configuration.add_new_node,
1815 _configuration.getClickToTitle( Configuration.add_new_node ) );
1816 if ( default_option == Configuration.add_new_node ) {
1817 selected_index = cb_index;
1821 if ( _configuration.doDisplayClickToOption( Configuration.edit_node_data ) ) {
1822 _edit_node_data_item = cb_index;
1823 addClickToOption( Configuration.edit_node_data,
1824 _configuration.getClickToTitle( Configuration.edit_node_data ) );
1825 if ( default_option == Configuration.edit_node_data ) {
1826 selected_index = cb_index;
1830 if ( _configuration.doDisplayClickToOption( Configuration.select_nodes ) ) {
1831 _select_nodes_item = cb_index;
1832 addClickToOption( Configuration.select_nodes,
1833 _configuration.getClickToTitle( Configuration.select_nodes ) );
1834 if ( default_option == Configuration.select_nodes ) {
1835 selected_index = cb_index;
1840 // Set default selection and its action
1841 _click_to_combobox.setSelectedIndex( selected_index );
1842 setClickToAction( selected_index );
1845 private void setupDisplayCheckboxes() {
1846 if ( _configuration.doDisplayOption( Configuration.display_as_phylogram ) ) {
1847 addCheckbox( Configuration.display_as_phylogram,
1848 _configuration.getDisplayTitle( Configuration.display_as_phylogram ) );
1849 setCheckbox( Configuration.display_as_phylogram,
1850 _configuration.doCheckOption( Configuration.display_as_phylogram ) );
1852 if ( _configuration.doDisplayOption( Configuration.dynamically_hide_data ) ) {
1853 addCheckbox( Configuration.dynamically_hide_data,
1854 _configuration.getDisplayTitle( Configuration.dynamically_hide_data ) );
1855 setCheckbox( Configuration.dynamically_hide_data,
1856 _configuration.doCheckOption( Configuration.dynamically_hide_data ) );
1858 if ( _configuration.doDisplayOption( Configuration.node_data_popup ) ) {
1859 addCheckbox( Configuration.node_data_popup, _configuration.getDisplayTitle( Configuration.node_data_popup ) );
1860 setCheckbox( Configuration.node_data_popup, _configuration.doCheckOption( Configuration.node_data_popup ) );
1862 if ( _configuration.doDisplayOption( Configuration.display_internal_data ) ) {
1863 addCheckbox( Configuration.display_internal_data,
1864 _configuration.getDisplayTitle( Configuration.display_internal_data ) );
1865 setCheckbox( Configuration.display_internal_data,
1866 _configuration.doCheckOption( Configuration.display_internal_data ) );
1868 if ( _configuration.doDisplayOption( Configuration.color_according_to_species ) ) {
1869 addCheckbox( Configuration.color_according_to_species,
1870 _configuration.getDisplayTitle( Configuration.color_according_to_species ) );
1871 setCheckbox( Configuration.color_according_to_species,
1872 _configuration.doCheckOption( Configuration.color_according_to_species ) );
1874 if ( _configuration.doDisplayOption( Configuration.color_according_to_annotation ) ) {
1875 addCheckbox( Configuration.color_according_to_annotation,
1876 _configuration.getDisplayTitle( Configuration.color_according_to_annotation ) );
1877 setCheckbox( Configuration.color_according_to_annotation,
1878 _configuration.doCheckOption( Configuration.color_according_to_annotation ) );
1880 if ( _configuration.doDisplayOption( Configuration.color_branches ) ) {
1881 addCheckbox( Configuration.color_branches, _configuration.getDisplayTitle( Configuration.color_branches ) );
1882 setCheckbox( Configuration.color_branches, _configuration.doCheckOption( Configuration.color_branches ) );
1884 if ( _configuration.doDisplayOption( Configuration.width_branches ) ) {
1885 addCheckbox( Configuration.width_branches, _configuration.getDisplayTitle( Configuration.width_branches ) );
1886 setCheckbox( Configuration.width_branches, _configuration.doCheckOption( Configuration.width_branches ) );
1888 final JLabel label = new JLabel( "Display Data:" );
1889 label.setFont( ControlPanel.jcb_bold_font );
1890 if ( !getConfiguration().isUseNativeUI() ) {
1891 label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1894 if ( _configuration.doDisplayOption( Configuration.show_node_names ) ) {
1895 addCheckbox( Configuration.show_node_names, _configuration.getDisplayTitle( Configuration.show_node_names ) );
1896 setCheckbox( Configuration.show_node_names, _configuration.doCheckOption( Configuration.show_node_names ) );
1898 if ( _configuration.doDisplayOption( Configuration.show_tax_code ) ) {
1899 addCheckbox( Configuration.show_tax_code, _configuration.getDisplayTitle( Configuration.show_tax_code ) );
1900 setCheckbox( Configuration.show_tax_code, _configuration.doCheckOption( Configuration.show_tax_code ) );
1902 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_scientific_names ) ) {
1903 addCheckbox( Configuration.show_taxonomy_scientific_names,
1904 _configuration.getDisplayTitle( Configuration.show_taxonomy_scientific_names ) );
1905 setCheckbox( Configuration.show_taxonomy_scientific_names,
1906 _configuration.doCheckOption( Configuration.show_taxonomy_scientific_names ) );
1908 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_common_names ) ) {
1909 addCheckbox( Configuration.show_taxonomy_common_names,
1910 _configuration.getDisplayTitle( Configuration.show_taxonomy_common_names ) );
1911 setCheckbox( Configuration.show_taxonomy_common_names,
1912 _configuration.doCheckOption( Configuration.show_taxonomy_common_names ) );
1914 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_images ) ) {
1915 addCheckbox( Configuration.show_taxonomy_images,
1916 _configuration.getDisplayTitle( Configuration.show_taxonomy_images ) );
1917 setCheckbox( Configuration.show_taxonomy_images,
1918 _configuration.doCheckOption( Configuration.show_taxonomy_images ) );
1920 if ( _configuration.doDisplayOption( Configuration.show_gene_symbols ) ) {
1921 addCheckbox( Configuration.show_gene_symbols,
1922 _configuration.getDisplayTitle( Configuration.show_gene_symbols ) );
1923 setCheckbox( Configuration.show_gene_symbols,
1924 _configuration.doCheckOption( Configuration.show_gene_symbols ) );
1926 if ( _configuration.doDisplayOption( Configuration.show_gene_names ) ) {
1927 addCheckbox( Configuration.show_gene_names, _configuration.getDisplayTitle( Configuration.show_gene_names ) );
1928 setCheckbox( Configuration.show_gene_names, _configuration.doCheckOption( Configuration.show_gene_names ) );
1930 if ( _configuration.doDisplayOption( Configuration.show_sequence_acc ) ) {
1931 addCheckbox( Configuration.show_sequence_acc,
1932 _configuration.getDisplayTitle( Configuration.show_sequence_acc ) );
1933 setCheckbox( Configuration.show_sequence_acc,
1934 _configuration.doCheckOption( Configuration.show_sequence_acc ) );
1936 if ( _configuration.doDisplayOption( Configuration.show_annotation ) ) {
1937 addCheckbox( Configuration.show_annotation, _configuration.getDisplayTitle( Configuration.show_annotation ) );
1938 setCheckbox( Configuration.show_annotation, _configuration.doCheckOption( Configuration.show_annotation ) );
1940 if ( _configuration.doDisplayOption( Configuration.show_binary_characters ) ) {
1941 addCheckbox( Configuration.show_binary_characters,
1942 _configuration.getDisplayTitle( Configuration.show_binary_characters ) );
1943 setCheckbox( Configuration.show_binary_characters,
1944 _configuration.doCheckOption( Configuration.show_binary_characters ) );
1946 if ( _configuration.doDisplayOption( Configuration.show_binary_character_counts ) ) {
1947 addCheckbox( Configuration.show_binary_character_counts,
1948 _configuration.getDisplayTitle( Configuration.show_binary_character_counts ) );
1949 setCheckbox( Configuration.show_binary_character_counts,
1950 _configuration.doCheckOption( Configuration.show_binary_character_counts ) );
1952 if ( _configuration.doDisplayOption( Configuration.show_domain_architectures ) ) {
1953 addCheckbox( Configuration.show_domain_architectures,
1954 _configuration.getDisplayTitle( Configuration.show_domain_architectures ) );
1955 setCheckbox( Configuration.show_domain_architectures,
1956 _configuration.doCheckOption( Configuration.show_domain_architectures ) );
1958 if ( _configuration.doDisplayOption( Configuration.write_confidence_values ) ) {
1959 addCheckbox( Configuration.write_confidence_values,
1960 _configuration.getDisplayTitle( Configuration.write_confidence_values ) );
1961 setCheckbox( Configuration.write_confidence_values,
1962 _configuration.doCheckOption( Configuration.write_confidence_values ) );
1964 if ( _configuration.doDisplayOption( Configuration.write_events ) ) {
1965 addCheckbox( Configuration.write_events, _configuration.getDisplayTitle( Configuration.write_events ) );
1966 setCheckbox( Configuration.write_events, _configuration.doCheckOption( Configuration.write_events ) );
1968 if ( _configuration.doDisplayOption( Configuration.show_vector_data ) ) {
1969 addCheckbox( Configuration.show_vector_data,
1970 _configuration.getDisplayTitle( Configuration.show_vector_data ) );
1971 setCheckbox( Configuration.show_vector_data, _configuration.doCheckOption( Configuration.show_vector_data ) );
1973 if ( _configuration.doDisplayOption( Configuration.show_properties ) ) {
1974 addCheckbox( Configuration.show_properties, _configuration.getDisplayTitle( Configuration.show_properties ) );
1975 setCheckbox( Configuration.show_properties, _configuration.doCheckOption( Configuration.show_properties ) );
1979 private void setVisibilityOfDomainStrucureControls() {
1980 if ( _zoom_in_domain_structure != null ) {
1981 if ( isShowDomainArchitectures() ) {
1982 _domain_display_label.setVisible( true );
1983 _zoom_in_domain_structure.setVisible( true );
1984 _zoom_out_domain_structure.setVisible( true );
1985 _decr_domain_structure_evalue_thr.setVisible( true );
1986 _incr_domain_structure_evalue_thr.setVisible( true );
1987 _domain_structure_evalue_thr_tf.setVisible( true );
1990 _domain_display_label.setVisible( false );
1991 _zoom_in_domain_structure.setVisible( false );
1992 _zoom_out_domain_structure.setVisible( false );
1993 _decr_domain_structure_evalue_thr.setVisible( false );
1994 _incr_domain_structure_evalue_thr.setVisible( false );
1995 _domain_structure_evalue_thr_tf.setVisible( false );
2000 static JLabel customizeLabel( final JLabel label, final Configuration configuration ) {
2001 label.setFont( ControlPanel.jcb_bold_font );
2002 if ( !configuration.isUseNativeUI() ) {
2003 label.setForeground( configuration.getGuiCheckboxTextColor() );
2004 label.setBackground( configuration.getGuiBackgroundColor() );
2009 enum NodeClickAction {
2020 DELETE_NODE_OR_SUBTREE,