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 final static Font jcb_bold_font = new Font( Configuration.getDefaultFontFamilyName(),
76 final static Font jcb_font = new Font( Configuration.getDefaultFontFamilyName(),
79 final static Font js_font = new Font( Configuration.getDefaultFontFamilyName(),
82 private static final String RETURN_TO_SUPER_TREE_TEXT = "Back to Super Tree";
83 private static final long serialVersionUID = -8463483932821545633L;
84 private NodeClickAction _action_when_node_clicked;
85 private int _add_new_node_item;
86 private Map<Integer, String> _all_click_to_names;
87 private Map<String, Color> _annotation_colors;
88 private int _blast_item;
89 private JComboBox _click_to_combobox;
90 private JLabel _click_to_label;
91 private List<String> _click_to_names;
92 private int _collapse_cb_item;
93 private JCheckBox _color_acc_species;
94 private JCheckBox _color_according_to_annotation;
95 private boolean _color_branches;
96 private JCheckBox _color_branches_cb;
97 private int _color_subtree_cb_item;
98 // The settings from the conf file
99 private final Configuration _configuration;
100 private int _copy_subtree_item;
101 private int _cut_subtree_item;
102 private JButton _decr_domain_structure_evalue_thr;
103 private int _delete_node_or_subtree_item;
104 private JCheckBox _display_as_phylogram_cb;
106 private JCheckBox _display_internal_data;
107 private JLabel _domain_display_label;
108 private JTextField _domain_structure_evalue_thr_tf;
109 private List<Boolean> _draw_phylogram;
110 private JCheckBox _dynamically_hide_data;
111 private int _edit_node_data_item;
112 private int _get_ext_desc_data;
113 private JButton _incr_domain_structure_evalue_thr;
114 private final MainPanel _mainpanel;
115 private JCheckBox _node_desc_popup_cb;
116 private int _open_pdb_item;
117 private int _open_seq_web_item;
118 private int _open_tax_web_item;
119 private JButton _order;
120 private boolean _order_of_appearance;
121 private int _paste_subtree_item;
122 private int _reroot_cb_item;
123 private JButton _return_to_super_tree;
124 private JLabel _search_found_label;
125 private JButton _search_reset_button;
126 private JTextField _search_tf;
127 private int _select_nodes_item;
128 private Sequence _selected_query_seq;
129 private JCheckBox _seq_relation_confidence_switch;
130 private JComboBox _sequence_relation_type_box;
131 private JCheckBox _show_annotation;
132 private JCheckBox _show_binary_character_counts;
133 private JCheckBox _show_binary_characters;
134 // Indices for the click-to options in the combo box
135 private int _show_data_item;
136 private JCheckBox _show_domain_architectures;
137 private JCheckBox _show_events;
138 private JCheckBox _show_gene_names;
139 private JCheckBox _show_node_names;
140 private JCheckBox _show_properties_cb;
141 private JCheckBox _show_seq_names;
142 private JCheckBox _show_seq_symbols;
143 private JCheckBox _show_sequence_acc;
144 private JComboBox _show_sequence_relations;
145 private JCheckBox _show_taxo_code;
146 private JCheckBox _show_taxo_common_names;
147 private JCheckBox _show_taxo_images_cb;
148 private JCheckBox _show_taxo_scientific_names;
149 private JCheckBox _show_vector_data_cb;
150 private JButton _show_whole;
151 private int _sort_descendents_item;
152 private Map<String, Color> _species_colors;
153 private int _subtree_cb_item;
154 private int _swap_cb_item;
155 private JButton _uncollapse_all;
156 private JCheckBox _width_branches;
157 private JCheckBox _write_confidence;
158 private JButton _zoom_in_domain_structure;
159 // zooming and quick tree manipulation buttons:
160 private JButton _zoom_in_x;
161 private JButton _zoom_in_y;
162 private JLabel _zoom_label;
163 private JButton _zoom_out_domain_structure;
164 private JButton _zoom_out_x;
165 private JButton _zoom_out_y;
167 ControlPanel( final MainPanel ap, final Configuration configuration ) {
170 _configuration = configuration;
171 if ( !_configuration.isUseNativeUI() ) {
172 setBackground( getConfiguration().getGuiBackgroundColor() );
173 setBorder( BorderFactory.createRaisedBevelBorder() );
175 setLayout( new GridLayout( 0, 1, 2, 2 ) );
176 _order_of_appearance = true;
184 public void actionPerformed( final ActionEvent e ) {
186 final TreePanel tp = getMainPanel().getCurrentTreePanel();
190 if ( e.getSource() == _click_to_combobox ) {
191 setClickToAction( _click_to_combobox.getSelectedIndex() );
192 getCurrentTreePanel().repaint();
194 else if ( e.getSource() == _show_binary_characters ) {
195 if ( ( _show_binary_character_counts != null ) && _show_binary_characters.isSelected() ) {
196 _show_binary_character_counts.setSelected( false );
198 displayedPhylogenyMightHaveChanged( true );
200 else if ( e.getSource() == _show_binary_character_counts ) {
201 if ( ( _show_binary_characters != null ) && _show_binary_character_counts.isSelected() ) {
202 _show_binary_characters.setSelected( false );
204 displayedPhylogenyMightHaveChanged( true );
206 else if ( e.getSource() == _show_domain_architectures ) {
208 displayedPhylogenyMightHaveChanged( true );
210 else if ( ( tp != null ) && ( tp.getPhylogeny() != null ) ) {
211 if ( e.getSource() == getDisplayAsPhylogramCb() ) {
212 setDrawPhylogram( getDisplayAsPhylogramCb().isSelected() );
216 else if ( e.getSource() == _zoom_in_x ) {
217 zoomInX( Constants.BUTTON_ZOOM_IN_FACTOR, Constants.BUTTON_ZOOM_IN_X_CORRECTION_FACTOR );
218 displayedPhylogenyMightHaveChanged( false );
220 else if ( e.getSource() == _zoom_in_y ) {
221 zoomInY( Constants.BUTTON_ZOOM_IN_FACTOR );
222 displayedPhylogenyMightHaveChanged( false );
224 else if ( e.getSource() == _zoom_out_x ) {
225 zoomOutX( Constants.BUTTON_ZOOM_OUT_FACTOR, Constants.BUTTON_ZOOM_OUT_X_CORRECTION_FACTOR );
226 displayedPhylogenyMightHaveChanged( false );
228 else if ( e.getSource() == _zoom_out_y ) {
229 zoomOutY( Constants.BUTTON_ZOOM_OUT_FACTOR );
230 displayedPhylogenyMightHaveChanged( false );
232 else if ( e.getSource() == _show_whole ) {
235 else if ( e.getSource() == _return_to_super_tree ) {
236 _mainpanel.getCurrentTreePanel().superTree();
239 else if ( e.getSource() == _order ) {
240 DESCENDANT_SORT_PRIORITY pri = DESCENDANT_SORT_PRIORITY.TAXONOMY;
241 if ( ( !isShowTaxonomyScientificNames() && !isShowTaxonomyCode() && !isShowTaxonomyCommonNames() ) ) {
242 if ( ( isShowSequenceAcc() || isShowSeqNames() || isShowSeqSymbols() ) ) {
243 pri = DESCENDANT_SORT_PRIORITY.SEQUENCE;
245 else if ( isShowNodeNames() ) {
246 pri = DESCENDANT_SORT_PRIORITY.NODE_NAME;
249 PhylogenyMethods.orderAppearance( tp.getPhylogeny().getRoot(), _order_of_appearance, true, pri );
250 _order_of_appearance = !_order_of_appearance;
251 tp.setNodeInPreorderToNull();
252 tp.getPhylogeny().externalNodesHaveChanged();
253 tp.getPhylogeny().clearHashIdToNodeMap();
254 tp.getPhylogeny().recalculateNumberOfExternalDescendants( true );
255 tp.resetNodeIdToDistToLeafMap();
256 tp.setEdited( true );
257 displayedPhylogenyMightHaveChanged( false );
259 else if ( e.getSource() == _uncollapse_all ) {
261 displayedPhylogenyMightHaveChanged( false );
263 else if ( e.getSource() == _zoom_in_domain_structure ) {
264 _mainpanel.getCurrentTreePanel().zoomInDomainStructure();
265 displayedPhylogenyMightHaveChanged( true );
267 else if ( e.getSource() == _zoom_out_domain_structure ) {
268 _mainpanel.getCurrentTreePanel().zoomOutDomainStructure();
269 displayedPhylogenyMightHaveChanged( true );
271 else if ( e.getSource() == _decr_domain_structure_evalue_thr ) {
272 _mainpanel.getCurrentTreePanel().decreaseDomainStructureEvalueThreshold();
273 displayedPhylogenyMightHaveChanged( true );
275 else if ( e.getSource() == _incr_domain_structure_evalue_thr ) {
276 _mainpanel.getCurrentTreePanel().increaseDomainStructureEvalueThreshold();
277 displayedPhylogenyMightHaveChanged( true );
279 else if ( e.getSource() == _search_tf ) {
281 displayedPhylogenyMightHaveChanged( true );
284 displayedPhylogenyMightHaveChanged( true );
288 tp.requestFocusInWindow();
291 catch ( final Exception ex ) {
292 AptxUtil.unexpectedException( ex );
294 catch ( final Error err ) {
295 AptxUtil.unexpectedError( err );
299 public JCheckBox getColorAccSpeciesCb() {
300 return _color_acc_species;
303 public JCheckBox getColorBranchesCb() {
304 return _color_branches_cb;
307 public JCheckBox getDisplayAsPhylogramCb() {
308 return _display_as_phylogram_cb;
311 public JCheckBox getDynamicallyHideData() {
312 return _dynamically_hide_data;
315 public JCheckBox getNodeDescPopupCb() {
316 return _node_desc_popup_cb;
319 public Sequence getSelectedQuerySequence() {
320 return _selected_query_seq;
323 public JComboBox getSequenceRelationBox() {
324 if ( _show_sequence_relations == null ) {
325 _show_sequence_relations = new JComboBox();
326 _show_sequence_relations.setFocusable( false );
327 _show_sequence_relations.setMaximumRowCount( 20 );
328 _show_sequence_relations.setFont( ControlPanel.js_font );
329 if ( !_configuration.isUseNativeUI() ) {
330 _show_sequence_relations.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
331 _show_sequence_relations.setForeground( getConfiguration().getGuiButtonTextColor() );
333 _show_sequence_relations.addItem( "-----" );
334 _show_sequence_relations.setToolTipText( "To display orthology information for selected query" );
336 return _show_sequence_relations;
340 public JComboBox getSequenceRelationTypeBox() {
341 if ( _sequence_relation_type_box == null ) {
342 _sequence_relation_type_box = new JComboBox();
343 for( final SequenceRelation.SEQUENCE_RELATION_TYPE type : SequenceRelation.SEQUENCE_RELATION_TYPE.values() ) {
344 _sequence_relation_type_box.addItem( type );
346 _sequence_relation_type_box.addActionListener( new ActionListener() {
349 public void actionPerformed( final ActionEvent e ) {
350 if ( _mainpanel.getCurrentPhylogeny() != null ) {
351 setSequenceRelationQueries( getMainPanel().getCurrentPhylogeny().getSequenceRelationQueries() );
356 return _sequence_relation_type_box;
359 public JCheckBox getShowEventsCb() {
363 public JCheckBox getWriteConfidenceCb() {
364 return _write_confidence;
367 public boolean isShowProperties() {
368 return ( ( _show_properties_cb != null ) && _show_properties_cb.isSelected() );
371 public boolean isShowTaxonomyImages() {
372 return ( ( _show_taxo_images_cb != null ) && _show_taxo_images_cb.isSelected() );
375 public boolean isShowVectorData() {
376 return ( ( _show_vector_data_cb != null ) && _show_vector_data_cb.isSelected() );
379 public void setSequenceRelationQueries( final Collection<Sequence> sequenceRelationQueries ) {
380 final JComboBox box = getSequenceRelationBox();
381 while ( box.getItemCount() > 1 ) {
382 box.removeItemAt( 1 );
384 final HashMap<String, Sequence> sequencesByName = new HashMap<String, Sequence>();
385 final SequenceRelation.SEQUENCE_RELATION_TYPE relationType = ( SequenceRelation.SEQUENCE_RELATION_TYPE ) _sequence_relation_type_box
387 if ( relationType == null ) {
390 final ArrayList<String> sequenceNamesToAdd = new ArrayList<String>();
391 for( final Sequence seq : sequenceRelationQueries ) {
392 if ( seq.hasSequenceRelations() ) {
393 boolean fFoundForCurrentType = false;
394 for( final SequenceRelation sq : seq.getSequenceRelations() ) {
395 if ( sq.getType().equals( relationType ) ) {
396 fFoundForCurrentType = true;
400 if ( fFoundForCurrentType ) {
401 sequenceNamesToAdd.add( seq.getName() );
402 sequencesByName.put( seq.getName(), seq );
406 // sort sequences by name before adding them to the combo
407 final String[] sequenceNameArray = sequenceNamesToAdd.toArray( new String[ sequenceNamesToAdd.size() ] );
408 Arrays.sort( sequenceNameArray, String.CASE_INSENSITIVE_ORDER );
409 for( final String seqName : sequenceNameArray ) {
410 box.addItem( seqName );
412 for( final ItemListener oldItemListener : box.getItemListeners() ) {
413 box.removeItemListener( oldItemListener );
415 box.addItemListener( new ItemListener() {
418 public void itemStateChanged( final ItemEvent e ) {
419 _selected_query_seq = sequencesByName.get( e.getItem() );
420 _mainpanel.getCurrentTreePanel().repaint();
425 void activateButtonToReturnToSuperTree( int index ) {
428 _return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT + " " + index );
431 _return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT );
433 _return_to_super_tree.setForeground( getConfiguration().getGuiCheckboxAndButtonActiveColor() );
434 _return_to_super_tree.setEnabled( true );
438 * Add zoom and quick edit buttons. (Last modified 8/9/04)
441 final JLabel spacer = new JLabel( "" );
442 spacer.setOpaque( false );
444 final JPanel x_panel = new JPanel( new GridLayout( 1, 1, 0, 0 ) );
445 final JPanel y_panel = new JPanel( new GridLayout( 1, 3, 0, 0 ) );
446 final JPanel z_panel = new JPanel( new GridLayout( 1, 1, 0, 0 ) );
447 if ( !getConfiguration().isUseNativeUI() ) {
448 x_panel.setBackground( getBackground() );
449 y_panel.setBackground( getBackground() );
450 z_panel.setBackground( getBackground() );
452 add( _zoom_label = new JLabel( "Zoom:" ) );
453 customizeLabel( _zoom_label, getConfiguration() );
457 if ( getConfiguration().isUseNativeUI() ) {
458 _zoom_in_x = new JButton( "+" );
459 _zoom_out_x = new JButton( "-" );
462 _zoom_in_x = new JButton( "X+" );
463 _zoom_out_x = new JButton( "X-" );
465 _zoom_in_y = new JButton( "Y+" );
466 _zoom_out_y = new JButton( "Y-" );
467 _show_whole = new JButton( "F" );
468 _show_whole.setToolTipText( "To fit the complete phylogeny to the current display size [F or Home]" );
469 _zoom_in_x.setToolTipText( "To zoom in horizontally [Shift+cursor-right]" );
470 _zoom_in_y.setToolTipText( "To zoom in vertically [Shift+cursor-up]" );
471 _zoom_out_x.setToolTipText( "To zoom out horizontally [Shift+cursor-left]" );
472 _zoom_out_y.setToolTipText( "To zoom out vertically [Shift+cursor-down]" );
473 if ( getConfiguration().isUseNativeUI() && ForesterUtil.isMac() ) {
474 _zoom_out_x.setPreferredSize( new Dimension( 55, 10 ) );
475 _zoom_in_x.setPreferredSize( new Dimension( 55, 10 ) );
478 _zoom_out_x.setPreferredSize( new Dimension( 10, 10 ) );
479 _zoom_in_x.setPreferredSize( new Dimension( 10, 10 ) );
481 _zoom_out_y.setPreferredSize( new Dimension( 10, 10 ) );
482 _zoom_in_y.setPreferredSize( new Dimension( 10, 10 ) );
483 _show_whole.setPreferredSize( new Dimension( 10, 10 ) );
484 _return_to_super_tree = new JButton( RETURN_TO_SUPER_TREE_TEXT );
485 _return_to_super_tree.setEnabled( false );
486 _order = new JButton( "Order Subtrees" );
487 _uncollapse_all = new JButton( "Uncollapse All" );
488 addJButton( _zoom_in_y, x_panel );
489 addJButton( _zoom_out_x, y_panel );
490 addJButton( _show_whole, y_panel );
491 addJButton( _zoom_in_x, y_panel );
492 addJButton( _zoom_out_y, z_panel );
493 if ( getConfiguration().doDisplayOption( Configuration.show_domain_architectures ) ) {
494 setUpControlsForDomainStrucures();
496 final JLabel spacer2 = new JLabel( "" );
498 addJButton( _return_to_super_tree, this );
499 addJButton( _order, this );
500 addJButton( _uncollapse_all, this );
501 final JLabel spacer3 = new JLabel( "" );
503 setVisibilityOfDomainStrucureControls();
506 void addCheckbox( final int which, final String title ) {
507 final JPanel ch_panel = new JPanel( new BorderLayout( 0, 0 ) );
509 case Configuration.display_as_phylogram:
510 _display_as_phylogram_cb = new JCheckBox( title );
511 getDisplayAsPhylogramCb().setToolTipText( "To switch between phylogram and cladogram display" );
512 addJCheckBox( getDisplayAsPhylogramCb(), ch_panel );
515 case Configuration.display_internal_data:
516 _display_internal_data = new JCheckBox( title );
517 _display_internal_data.setToolTipText( "To allow or disallow display of internal labels" );
518 addJCheckBox( _display_internal_data, ch_panel );
521 case Configuration.color_according_to_species:
522 _color_acc_species = new JCheckBox( title );
524 .setToolTipText( "To colorize taxonomy and sequence labels as a function of taxonomy" );
525 addJCheckBox( _color_acc_species, ch_panel );
528 case Configuration.color_according_to_annotation:
529 _color_according_to_annotation = new JCheckBox( title );
530 _color_according_to_annotation
531 .setToolTipText( "To colorize sequence annotation labels as a function of sequence annotation" );
532 addJCheckBox( _color_according_to_annotation, ch_panel );
535 case Configuration.show_node_names:
536 _show_node_names = new JCheckBox( title );
537 addJCheckBox( _show_node_names, ch_panel );
540 case Configuration.show_taxonomy_scientific_names:
541 _show_taxo_scientific_names = new JCheckBox( title );
542 addJCheckBox( _show_taxo_scientific_names, ch_panel );
545 case Configuration.show_taxonomy_common_names:
546 _show_taxo_common_names = new JCheckBox( title );
547 addJCheckBox( _show_taxo_common_names, ch_panel );
550 case Configuration.show_tax_code:
551 _show_taxo_code = new JCheckBox( title );
552 addJCheckBox( _show_taxo_code, ch_panel );
555 case Configuration.show_taxonomy_images:
556 _show_taxo_images_cb = new JCheckBox( title );
557 addJCheckBox( _show_taxo_images_cb, ch_panel );
560 case Configuration.show_binary_characters:
561 _show_binary_characters = new JCheckBox( title );
562 addJCheckBox( _show_binary_characters, ch_panel );
565 case Configuration.show_annotation:
566 _show_annotation = new JCheckBox( title );
567 addJCheckBox( _show_annotation, ch_panel );
570 case Configuration.show_binary_character_counts:
571 _show_binary_character_counts = new JCheckBox( title );
572 addJCheckBox( _show_binary_character_counts, ch_panel );
575 case Configuration.write_confidence_values:
576 _write_confidence = new JCheckBox( title );
577 addJCheckBox( getWriteConfidenceCb(), ch_panel );
580 case Configuration.write_events:
581 _show_events = new JCheckBox( title );
582 addJCheckBox( getShowEventsCb(), ch_panel );
585 case Configuration.color_branches:
586 _color_branches_cb = new JCheckBox( title );
587 getColorBranchesCb().setToolTipText( "To use branch color values, if present" );
588 addJCheckBox( getColorBranchesCb(), ch_panel );
591 case Configuration.width_branches:
592 _width_branches = new JCheckBox( title );
593 _width_branches.setToolTipText( "To use branch width values, if present" );
594 addJCheckBox( _width_branches, ch_panel );
597 case Configuration.show_domain_architectures:
598 _show_domain_architectures = new JCheckBox( title );
599 addJCheckBox( _show_domain_architectures, ch_panel );
602 case Configuration.show_seq_names:
603 _show_seq_names = new JCheckBox( title );
604 addJCheckBox( _show_seq_names, 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_seq_symbols:
613 _show_seq_symbols = new JCheckBox( title );
614 addJCheckBox( _show_seq_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 JLabel getSearchFoundCountsLabel() {
751 return _search_found_label;
754 JButton getSearchResetButton() {
755 return _search_reset_button;
758 JTextField getSearchTextField() {
762 List<String> getSingleClickToNames() {
763 return _click_to_names;
766 Map<String, Color> getSpeciesColors() {
767 return _species_colors;
770 boolean isAntialiasScreenText() {
774 boolean isColorAccordingToAnnotation() {
775 return ( ( _color_according_to_annotation != null ) && _color_according_to_annotation.isSelected() );
778 boolean isColorAccordingToTaxonomy() {
779 return ( ( _color_acc_species != null ) && _color_acc_species.isSelected() );
782 boolean isColorBranches() {
783 return ( ( ( getColorBranchesCb() != null ) && getColorBranchesCb().isSelected() ) || ( ( getColorBranchesCb() == null ) && _color_branches ) );
786 boolean isDrawPhylogram() {
787 return isDrawPhylogram( getMainPanel().getCurrentTabIndex() );
790 boolean isDynamicallyHideData() {
791 return ( ( getDynamicallyHideData() != null ) && getDynamicallyHideData().isSelected() );
795 return ( ( getShowEventsCb() != null ) && getShowEventsCb().isSelected() );
798 boolean isNodeDescPopup() {
799 return ( ( getNodeDescPopupCb() != null ) && getNodeDescPopupCb().isSelected() );
802 boolean isShowAnnotation() {
803 return ( ( _show_annotation != null ) && _show_annotation.isSelected() );
806 boolean isShowBinaryCharacterCounts() {
807 return ( ( _show_binary_character_counts != null ) && _show_binary_character_counts.isSelected() );
810 boolean isShowBinaryCharacters() {
811 return ( ( _show_binary_characters != null ) && _show_binary_characters.isSelected() );
814 boolean isShowConfidenceValues() {
815 return ( ( getWriteConfidenceCb() != null ) && getWriteConfidenceCb().isSelected() );
818 boolean isShowDomainArchitectures() {
819 return ( ( _show_domain_architectures != null ) && _show_domain_architectures.isSelected() );
822 boolean isShowGeneNames() {
823 return ( ( _show_gene_names != null ) && _show_gene_names.isSelected() );
826 boolean isShowInternalData() {
827 return ( ( _display_internal_data == null ) || _display_internal_data.isSelected() );
830 boolean isShowNodeNames() {
831 return ( ( _show_node_names != null ) && _show_node_names.isSelected() );
834 boolean isShowSeqNames() {
835 return ( ( _show_seq_names != null ) && _show_seq_names.isSelected() );
838 boolean isShowSeqSymbols() {
839 return ( ( _show_seq_symbols != null ) && _show_seq_symbols.isSelected() );
842 boolean isShowSequenceAcc() {
843 return ( ( _show_sequence_acc != null ) && _show_sequence_acc.isSelected() );
846 boolean isShowSequenceRelationConfidence() {
847 return ( ( _seq_relation_confidence_switch != null ) && ( _seq_relation_confidence_switch.isSelected() ) );
850 boolean isShowSequenceRelations() {
851 return ( ( _show_sequence_relations != null ) && ( _show_sequence_relations.getSelectedIndex() > 0 ) );
854 boolean isShowTaxonomyCode() {
855 return ( ( _show_taxo_code != null ) && _show_taxo_code.isSelected() );
858 boolean isShowTaxonomyCommonNames() {
859 return ( ( _show_taxo_common_names != null ) && _show_taxo_common_names.isSelected() );
862 boolean isShowTaxonomyScientificNames() {
863 return ( ( _show_taxo_scientific_names != null ) && _show_taxo_scientific_names.isSelected() );
866 boolean isWidthBranches() {
867 return ( ( _width_branches != null ) && _width_branches.isSelected() );
870 void phylogenyAdded( final Configuration configuration ) {
871 getIsDrawPhylogramList().add( configuration.isDrawAsPhylogram() );
874 void phylogenyRemoved( final int index ) {
875 getIsDrawPhylogramList().remove( index );
879 final MainPanel main_panel = getMainPanel();
880 final Phylogeny tree = main_panel.getCurrentPhylogeny();
881 if ( ( tree == null ) || tree.isEmpty() ) {
884 String query = getSearchTextField().getText();
885 if ( query != null ) {
886 query = query.trim();
889 getSearchFoundCountsLabel().setVisible( false );
890 getSearchResetButton().setEnabled( false );
891 getSearchResetButton().setVisible( false );
894 if ( !ForesterUtil.isEmpty( query ) ) {
895 search( main_panel, tree, query );
898 getSearchFoundCountsLabel().setVisible( false );
899 getSearchResetButton().setEnabled( false );
900 getSearchResetButton().setVisible( false );
906 if ( getMainPanel().getCurrentTreePanel() != null ) {
907 getMainPanel().getCurrentTreePanel().setFoundNodes( null );
911 void setActionWhenNodeClicked( final NodeClickAction action ) {
912 _action_when_node_clicked = action;
915 void setAnnotationColors( final Map<String, Color> annotation_colors ) {
916 _annotation_colors = annotation_colors;
919 void setCheckbox( final int which, final boolean state ) {
921 case Configuration.display_as_phylogram:
922 if ( getDisplayAsPhylogramCb() != null ) {
923 getDisplayAsPhylogramCb().setSelected( state );
926 case Configuration.display_internal_data:
927 if ( _display_internal_data != null ) {
928 _display_internal_data.setSelected( state );
931 case Configuration.color_according_to_species:
932 if ( _color_acc_species != null ) {
933 _color_acc_species.setSelected( state );
936 case Configuration.color_according_to_annotation:
937 if ( _color_according_to_annotation != null ) {
938 _color_according_to_annotation.setSelected( state );
941 case Configuration.show_node_names:
942 if ( _show_node_names != null ) {
943 _show_node_names.setSelected( state );
946 case Configuration.show_taxonomy_scientific_names:
947 if ( _show_taxo_scientific_names != null ) {
948 _show_taxo_scientific_names.setSelected( state );
951 case Configuration.show_taxonomy_common_names:
952 if ( _show_taxo_common_names != null ) {
953 _show_taxo_common_names.setSelected( state );
956 case Configuration.show_tax_code:
957 if ( _show_taxo_code != null ) {
958 _show_taxo_code.setSelected( state );
961 case Configuration.show_taxonomy_images:
962 if ( _show_taxo_images_cb != null ) {
963 _show_taxo_images_cb.setSelected( state );
966 case Configuration.show_annotation:
967 if ( _show_annotation != null ) {
968 _show_annotation.setSelected( state );
971 case Configuration.show_binary_characters:
972 if ( _show_binary_characters != null ) {
973 _show_binary_characters.setSelected( state );
976 case Configuration.show_binary_character_counts:
977 if ( _show_binary_character_counts != null ) {
978 _show_binary_character_counts.setSelected( state );
981 case Configuration.write_confidence_values:
982 if ( getWriteConfidenceCb() != null ) {
983 getWriteConfidenceCb().setSelected( state );
986 case Configuration.write_events:
987 if ( getShowEventsCb() != null ) {
988 getShowEventsCb().setSelected( state );
991 case Configuration.color_branches:
992 if ( getColorBranchesCb() != null ) {
993 getColorBranchesCb().setSelected( state );
996 case Configuration.width_branches:
997 if ( _width_branches != null ) {
998 _width_branches.setSelected( state );
1001 case Configuration.show_domain_architectures:
1002 if ( _show_domain_architectures != null ) {
1003 _show_domain_architectures.setSelected( state );
1006 case Configuration.show_seq_names:
1007 if ( _show_seq_names != null ) {
1008 _show_seq_names.setSelected( state );
1011 case Configuration.show_gene_names:
1012 if ( _show_gene_names != null ) {
1013 _show_gene_names.setSelected( state );
1016 case Configuration.show_seq_symbols:
1017 if ( _show_seq_symbols != null ) {
1018 _show_seq_symbols.setSelected( state );
1021 case Configuration.show_vector_data:
1022 if ( _show_vector_data_cb != null ) {
1023 _show_vector_data_cb.setSelected( state );
1026 case Configuration.show_properties:
1027 if ( _show_properties_cb != null ) {
1028 _show_properties_cb.setSelected( state );
1031 case Configuration.show_sequence_acc:
1032 if ( _show_sequence_acc != null ) {
1033 _show_sequence_acc.setSelected( state );
1036 case Configuration.dynamically_hide_data:
1037 if ( getDynamicallyHideData() != null ) {
1038 getDynamicallyHideData().setSelected( state );
1041 case Configuration.node_data_popup:
1042 if ( getNodeDescPopupCb() != null ) {
1043 getNodeDescPopupCb().setSelected( state );
1047 case Configuration.show_relation_confidence:
1048 if ( _seq_relation_confidence_switch != null ) {
1049 _seq_relation_confidence_switch.setSelected( state );
1054 throw new AssertionError( "unknown checkbox: " + which );
1059 * Set this checkbox state. Not all checkboxes have been instantiated
1060 * depending on the config.
1062 void setCheckbox( final JCheckBox cb, final boolean state ) {
1064 cb.setSelected( state );
1068 void setClickToAction( final int action ) {
1069 // Set click-to action
1070 if ( action == _show_data_item ) {
1071 setActionWhenNodeClicked( NodeClickAction.SHOW_DATA );
1073 else if ( action == _collapse_cb_item ) {
1074 setActionWhenNodeClicked( NodeClickAction.COLLAPSE );
1076 else if ( action == _reroot_cb_item ) {
1077 setActionWhenNodeClicked( NodeClickAction.REROOT );
1079 else if ( action == _subtree_cb_item ) {
1080 setActionWhenNodeClicked( NodeClickAction.SUBTREE );
1082 else if ( action == _swap_cb_item ) {
1083 setActionWhenNodeClicked( NodeClickAction.SWAP );
1085 else if ( action == _color_subtree_cb_item ) {
1086 setActionWhenNodeClicked( NodeClickAction.COLOR_SUBTREE );
1088 else if ( action == _open_seq_web_item ) {
1089 setActionWhenNodeClicked( NodeClickAction.OPEN_SEQ_WEB );
1091 else if ( action == _sort_descendents_item ) {
1092 setActionWhenNodeClicked( NodeClickAction.SORT_DESCENDENTS );
1094 else if ( action == _blast_item ) {
1095 setActionWhenNodeClicked( NodeClickAction.BLAST );
1097 else if ( action == _open_tax_web_item ) {
1098 setActionWhenNodeClicked( NodeClickAction.OPEN_TAX_WEB );
1100 else if ( action == _cut_subtree_item ) {
1101 setActionWhenNodeClicked( NodeClickAction.CUT_SUBTREE );
1103 else if ( action == _copy_subtree_item ) {
1104 setActionWhenNodeClicked( NodeClickAction.COPY_SUBTREE );
1106 else if ( action == _delete_node_or_subtree_item ) {
1107 setActionWhenNodeClicked( NodeClickAction.DELETE_NODE_OR_SUBTREE );
1109 else if ( action == _paste_subtree_item ) {
1110 setActionWhenNodeClicked( NodeClickAction.PASTE_SUBTREE );
1112 else if ( action == _add_new_node_item ) {
1113 setActionWhenNodeClicked( NodeClickAction.ADD_NEW_NODE );
1115 else if ( action == _edit_node_data_item ) {
1116 setActionWhenNodeClicked( NodeClickAction.EDIT_NODE_DATA );
1118 else if ( action == _select_nodes_item ) {
1119 setActionWhenNodeClicked( NodeClickAction.SELECT_NODES );
1121 else if ( action == _get_ext_desc_data ) {
1122 setActionWhenNodeClicked( NodeClickAction.GET_EXT_DESC_DATA );
1124 else if ( action == _open_pdb_item ) {
1125 setActionWhenNodeClicked( NodeClickAction.OPEN_PDB_WEB );
1128 throw new RuntimeException( "unknown action: " + action );
1130 // make sure drop down is displaying the correct action
1131 // in case this was called from outside the class
1132 _click_to_combobox.setSelectedIndex( action );
1135 void setColorBranches( final boolean color_branches ) {
1136 _color_branches = color_branches;
1139 void setDrawPhylogram( final boolean b ) {
1140 getDisplayAsPhylogramCb().setSelected( b );
1141 setDrawPhylogram( getMainPanel().getCurrentTabIndex(), b );
1144 void setDrawPhylogramEnabled( final boolean b ) {
1145 getDisplayAsPhylogramCb().setEnabled( b );
1148 void setDynamicHidingIsOn( final boolean is_on ) {
1149 // if ( !_configuration.isUseNativeUI() ) {
1151 getDynamicallyHideData().setForeground( getConfiguration().getGuiCheckboxAndButtonActiveColor() );
1154 if ( !_configuration.isUseNativeUI() ) {
1155 getDynamicallyHideData().setForeground( getConfiguration().getGuiButtonTextColor() );
1158 getDynamicallyHideData().setForeground( Color.BLACK );
1164 void setSearchFoundCountsOnLabel( final int counts ) {
1165 getSearchFoundCountsLabel().setText( "Found: " + counts );
1168 void setShowEvents( final boolean show_events ) {
1169 if ( getShowEventsCb() == null ) {
1170 _show_events = new JCheckBox( "" );
1172 getShowEventsCb().setSelected( show_events );
1175 void setSpeciesColors( final Map<String, Color> species_colors ) {
1176 _species_colors = species_colors;
1181 * Set up the controls from the config settings. 11/26/05
1183 void setupControls() {
1184 // The tree display options:
1185 setupDisplayCheckboxes();
1187 // The sequence relation query selection combo-box
1188 if ( _configuration.displaySequenceRelations() ) {
1189 addSequenceRelationBlock();
1193 startClickToOptions();
1194 setupClickToOptions();
1195 endClickToOptions();
1196 // Zoom and quick edit buttons
1201 void setUpControlsForDomainStrucures() {
1202 _domain_display_label = new JLabel( "Domain Display:" );
1203 add( customizeLabel( _domain_display_label, getConfiguration() ) );
1204 add( _domain_display_label );
1205 _zoom_in_domain_structure = new JButton( "d+" );
1206 _zoom_out_domain_structure = new JButton( "d-" );
1207 _decr_domain_structure_evalue_thr = new JButton( "-" );
1208 _incr_domain_structure_evalue_thr = new JButton( "+" );
1209 _zoom_in_domain_structure.setPreferredSize( new Dimension( 10, 10 ) );
1210 _zoom_out_domain_structure.setPreferredSize( new Dimension( 10, 10 ) );
1211 _decr_domain_structure_evalue_thr.setPreferredSize( new Dimension( 10, 10 ) );
1212 _incr_domain_structure_evalue_thr.setPreferredSize( new Dimension( 10, 10 ) );
1213 _incr_domain_structure_evalue_thr.setToolTipText( "Increase the E-value threshold by a factor of 10" );
1214 _decr_domain_structure_evalue_thr.setToolTipText( "Decrease the E-value threshold by a factor of 10" );
1215 _domain_structure_evalue_thr_tf = new JTextField( 3 );
1216 _domain_structure_evalue_thr_tf.setEditable( false );
1217 if ( !getConfiguration().isUseNativeUI() ) {
1218 _domain_structure_evalue_thr_tf.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
1219 _domain_structure_evalue_thr_tf.setBackground( getConfiguration().getGuiCheckboxTextColor() );
1220 _domain_structure_evalue_thr_tf.setBorder( null );
1222 final JPanel d1_panel = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
1223 final JPanel d2_panel = new JPanel( new GridLayout( 1, 3, 0, 0 ) );
1224 if ( !_configuration.isUseNativeUI() ) {
1225 d1_panel.setBackground( getBackground() );
1226 d2_panel.setBackground( getBackground() );
1230 addJButton( _zoom_out_domain_structure, d1_panel );
1231 addJButton( _zoom_in_domain_structure, d1_panel );
1232 addJButton( _decr_domain_structure_evalue_thr, d2_panel );
1233 addJTextField( _domain_structure_evalue_thr_tf, d2_panel );
1234 addJButton( _incr_domain_structure_evalue_thr, d2_panel );
1237 void setupSearchTools() {
1238 final String tip = "Enter text to search for. Use ',' for multiple searches (logical OR) and '+' for logical AND.";
1239 final JLabel search_label = new JLabel( "Search:" );
1240 search_label.setFont( ControlPanel.jcb_bold_font );
1241 if ( !getConfiguration().isUseNativeUI() ) {
1242 search_label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1244 add( search_label );
1245 search_label.setToolTipText( tip );
1246 _search_found_label = new JLabel();
1247 getSearchFoundCountsLabel().setVisible( false );
1248 _search_found_label.setFont( ControlPanel.jcb_bold_font );
1249 if ( !getConfiguration().isUseNativeUI() ) {
1250 _search_found_label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1252 _search_tf = new JTextField( 3 );
1253 _search_tf.setToolTipText( tip );
1254 _search_tf.setEditable( true );
1255 if ( !getConfiguration().isUseNativeUI() ) {
1256 _search_tf.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
1257 _search_tf.setBackground( getConfiguration().getGuiCheckboxTextColor() );
1258 _search_tf.setBorder( null );
1260 _search_reset_button = new JButton();
1261 getSearchResetButton().setText( "Reset" );
1262 getSearchResetButton().setEnabled( false );
1263 getSearchResetButton().setVisible( false );
1264 final JPanel s_panel_1 = new JPanel( new BorderLayout() );
1265 final JPanel s_panel_2 = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
1266 s_panel_1.setBackground( getBackground() );
1268 s_panel_2.setBackground( getBackground() );
1270 final KeyAdapter key_adapter = new KeyAdapter() {
1273 public void keyReleased( final KeyEvent key_event ) {
1275 displayedPhylogenyMightHaveChanged( true );
1278 final ActionListener action_listener = new ActionListener() {
1281 public void actionPerformed( final ActionEvent e ) {
1283 setSearchFoundCountsOnLabel( 0 );
1284 getSearchFoundCountsLabel().setVisible( false );
1285 getSearchTextField().setText( "" );
1286 getSearchResetButton().setEnabled( false );
1287 getSearchResetButton().setVisible( false );
1288 displayedPhylogenyMightHaveChanged( true );
1291 _search_reset_button.addActionListener( action_listener );
1292 _search_tf.addKeyListener( key_adapter );
1293 addJTextField( _search_tf, s_panel_1 );
1294 s_panel_2.add( _search_found_label );
1295 addJButton( _search_reset_button, s_panel_2 );
1298 void showAnnotations() {
1299 if ( _show_annotation != null ) {
1300 _show_annotation.setSelected( true );
1302 if ( _color_according_to_annotation != null ) {
1303 _color_according_to_annotation.setSelected( true );
1305 if ( _color_acc_species != null ) {
1306 _color_acc_species.setSelected( false );
1308 _mainpanel.getCurrentTreePanel().repaint();
1312 * Fit entire tree into window.
1315 if ( ( _mainpanel.getCurrentScrollPane() == null ) || _mainpanel.getCurrentTreePanel().getPhylogeny().isEmpty() ) {
1318 getCurrentTreePanel().updateSetOfCollapsedExternalNodes();
1319 displayedPhylogenyMightHaveChanged( true );
1320 _mainpanel.getCurrentTreePanel().updateOvSettings();
1321 _mainpanel.getCurrentTreePanel().validate();
1322 _mainpanel.validate();
1323 _mainpanel.getCurrentTreePanel().calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
1324 _mainpanel.getSizeOfViewport().height,
1326 _mainpanel.getCurrentTreePanel().resetPreferredSize();
1327 _mainpanel.adjustJScrollPane();
1328 _mainpanel.getCurrentTreePanel().repaint();
1329 _mainpanel.getCurrentTreePanel().validate();
1330 _mainpanel.validate();
1331 _mainpanel.getCurrentTreePanel().calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
1332 _mainpanel.getSizeOfViewport().height,
1334 _mainpanel.getCurrentTreePanel().resetPreferredSize();
1335 _mainpanel.adjustJScrollPane();
1336 _mainpanel.getCurrentTreePanel().repaint();
1337 _mainpanel.getCurrentTreePanel().updateOvSizes();
1340 void showWholeAll() {
1341 for( final TreePanel tree_panel : _mainpanel.getTreePanels() ) {
1342 if ( tree_panel != null ) {
1343 tree_panel.validate();
1344 tree_panel.calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
1345 _mainpanel.getSizeOfViewport().height,
1347 tree_panel.resetPreferredSize();
1348 tree_panel.repaint();
1353 // Create header for click-to combo box.
1354 void startClickToOptions() {
1355 final JLabel spacer = new JLabel( "" );
1356 spacer.setFont( ControlPanel.jcb_font );
1358 _click_to_label = new JLabel( "Click on Node to:" );
1359 add( customizeLabel( _click_to_label, getConfiguration() ) );
1360 _click_to_combobox = new JComboBox();
1361 _click_to_combobox.setFocusable( false );
1362 _click_to_combobox.setMaximumRowCount( 14 );
1363 _click_to_combobox.setFont( ControlPanel.js_font );
1364 if ( !_configuration.isUseNativeUI() ) {
1365 _click_to_combobox.setBackground( getConfiguration().getGuiBackgroundColor() );
1367 // don't add listener until all items are set (or each one will trigger
1369 // click_to_list.addActionListener(this);
1370 add( _click_to_combobox );
1371 // Correlates option names to titles
1372 _all_click_to_names = new HashMap<Integer, String>();
1373 _click_to_names = new ArrayList<String>();
1377 if ( getMainPanel().getTabbedPane().getTabCount() > 0 ) {
1378 if ( getCurrentTreePanel().isPhyHasBranchLengths()
1379 && ( getCurrentTreePanel().getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) {
1380 setDrawPhylogramEnabled( true );
1381 setDrawPhylogram( isDrawPhylogram() );
1384 setDrawPhylogramEnabled( false );
1385 setDrawPhylogram( false );
1387 if ( getMainPanel().getMainFrame() == null ) {
1388 // Must be "E" applet version.
1389 final ArchaeopteryxE e = ( ArchaeopteryxE ) ( ( MainPanelApplets ) getMainPanel() ).getApplet();
1390 e.setSelectedTypeInTypeMenu( e.getCurrentTreePanel().getPhylogenyGraphicsType() );
1393 getMainPanel().getMainFrame().setSelectedTypeInTypeMenu( getMainPanel().getCurrentTreePanel()
1394 .getPhylogenyGraphicsType() );
1396 getMainPanel().getCurrentTreePanel().updateSubSuperTreeButton();
1397 getMainPanel().getControlPanel().search();
1398 getMainPanel().getControlPanel().updateDomainStructureEvaluethresholdDisplay();
1399 getSequenceRelationTypeBox().removeAllItems();
1400 for( final SequenceRelation.SEQUENCE_RELATION_TYPE type : getMainPanel().getCurrentPhylogeny()
1401 .getRelevantSequenceRelationTypes() ) {
1402 _sequence_relation_type_box.addItem( type );
1404 getMainPanel().getCurrentTreePanel().repaint();
1405 //setSequenceRelationQueries( getMainPanel().getCurrentPhylogeny().getSequenceRelationQueries() );
1406 // according to GUILHEM the line above can be removed.
1411 * Uncollapse all nodes.
1413 void uncollapseAll( final TreePanel tp ) {
1414 final Phylogeny t = tp.getPhylogeny();
1415 if ( ( t != null ) && !t.isEmpty() ) {
1416 for( final PhylogenyNodeIterator iter = t.iteratorPreorder(); iter.hasNext(); ) {
1417 final PhylogenyNode node = iter.next();
1418 node.setCollapse( false );
1420 tp.resetNodeIdToDistToLeafMap();
1421 tp.updateSetOfCollapsedExternalNodes();
1422 t.recalculateNumberOfExternalDescendants( false );
1423 tp.setNodeInPreorderToNull();
1424 t.clearHashIdToNodeMap();
1429 void updateDomainStructureEvaluethresholdDisplay() {
1430 if ( _domain_structure_evalue_thr_tf != null ) {
1431 _domain_structure_evalue_thr_tf.setText( "10^"
1432 + getMainPanel().getCurrentTreePanel().getDomainStructureEvalueThreshold() );
1436 void zoomInX( final float factor, final float x_correction_factor ) {
1437 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar();
1438 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1439 treepanel.multiplyUrtFactor( 1f );
1440 if ( ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
1441 || ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
1442 || isDrawPhylogram( getMainPanel().getCurrentTabIndex() )
1443 || ( getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP ) ) {
1444 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1445 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
1446 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
1447 getMainPanel().adjustJScrollPane();
1448 treepanel.resetPreferredSize();
1449 getMainPanel().getCurrentScrollPane().getViewport().validate();
1450 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1451 - ( sb.getVisibleAmount() / 2.0 ) ) );
1454 final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue();
1455 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
1456 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
1457 getMainPanel().adjustJScrollPane();
1458 treepanel.resetPreferredSize();
1459 getMainPanel().getCurrentScrollPane().getViewport().validate();
1460 sb.setValue( sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount() );
1462 treepanel.resetPreferredSize();
1463 treepanel.updateOvSizes();
1466 void zoomInY( final float factor ) {
1467 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getVerticalScrollBar();
1468 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1469 treepanel.multiplyUrtFactor( 1.1f );
1470 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1471 treepanel.setYdistance( ( treepanel.getYdistance() * factor ) );
1472 getMainPanel().adjustJScrollPane();
1473 treepanel.resetPreferredSize();
1474 getMainPanel().getCurrentScrollPane().getViewport().validate();
1475 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1476 - ( sb.getVisibleAmount() / 2.0 ) ) );
1477 treepanel.resetPreferredSize();
1478 treepanel.updateOvSizes();
1481 void zoomOutX( final float factor, final float x_correction_factor ) {
1482 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1483 treepanel.multiplyUrtFactor( 1f );
1484 if ( ( treepanel.getXdistance() * factor ) > 0.0 ) {
1485 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar();
1486 if ( ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
1487 || ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
1488 || isDrawPhylogram( getMainPanel().getCurrentTabIndex() )
1489 || ( getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP ) ) {
1490 getMainPanel().adjustJScrollPane();
1491 treepanel.resetPreferredSize();
1492 getMainPanel().getCurrentScrollPane().getViewport().validate();
1493 final double x = ( sb.getMaximum() - sb.getMinimum() )
1494 / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1495 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
1496 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
1497 getMainPanel().adjustJScrollPane();
1498 treepanel.resetPreferredSize();
1499 getMainPanel().getCurrentScrollPane().getViewport().validate();
1500 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1501 - ( sb.getVisibleAmount() / 2.0 ) ) );
1504 final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue();
1505 treepanel.setXdistance( treepanel.getXdistance() * factor );
1506 treepanel.setXcorrectionFactor( treepanel.getXcorrectionFactor() * x_correction_factor );
1508 getMainPanel().adjustJScrollPane();
1509 treepanel.resetPreferredSize();
1510 getMainPanel().getCurrentScrollPane().getViewport().validate();
1511 sb.setValue( sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount() );
1514 treepanel.resetPreferredSize();
1515 treepanel.updateOvSizes();
1519 void zoomOutY( final float factor ) {
1520 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
1521 treepanel.multiplyUrtFactor( 0.9f );
1522 if ( ( treepanel.getYdistance() * factor ) > 0.0 ) {
1523 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getVerticalScrollBar();
1524 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
1525 treepanel.setYdistance( ( treepanel.getYdistance() * factor ) );
1526 getMainPanel().adjustJScrollPane();
1527 treepanel.resetPreferredSize();
1528 getMainPanel().getCurrentScrollPane().getViewport().validate();
1529 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
1530 - ( sb.getVisibleAmount() / 2.0 ) ) );
1531 treepanel.resetPreferredSize();
1532 treepanel.updateOvSizes();
1536 private void addClickToOption( final int which, final String title ) {
1537 _click_to_combobox.addItem( title );
1538 _click_to_names.add( title );
1539 _all_click_to_names.put( new Integer( which ), title );
1540 if ( !_configuration.isUseNativeUI() ) {
1541 _click_to_combobox.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
1542 _click_to_combobox.setForeground( getConfiguration().getGuiButtonTextColor() );
1547 private void addSequenceRelationBlock() {
1548 final JLabel spacer = new JLabel( "" );
1549 spacer.setSize( 1, 1 );
1551 final JLabel mainLabel = new JLabel( "Sequence relations to display" );
1552 final JLabel typeLabel = customizeLabel( new JLabel( "(type) " ), getConfiguration() );
1553 typeLabel.setFont( ControlPanel.js_font.deriveFont( 7 ) );
1554 getSequenceRelationTypeBox().setFocusable( false );
1555 _sequence_relation_type_box.setFont( ControlPanel.js_font );
1556 if ( !_configuration.isUseNativeUI() ) {
1557 _sequence_relation_type_box.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
1558 _sequence_relation_type_box.setForeground( getConfiguration().getGuiButtonTextColor() );
1560 _sequence_relation_type_box.setRenderer( new ListCellRenderer() {
1563 public Component getListCellRendererComponent( final JList list,
1566 final boolean isSelected,
1567 final boolean cellHasFocus ) {
1568 final Component component = new DefaultListCellRenderer().getListCellRendererComponent( list,
1573 if ( ( value != null ) && ( value instanceof SequenceRelation.SEQUENCE_RELATION_TYPE ) ) {
1574 ( ( DefaultListCellRenderer ) component ).setText( SequenceRelation
1575 .getPrintableNameByType( ( SequenceRelation.SEQUENCE_RELATION_TYPE ) value ) );
1580 final GridBagLayout gbl = new GridBagLayout();
1581 _sequence_relation_type_box.setMinimumSize( new Dimension( 115, 17 ) );
1582 _sequence_relation_type_box.setPreferredSize( new Dimension( 115, 20 ) );
1583 final JPanel horizGrid = new JPanel( gbl );
1584 horizGrid.setBackground( getBackground() );
1585 horizGrid.add( typeLabel );
1586 horizGrid.add( _sequence_relation_type_box );
1587 add( customizeLabel( mainLabel, getConfiguration() ) );
1589 add( getSequenceRelationBox() );
1590 if ( _configuration.doDisplayOption( Configuration.show_relation_confidence ) ) {
1591 addCheckbox( Configuration.show_relation_confidence,
1592 _configuration.getDisplayTitle( Configuration.show_relation_confidence ) );
1593 setCheckbox( Configuration.show_relation_confidence,
1594 _configuration.doCheckOption( Configuration.show_relation_confidence ) );
1596 }// addSequenceRelationBlock
1599 private List<Boolean> getIsDrawPhylogramList() {
1600 return _draw_phylogram;
1603 private void init() {
1604 _draw_phylogram = new ArrayList<Boolean>();
1605 setSpeciesColors( new HashMap<String, Color>() );
1606 setAnnotationColors( new HashMap<String, Color>() );
1609 private boolean isDrawPhylogram( final int index ) {
1610 return getIsDrawPhylogramList().get( index );
1613 private void search( final MainPanel main_panel, final Phylogeny tree, final String query_str ) {
1614 getSearchFoundCountsLabel().setVisible( true );
1615 getSearchResetButton().setEnabled( true );
1616 getSearchResetButton().setVisible( true );
1617 String[] queries = null;
1618 List<PhylogenyNode> nodes = null;
1619 if ( query_str.indexOf( ',' ) >= 0 ) {
1620 queries = query_str.split( ",+" );
1623 queries = new String[ 1 ];
1624 queries[ 0 ] = query_str.trim();
1626 if ( ( queries != null ) && ( queries.length > 0 ) ) {
1627 nodes = new ArrayList<PhylogenyNode>();
1628 for( String query : queries ) {
1629 if ( ForesterUtil.isEmpty( query ) ) {
1632 query = query.trim();
1633 if ( query.indexOf( '+' ) >= 0 ) {
1634 nodes.addAll( PhylogenyMethods.searchDataLogicalAnd( query.split( "\\++" ),
1636 getOptions().isSearchCaseSensitive(),
1637 !getOptions().isMatchWholeTermsOnly(),
1638 isShowDomainArchitectures() ) );
1641 nodes.addAll( PhylogenyMethods.searchData( query,
1643 getOptions().isSearchCaseSensitive(),
1644 !getOptions().isMatchWholeTermsOnly(),
1645 isShowDomainArchitectures() ) );
1648 if ( getOptions().isInverseSearchResult() ) {
1649 final List<PhylogenyNode> all = PhylogenyMethods.obtainAllNodesAsList( tree );
1650 all.removeAll( nodes );
1654 if ( ( nodes != null ) && ( nodes.size() > 0 ) ) {
1655 main_panel.getCurrentTreePanel().setFoundNodes( new HashSet<Long>() );
1656 for( final PhylogenyNode node : nodes ) {
1657 main_panel.getCurrentTreePanel().getFoundNodes().add( node.getId() );
1659 setSearchFoundCountsOnLabel( nodes.size() );
1662 setSearchFoundCountsOnLabel( 0 );
1667 private void setDrawPhylogram( final int index, final boolean b ) {
1668 getIsDrawPhylogramList().set( index, b );
1671 private void setupClickToOptions() {
1672 final int default_option = _configuration.getDefaultDisplayClicktoOption();
1673 int selected_index = 0;
1675 if ( _configuration.doDisplayClickToOption( Configuration.display_node_data ) ) {
1676 _show_data_item = cb_index;
1677 addClickToOption( Configuration.display_node_data,
1678 _configuration.getClickToTitle( Configuration.display_node_data ) );
1679 if ( default_option == Configuration.display_node_data ) {
1680 selected_index = cb_index;
1684 if ( _configuration.doDisplayClickToOption( Configuration.collapse_uncollapse ) ) {
1685 _collapse_cb_item = cb_index;
1686 addClickToOption( Configuration.collapse_uncollapse,
1687 _configuration.getClickToTitle( Configuration.collapse_uncollapse ) );
1688 if ( default_option == Configuration.collapse_uncollapse ) {
1689 selected_index = cb_index;
1693 if ( _configuration.doDisplayClickToOption( Configuration.reroot ) ) {
1694 _reroot_cb_item = cb_index;
1695 addClickToOption( Configuration.reroot, _configuration.getClickToTitle( Configuration.reroot ) );
1696 if ( default_option == Configuration.reroot ) {
1697 selected_index = cb_index;
1701 if ( _configuration.doDisplayClickToOption( Configuration.subtree ) ) {
1702 _subtree_cb_item = cb_index;
1703 addClickToOption( Configuration.subtree, _configuration.getClickToTitle( Configuration.subtree ) );
1704 if ( default_option == Configuration.subtree ) {
1705 selected_index = cb_index;
1709 if ( _configuration.doDisplayClickToOption( Configuration.swap ) ) {
1710 _swap_cb_item = cb_index;
1711 addClickToOption( Configuration.swap, _configuration.getClickToTitle( Configuration.swap ) );
1712 if ( default_option == Configuration.swap ) {
1713 selected_index = cb_index;
1717 if ( _configuration.doDisplayClickToOption( Configuration.sort_descendents ) ) {
1718 _sort_descendents_item = cb_index;
1719 addClickToOption( Configuration.sort_descendents,
1720 _configuration.getClickToTitle( Configuration.sort_descendents ) );
1721 if ( default_option == Configuration.sort_descendents ) {
1722 selected_index = cb_index;
1726 if ( _configuration.doDisplayClickToOption( Configuration.color_subtree ) ) {
1727 _color_subtree_cb_item = cb_index;
1728 addClickToOption( Configuration.color_subtree, _configuration.getClickToTitle( Configuration.color_subtree ) );
1729 if ( default_option == Configuration.color_subtree ) {
1730 selected_index = cb_index;
1734 if ( _configuration.doDisplayClickToOption( Configuration.open_seq_web ) ) {
1735 _open_seq_web_item = cb_index;
1736 addClickToOption( Configuration.open_seq_web, _configuration.getClickToTitle( Configuration.open_seq_web ) );
1737 if ( default_option == Configuration.open_seq_web ) {
1738 selected_index = cb_index;
1742 if ( _configuration.doDisplayClickToOption( Configuration.open_pdb_web ) ) {
1743 _open_pdb_item = cb_index;
1744 addClickToOption( Configuration.open_pdb_web, _configuration.getClickToTitle( Configuration.open_pdb_web ) );
1745 if ( default_option == Configuration.open_pdb_web ) {
1746 selected_index = cb_index;
1750 if ( _configuration.doDisplayClickToOption( Configuration.open_tax_web ) ) {
1751 _open_tax_web_item = cb_index;
1752 addClickToOption( Configuration.open_tax_web, _configuration.getClickToTitle( Configuration.open_tax_web ) );
1753 if ( default_option == Configuration.open_tax_web ) {
1754 selected_index = cb_index;
1758 if ( _configuration.doDisplayClickToOption( Configuration.blast ) ) {
1759 _blast_item = cb_index;
1760 addClickToOption( Configuration.blast, _configuration.getClickToTitle( Configuration.blast ) );
1761 if ( default_option == Configuration.blast ) {
1762 selected_index = cb_index;
1766 if ( _configuration.doDisplayClickToOption( Configuration.select_nodes ) ) {
1767 _select_nodes_item = cb_index;
1768 addClickToOption( Configuration.select_nodes, _configuration.getClickToTitle( Configuration.select_nodes ) );
1769 if ( default_option == Configuration.select_nodes ) {
1770 selected_index = cb_index;
1774 if ( _configuration.doDisplayClickToOption( Configuration.get_ext_desc_data ) ) {
1775 _get_ext_desc_data = cb_index;
1776 if ( !ForesterUtil.isEmpty( getConfiguration().getLabelForGetExtDescendentsData() ) ) {
1777 addClickToOption( Configuration.get_ext_desc_data, getConfiguration()
1778 .getLabelForGetExtDescendentsData() );
1782 switch ( getConfiguration().getExtDescNodeDataToReturn() ) {
1787 s = "Sequence Accessors";
1789 case SEQUENCE_MOL_SEQ:
1790 s = "Molecular Sequence";
1792 case SEQUENCE_MOL_SEQ_FASTA:
1793 s = "Molecular Sequence (Fasta)";
1796 s = "Sequence Names";
1801 case SEQUENCE_SYMBOL:
1802 s = "Sequence Symbols";
1805 s = "Taxonomy Codes";
1807 case TAXONOMY_COMM0N_NAME:
1808 s = "Taxonomy Common Names";
1810 case TAXONOMY_SCIENTIFIC_NAME:
1811 s = "Scientific Names";
1814 s = "User Selected Data";
1817 final String label = _configuration.getClickToTitle( Configuration.get_ext_desc_data ) + " " + s;
1818 addClickToOption( Configuration.get_ext_desc_data, label );
1820 if ( default_option == Configuration.get_ext_desc_data ) {
1821 selected_index = cb_index;
1825 if ( getOptions().isEditable() ) {
1826 if ( _configuration.doDisplayClickToOption( Configuration.cut_subtree ) ) {
1827 _cut_subtree_item = cb_index;
1828 addClickToOption( Configuration.cut_subtree, _configuration.getClickToTitle( Configuration.cut_subtree ) );
1829 if ( default_option == Configuration.cut_subtree ) {
1830 selected_index = cb_index;
1834 if ( _configuration.doDisplayClickToOption( Configuration.copy_subtree ) ) {
1835 _copy_subtree_item = cb_index;
1836 addClickToOption( Configuration.copy_subtree,
1837 _configuration.getClickToTitle( Configuration.copy_subtree ) );
1838 if ( default_option == Configuration.copy_subtree ) {
1839 selected_index = cb_index;
1843 if ( _configuration.doDisplayClickToOption( Configuration.paste_subtree ) ) {
1844 _paste_subtree_item = cb_index;
1845 addClickToOption( Configuration.paste_subtree,
1846 _configuration.getClickToTitle( Configuration.paste_subtree ) );
1847 if ( default_option == Configuration.paste_subtree ) {
1848 selected_index = cb_index;
1852 if ( _configuration.doDisplayClickToOption( Configuration.delete_subtree_or_node ) ) {
1853 _delete_node_or_subtree_item = cb_index;
1854 addClickToOption( Configuration.delete_subtree_or_node,
1855 _configuration.getClickToTitle( Configuration.delete_subtree_or_node ) );
1856 if ( default_option == Configuration.delete_subtree_or_node ) {
1857 selected_index = cb_index;
1861 if ( _configuration.doDisplayClickToOption( Configuration.add_new_node ) ) {
1862 _add_new_node_item = cb_index;
1863 addClickToOption( Configuration.add_new_node,
1864 _configuration.getClickToTitle( Configuration.add_new_node ) );
1865 if ( default_option == Configuration.add_new_node ) {
1866 selected_index = cb_index;
1870 if ( _configuration.doDisplayClickToOption( Configuration.edit_node_data ) ) {
1871 _edit_node_data_item = cb_index;
1872 addClickToOption( Configuration.edit_node_data,
1873 _configuration.getClickToTitle( Configuration.edit_node_data ) );
1874 if ( default_option == Configuration.edit_node_data ) {
1875 selected_index = cb_index;
1880 // Set default selection and its action
1881 _click_to_combobox.setSelectedIndex( selected_index );
1882 setClickToAction( selected_index );
1885 private void setupDisplayCheckboxes() {
1886 if ( _configuration.doDisplayOption( Configuration.display_as_phylogram ) ) {
1887 addCheckbox( Configuration.display_as_phylogram,
1888 _configuration.getDisplayTitle( Configuration.display_as_phylogram ) );
1889 setCheckbox( Configuration.display_as_phylogram,
1890 _configuration.doCheckOption( Configuration.display_as_phylogram ) );
1892 if ( _configuration.doDisplayOption( Configuration.dynamically_hide_data ) ) {
1893 addCheckbox( Configuration.dynamically_hide_data,
1894 _configuration.getDisplayTitle( Configuration.dynamically_hide_data ) );
1895 setCheckbox( Configuration.dynamically_hide_data,
1896 _configuration.doCheckOption( Configuration.dynamically_hide_data ) );
1898 if ( _configuration.doDisplayOption( Configuration.node_data_popup ) ) {
1899 addCheckbox( Configuration.node_data_popup, _configuration.getDisplayTitle( Configuration.node_data_popup ) );
1900 setCheckbox( Configuration.node_data_popup, _configuration.doCheckOption( Configuration.node_data_popup ) );
1902 if ( _configuration.doDisplayOption( Configuration.display_internal_data ) ) {
1903 addCheckbox( Configuration.display_internal_data,
1904 _configuration.getDisplayTitle( Configuration.display_internal_data ) );
1905 setCheckbox( Configuration.display_internal_data,
1906 _configuration.doCheckOption( Configuration.display_internal_data ) );
1908 if ( _configuration.doDisplayOption( Configuration.color_according_to_species ) ) {
1909 addCheckbox( Configuration.color_according_to_species,
1910 _configuration.getDisplayTitle( Configuration.color_according_to_species ) );
1911 setCheckbox( Configuration.color_according_to_species,
1912 _configuration.doCheckOption( Configuration.color_according_to_species ) );
1914 if ( _configuration.doDisplayOption( Configuration.color_according_to_annotation ) ) {
1915 addCheckbox( Configuration.color_according_to_annotation,
1916 _configuration.getDisplayTitle( Configuration.color_according_to_annotation ) );
1917 setCheckbox( Configuration.color_according_to_annotation,
1918 _configuration.doCheckOption( Configuration.color_according_to_annotation ) );
1920 if ( _configuration.doDisplayOption( Configuration.color_branches ) ) {
1921 addCheckbox( Configuration.color_branches, _configuration.getDisplayTitle( Configuration.color_branches ) );
1922 setCheckbox( Configuration.color_branches, _configuration.doCheckOption( Configuration.color_branches ) );
1924 if ( _configuration.doDisplayOption( Configuration.width_branches ) ) {
1925 addCheckbox( Configuration.width_branches, _configuration.getDisplayTitle( Configuration.width_branches ) );
1926 setCheckbox( Configuration.width_branches, _configuration.doCheckOption( Configuration.width_branches ) );
1928 final JLabel label = new JLabel( "Display Data:" );
1929 label.setFont( ControlPanel.jcb_bold_font );
1930 if ( !getConfiguration().isUseNativeUI() ) {
1931 label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1934 if ( _configuration.doDisplayOption( Configuration.show_node_names ) ) {
1935 addCheckbox( Configuration.show_node_names, _configuration.getDisplayTitle( Configuration.show_node_names ) );
1936 setCheckbox( Configuration.show_node_names, _configuration.doCheckOption( Configuration.show_node_names ) );
1938 if ( _configuration.doDisplayOption( Configuration.show_tax_code ) ) {
1939 addCheckbox( Configuration.show_tax_code, _configuration.getDisplayTitle( Configuration.show_tax_code ) );
1940 setCheckbox( Configuration.show_tax_code, _configuration.doCheckOption( Configuration.show_tax_code ) );
1942 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_scientific_names ) ) {
1943 addCheckbox( Configuration.show_taxonomy_scientific_names,
1944 _configuration.getDisplayTitle( Configuration.show_taxonomy_scientific_names ) );
1945 setCheckbox( Configuration.show_taxonomy_scientific_names,
1946 _configuration.doCheckOption( Configuration.show_taxonomy_scientific_names ) );
1948 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_common_names ) ) {
1949 addCheckbox( Configuration.show_taxonomy_common_names,
1950 _configuration.getDisplayTitle( Configuration.show_taxonomy_common_names ) );
1951 setCheckbox( Configuration.show_taxonomy_common_names,
1952 _configuration.doCheckOption( Configuration.show_taxonomy_common_names ) );
1954 if ( _configuration.doDisplayOption( Configuration.show_seq_names ) ) {
1955 addCheckbox( Configuration.show_seq_names, _configuration.getDisplayTitle( Configuration.show_seq_names ) );
1956 setCheckbox( Configuration.show_seq_names, _configuration.doCheckOption( Configuration.show_seq_names ) );
1958 if ( _configuration.doDisplayOption( Configuration.show_gene_names ) ) {
1959 addCheckbox( Configuration.show_gene_names, _configuration.getDisplayTitle( Configuration.show_gene_names ) );
1960 setCheckbox( Configuration.show_gene_names, _configuration.doCheckOption( Configuration.show_gene_names ) );
1962 if ( _configuration.doDisplayOption( Configuration.show_seq_symbols ) ) {
1963 addCheckbox( Configuration.show_seq_symbols,
1964 _configuration.getDisplayTitle( Configuration.show_seq_symbols ) );
1965 setCheckbox( Configuration.show_seq_symbols, _configuration.doCheckOption( Configuration.show_seq_symbols ) );
1967 if ( _configuration.doDisplayOption( Configuration.show_sequence_acc ) ) {
1968 addCheckbox( Configuration.show_sequence_acc,
1969 _configuration.getDisplayTitle( Configuration.show_sequence_acc ) );
1970 setCheckbox( Configuration.show_sequence_acc,
1971 _configuration.doCheckOption( Configuration.show_sequence_acc ) );
1973 if ( _configuration.doDisplayOption( Configuration.show_annotation ) ) {
1974 addCheckbox( Configuration.show_annotation, _configuration.getDisplayTitle( Configuration.show_annotation ) );
1975 setCheckbox( Configuration.show_annotation, _configuration.doCheckOption( Configuration.show_annotation ) );
1977 if ( _configuration.doDisplayOption( Configuration.show_binary_characters ) ) {
1978 addCheckbox( Configuration.show_binary_characters,
1979 _configuration.getDisplayTitle( Configuration.show_binary_characters ) );
1980 setCheckbox( Configuration.show_binary_characters,
1981 _configuration.doCheckOption( Configuration.show_binary_characters ) );
1983 if ( _configuration.doDisplayOption( Configuration.show_binary_character_counts ) ) {
1984 addCheckbox( Configuration.show_binary_character_counts,
1985 _configuration.getDisplayTitle( Configuration.show_binary_character_counts ) );
1986 setCheckbox( Configuration.show_binary_character_counts,
1987 _configuration.doCheckOption( Configuration.show_binary_character_counts ) );
1989 if ( _configuration.doDisplayOption( Configuration.show_domain_architectures ) ) {
1990 addCheckbox( Configuration.show_domain_architectures,
1991 _configuration.getDisplayTitle( Configuration.show_domain_architectures ) );
1992 setCheckbox( Configuration.show_domain_architectures,
1993 _configuration.doCheckOption( Configuration.show_domain_architectures ) );
1995 if ( _configuration.doDisplayOption( Configuration.write_confidence_values ) ) {
1996 addCheckbox( Configuration.write_confidence_values,
1997 _configuration.getDisplayTitle( Configuration.write_confidence_values ) );
1998 setCheckbox( Configuration.write_confidence_values,
1999 _configuration.doCheckOption( Configuration.write_confidence_values ) );
2001 if ( _configuration.doDisplayOption( Configuration.write_events ) ) {
2002 addCheckbox( Configuration.write_events, _configuration.getDisplayTitle( Configuration.write_events ) );
2003 setCheckbox( Configuration.write_events, _configuration.doCheckOption( Configuration.write_events ) );
2005 if ( _configuration.doDisplayOption( Configuration.show_vector_data ) ) {
2006 addCheckbox( Configuration.show_vector_data,
2007 _configuration.getDisplayTitle( Configuration.show_vector_data ) );
2008 setCheckbox( Configuration.show_vector_data, _configuration.doCheckOption( Configuration.show_vector_data ) );
2010 if ( _configuration.doDisplayOption( Configuration.show_properties ) ) {
2011 addCheckbox( Configuration.show_properties, _configuration.getDisplayTitle( Configuration.show_properties ) );
2012 setCheckbox( Configuration.show_properties, _configuration.doCheckOption( Configuration.show_properties ) );
2014 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_images ) ) {
2015 addCheckbox( Configuration.show_taxonomy_images,
2016 _configuration.getDisplayTitle( Configuration.show_taxonomy_images ) );
2017 setCheckbox( Configuration.show_taxonomy_images,
2018 _configuration.doCheckOption( Configuration.show_taxonomy_images ) );
2022 private void setVisibilityOfDomainStrucureControls() {
2023 if ( _zoom_in_domain_structure != null ) {
2024 if ( isShowDomainArchitectures() ) {
2025 _domain_display_label.setVisible( true );
2026 _zoom_in_domain_structure.setVisible( true );
2027 _zoom_out_domain_structure.setVisible( true );
2028 _decr_domain_structure_evalue_thr.setVisible( true );
2029 _incr_domain_structure_evalue_thr.setVisible( true );
2030 _domain_structure_evalue_thr_tf.setVisible( true );
2033 _domain_display_label.setVisible( false );
2034 _zoom_in_domain_structure.setVisible( false );
2035 _zoom_out_domain_structure.setVisible( false );
2036 _decr_domain_structure_evalue_thr.setVisible( false );
2037 _incr_domain_structure_evalue_thr.setVisible( false );
2038 _domain_structure_evalue_thr_tf.setVisible( false );
2043 static JLabel customizeLabel( final JLabel label, final Configuration configuration ) {
2044 label.setFont( ControlPanel.jcb_bold_font );
2045 if ( !configuration.isUseNativeUI() ) {
2046 label.setForeground( configuration.getGuiCheckboxTextColor() );
2047 label.setBackground( configuration.getGuiBackgroundColor() );
2052 enum NodeClickAction {
2059 DELETE_NODE_OR_SUBTREE,