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;
49 import javax.swing.BorderFactory;
50 import javax.swing.DefaultListCellRenderer;
51 import javax.swing.JButton;
52 import javax.swing.JCheckBox;
53 import javax.swing.JComboBox;
54 import javax.swing.JLabel;
55 import javax.swing.JList;
56 import javax.swing.JPanel;
57 import javax.swing.JScrollBar;
58 import javax.swing.JTextField;
59 import javax.swing.ListCellRenderer;
61 import org.forester.archaeopteryx.Options.CLADOGRAM_TYPE;
62 import org.forester.archaeopteryx.Options.PHYLOGENY_GRAPHICS_TYPE;
63 import org.forester.phylogeny.Phylogeny;
64 import org.forester.phylogeny.PhylogenyMethods;
65 import org.forester.phylogeny.PhylogenyMethods.DESCENDANT_SORT_PRIORITY;
66 import org.forester.phylogeny.PhylogenyNode;
67 import org.forester.phylogeny.data.Sequence;
68 import org.forester.phylogeny.data.SequenceRelation;
69 import org.forester.phylogeny.data.SequenceRelation.SEQUENCE_RELATION_TYPE;
70 import org.forester.phylogeny.iterators.PhylogenyNodeIterator;
71 import org.forester.util.ForesterUtil;
73 final class ControlPanel extends JPanel implements ActionListener {
75 enum NodeClickAction {
82 DELETE_NODE_OR_SUBTREE,
98 final static Font jcb_bold_font = new Font( Configuration.getDefaultFontFamilyName(),
101 final static Font jcb_font = new Font( Configuration.getDefaultFontFamilyName(),
104 final static Font js_font = new Font( Configuration.getDefaultFontFamilyName(),
107 private static final String RETURN_TO_SUPER_TREE_TEXT = "Back to Super Tree";
108 private static final String SEARCH_TIP_TEXT = "Enter text to search for. Use ',' for logical OR and '+' for logical AND (not used in this manner for regular expression searches).";
109 private static final long serialVersionUID = -8463483932821545633L;
110 private NodeClickAction _action_when_node_clicked;
111 private int _add_new_node_item;
112 private Map<Integer, String> _all_click_to_names;
113 private Map<String, Color> _annotation_colors;
114 private int _blast_item;
115 private JComboBox<String> _click_to_combobox;
116 private JLabel _click_to_label;
117 private List<String> _click_to_names;
118 private int _collapse_cb_item;
119 private JCheckBox _color_acc_species;
120 private JCheckBox _color_acc_sequence;
121 private JCheckBox _color_according_to_annotation;
122 private boolean _color_branches;
123 private JCheckBox _use_visual_styles_cb;
124 private int _color_subtree_cb_item;
125 private int _change_node_font_item;
126 // The settings from the conf file
127 private final Configuration _configuration;
128 private int _copy_subtree_item;
129 private int _cut_subtree_item;
130 private JButton _decr_domain_structure_evalue_thr;
131 private int _delete_node_or_subtree_item;
132 private JCheckBox _display_as_phylogram_cb;
134 private JCheckBox _display_internal_data;
135 private JLabel _domain_display_label;
136 private JTextField _domain_structure_evalue_thr_tf;
137 private List<Boolean> _draw_phylogram;
138 private JCheckBox _dynamically_hide_data;
139 private int _edit_node_data_item;
140 private int _get_ext_desc_data;
141 private JButton _incr_domain_structure_evalue_thr;
142 private final MainPanel _mainpanel;
143 private JCheckBox _node_desc_popup_cb;
144 private int _open_pdb_item;
145 private int _open_seq_web_item;
146 private int _open_tax_web_item;
147 private int _color_node_font_item;
148 private JButton _order;
149 private boolean _order_of_appearance;
150 private int _paste_subtree_item;
151 private int _reroot_cb_item;
152 private JButton _return_to_super_tree;
154 private JLabel _search_found_label_0;
155 private JLabel _search_found_label_1;
156 private JButton _search_reset_button_0;
157 private JButton _search_reset_button_1;
158 private JTextField _search_tf_0;
159 private JTextField _search_tf_1;
160 private int _select_nodes_item;
161 private Sequence _selected_query_seq;
162 private JCheckBox _seq_relation_confidence_switch;
163 private JComboBox<SEQUENCE_RELATION_TYPE> _sequence_relation_type_box;
164 private JCheckBox _show_annotation;
165 private JCheckBox _show_binary_character_counts;
166 private JCheckBox _show_binary_characters;
167 // Indices for the click-to options in the combo box
168 private int _show_data_item;
169 private JCheckBox _show_domain_architectures;
170 private JCheckBox _show_mol_seqs;
171 private JCheckBox _write_branch_length_values;
172 private JCheckBox _show_events;
173 private JCheckBox _show_gene_names;
174 private JCheckBox _show_node_names;
175 private JCheckBox _show_properties_cb;
176 private JCheckBox _show_seq_names;
177 private JCheckBox _show_seq_symbols;
178 private JCheckBox _show_sequence_acc;
179 private JComboBox<String> _show_sequence_relations;
180 private JCheckBox _show_taxo_code;
181 private JCheckBox _show_taxo_common_names;
182 private JCheckBox _show_taxo_images_cb;
183 private JCheckBox _show_taxo_scientific_names;
184 private JCheckBox _show_vector_data_cb;
185 private JButton _show_whole;
186 private int _sort_descendents_item;
187 private Map<String, Color> _species_colors;
188 private Map<String, Color> _sequence_colors;
189 private int _subtree_cb_item;
190 private int _swap_cb_item;
191 private JButton _uncollapse_all;
192 private JCheckBox _width_branches;
193 private JCheckBox _write_confidence;
194 private JButton _zoom_in_domain_structure;
195 private JButton _zoom_in_x;
196 private JButton _zoom_in_y;
197 private JLabel _zoom_label;
198 private JButton _zoom_out_domain_structure;
199 private JButton _zoom_out_x;
200 private JButton _zoom_out_y;
202 ControlPanel( final MainPanel ap, final Configuration configuration ) {
205 _configuration = configuration;
206 if ( !_configuration.isUseNativeUI() ) {
207 setBackground( getConfiguration().getGuiBackgroundColor() );
208 setBorder( BorderFactory.createRaisedBevelBorder() );
210 setLayout( new GridLayout( 0, 1, 2, 2 ) );
211 _order_of_appearance = true;
219 public void actionPerformed( final ActionEvent e ) {
221 if ( e.getSource() == _color_acc_sequence ) {
222 if ( _color_acc_species != null ) {
223 _color_acc_species.setSelected( false );
226 else if ( e.getSource() == _color_acc_species ) {
227 if ( _color_acc_sequence != null ) {
228 _color_acc_sequence.setSelected( false );
231 final TreePanel tp = getMainPanel().getCurrentTreePanel();
235 if ( e.getSource() == _click_to_combobox ) {
236 setClickToAction( _click_to_combobox.getSelectedIndex() );
237 getCurrentTreePanel().repaint();
239 else if ( e.getSource() == _show_binary_characters ) {
240 if ( ( _show_binary_character_counts != null ) && _show_binary_characters.isSelected() ) {
241 _show_binary_character_counts.setSelected( false );
243 displayedPhylogenyMightHaveChanged( true );
245 else if ( e.getSource() == _show_binary_character_counts ) {
246 if ( ( _show_binary_characters != null ) && _show_binary_character_counts.isSelected() ) {
247 _show_binary_characters.setSelected( false );
249 displayedPhylogenyMightHaveChanged( true );
251 else if ( e.getSource() == _show_domain_architectures ) {
254 displayedPhylogenyMightHaveChanged( true );
256 else if ( ( tp != null ) && ( tp.getPhylogeny() != null ) ) {
257 if ( e.getSource() == getDisplayAsPhylogramCb() ) {
258 setDrawPhylogram( getDisplayAsPhylogramCb().isSelected() );
262 else if ( e.getSource() == _zoom_in_x ) {
263 zoomInX( AptxConstants.BUTTON_ZOOM_IN_FACTOR, AptxConstants.BUTTON_ZOOM_IN_X_CORRECTION_FACTOR );
264 displayedPhylogenyMightHaveChanged( false );
266 else if ( e.getSource() == _zoom_in_y ) {
267 zoomInY( AptxConstants.BUTTON_ZOOM_IN_FACTOR );
268 displayedPhylogenyMightHaveChanged( false );
270 else if ( e.getSource() == _zoom_out_x ) {
271 zoomOutX( AptxConstants.BUTTON_ZOOM_OUT_FACTOR, AptxConstants.BUTTON_ZOOM_OUT_X_CORRECTION_FACTOR );
272 displayedPhylogenyMightHaveChanged( false );
274 else if ( e.getSource() == _zoom_out_y ) {
275 zoomOutY( AptxConstants.BUTTON_ZOOM_OUT_FACTOR );
276 displayedPhylogenyMightHaveChanged( false );
278 else if ( e.getSource() == _show_whole ) {
279 displayedPhylogenyMightHaveChanged( true );
282 else if ( e.getSource() == _return_to_super_tree ) {
283 _mainpanel.getCurrentTreePanel().superTree();
286 else if ( e.getSource() == _order ) {
287 DESCENDANT_SORT_PRIORITY pri = DESCENDANT_SORT_PRIORITY.NODE_NAME;
288 if ( isShowTaxonomyScientificNames() || isShowTaxonomyCode() ) {
289 pri = DESCENDANT_SORT_PRIORITY.TAXONOMY;
291 else if ( isShowSeqNames() || isShowSeqSymbols() || isShowGeneNames() ) {
292 pri = DESCENDANT_SORT_PRIORITY.SEQUENCE;
294 PhylogenyMethods.orderAppearance( tp.getPhylogeny().getRoot(), _order_of_appearance, true, pri );
295 _order_of_appearance = !_order_of_appearance;
296 tp.setNodeInPreorderToNull();
297 tp.getPhylogeny().externalNodesHaveChanged();
298 tp.getPhylogeny().clearHashIdToNodeMap();
299 tp.getPhylogeny().recalculateNumberOfExternalDescendants( true );
300 tp.resetNodeIdToDistToLeafMap();
301 tp.setEdited( true );
302 displayedPhylogenyMightHaveChanged( true );
304 else if ( e.getSource() == _uncollapse_all ) {
306 displayedPhylogenyMightHaveChanged( false );
308 else if ( e.getSource() == _zoom_in_domain_structure ) {
309 _mainpanel.getCurrentTreePanel().zoomInDomainStructure();
310 displayedPhylogenyMightHaveChanged( true );
312 else if ( e.getSource() == _zoom_out_domain_structure ) {
313 _mainpanel.getCurrentTreePanel().zoomOutDomainStructure();
314 displayedPhylogenyMightHaveChanged( true );
316 else if ( e.getSource() == _decr_domain_structure_evalue_thr ) {
317 _mainpanel.getCurrentTreePanel().decreaseDomainStructureEvalueThresholdExp();
320 displayedPhylogenyMightHaveChanged( true );
322 else if ( e.getSource() == _incr_domain_structure_evalue_thr ) {
323 _mainpanel.getCurrentTreePanel().increaseDomainStructureEvalueThresholdExp();
326 displayedPhylogenyMightHaveChanged( true );
328 else if ( e.getSource() == _search_tf_0 ) {
330 displayedPhylogenyMightHaveChanged( true );
332 else if ( e.getSource() == _search_tf_1 ) {
334 displayedPhylogenyMightHaveChanged( true );
336 else if ( ( _dynamically_hide_data != null ) && ( e.getSource() == _dynamically_hide_data )
337 && !_dynamically_hide_data.isSelected() ) {
338 setDynamicHidingIsOn( false );
339 displayedPhylogenyMightHaveChanged( true );
342 displayedPhylogenyMightHaveChanged( true );
346 tp.requestFocusInWindow();
349 catch ( final Exception ex ) {
350 AptxUtil.unexpectedException( ex );
352 catch ( final Error err ) {
353 AptxUtil.unexpectedError( err );
357 public JCheckBox getColorAccSequenceCb() {
358 return _color_acc_sequence;
361 public JCheckBox getColorAccSpeciesCb() {
362 return _color_acc_species;
365 public JCheckBox getDisplayAsPhylogramCb() {
366 return _display_as_phylogram_cb;
369 public JCheckBox getDynamicallyHideData() {
370 return _dynamically_hide_data;
373 public JCheckBox getNodeDescPopupCb() {
374 return _node_desc_popup_cb;
377 public Sequence getSelectedQuerySequence() {
378 return _selected_query_seq;
381 public JComboBox<String> getSequenceRelationBox() {
382 if ( _show_sequence_relations == null ) {
383 _show_sequence_relations = new JComboBox<String>();
384 _show_sequence_relations.setFocusable( false );
385 _show_sequence_relations.setMaximumRowCount( 20 );
386 _show_sequence_relations.setFont( ControlPanel.js_font );
387 if ( !_configuration.isUseNativeUI() ) {
388 _show_sequence_relations.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
389 _show_sequence_relations.setForeground( getConfiguration().getGuiButtonTextColor() );
391 _show_sequence_relations.addItem( "-----" );
392 _show_sequence_relations.setToolTipText( "To display orthology information for selected query" );
394 return _show_sequence_relations;
398 public JComboBox<SEQUENCE_RELATION_TYPE> getSequenceRelationTypeBox() {
399 if ( _sequence_relation_type_box == null ) {
400 _sequence_relation_type_box = new JComboBox<SEQUENCE_RELATION_TYPE>();
401 for( final SequenceRelation.SEQUENCE_RELATION_TYPE type : SequenceRelation.SEQUENCE_RELATION_TYPE.values() ) {
402 _sequence_relation_type_box.addItem( type );
404 _sequence_relation_type_box.addActionListener( new ActionListener() {
407 public void actionPerformed( final ActionEvent e ) {
408 if ( _mainpanel.getCurrentPhylogeny() != null ) {
409 setSequenceRelationQueries( getMainPanel().getCurrentPhylogeny().getSequenceRelationQueries() );
414 return _sequence_relation_type_box;
417 public JCheckBox getShowEventsCb() {
421 public JCheckBox getUseVisualStylesCb() {
422 return _use_visual_styles_cb;
425 public JCheckBox getWriteConfidenceCb() {
426 return _write_confidence;
429 public boolean isShowMolSequences() {
430 return ( ( _show_mol_seqs != null ) && _show_mol_seqs.isSelected() );
433 public boolean isShowProperties() {
434 return ( ( _show_properties_cb != null ) && _show_properties_cb.isSelected() );
437 public boolean isShowTaxonomyImages() {
438 return ( ( _show_taxo_images_cb != null ) && _show_taxo_images_cb.isSelected() );
441 public boolean isShowVectorData() {
442 return ( ( _show_vector_data_cb != null ) && _show_vector_data_cb.isSelected() );
445 public void setSequenceRelationQueries( final Collection<Sequence> sequenceRelationQueries ) {
446 final JComboBox<String> box = getSequenceRelationBox();
447 while ( box.getItemCount() > 1 ) {
448 box.removeItemAt( 1 );
450 final HashMap<String, Sequence> sequencesByName = new HashMap<String, Sequence>();
451 final SequenceRelation.SEQUENCE_RELATION_TYPE relationType = ( SequenceRelation.SEQUENCE_RELATION_TYPE ) _sequence_relation_type_box
453 if ( relationType == null ) {
456 final ArrayList<String> sequenceNamesToAdd = new ArrayList<String>();
457 for( final Sequence seq : sequenceRelationQueries ) {
458 if ( seq.hasSequenceRelations() ) {
459 boolean fFoundForCurrentType = false;
460 for( final SequenceRelation sq : seq.getSequenceRelations() ) {
461 if ( sq.getType().equals( relationType ) ) {
462 fFoundForCurrentType = true;
466 if ( fFoundForCurrentType ) {
467 sequenceNamesToAdd.add( seq.getName() );
468 sequencesByName.put( seq.getName(), seq );
472 // sort sequences by name before adding them to the combo
473 final String[] sequenceNameArray = sequenceNamesToAdd.toArray( new String[ sequenceNamesToAdd.size() ] );
474 Arrays.sort( sequenceNameArray, String.CASE_INSENSITIVE_ORDER );
475 for( final String seqName : sequenceNameArray ) {
476 box.addItem( seqName );
478 for( final ItemListener oldItemListener : box.getItemListeners() ) {
479 box.removeItemListener( oldItemListener );
481 box.addItemListener( new ItemListener() {
484 public void itemStateChanged( final ItemEvent e ) {
485 _selected_query_seq = sequencesByName.get( e.getItem() );
486 _mainpanel.getCurrentTreePanel().repaint();
491 private void addClickToOption( final int which, final String title ) {
492 _click_to_combobox.addItem( title );
493 _click_to_names.add( title );
494 _all_click_to_names.put( new Integer( which ), title );
495 if ( !_configuration.isUseNativeUI() ) {
496 _click_to_combobox.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
497 _click_to_combobox.setForeground( getConfiguration().getGuiButtonTextColor() );
502 private void addSequenceRelationBlock() {
503 final JLabel spacer = new JLabel( "" );
504 spacer.setSize( 1, 1 );
506 final JLabel mainLabel = new JLabel( "Sequence relations to display" );
507 final JLabel typeLabel = customizeLabel( new JLabel( "(type) " ), getConfiguration() );
508 typeLabel.setFont( ControlPanel.js_font.deriveFont( 7 ) );
509 getSequenceRelationTypeBox().setFocusable( false );
510 _sequence_relation_type_box.setFont( ControlPanel.js_font );
511 if ( !_configuration.isUseNativeUI() ) {
512 _sequence_relation_type_box.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
513 _sequence_relation_type_box.setForeground( getConfiguration().getGuiButtonTextColor() );
515 _sequence_relation_type_box.setRenderer( new ListCellRenderer<Object>() {
518 public Component getListCellRendererComponent( final JList<?> list,
521 final boolean isSelected,
522 final boolean cellHasFocus ) {
523 final Component component = new DefaultListCellRenderer().getListCellRendererComponent( list,
528 if ( ( value != null ) && ( value instanceof SequenceRelation.SEQUENCE_RELATION_TYPE ) ) {
529 ( ( DefaultListCellRenderer ) component ).setText( SequenceRelation
530 .getPrintableNameByType( ( SequenceRelation.SEQUENCE_RELATION_TYPE ) value ) );
535 final GridBagLayout gbl = new GridBagLayout();
536 _sequence_relation_type_box.setMinimumSize( new Dimension( 115, 17 ) );
537 _sequence_relation_type_box.setPreferredSize( new Dimension( 115, 20 ) );
538 final JPanel horizGrid = new JPanel( gbl );
539 horizGrid.setBackground( getBackground() );
540 horizGrid.add( typeLabel );
541 horizGrid.add( _sequence_relation_type_box );
542 add( customizeLabel( mainLabel, getConfiguration() ) );
544 add( getSequenceRelationBox() );
545 if ( _configuration.doDisplayOption( Configuration.show_relation_confidence ) ) {
546 addCheckbox( Configuration.show_relation_confidence,
547 _configuration.getDisplayTitle( Configuration.show_relation_confidence ) );
548 setCheckbox( Configuration.show_relation_confidence,
549 _configuration.doCheckOption( Configuration.show_relation_confidence ) );
551 }// addSequenceRelationBlock
555 private List<Boolean> getIsDrawPhylogramList() {
556 return _draw_phylogram;
559 // This takes care of ArchaeopteryxE-issue.
560 // Can, and will, return null prior to ArchaeopteryxE initialization completion.
561 final private MainFrame getMainFrame() {
562 MainFrame mf = getMainPanel().getMainFrame();
564 // Must be "E" applet version.
565 final ArchaeopteryxE e = ( ArchaeopteryxE ) ( ( MainPanelApplets ) getMainPanel() ).getApplet();
566 if ( e.getMainPanel() == null ) {
569 mf = e.getMainPanel().getMainFrame();
574 private void init() {
575 _draw_phylogram = new ArrayList<Boolean>();
576 setSpeciesColors( new HashMap<String, Color>() );
577 setSequenceColors( new HashMap<String, Color>() );
578 setAnnotationColors( new HashMap<String, Color>() );
581 private boolean isDrawPhylogram( final int index ) {
582 return getIsDrawPhylogramList().get( index );
585 private void search0( final MainPanel main_panel, final Phylogeny tree, final String query_str ) {
586 getSearchFoundCountsLabel0().setVisible( true );
587 getSearchResetButton0().setEnabled( true );
588 getSearchResetButton0().setVisible( true );
589 String[] queries = null;
590 Set<PhylogenyNode> nodes = null;
591 if ( ( query_str.indexOf( ',' ) >= 0 ) && !getOptions().isSearchWithRegex() ) {
592 queries = query_str.split( ",+" );
595 queries = new String[ 1 ];
596 queries[ 0 ] = query_str.trim();
598 if ( ( queries != null ) && ( queries.length > 0 ) ) {
599 nodes = new HashSet<PhylogenyNode>();
600 for( String query : queries ) {
601 if ( ForesterUtil.isEmpty( query ) ) {
604 query = query.trim();
605 final TreePanel tp = getMainPanel().getCurrentTreePanel();
606 if ( ( query.indexOf( '+' ) > 0 ) && !getOptions().isSearchWithRegex() ) {
607 nodes.addAll( PhylogenyMethods.searchDataLogicalAnd( query.split( "\\++" ),
609 getOptions().isSearchCaseSensitive(),
610 !getOptions().isMatchWholeTermsOnly(),
611 isShowDomainArchitectures(),
612 tp != null ? Math.pow( 10,
613 tp.getDomainStructureEvalueThresholdExp() )
617 nodes.addAll( PhylogenyMethods.searchData( query,
619 getOptions().isSearchCaseSensitive(),
620 !getOptions().isMatchWholeTermsOnly(),
621 getOptions().isSearchWithRegex(),
622 isShowDomainArchitectures(),
623 tp != null ? Math.pow( 10, tp
624 .getDomainStructureEvalueThresholdExp() ) : 0 ) );
627 if ( getOptions().isInverseSearchResult() ) {
628 final List<PhylogenyNode> all = PhylogenyMethods.obtainAllNodesAsList( tree );
629 all.removeAll( nodes );
630 nodes = new HashSet<PhylogenyNode>();
634 if ( ( nodes != null ) && ( nodes.size() > 0 ) ) {
635 main_panel.getCurrentTreePanel().setFoundNodes0( new HashSet<Long>() );
636 for( final PhylogenyNode node : nodes ) {
637 main_panel.getCurrentTreePanel().getFoundNodes0().add( node.getId() );
639 setSearchFoundCountsOnLabel0( nodes.size() );
642 setSearchFoundCountsOnLabel0( 0 );
647 private void search1( final MainPanel main_panel, final Phylogeny tree, final String query_str ) {
648 getSearchFoundCountsLabel1().setVisible( true );
649 getSearchResetButton1().setEnabled( true );
650 getSearchResetButton1().setVisible( true );
651 String[] queries = null;
652 Set<PhylogenyNode> nodes = null;
653 if ( ( query_str.indexOf( ',' ) >= 0 ) && !getOptions().isSearchWithRegex() ) {
654 queries = query_str.split( ",+" );
657 queries = new String[ 1 ];
658 queries[ 0 ] = query_str.trim();
660 if ( ( queries != null ) && ( queries.length > 0 ) ) {
661 nodes = new HashSet<PhylogenyNode>();
662 for( String query : queries ) {
663 if ( ForesterUtil.isEmpty( query ) ) {
666 query = query.trim();
667 final TreePanel tp = getMainPanel().getCurrentTreePanel();
668 if ( ( query.indexOf( '+' ) > 0 ) && !getOptions().isSearchWithRegex() ) {
669 nodes.addAll( PhylogenyMethods.searchDataLogicalAnd( query.split( "\\++" ),
671 getOptions().isSearchCaseSensitive(),
672 !getOptions().isMatchWholeTermsOnly(),
673 isShowDomainArchitectures(),
674 tp != null ? Math.pow( 10,
675 tp.getDomainStructureEvalueThresholdExp() )
679 nodes.addAll( PhylogenyMethods.searchData( query,
681 getOptions().isSearchCaseSensitive(),
682 !getOptions().isMatchWholeTermsOnly(),
683 getOptions().isSearchWithRegex(),
684 isShowDomainArchitectures(),
685 tp != null ? Math.pow( 10, tp
686 .getDomainStructureEvalueThresholdExp() ) : 0 ) );
689 if ( getOptions().isInverseSearchResult() ) {
690 final List<PhylogenyNode> all = PhylogenyMethods.obtainAllNodesAsList( tree );
691 all.removeAll( nodes );
692 nodes = new HashSet<PhylogenyNode>();
696 if ( ( nodes != null ) && ( nodes.size() > 0 ) ) {
697 main_panel.getCurrentTreePanel().setFoundNodes1( new HashSet<Long>() );
698 for( final PhylogenyNode node : nodes ) {
699 main_panel.getCurrentTreePanel().getFoundNodes1().add( node.getId() );
701 setSearchFoundCountsOnLabel1( nodes.size() );
704 setSearchFoundCountsOnLabel1( 0 );
709 private void setDrawPhylogram( final int index, final boolean b ) {
710 getIsDrawPhylogramList().set( index, b );
713 private void setupClickToOptions() {
714 final int default_option = _configuration.getDefaultDisplayClicktoOption();
715 int selected_index = 0;
717 if ( _configuration.doDisplayClickToOption( Configuration.display_node_data ) ) {
718 _show_data_item = cb_index;
719 addClickToOption( Configuration.display_node_data,
720 _configuration.getClickToTitle( Configuration.display_node_data ) );
721 if ( default_option == Configuration.display_node_data ) {
722 selected_index = cb_index;
726 if ( _configuration.doDisplayClickToOption( Configuration.collapse_uncollapse ) ) {
727 _collapse_cb_item = cb_index;
728 addClickToOption( Configuration.collapse_uncollapse,
729 _configuration.getClickToTitle( Configuration.collapse_uncollapse ) );
730 if ( default_option == Configuration.collapse_uncollapse ) {
731 selected_index = cb_index;
735 if ( _configuration.doDisplayClickToOption( Configuration.reroot ) ) {
736 _reroot_cb_item = cb_index;
737 addClickToOption( Configuration.reroot, _configuration.getClickToTitle( Configuration.reroot ) );
738 if ( default_option == Configuration.reroot ) {
739 selected_index = cb_index;
743 if ( _configuration.doDisplayClickToOption( Configuration.subtree ) ) {
744 _subtree_cb_item = cb_index;
745 addClickToOption( Configuration.subtree, _configuration.getClickToTitle( Configuration.subtree ) );
746 if ( default_option == Configuration.subtree ) {
747 selected_index = cb_index;
751 if ( _configuration.doDisplayClickToOption( Configuration.swap ) ) {
752 _swap_cb_item = cb_index;
753 addClickToOption( Configuration.swap, _configuration.getClickToTitle( Configuration.swap ) );
754 if ( default_option == Configuration.swap ) {
755 selected_index = cb_index;
759 if ( _configuration.doDisplayClickToOption( Configuration.sort_descendents ) ) {
760 _sort_descendents_item = cb_index;
761 addClickToOption( Configuration.sort_descendents,
762 _configuration.getClickToTitle( Configuration.sort_descendents ) );
763 if ( default_option == Configuration.sort_descendents ) {
764 selected_index = cb_index;
768 if ( _configuration.doDisplayClickToOption( Configuration.color_node_font ) ) {
769 _color_node_font_item = cb_index;
770 addClickToOption( Configuration.color_node_font,
771 _configuration.getClickToTitle( Configuration.color_node_font ) );
772 if ( default_option == Configuration.color_node_font ) {
773 selected_index = cb_index;
777 if ( _configuration.doDisplayClickToOption( Configuration.change_node_font ) ) {
778 _change_node_font_item = cb_index;
779 addClickToOption( Configuration.change_node_font,
780 _configuration.getClickToTitle( Configuration.change_node_font ) );
781 if ( default_option == Configuration.change_node_font ) {
782 selected_index = cb_index;
786 if ( _configuration.doDisplayClickToOption( Configuration.color_subtree ) ) {
787 _color_subtree_cb_item = cb_index;
788 addClickToOption( Configuration.color_subtree, _configuration.getClickToTitle( Configuration.color_subtree ) );
789 if ( default_option == Configuration.color_subtree ) {
790 selected_index = cb_index;
794 if ( _configuration.doDisplayClickToOption( Configuration.open_seq_web ) ) {
795 _open_seq_web_item = cb_index;
796 addClickToOption( Configuration.open_seq_web, _configuration.getClickToTitle( Configuration.open_seq_web ) );
797 if ( default_option == Configuration.open_seq_web ) {
798 selected_index = cb_index;
802 if ( _configuration.doDisplayClickToOption( Configuration.open_pdb_web ) ) {
803 _open_pdb_item = cb_index;
804 addClickToOption( Configuration.open_pdb_web, _configuration.getClickToTitle( Configuration.open_pdb_web ) );
805 if ( default_option == Configuration.open_pdb_web ) {
806 selected_index = cb_index;
810 if ( _configuration.doDisplayClickToOption( Configuration.open_tax_web ) ) {
811 _open_tax_web_item = cb_index;
812 addClickToOption( Configuration.open_tax_web, _configuration.getClickToTitle( Configuration.open_tax_web ) );
813 if ( default_option == Configuration.open_tax_web ) {
814 selected_index = cb_index;
818 if ( _configuration.doDisplayClickToOption( Configuration.blast ) ) {
819 _blast_item = cb_index;
820 addClickToOption( Configuration.blast, _configuration.getClickToTitle( Configuration.blast ) );
821 if ( default_option == Configuration.blast ) {
822 selected_index = cb_index;
826 if ( _configuration.doDisplayClickToOption( Configuration.select_nodes ) ) {
827 _select_nodes_item = cb_index;
828 addClickToOption( Configuration.select_nodes, _configuration.getClickToTitle( Configuration.select_nodes ) );
829 if ( default_option == Configuration.select_nodes ) {
830 selected_index = cb_index;
834 if ( _configuration.doDisplayClickToOption( Configuration.get_ext_desc_data ) ) {
835 _get_ext_desc_data = cb_index;
836 if ( !ForesterUtil.isEmpty( getConfiguration().getLabelForGetExtDescendentsData() ) ) {
837 addClickToOption( Configuration.get_ext_desc_data, getConfiguration()
838 .getLabelForGetExtDescendentsData() );
841 addClickToOption( Configuration.get_ext_desc_data,
842 getConfiguration().getClickToTitle( Configuration.get_ext_desc_data ) );
844 if ( default_option == Configuration.get_ext_desc_data ) {
845 selected_index = cb_index;
849 if ( getOptions().isEditable() ) {
850 if ( _configuration.doDisplayClickToOption( Configuration.cut_subtree ) ) {
851 _cut_subtree_item = cb_index;
852 addClickToOption( Configuration.cut_subtree, _configuration.getClickToTitle( Configuration.cut_subtree ) );
853 if ( default_option == Configuration.cut_subtree ) {
854 selected_index = cb_index;
858 if ( _configuration.doDisplayClickToOption( Configuration.copy_subtree ) ) {
859 _copy_subtree_item = cb_index;
860 addClickToOption( Configuration.copy_subtree,
861 _configuration.getClickToTitle( Configuration.copy_subtree ) );
862 if ( default_option == Configuration.copy_subtree ) {
863 selected_index = cb_index;
867 if ( _configuration.doDisplayClickToOption( Configuration.paste_subtree ) ) {
868 _paste_subtree_item = cb_index;
869 addClickToOption( Configuration.paste_subtree,
870 _configuration.getClickToTitle( Configuration.paste_subtree ) );
871 if ( default_option == Configuration.paste_subtree ) {
872 selected_index = cb_index;
876 if ( _configuration.doDisplayClickToOption( Configuration.delete_subtree_or_node ) ) {
877 _delete_node_or_subtree_item = cb_index;
878 addClickToOption( Configuration.delete_subtree_or_node,
879 _configuration.getClickToTitle( Configuration.delete_subtree_or_node ) );
880 if ( default_option == Configuration.delete_subtree_or_node ) {
881 selected_index = cb_index;
885 if ( _configuration.doDisplayClickToOption( Configuration.add_new_node ) ) {
886 _add_new_node_item = cb_index;
887 addClickToOption( Configuration.add_new_node,
888 _configuration.getClickToTitle( Configuration.add_new_node ) );
889 if ( default_option == Configuration.add_new_node ) {
890 selected_index = cb_index;
894 if ( _configuration.doDisplayClickToOption( Configuration.edit_node_data ) ) {
895 _edit_node_data_item = cb_index;
896 addClickToOption( Configuration.edit_node_data,
897 _configuration.getClickToTitle( Configuration.edit_node_data ) );
898 if ( default_option == Configuration.edit_node_data ) {
899 selected_index = cb_index;
904 // Set default selection and its action
905 _click_to_combobox.setSelectedIndex( selected_index );
906 setClickToAction( selected_index );
909 private void setupDisplayCheckboxes() {
910 if ( _configuration.doDisplayOption( Configuration.display_as_phylogram ) ) {
911 addCheckbox( Configuration.display_as_phylogram,
912 _configuration.getDisplayTitle( Configuration.display_as_phylogram ) );
913 setCheckbox( Configuration.display_as_phylogram,
914 _configuration.doCheckOption( Configuration.display_as_phylogram ) );
916 if ( _configuration.doDisplayOption( Configuration.dynamically_hide_data ) ) {
917 addCheckbox( Configuration.dynamically_hide_data,
918 _configuration.getDisplayTitle( Configuration.dynamically_hide_data ) );
919 setCheckbox( Configuration.dynamically_hide_data,
920 _configuration.doCheckOption( Configuration.dynamically_hide_data ) );
922 if ( _configuration.doDisplayOption( Configuration.node_data_popup ) ) {
923 addCheckbox( Configuration.node_data_popup, _configuration.getDisplayTitle( Configuration.node_data_popup ) );
924 setCheckbox( Configuration.node_data_popup, _configuration.doCheckOption( Configuration.node_data_popup ) );
926 if ( _configuration.doDisplayOption( Configuration.display_internal_data ) ) {
927 addCheckbox( Configuration.display_internal_data,
928 _configuration.getDisplayTitle( Configuration.display_internal_data ) );
929 setCheckbox( Configuration.display_internal_data,
930 _configuration.doCheckOption( Configuration.display_internal_data ) );
932 if ( _configuration.doDisplayOption( Configuration.color_according_to_sequence ) ) {
933 addCheckbox( Configuration.color_according_to_sequence,
934 _configuration.getDisplayTitle( Configuration.color_according_to_sequence ) );
935 setCheckbox( Configuration.color_according_to_sequence,
936 _configuration.doCheckOption( Configuration.color_according_to_sequence ) );
938 if ( _configuration.doDisplayOption( Configuration.color_according_to_species ) ) {
939 addCheckbox( Configuration.color_according_to_species,
940 _configuration.getDisplayTitle( Configuration.color_according_to_species ) );
941 setCheckbox( Configuration.color_according_to_species,
942 _configuration.doCheckOption( Configuration.color_according_to_species ) );
944 if ( _configuration.doDisplayOption( Configuration.color_according_to_annotation ) ) {
945 addCheckbox( Configuration.color_according_to_annotation,
946 _configuration.getDisplayTitle( Configuration.color_according_to_annotation ) );
947 setCheckbox( Configuration.color_according_to_annotation,
948 _configuration.doCheckOption( Configuration.color_according_to_annotation ) );
950 if ( _configuration.doDisplayOption( Configuration.use_style ) ) {
951 addCheckbox( Configuration.use_style, _configuration.getDisplayTitle( Configuration.use_style ) );
952 setCheckbox( Configuration.use_style, _configuration.doCheckOption( Configuration.use_style ) );
954 if ( _configuration.doDisplayOption( Configuration.width_branches ) ) {
955 addCheckbox( Configuration.width_branches, _configuration.getDisplayTitle( Configuration.width_branches ) );
956 setCheckbox( Configuration.width_branches, _configuration.doCheckOption( Configuration.width_branches ) );
958 final JLabel label = new JLabel( "Display Data:" );
959 label.setFont( ControlPanel.jcb_bold_font );
960 if ( !getConfiguration().isUseNativeUI() ) {
961 label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
964 if ( _configuration.doDisplayOption( Configuration.show_node_names ) ) {
965 addCheckbox( Configuration.show_node_names, _configuration.getDisplayTitle( Configuration.show_node_names ) );
966 setCheckbox( Configuration.show_node_names, _configuration.doCheckOption( Configuration.show_node_names ) );
968 if ( _configuration.doDisplayOption( Configuration.show_tax_code ) ) {
969 addCheckbox( Configuration.show_tax_code, _configuration.getDisplayTitle( Configuration.show_tax_code ) );
970 setCheckbox( Configuration.show_tax_code, _configuration.doCheckOption( Configuration.show_tax_code ) );
972 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_scientific_names ) ) {
973 addCheckbox( Configuration.show_taxonomy_scientific_names,
974 _configuration.getDisplayTitle( Configuration.show_taxonomy_scientific_names ) );
975 setCheckbox( Configuration.show_taxonomy_scientific_names,
976 _configuration.doCheckOption( Configuration.show_taxonomy_scientific_names ) );
978 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_common_names ) ) {
979 addCheckbox( Configuration.show_taxonomy_common_names,
980 _configuration.getDisplayTitle( Configuration.show_taxonomy_common_names ) );
981 setCheckbox( Configuration.show_taxonomy_common_names,
982 _configuration.doCheckOption( Configuration.show_taxonomy_common_names ) );
984 if ( _configuration.doDisplayOption( Configuration.show_seq_names ) ) {
985 addCheckbox( Configuration.show_seq_names, _configuration.getDisplayTitle( Configuration.show_seq_names ) );
986 setCheckbox( Configuration.show_seq_names, _configuration.doCheckOption( Configuration.show_seq_names ) );
988 if ( _configuration.doDisplayOption( Configuration.show_gene_names ) ) {
989 addCheckbox( Configuration.show_gene_names, _configuration.getDisplayTitle( Configuration.show_gene_names ) );
990 setCheckbox( Configuration.show_gene_names, _configuration.doCheckOption( Configuration.show_gene_names ) );
992 if ( _configuration.doDisplayOption( Configuration.show_seq_symbols ) ) {
993 addCheckbox( Configuration.show_seq_symbols,
994 _configuration.getDisplayTitle( Configuration.show_seq_symbols ) );
995 setCheckbox( Configuration.show_seq_symbols, _configuration.doCheckOption( Configuration.show_seq_symbols ) );
997 if ( _configuration.doDisplayOption( Configuration.show_sequence_acc ) ) {
998 addCheckbox( Configuration.show_sequence_acc,
999 _configuration.getDisplayTitle( Configuration.show_sequence_acc ) );
1000 setCheckbox( Configuration.show_sequence_acc,
1001 _configuration.doCheckOption( Configuration.show_sequence_acc ) );
1003 if ( _configuration.doDisplayOption( Configuration.show_annotation ) ) {
1004 addCheckbox( Configuration.show_annotation, _configuration.getDisplayTitle( Configuration.show_annotation ) );
1005 setCheckbox( Configuration.show_annotation, _configuration.doCheckOption( Configuration.show_annotation ) );
1007 if ( _configuration.doDisplayOption( Configuration.write_confidence_values ) ) {
1008 addCheckbox( Configuration.write_confidence_values,
1009 _configuration.getDisplayTitle( Configuration.write_confidence_values ) );
1010 setCheckbox( Configuration.write_confidence_values,
1011 _configuration.doCheckOption( Configuration.write_confidence_values ) );
1013 if ( _configuration.doDisplayOption( Configuration.write_branch_length_values ) ) {
1014 addCheckbox( Configuration.write_branch_length_values,
1015 _configuration.getDisplayTitle( Configuration.write_branch_length_values ) );
1016 setCheckbox( Configuration.write_branch_length_values,
1017 _configuration.doCheckOption( Configuration.write_branch_length_values ) );
1019 if ( _configuration.doDisplayOption( Configuration.show_binary_characters ) ) {
1020 addCheckbox( Configuration.show_binary_characters,
1021 _configuration.getDisplayTitle( Configuration.show_binary_characters ) );
1022 setCheckbox( Configuration.show_binary_characters,
1023 _configuration.doCheckOption( Configuration.show_binary_characters ) );
1025 if ( _configuration.doDisplayOption( Configuration.show_binary_character_counts ) ) {
1026 addCheckbox( Configuration.show_binary_character_counts,
1027 _configuration.getDisplayTitle( Configuration.show_binary_character_counts ) );
1028 setCheckbox( Configuration.show_binary_character_counts,
1029 _configuration.doCheckOption( Configuration.show_binary_character_counts ) );
1031 if ( _configuration.doDisplayOption( Configuration.show_domain_architectures ) ) {
1032 addCheckbox( Configuration.show_domain_architectures,
1033 _configuration.getDisplayTitle( Configuration.show_domain_architectures ) );
1034 setCheckbox( Configuration.show_domain_architectures,
1035 _configuration.doCheckOption( Configuration.show_domain_architectures ) );
1037 if ( _configuration.doDisplayOption( Configuration.show_mol_seqs ) ) {
1038 addCheckbox( Configuration.show_mol_seqs, _configuration.getDisplayTitle( Configuration.show_mol_seqs ) );
1039 setCheckbox( Configuration.show_mol_seqs, _configuration.doCheckOption( Configuration.show_mol_seqs ) );
1041 if ( _configuration.doDisplayOption( Configuration.write_events ) ) {
1042 addCheckbox( Configuration.write_events, _configuration.getDisplayTitle( Configuration.write_events ) );
1043 setCheckbox( Configuration.write_events, _configuration.doCheckOption( Configuration.write_events ) );
1045 if ( _configuration.doDisplayOption( Configuration.show_vector_data ) ) {
1046 addCheckbox( Configuration.show_vector_data,
1047 _configuration.getDisplayTitle( Configuration.show_vector_data ) );
1048 setCheckbox( Configuration.show_vector_data, _configuration.doCheckOption( Configuration.show_vector_data ) );
1050 if ( _configuration.doDisplayOption( Configuration.show_properties ) ) {
1051 addCheckbox( Configuration.show_properties, _configuration.getDisplayTitle( Configuration.show_properties ) );
1052 setCheckbox( Configuration.show_properties, _configuration.doCheckOption( Configuration.show_properties ) );
1054 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_images ) ) {
1055 addCheckbox( Configuration.show_taxonomy_images,
1056 _configuration.getDisplayTitle( Configuration.show_taxonomy_images ) );
1057 setCheckbox( Configuration.show_taxonomy_images,
1058 _configuration.doCheckOption( Configuration.show_taxonomy_images ) );
1062 private void setVisibilityOfDomainStrucureControls() {
1063 if ( _zoom_in_domain_structure != null ) {
1064 final MainFrame mf = getMainFrame();
1066 if ( isShowDomainArchitectures() ) {
1067 _domain_display_label.setVisible( true );
1068 _zoom_in_domain_structure.setVisible( true );
1069 _zoom_out_domain_structure.setVisible( true );
1070 _decr_domain_structure_evalue_thr.setVisible( true );
1071 _incr_domain_structure_evalue_thr.setVisible( true );
1072 _domain_structure_evalue_thr_tf.setVisible( true );
1073 if ( mf._right_line_up_domains_cbmi != null ) {
1074 mf._right_line_up_domains_cbmi.setVisible( true );
1076 if ( mf._show_domain_labels != null ) {
1077 mf._show_domain_labels.setVisible( true );
1081 _domain_display_label.setVisible( false );
1082 _zoom_in_domain_structure.setVisible( false );
1083 _zoom_out_domain_structure.setVisible( false );
1084 _decr_domain_structure_evalue_thr.setVisible( false );
1085 _incr_domain_structure_evalue_thr.setVisible( false );
1086 _domain_structure_evalue_thr_tf.setVisible( false );
1087 if ( mf._right_line_up_domains_cbmi != null ) {
1088 mf._right_line_up_domains_cbmi.setVisible( false );
1090 if ( mf._show_domain_labels != null ) {
1091 mf._show_domain_labels.setVisible( false );
1098 void activateButtonToReturnToSuperTree( int index ) {
1101 _return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT + " " + index );
1104 _return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT );
1106 _return_to_super_tree.setForeground( getConfiguration().getGuiCheckboxAndButtonActiveColor() );
1107 _return_to_super_tree.setEnabled( true );
1111 * Add zoom and quick edit buttons. (Last modified 8/9/04)
1114 final JLabel spacer = new JLabel( "" );
1115 spacer.setOpaque( false );
1117 final JPanel x_panel = new JPanel( new GridLayout( 1, 1, 0, 0 ) );
1118 final JPanel y_panel = new JPanel( new GridLayout( 1, 3, 0, 0 ) );
1119 final JPanel z_panel = new JPanel( new GridLayout( 1, 1, 0, 0 ) );
1120 if ( !getConfiguration().isUseNativeUI() ) {
1121 x_panel.setBackground( getBackground() );
1122 y_panel.setBackground( getBackground() );
1123 z_panel.setBackground( getBackground() );
1125 add( _zoom_label = new JLabel( "Zoom:" ) );
1126 customizeLabel( _zoom_label, getConfiguration() );
1130 if ( getConfiguration().isUseNativeUI() ) {
1131 _zoom_in_x = new JButton( "+" );
1132 _zoom_out_x = new JButton( "-" );
1135 _zoom_in_x = new JButton( "X+" );
1136 _zoom_out_x = new JButton( "X-" );
1138 _zoom_in_y = new JButton( "Y+" );
1139 _zoom_out_y = new JButton( "Y-" );
1140 _show_whole = new JButton( "F" );
1141 _show_whole.setToolTipText( "To fit the complete phylogeny to the current display size [F or Home]" );
1142 _zoom_in_x.setToolTipText( "To zoom in horizontally [Shift+cursor-right]" );
1143 _zoom_in_y.setToolTipText( "To zoom in vertically [Shift+cursor-up]" );
1144 _zoom_out_x.setToolTipText( "To zoom out horizontally [Shift+cursor-left]" );
1145 _zoom_out_y.setToolTipText( "To zoom out vertically [Shift+cursor-down]" );
1146 if ( getConfiguration().isUseNativeUI() && ForesterUtil.isMac() ) {
1147 _zoom_out_x.setPreferredSize( new Dimension( 55, 10 ) );
1148 _zoom_in_x.setPreferredSize( new Dimension( 55, 10 ) );
1151 _zoom_out_x.setPreferredSize( new Dimension( 10, 10 ) );
1152 _zoom_in_x.setPreferredSize( new Dimension( 10, 10 ) );
1154 _zoom_out_y.setPreferredSize( new Dimension( 10, 10 ) );
1155 _zoom_in_y.setPreferredSize( new Dimension( 10, 10 ) );
1156 _show_whole.setPreferredSize( new Dimension( 10, 10 ) );
1157 _return_to_super_tree = new JButton( RETURN_TO_SUPER_TREE_TEXT );
1158 _return_to_super_tree.setEnabled( false );
1159 _order = new JButton( "Order Subtrees" );
1160 _uncollapse_all = new JButton( "Uncollapse All" );
1161 addJButton( _zoom_in_y, x_panel );
1162 addJButton( _zoom_out_x, y_panel );
1163 addJButton( _show_whole, y_panel );
1164 addJButton( _zoom_in_x, y_panel );
1165 addJButton( _zoom_out_y, z_panel );
1166 if ( getConfiguration().doDisplayOption( Configuration.show_domain_architectures ) ) {
1167 setUpControlsForDomainStrucures();
1169 final JLabel spacer2 = new JLabel( "" );
1171 addJButton( _return_to_super_tree, this );
1172 addJButton( _order, this );
1173 addJButton( _uncollapse_all, this );
1174 final JLabel spacer3 = new JLabel( "" );
1176 setVisibilityOfDomainStrucureControls();
1179 void addCheckbox( final int which, final String title ) {
1180 final JPanel ch_panel = new JPanel( new BorderLayout( 0, 0 ) );
1182 case Configuration.display_as_phylogram:
1183 _display_as_phylogram_cb = new JCheckBox( title );
1184 getDisplayAsPhylogramCb().setToolTipText( "To switch between phylogram and cladogram display" );
1185 addJCheckBox( getDisplayAsPhylogramCb(), ch_panel );
1188 case Configuration.display_internal_data:
1189 _display_internal_data = new JCheckBox( title );
1190 _display_internal_data.setToolTipText( "To allow or disallow display of internal labels" );
1191 addJCheckBox( _display_internal_data, ch_panel );
1194 case Configuration.color_according_to_species:
1195 _color_acc_species = new JCheckBox( title );
1196 _color_acc_species.setToolTipText( "To colorize node labels as a function of taxonomy" );
1197 addJCheckBox( _color_acc_species, ch_panel );
1200 case Configuration.color_according_to_sequence:
1201 _color_acc_sequence = new JCheckBox( title );
1202 _color_acc_sequence.setToolTipText( "To colorize node labels as a function of sequence name" );
1203 addJCheckBox( _color_acc_sequence, ch_panel );
1206 case Configuration.color_according_to_annotation:
1207 _color_according_to_annotation = new JCheckBox( title );
1208 _color_according_to_annotation
1209 .setToolTipText( "To colorize sequence annotation labels as a function of sequence annotation" );
1210 addJCheckBox( _color_according_to_annotation, ch_panel );
1213 case Configuration.show_node_names:
1214 _show_node_names = new JCheckBox( title );
1215 addJCheckBox( _show_node_names, ch_panel );
1218 case Configuration.show_taxonomy_scientific_names:
1219 _show_taxo_scientific_names = new JCheckBox( title );
1220 addJCheckBox( _show_taxo_scientific_names, ch_panel );
1223 case Configuration.show_taxonomy_common_names:
1224 _show_taxo_common_names = new JCheckBox( title );
1225 addJCheckBox( _show_taxo_common_names, ch_panel );
1228 case Configuration.show_tax_code:
1229 _show_taxo_code = new JCheckBox( title );
1230 addJCheckBox( _show_taxo_code, ch_panel );
1233 case Configuration.show_taxonomy_images:
1234 _show_taxo_images_cb = new JCheckBox( title );
1235 addJCheckBox( _show_taxo_images_cb, ch_panel );
1238 case Configuration.show_binary_characters:
1239 _show_binary_characters = new JCheckBox( title );
1240 addJCheckBox( _show_binary_characters, ch_panel );
1243 case Configuration.show_annotation:
1244 _show_annotation = new JCheckBox( title );
1245 addJCheckBox( _show_annotation, ch_panel );
1248 case Configuration.show_binary_character_counts:
1249 _show_binary_character_counts = new JCheckBox( title );
1250 addJCheckBox( _show_binary_character_counts, ch_panel );
1253 case Configuration.write_confidence_values:
1254 _write_confidence = new JCheckBox( title );
1255 addJCheckBox( getWriteConfidenceCb(), ch_panel );
1258 case Configuration.write_events:
1259 _show_events = new JCheckBox( title );
1260 addJCheckBox( getShowEventsCb(), ch_panel );
1263 case Configuration.use_style:
1264 _use_visual_styles_cb = new JCheckBox( title );
1265 getUseVisualStylesCb()
1266 .setToolTipText( "To use visual styles (node colors, fonts) and branch colors, if present" );
1267 addJCheckBox( getUseVisualStylesCb(), ch_panel );
1270 case Configuration.width_branches:
1271 _width_branches = new JCheckBox( title );
1272 _width_branches.setToolTipText( "To use branch width values, if present" );
1273 addJCheckBox( _width_branches, ch_panel );
1276 case Configuration.write_branch_length_values:
1277 _write_branch_length_values = new JCheckBox( title );
1278 addJCheckBox( _write_branch_length_values, ch_panel );
1281 case Configuration.show_domain_architectures:
1282 _show_domain_architectures = new JCheckBox( title );
1283 addJCheckBox( _show_domain_architectures, ch_panel );
1286 case Configuration.show_mol_seqs:
1287 _show_mol_seqs = new JCheckBox( title );
1288 addJCheckBox( _show_mol_seqs, ch_panel );
1291 case Configuration.show_seq_names:
1292 _show_seq_names = new JCheckBox( title );
1293 addJCheckBox( _show_seq_names, ch_panel );
1296 case Configuration.show_gene_names:
1297 _show_gene_names = new JCheckBox( title );
1298 addJCheckBox( _show_gene_names, ch_panel );
1301 case Configuration.show_seq_symbols:
1302 _show_seq_symbols = new JCheckBox( title );
1303 addJCheckBox( _show_seq_symbols, ch_panel );
1306 case Configuration.show_sequence_acc:
1307 _show_sequence_acc = new JCheckBox( title );
1308 addJCheckBox( _show_sequence_acc, ch_panel );
1311 case Configuration.dynamically_hide_data:
1312 _dynamically_hide_data = new JCheckBox( title );
1313 getDynamicallyHideData().setToolTipText( "To hide labels depending on expected visibility" );
1314 addJCheckBox( getDynamicallyHideData(), ch_panel );
1317 case Configuration.node_data_popup:
1318 _node_desc_popup_cb = new JCheckBox( title );
1319 getNodeDescPopupCb().setToolTipText( "To enable mouse rollover display of basic node data" );
1320 addJCheckBox( getNodeDescPopupCb(), ch_panel );
1323 case Configuration.show_relation_confidence:
1324 _seq_relation_confidence_switch = new JCheckBox( title );
1325 addJCheckBox( _seq_relation_confidence_switch, ch_panel );
1328 case Configuration.show_vector_data:
1329 _show_vector_data_cb = new JCheckBox( title );
1330 addJCheckBox( _show_vector_data_cb, ch_panel );
1333 case Configuration.show_properties:
1334 _show_properties_cb = new JCheckBox( title );
1335 addJCheckBox( _show_properties_cb, ch_panel );
1339 throw new RuntimeException( "unknown checkbox: " + which );
1343 void addJButton( final JButton jb, final JPanel p ) {
1344 jb.setFocusPainted( false );
1345 jb.setFont( ControlPanel.jcb_font );
1346 if ( !_configuration.isUseNativeUI() ) {
1347 jb.setBorder( BorderFactory.createLineBorder( getConfiguration().getGuiButtonBorderColor() ) );
1348 jb.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
1349 jb.setForeground( getConfiguration().getGuiButtonTextColor() );
1352 jb.addActionListener( this );
1355 void addJCheckBox( final JCheckBox jcb, final JPanel p ) {
1356 jcb.setFocusPainted( false );
1357 jcb.setFont( ControlPanel.jcb_font );
1358 if ( !_configuration.isUseNativeUI() ) {
1359 jcb.setBackground( getConfiguration().getGuiBackgroundColor() );
1360 jcb.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1362 p.add( jcb, "Center" );
1363 jcb.addActionListener( this );
1366 void addJTextField( final JTextField tf, final JPanel p ) {
1367 if ( !_configuration.isUseNativeUI() ) {
1368 tf.setForeground( getConfiguration().getGuiBackgroundColor() );
1369 tf.setFont( ControlPanel.jcb_font );
1372 tf.addActionListener( this );
1375 void deactivateButtonToReturnToSuperTree() {
1376 _return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT );
1377 _return_to_super_tree.setForeground( getConfiguration().getGuiButtonTextColor() );
1378 _return_to_super_tree.setEnabled( false );
1381 void displayedPhylogenyMightHaveChanged( final boolean recalc_longest_ext_node_info ) {
1382 if ( ( _mainpanel != null )
1383 && ( ( _mainpanel.getCurrentPhylogeny() != null ) && !_mainpanel.getCurrentPhylogeny().isEmpty() ) ) {
1384 if ( getOptions().isShowOverview() ) {
1385 _mainpanel.getCurrentTreePanel().updateOvSizes();
1387 _mainpanel.getCurrentTreePanel().recalculateMaxDistanceToRoot();
1388 setVisibilityOfDomainStrucureControls();
1389 updateDomainStructureEvaluethresholdDisplay();
1390 _mainpanel.getCurrentTreePanel().calculateScaleDistance();
1391 _mainpanel.getCurrentTreePanel().calcMaxDepth();
1392 _mainpanel.adjustJScrollPane();
1393 if ( recalc_longest_ext_node_info ) {
1394 _mainpanel.getCurrentTreePanel().initNodeData();
1395 _mainpanel.getCurrentTreePanel().calculateLongestExtNodeInfo();
1397 _mainpanel.getCurrentTreePanel().repaint();
1398 // _mainpanel.getCurrentTreePanel().setUpUrtFactors();
1402 void endClickToOptions() {
1403 _click_to_combobox.addActionListener( this );
1407 * Indicates what action should be execute when a node is clicked
1409 * @return the click-on action
1411 NodeClickAction getActionWhenNodeClicked() {
1412 return _action_when_node_clicked;
1415 Map<Integer, String> getAllClickToItems() {
1416 return _all_click_to_names;
1419 Map<String, Color> getAnnotationColors() {
1420 return _annotation_colors;
1423 Configuration getConfiguration() {
1424 return _configuration;
1427 TreePanel getCurrentTreePanel() {
1428 return getMainPanel().getCurrentTreePanel();
1431 MainPanel getMainPanel() {
1435 Options getOptions() {
1436 return getMainPanel().getOptions();
1439 JLabel getSearchFoundCountsLabel0() {
1440 return _search_found_label_0;
1443 JLabel getSearchFoundCountsLabel1() {
1444 return _search_found_label_1;
1447 JButton getSearchResetButton0() {
1448 return _search_reset_button_0;
1451 JButton getSearchResetButton1() {
1452 return _search_reset_button_1;
1455 JTextField getSearchTextField0() {
1456 return _search_tf_0;
1459 JTextField getSearchTextField1() {
1460 return _search_tf_1;
1463 Map<String, Color> getSequenceColors() {
1464 return _sequence_colors;
1467 List<String> getSingleClickToNames() {
1468 return _click_to_names;
1471 Map<String, Color> getSpeciesColors() {
1472 return _species_colors;
1475 boolean isAntialiasScreenText() {
1479 boolean isColorAccordingToAnnotation() {
1480 return ( ( _color_according_to_annotation != null ) && _color_according_to_annotation.isSelected() );
1483 boolean isColorAccordingToSequence() {
1484 return ( ( _color_acc_sequence != null ) && _color_acc_sequence.isSelected() );
1487 boolean isColorAccordingToTaxonomy() {
1488 return ( ( _color_acc_species != null ) && _color_acc_species.isSelected() );
1491 boolean isDrawPhylogram() {
1492 return isDrawPhylogram( getMainPanel().getCurrentTabIndex() );
1495 boolean isDynamicallyHideData() {
1496 return ( ( getDynamicallyHideData() != null ) && getDynamicallyHideData().isSelected() );
1499 boolean isEvents() {
1500 return ( ( getShowEventsCb() != null ) && getShowEventsCb().isSelected() );
1503 boolean isNodeDescPopup() {
1504 return ( ( getNodeDescPopupCb() != null ) && getNodeDescPopupCb().isSelected() );
1507 boolean isShowAnnotation() {
1508 return ( ( _show_annotation != null ) && _show_annotation.isSelected() );
1511 boolean isShowBinaryCharacterCounts() {
1512 return ( ( _show_binary_character_counts != null ) && _show_binary_character_counts.isSelected() );
1515 boolean isShowBinaryCharacters() {
1516 return ( ( _show_binary_characters != null ) && _show_binary_characters.isSelected() );
1519 boolean isShowConfidenceValues() {
1520 return ( ( getWriteConfidenceCb() != null ) && getWriteConfidenceCb().isSelected() );
1523 boolean isShowDomainArchitectures() {
1524 return ( ( _show_domain_architectures != null ) && _show_domain_architectures.isSelected() );
1527 boolean isShowGeneNames() {
1528 return ( ( _show_gene_names != null ) && _show_gene_names.isSelected() );
1531 boolean isShowInternalData() {
1532 return ( ( _display_internal_data == null ) || _display_internal_data.isSelected() );
1535 boolean isShowNodeNames() {
1536 return ( ( _show_node_names != null ) && _show_node_names.isSelected() );
1539 boolean isShowSeqNames() {
1540 return ( ( _show_seq_names != null ) && _show_seq_names.isSelected() );
1543 boolean isShowSeqSymbols() {
1544 return ( ( _show_seq_symbols != null ) && _show_seq_symbols.isSelected() );
1547 boolean isShowSequenceAcc() {
1548 return ( ( _show_sequence_acc != null ) && _show_sequence_acc.isSelected() );
1551 boolean isShowSequenceRelationConfidence() {
1552 return ( ( _seq_relation_confidence_switch != null ) && ( _seq_relation_confidence_switch.isSelected() ) );
1555 boolean isShowSequenceRelations() {
1556 return ( ( _show_sequence_relations != null ) && ( _show_sequence_relations.getSelectedIndex() > 0 ) );
1559 boolean isShowTaxonomyCode() {
1560 return ( ( _show_taxo_code != null ) && _show_taxo_code.isSelected() );
1563 boolean isShowTaxonomyCommonNames() {
1564 return ( ( _show_taxo_common_names != null ) && _show_taxo_common_names.isSelected() );
1567 boolean isShowTaxonomyScientificNames() {
1568 return ( ( _show_taxo_scientific_names != null ) && _show_taxo_scientific_names.isSelected() );
1571 boolean isUseVisualStyles() {
1572 return ( ( ( getUseVisualStylesCb() != null ) && getUseVisualStylesCb().isSelected() ) || ( ( getUseVisualStylesCb() == null ) && _color_branches ) );
1575 boolean isWidthBranches() {
1576 return ( ( _width_branches != null ) && _width_branches.isSelected() );
1579 boolean isWriteBranchLengthValues() {
1580 return ( ( _write_branch_length_values != null ) && _write_branch_length_values.isSelected() );
1583 void phylogenyAdded( final Configuration configuration ) {
1584 getIsDrawPhylogramList().add( configuration.isDrawAsPhylogram() );
1587 void phylogenyRemoved( final int index ) {
1588 getIsDrawPhylogramList().remove( index );
1592 final MainPanel main_panel = getMainPanel();
1593 final Phylogeny tree = main_panel.getCurrentPhylogeny();
1594 if ( ( tree == null ) || tree.isEmpty() ) {
1597 String query = getSearchTextField0().getText();
1598 if ( query != null ) {
1599 query = query.trim();
1601 if ( !ForesterUtil.isEmpty( query ) ) {
1602 search0( main_panel, tree, query );
1605 getSearchFoundCountsLabel0().setVisible( false );
1606 getSearchResetButton0().setEnabled( false );
1607 getSearchResetButton0().setVisible( false );
1613 final MainPanel main_panel = getMainPanel();
1614 final Phylogeny tree = main_panel.getCurrentPhylogeny();
1615 if ( ( tree == null ) || tree.isEmpty() ) {
1618 String query = getSearchTextField1().getText();
1619 if ( query != null ) {
1620 query = query.trim();
1622 if ( !ForesterUtil.isEmpty( query ) ) {
1623 search1( main_panel, tree, query );
1626 getSearchFoundCountsLabel1().setVisible( false );
1627 getSearchResetButton1().setEnabled( false );
1628 getSearchResetButton1().setVisible( false );
1633 void searchReset0() {
1634 if ( getMainPanel().getCurrentTreePanel() != null ) {
1635 getMainPanel().getCurrentTreePanel().setFoundNodes0( null );
1639 void searchReset1() {
1640 if ( getMainPanel().getCurrentTreePanel() != null ) {
1641 getMainPanel().getCurrentTreePanel().setFoundNodes1( null );
1645 void setActionWhenNodeClicked( final NodeClickAction action ) {
1646 _action_when_node_clicked = action;
1649 void setAnnotationColors( final Map<String, Color> annotation_colors ) {
1650 _annotation_colors = annotation_colors;
1653 void setCheckbox( final int which, final boolean state ) {
1655 case Configuration.display_as_phylogram:
1656 if ( getDisplayAsPhylogramCb() != null ) {
1657 getDisplayAsPhylogramCb().setSelected( state );
1660 case Configuration.display_internal_data:
1661 if ( _display_internal_data != null ) {
1662 _display_internal_data.setSelected( state );
1665 case Configuration.color_according_to_species:
1666 if ( _color_acc_species != null ) {
1667 _color_acc_species.setSelected( state );
1670 case Configuration.color_according_to_sequence:
1671 if ( _color_acc_sequence != null ) {
1672 _color_acc_sequence.setSelected( state );
1675 case Configuration.color_according_to_annotation:
1676 if ( _color_according_to_annotation != null ) {
1677 _color_according_to_annotation.setSelected( state );
1680 case Configuration.show_node_names:
1681 if ( _show_node_names != null ) {
1682 _show_node_names.setSelected( state );
1685 case Configuration.show_taxonomy_scientific_names:
1686 if ( _show_taxo_scientific_names != null ) {
1687 _show_taxo_scientific_names.setSelected( state );
1690 case Configuration.show_taxonomy_common_names:
1691 if ( _show_taxo_common_names != null ) {
1692 _show_taxo_common_names.setSelected( state );
1695 case Configuration.show_tax_code:
1696 if ( _show_taxo_code != null ) {
1697 _show_taxo_code.setSelected( state );
1700 case Configuration.show_taxonomy_images:
1701 if ( _show_taxo_images_cb != null ) {
1702 _show_taxo_images_cb.setSelected( state );
1705 case Configuration.show_annotation:
1706 if ( _show_annotation != null ) {
1707 _show_annotation.setSelected( state );
1710 case Configuration.show_binary_characters:
1711 if ( _show_binary_characters != null ) {
1712 _show_binary_characters.setSelected( state );
1715 case Configuration.show_binary_character_counts:
1716 if ( _show_binary_character_counts != null ) {
1717 _show_binary_character_counts.setSelected( state );
1720 case Configuration.write_confidence_values:
1721 if ( getWriteConfidenceCb() != null ) {
1722 getWriteConfidenceCb().setSelected( state );
1725 case Configuration.write_events:
1726 if ( getShowEventsCb() != null ) {
1727 getShowEventsCb().setSelected( state );
1730 case Configuration.use_style:
1731 if ( getUseVisualStylesCb() != null ) {
1732 getUseVisualStylesCb().setSelected( state );
1735 case Configuration.width_branches:
1736 if ( _width_branches != null ) {
1737 _width_branches.setSelected( state );
1740 case Configuration.show_domain_architectures:
1741 if ( _show_domain_architectures != null ) {
1742 _show_domain_architectures.setSelected( state );
1745 case Configuration.write_branch_length_values:
1746 if ( _write_branch_length_values != null ) {
1747 _write_branch_length_values.setSelected( state );
1750 case Configuration.show_mol_seqs:
1751 if ( _show_mol_seqs != null ) {
1752 _show_mol_seqs.setSelected( state );
1755 case Configuration.show_seq_names:
1756 if ( _show_seq_names != null ) {
1757 _show_seq_names.setSelected( state );
1760 case Configuration.show_gene_names:
1761 if ( _show_gene_names != null ) {
1762 _show_gene_names.setSelected( state );
1765 case Configuration.show_seq_symbols:
1766 if ( _show_seq_symbols != null ) {
1767 _show_seq_symbols.setSelected( state );
1770 case Configuration.show_vector_data:
1771 if ( _show_vector_data_cb != null ) {
1772 _show_vector_data_cb.setSelected( state );
1775 case Configuration.show_properties:
1776 if ( _show_properties_cb != null ) {
1777 _show_properties_cb.setSelected( state );
1780 case Configuration.show_sequence_acc:
1781 if ( _show_sequence_acc != null ) {
1782 _show_sequence_acc.setSelected( state );
1785 case Configuration.dynamically_hide_data:
1786 if ( getDynamicallyHideData() != null ) {
1787 getDynamicallyHideData().setSelected( state );
1790 case Configuration.node_data_popup:
1791 if ( getNodeDescPopupCb() != null ) {
1792 getNodeDescPopupCb().setSelected( state );
1796 case Configuration.show_relation_confidence:
1797 if ( _seq_relation_confidence_switch != null ) {
1798 _seq_relation_confidence_switch.setSelected( state );
1803 throw new AssertionError( "unknown checkbox: " + which );
1808 * Set this checkbox state. Not all checkboxes have been instantiated
1809 * depending on the config.
1811 void setCheckbox( final JCheckBox cb, final boolean state ) {
1813 cb.setSelected( state );
1817 void setClickToAction( final int action ) {
1818 // Set click-to action
1819 if ( action == _show_data_item ) {
1820 setActionWhenNodeClicked( NodeClickAction.SHOW_DATA );
1822 else if ( action == _collapse_cb_item ) {
1823 setActionWhenNodeClicked( NodeClickAction.COLLAPSE );
1825 else if ( action == _reroot_cb_item ) {
1826 setActionWhenNodeClicked( NodeClickAction.REROOT );
1828 else if ( action == _subtree_cb_item ) {
1829 setActionWhenNodeClicked( NodeClickAction.SUBTREE );
1831 else if ( action == _swap_cb_item ) {
1832 setActionWhenNodeClicked( NodeClickAction.SWAP );
1834 else if ( action == _color_subtree_cb_item ) {
1835 setActionWhenNodeClicked( NodeClickAction.COLOR_SUBTREE );
1837 else if ( action == _open_seq_web_item ) {
1838 setActionWhenNodeClicked( NodeClickAction.OPEN_SEQ_WEB );
1840 else if ( action == _sort_descendents_item ) {
1841 setActionWhenNodeClicked( NodeClickAction.SORT_DESCENDENTS );
1843 else if ( action == _blast_item ) {
1844 setActionWhenNodeClicked( NodeClickAction.BLAST );
1846 else if ( action == _open_tax_web_item ) {
1847 setActionWhenNodeClicked( NodeClickAction.OPEN_TAX_WEB );
1849 else if ( action == _cut_subtree_item ) {
1850 setActionWhenNodeClicked( NodeClickAction.CUT_SUBTREE );
1852 else if ( action == _copy_subtree_item ) {
1853 setActionWhenNodeClicked( NodeClickAction.COPY_SUBTREE );
1855 else if ( action == _delete_node_or_subtree_item ) {
1856 setActionWhenNodeClicked( NodeClickAction.DELETE_NODE_OR_SUBTREE );
1858 else if ( action == _paste_subtree_item ) {
1859 setActionWhenNodeClicked( NodeClickAction.PASTE_SUBTREE );
1861 else if ( action == _add_new_node_item ) {
1862 setActionWhenNodeClicked( NodeClickAction.ADD_NEW_NODE );
1864 else if ( action == _edit_node_data_item ) {
1865 setActionWhenNodeClicked( NodeClickAction.EDIT_NODE_DATA );
1867 else if ( action == _select_nodes_item ) {
1868 setActionWhenNodeClicked( NodeClickAction.SELECT_NODES );
1870 else if ( action == _get_ext_desc_data ) {
1871 setActionWhenNodeClicked( NodeClickAction.GET_EXT_DESC_DATA );
1873 else if ( action == _open_pdb_item ) {
1874 setActionWhenNodeClicked( NodeClickAction.OPEN_PDB_WEB );
1876 else if ( action == _color_node_font_item ) {
1877 setActionWhenNodeClicked( NodeClickAction.COLOR_NODE_FONT );
1879 else if ( action == _change_node_font_item ) {
1880 setActionWhenNodeClicked( NodeClickAction.CHANGE_NODE_FONT );
1883 throw new RuntimeException( "unknown action: " + action );
1885 // make sure drop down is displaying the correct action
1886 // in case this was called from outside the class
1887 _click_to_combobox.setSelectedIndex( action );
1890 void setColorBranches( final boolean color_branches ) {
1891 _color_branches = color_branches;
1894 void setDrawPhylogram( final boolean b ) {
1895 getDisplayAsPhylogramCb().setSelected( b );
1896 setDrawPhylogram( getMainPanel().getCurrentTabIndex(), b );
1899 void setDrawPhylogramEnabled( final boolean b ) {
1900 getDisplayAsPhylogramCb().setEnabled( b );
1903 void setDynamicHidingIsOn( final boolean is_on ) {
1905 getDynamicallyHideData().setForeground( getConfiguration().getGuiCheckboxAndButtonActiveColor() );
1908 if ( !_configuration.isUseNativeUI() ) {
1909 getDynamicallyHideData().setForeground( getConfiguration().getGuiButtonTextColor() );
1912 getDynamicallyHideData().setForeground( Color.BLACK );
1917 void setSearchFoundCountsOnLabel0( final int counts ) {
1918 getSearchFoundCountsLabel0().setText( "Found: " + counts );
1921 void setSearchFoundCountsOnLabel1( final int counts ) {
1922 getSearchFoundCountsLabel1().setText( "Found: " + counts );
1925 void setSequenceColors( final Map<String, Color> sequence_colors ) {
1926 _sequence_colors = sequence_colors;
1929 void setShowEvents( final boolean show_events ) {
1930 if ( getShowEventsCb() == null ) {
1931 _show_events = new JCheckBox( "" );
1933 getShowEventsCb().setSelected( show_events );
1936 void setSpeciesColors( final Map<String, Color> species_colors ) {
1937 _species_colors = species_colors;
1940 void setupControls() {
1941 // The tree display options:
1942 setupDisplayCheckboxes();
1944 // The sequence relation query selection combo-box
1945 if ( _configuration.displaySequenceRelations() ) {
1946 addSequenceRelationBlock();
1950 startClickToOptions();
1951 setupClickToOptions();
1952 endClickToOptions();
1953 // Zoom and quick edit buttons
1955 setupSearchTools0();
1956 setupSearchTools1();
1959 void setUpControlsForDomainStrucures() {
1960 _domain_display_label = new JLabel( "Domain Architectures:" );
1961 add( customizeLabel( _domain_display_label, getConfiguration() ) );
1962 add( _domain_display_label );
1963 _zoom_in_domain_structure = new JButton( "d+" );
1964 _zoom_out_domain_structure = new JButton( "d-" );
1965 _decr_domain_structure_evalue_thr = new JButton( "-" );
1966 _incr_domain_structure_evalue_thr = new JButton( "+" );
1967 _zoom_in_domain_structure.setPreferredSize( new Dimension( 10, 10 ) );
1968 _zoom_out_domain_structure.setPreferredSize( new Dimension( 10, 10 ) );
1969 _decr_domain_structure_evalue_thr.setPreferredSize( new Dimension( 10, 10 ) );
1970 _incr_domain_structure_evalue_thr.setPreferredSize( new Dimension( 10, 10 ) );
1971 _incr_domain_structure_evalue_thr.setToolTipText( "Increase the E-value threshold by a factor of 10" );
1972 _decr_domain_structure_evalue_thr.setToolTipText( "Decrease the E-value threshold by a factor of 10" );
1973 _domain_structure_evalue_thr_tf = new JTextField( 3 );
1974 _domain_structure_evalue_thr_tf.setEditable( false );
1975 if ( !getConfiguration().isUseNativeUI() ) {
1976 _domain_structure_evalue_thr_tf.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
1977 _domain_structure_evalue_thr_tf.setBackground( getConfiguration().getGuiCheckboxTextColor() );
1978 _domain_structure_evalue_thr_tf.setBorder( null );
1980 final JPanel d1_panel = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
1981 final JPanel d2_panel = new JPanel( new GridLayout( 1, 3, 0, 0 ) );
1982 if ( !_configuration.isUseNativeUI() ) {
1983 d1_panel.setBackground( getBackground() );
1984 d2_panel.setBackground( getBackground() );
1988 addJButton( _zoom_out_domain_structure, d1_panel );
1989 addJButton( _zoom_in_domain_structure, d1_panel );
1990 addJButton( _decr_domain_structure_evalue_thr, d2_panel );
1991 addJTextField( _domain_structure_evalue_thr_tf, d2_panel );
1992 addJButton( _incr_domain_structure_evalue_thr, d2_panel );
1995 void setupSearchTools0() {
1996 final JLabel search_label = new JLabel( "Search (A):" );
1997 search_label.setFont( ControlPanel.jcb_bold_font );
1998 if ( !getConfiguration().isUseNativeUI() ) {
1999 search_label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
2001 add( search_label );
2002 search_label.setToolTipText( SEARCH_TIP_TEXT );
2003 _search_found_label_0 = new JLabel();
2004 getSearchFoundCountsLabel0().setVisible( false );
2005 _search_found_label_0.setFont( ControlPanel.jcb_bold_font );
2006 if ( !getConfiguration().isUseNativeUI() ) {
2007 _search_found_label_0.setForeground( getConfiguration().getGuiCheckboxTextColor() );
2009 _search_tf_0 = new JTextField( 3 );
2010 _search_tf_0.setToolTipText( SEARCH_TIP_TEXT );
2011 _search_tf_0.setEditable( true );
2012 if ( !getConfiguration().isUseNativeUI() ) {
2013 _search_tf_0.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
2014 _search_tf_0.setBackground( getConfiguration().getGuiCheckboxTextColor() );
2015 _search_tf_0.setBorder( null );
2017 _search_reset_button_0 = new JButton();
2018 getSearchResetButton0().setText( "Reset" );
2019 getSearchResetButton0().setEnabled( false );
2020 getSearchResetButton0().setVisible( false );
2021 final JPanel s_panel_1 = new JPanel( new BorderLayout() );
2022 final JPanel s_panel_2 = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
2023 s_panel_1.setBackground( getBackground() );
2025 s_panel_2.setBackground( getBackground() );
2027 final KeyAdapter key_adapter = new KeyAdapter() {
2030 public void keyReleased( final KeyEvent key_event ) {
2032 displayedPhylogenyMightHaveChanged( true );
2035 final ActionListener action_listener = new ActionListener() {
2038 public void actionPerformed( final ActionEvent e ) {
2040 setSearchFoundCountsOnLabel0( 0 );
2041 getSearchFoundCountsLabel0().setVisible( false );
2042 getSearchTextField0().setText( "" );
2043 getSearchResetButton0().setEnabled( false );
2044 getSearchResetButton0().setVisible( false );
2045 displayedPhylogenyMightHaveChanged( true );
2048 _search_reset_button_0.addActionListener( action_listener );
2049 _search_tf_0.addKeyListener( key_adapter );
2050 addJTextField( _search_tf_0, s_panel_1 );
2051 s_panel_2.add( _search_found_label_0 );
2052 addJButton( _search_reset_button_0, s_panel_2 );
2055 void setupSearchTools1() {
2056 final JLabel search_label = new JLabel( "Search (B):" );
2057 search_label.setFont( ControlPanel.jcb_bold_font );
2058 if ( !getConfiguration().isUseNativeUI() ) {
2059 search_label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
2061 add( search_label );
2062 search_label.setToolTipText( SEARCH_TIP_TEXT );
2063 _search_found_label_1 = new JLabel();
2064 getSearchFoundCountsLabel1().setVisible( false );
2065 _search_found_label_1.setFont( ControlPanel.jcb_bold_font );
2066 if ( !getConfiguration().isUseNativeUI() ) {
2067 _search_found_label_1.setForeground( getConfiguration().getGuiCheckboxTextColor() );
2069 _search_tf_1 = new JTextField( 3 );
2070 _search_tf_1.setToolTipText( SEARCH_TIP_TEXT );
2071 _search_tf_1.setEditable( true );
2072 if ( !getConfiguration().isUseNativeUI() ) {
2073 _search_tf_1.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
2074 _search_tf_1.setBackground( getConfiguration().getGuiCheckboxTextColor() );
2075 _search_tf_1.setBorder( null );
2077 _search_reset_button_1 = new JButton();
2078 getSearchResetButton1().setText( "Reset" );
2079 getSearchResetButton1().setEnabled( false );
2080 getSearchResetButton1().setVisible( false );
2081 final JPanel s_panel_1 = new JPanel( new BorderLayout() );
2082 final JPanel s_panel_2 = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
2083 s_panel_1.setBackground( getBackground() );
2085 s_panel_2.setBackground( getBackground() );
2087 final KeyAdapter key_adapter = new KeyAdapter() {
2090 public void keyReleased( final KeyEvent key_event ) {
2092 displayedPhylogenyMightHaveChanged( true );
2095 final ActionListener action_listener = new ActionListener() {
2098 public void actionPerformed( final ActionEvent e ) {
2100 setSearchFoundCountsOnLabel1( 0 );
2101 getSearchFoundCountsLabel1().setVisible( false );
2102 getSearchTextField1().setText( "" );
2103 getSearchResetButton1().setEnabled( false );
2104 getSearchResetButton1().setVisible( false );
2105 displayedPhylogenyMightHaveChanged( true );
2108 _search_reset_button_1.addActionListener( action_listener );
2109 _search_tf_1.addKeyListener( key_adapter );
2110 addJTextField( _search_tf_1, s_panel_1 );
2111 s_panel_2.add( _search_found_label_1 );
2112 addJButton( _search_reset_button_1, s_panel_2 );
2115 void setVisibilityOfDomainStrucureCB() {
2117 if ( ( getCurrentTreePanel() != null )
2118 && ( ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) || ( getCurrentTreePanel()
2119 .getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) ) {
2120 if ( getMainPanel().getMainFrame()._right_line_up_domains_cbmi != null ) {
2121 getMainPanel().getMainFrame()._right_line_up_domains_cbmi.setVisible( false );
2123 if ( getMainPanel().getMainFrame()._show_domain_labels != null ) {
2124 getMainPanel().getMainFrame()._show_domain_labels.setVisible( false );
2127 else if ( isShowDomainArchitectures() ) {
2128 if ( getMainPanel().getMainFrame()._right_line_up_domains_cbmi != null ) {
2129 getMainPanel().getMainFrame()._right_line_up_domains_cbmi.setVisible( true );
2131 if ( getMainPanel().getMainFrame()._show_domain_labels != null ) {
2132 getMainPanel().getMainFrame()._show_domain_labels.setVisible( true );
2136 if ( getMainPanel().getMainFrame()._right_line_up_domains_cbmi != null ) {
2137 getMainPanel().getMainFrame()._right_line_up_domains_cbmi.setVisible( false );
2139 if ( getMainPanel().getMainFrame()._show_domain_labels != null ) {
2140 getMainPanel().getMainFrame()._show_domain_labels.setVisible( false );
2144 catch ( final Exception ignore ) {
2149 void setVisibilityOfX() {
2150 final MainFrame mf = getMainFrame();
2152 if ( ( getCurrentTreePanel() != null ) && ( getCurrentTreePanel().getPhylogeny() != null ) ) {
2153 if ( AptxUtil.isHasAtLeastOneBranchWithSupportSD( getCurrentTreePanel().getPhylogeny() ) ) {
2154 if ( mf._show_confidence_stddev_cbmi != null ) {
2155 mf._show_confidence_stddev_cbmi.setVisible( true );
2159 if ( mf._show_confidence_stddev_cbmi != null ) {
2160 mf._show_confidence_stddev_cbmi.setVisible( false );
2163 if ( AptxUtil.isHasAtLeastOneNodeWithScientificName( getCurrentTreePanel().getPhylogeny() ) ) {
2164 if ( mf._abbreviate_scientific_names != null ) {
2165 mf._abbreviate_scientific_names.setVisible( true );
2169 if ( mf._abbreviate_scientific_names != null ) {
2170 mf._abbreviate_scientific_names.setVisible( false );
2173 if ( AptxUtil.isHasAtLeastOneNodeWithSequenceAnnotation( getCurrentTreePanel().getPhylogeny() ) ) {
2174 if ( mf._show_annotation_ref_source != null ) {
2175 mf._show_annotation_ref_source.setVisible( true );
2179 if ( mf._show_annotation_ref_source != null ) {
2180 mf._show_annotation_ref_source.setVisible( false );
2184 if ( isDrawPhylogram()
2185 || ( ( getCurrentTreePanel() != null ) && ( ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) || ( getCurrentTreePanel()
2186 .getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) ) ) {
2187 if ( mf._non_lined_up_cladograms_rbmi != null ) {
2188 mf._non_lined_up_cladograms_rbmi.setVisible( false );
2190 if ( mf._uniform_cladograms_rbmi != null ) {
2191 mf._uniform_cladograms_rbmi.setVisible( false );
2193 if ( mf._ext_node_dependent_cladogram_rbmi != null ) {
2194 mf._ext_node_dependent_cladogram_rbmi.setVisible( false );
2198 if ( mf._non_lined_up_cladograms_rbmi != null ) {
2199 mf._non_lined_up_cladograms_rbmi.setVisible( true );
2201 if ( mf._uniform_cladograms_rbmi != null ) {
2202 mf._uniform_cladograms_rbmi.setVisible( true );
2204 if ( mf._ext_node_dependent_cladogram_rbmi != null ) {
2205 mf._ext_node_dependent_cladogram_rbmi.setVisible( true );
2208 if ( isDrawPhylogram() ) {
2209 if ( mf._show_scale_cbmi != null ) {
2210 mf._show_scale_cbmi.setVisible( true );
2214 if ( mf._show_scale_cbmi != null ) {
2215 mf._show_scale_cbmi.setVisible( false );
2218 if ( getCurrentTreePanel() != null ) {
2219 if ( ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
2220 || ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) {
2221 if ( mf._label_direction_cbmi != null ) {
2222 mf._label_direction_cbmi.setVisible( true );
2226 if ( mf._label_direction_cbmi != null ) {
2227 mf._label_direction_cbmi.setVisible( false );
2234 void showAnnotations() {
2235 if ( _show_annotation != null ) {
2236 _show_annotation.setSelected( true );
2238 if ( _color_according_to_annotation != null ) {
2239 _color_according_to_annotation.setSelected( true );
2241 if ( _color_acc_species != null ) {
2242 _color_acc_species.setSelected( false );
2244 if ( _color_acc_sequence != null ) {
2245 _color_acc_sequence.setSelected( false );
2247 _mainpanel.getCurrentTreePanel().repaint();
2251 * Fit entire tree into window.
2254 if ( ( _mainpanel.getCurrentScrollPane() == null ) || _mainpanel.getCurrentTreePanel().getPhylogeny().isEmpty() ) {
2257 getCurrentTreePanel().updateSetOfCollapsedExternalNodes();
2258 displayedPhylogenyMightHaveChanged( true );
2259 _mainpanel.getCurrentTreePanel().updateOvSettings();
2260 _mainpanel.getCurrentTreePanel().validate();
2261 _mainpanel.validate();
2262 _mainpanel.getCurrentTreePanel().calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
2263 _mainpanel.getSizeOfViewport().height );
2264 _mainpanel.getCurrentTreePanel().resetPreferredSize();
2265 _mainpanel.adjustJScrollPane();
2266 _mainpanel.getCurrentTreePanel().repaint();
2267 _mainpanel.getCurrentTreePanel().validate();
2268 _mainpanel.validate();
2269 _mainpanel.getCurrentTreePanel().calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
2270 _mainpanel.getSizeOfViewport().height );
2271 _mainpanel.getCurrentTreePanel().resetPreferredSize();
2272 _mainpanel.adjustJScrollPane();
2273 _mainpanel.getCurrentTreePanel().repaint();
2274 _mainpanel.getCurrentTreePanel().updateOvSizes();
2277 void showWholeAll() {
2278 for( final TreePanel tree_panel : _mainpanel.getTreePanels() ) {
2279 if ( tree_panel != null ) {
2280 tree_panel.validate();
2281 tree_panel.calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
2282 _mainpanel.getSizeOfViewport().height );
2283 tree_panel.resetPreferredSize();
2284 tree_panel.repaint();
2289 // Create header for click-to combo box.
2290 void startClickToOptions() {
2291 final JLabel spacer = new JLabel( "" );
2292 spacer.setFont( ControlPanel.jcb_font );
2294 _click_to_label = new JLabel( "Click on Node to:" );
2295 add( customizeLabel( _click_to_label, getConfiguration() ) );
2296 _click_to_combobox = new JComboBox<String>();
2297 _click_to_combobox.setFocusable( false );
2298 _click_to_combobox.setMaximumRowCount( 14 );
2299 _click_to_combobox.setFont( ControlPanel.js_font );
2300 if ( !_configuration.isUseNativeUI() ) {
2301 _click_to_combobox.setBackground( getConfiguration().getGuiBackgroundColor() );
2303 // don't add listener until all items are set (or each one will trigger
2305 // click_to_list.addActionListener(this);
2306 add( _click_to_combobox );
2307 // Correlates option names to titles
2308 _all_click_to_names = new HashMap<Integer, String>();
2309 _click_to_names = new ArrayList<String>();
2313 if ( getMainPanel().getTabbedPane().getTabCount() > 0 ) {
2314 if ( getCurrentTreePanel().isPhyHasBranchLengths()
2315 && ( getCurrentTreePanel().getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) {
2316 setDrawPhylogramEnabled( true );
2317 setDrawPhylogram( isDrawPhylogram() );
2320 setDrawPhylogramEnabled( false );
2321 setDrawPhylogram( false );
2323 if ( getMainPanel().getMainFrame() == null ) {
2324 // Must be "E" applet version.
2325 final ArchaeopteryxE e = ( ArchaeopteryxE ) ( ( MainPanelApplets ) getMainPanel() ).getApplet();
2326 e.setSelectedTypeInTypeMenu( e.getCurrentTreePanel().getPhylogenyGraphicsType() );
2329 getMainPanel().getMainFrame().setSelectedTypeInTypeMenu( getMainPanel().getCurrentTreePanel()
2330 .getPhylogenyGraphicsType() );
2332 getMainPanel().getCurrentTreePanel().updateSubSuperTreeButton();
2333 getMainPanel().getControlPanel().search0();
2334 getMainPanel().getControlPanel().search1();
2335 getMainPanel().getControlPanel().updateDomainStructureEvaluethresholdDisplay();
2336 getSequenceRelationTypeBox().removeAllItems();
2337 for( final SequenceRelation.SEQUENCE_RELATION_TYPE type : getMainPanel().getCurrentPhylogeny()
2338 .getRelevantSequenceRelationTypes() ) {
2339 _sequence_relation_type_box.addItem( type );
2341 getMainPanel().getCurrentTreePanel().repaint();
2342 //setSequenceRelationQueries( getMainPanel().getCurrentPhylogeny().getSequenceRelationQueries() );
2343 // according to GUILHEM the line above can be removed.
2348 * Uncollapse all nodes.
2350 void uncollapseAll( final TreePanel tp ) {
2351 final Phylogeny t = tp.getPhylogeny();
2352 if ( ( t != null ) && !t.isEmpty() ) {
2353 for( final PhylogenyNodeIterator iter = t.iteratorPreorder(); iter.hasNext(); ) {
2354 final PhylogenyNode node = iter.next();
2355 node.setCollapse( false );
2357 tp.resetNodeIdToDistToLeafMap();
2358 tp.updateSetOfCollapsedExternalNodes();
2359 t.recalculateNumberOfExternalDescendants( false );
2360 tp.setNodeInPreorderToNull();
2361 t.clearHashIdToNodeMap();
2366 void updateDomainStructureEvaluethresholdDisplay() {
2367 if ( _domain_structure_evalue_thr_tf != null ) {
2368 _domain_structure_evalue_thr_tf.setText( "10^"
2369 + getMainPanel().getCurrentTreePanel().getDomainStructureEvalueThresholdExp() );
2373 void zoomInX( final float factor, final float x_correction_factor ) {
2374 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar();
2375 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
2376 treepanel.multiplyUrtFactor( 1f );
2377 if ( ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
2378 || ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
2379 || isDrawPhylogram( getMainPanel().getCurrentTabIndex() )
2380 || ( getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP ) ) {
2381 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
2382 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
2383 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
2384 getMainPanel().adjustJScrollPane();
2385 treepanel.resetPreferredSize();
2386 getMainPanel().getCurrentScrollPane().getViewport().validate();
2387 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
2388 - ( sb.getVisibleAmount() / 2.0 ) ) );
2391 final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue();
2392 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
2393 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
2394 getMainPanel().adjustJScrollPane();
2395 treepanel.resetPreferredSize();
2396 getMainPanel().getCurrentScrollPane().getViewport().validate();
2397 sb.setValue( sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount() );
2399 treepanel.resetPreferredSize();
2400 treepanel.updateOvSizes();
2403 void zoomInY( final float factor ) {
2404 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getVerticalScrollBar();
2405 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
2406 treepanel.multiplyUrtFactor( 1.1f );
2407 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
2408 treepanel.setYdistance( ( treepanel.getYdistance() * factor ) );
2409 getMainPanel().adjustJScrollPane();
2410 treepanel.resetPreferredSize();
2411 getMainPanel().getCurrentScrollPane().getViewport().validate();
2412 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
2413 - ( sb.getVisibleAmount() / 2.0 ) ) );
2414 treepanel.resetPreferredSize();
2415 treepanel.updateOvSizes();
2418 void zoomOutX( final float factor, final float x_correction_factor ) {
2419 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
2420 treepanel.multiplyUrtFactor( 1f );
2421 if ( ( treepanel.getXdistance() * factor ) > 0.0 ) {
2422 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar();
2423 if ( ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
2424 || ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
2425 || isDrawPhylogram( getMainPanel().getCurrentTabIndex() )
2426 || ( getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP ) ) {
2427 getMainPanel().adjustJScrollPane();
2428 treepanel.resetPreferredSize();
2429 getMainPanel().getCurrentScrollPane().getViewport().validate();
2430 final double x = ( sb.getMaximum() - sb.getMinimum() )
2431 / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
2432 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
2433 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
2434 getMainPanel().adjustJScrollPane();
2435 treepanel.resetPreferredSize();
2436 getMainPanel().getCurrentScrollPane().getViewport().validate();
2437 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
2438 - ( sb.getVisibleAmount() / 2.0 ) ) );
2441 final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue();
2442 treepanel.setXdistance( treepanel.getXdistance() * factor );
2443 treepanel.setXcorrectionFactor( treepanel.getXcorrectionFactor() * x_correction_factor );
2445 getMainPanel().adjustJScrollPane();
2446 treepanel.resetPreferredSize();
2447 getMainPanel().getCurrentScrollPane().getViewport().validate();
2448 sb.setValue( sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount() );
2451 treepanel.resetPreferredSize();
2452 treepanel.updateOvSizes();
2456 void zoomOutY( final float factor ) {
2457 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
2458 treepanel.multiplyUrtFactor( 0.9f );
2459 if ( ( treepanel.getYdistance() * factor ) > 0.0 ) {
2460 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getVerticalScrollBar();
2461 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
2462 treepanel.setYdistance( ( treepanel.getYdistance() * factor ) );
2463 getMainPanel().adjustJScrollPane();
2464 treepanel.resetPreferredSize();
2465 getMainPanel().getCurrentScrollPane().getViewport().validate();
2466 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
2467 - ( sb.getVisibleAmount() / 2.0 ) ) );
2468 treepanel.resetPreferredSize();
2469 treepanel.updateOvSizes();
2473 static JLabel customizeLabel( final JLabel label, final Configuration configuration ) {
2474 label.setFont( ControlPanel.jcb_bold_font );
2475 if ( !configuration.isUseNativeUI() ) {
2476 label.setForeground( configuration.getGuiCheckboxTextColor() );
2477 label.setBackground( configuration.getGuiBackgroundColor() );