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() ) ) {
1385 if ( recalc_longest_ext_node_info ) {
1386 _mainpanel.getCurrentTreePanel().initNodeData();
1387 _mainpanel.getCurrentTreePanel().calculateLongestExtNodeInfo();
1389 if ( getOptions().isShowOverview() ) {
1390 _mainpanel.getCurrentTreePanel().updateOvSizes();
1392 _mainpanel.getCurrentTreePanel().recalculateMaxDistanceToRoot();
1393 setVisibilityOfDomainStrucureControls();
1394 updateDomainStructureEvaluethresholdDisplay();
1395 _mainpanel.getCurrentTreePanel().calculateScaleDistance();
1396 _mainpanel.getCurrentTreePanel().calcMaxDepth();
1397 _mainpanel.adjustJScrollPane();
1399 _mainpanel.getCurrentTreePanel().repaint();
1400 // _mainpanel.getCurrentTreePanel().setUpUrtFactor();
1404 void endClickToOptions() {
1405 _click_to_combobox.addActionListener( this );
1409 * Indicates what action should be execute when a node is clicked
1411 * @return the click-on action
1413 NodeClickAction getActionWhenNodeClicked() {
1414 return _action_when_node_clicked;
1417 Map<Integer, String> getAllClickToItems() {
1418 return _all_click_to_names;
1421 Map<String, Color> getAnnotationColors() {
1422 return _annotation_colors;
1425 Configuration getConfiguration() {
1426 return _configuration;
1429 TreePanel getCurrentTreePanel() {
1430 return getMainPanel().getCurrentTreePanel();
1433 MainPanel getMainPanel() {
1437 Options getOptions() {
1438 return getMainPanel().getOptions();
1441 JLabel getSearchFoundCountsLabel0() {
1442 return _search_found_label_0;
1445 JLabel getSearchFoundCountsLabel1() {
1446 return _search_found_label_1;
1449 JButton getSearchResetButton0() {
1450 return _search_reset_button_0;
1453 JButton getSearchResetButton1() {
1454 return _search_reset_button_1;
1457 JTextField getSearchTextField0() {
1458 return _search_tf_0;
1461 JTextField getSearchTextField1() {
1462 return _search_tf_1;
1465 Map<String, Color> getSequenceColors() {
1466 return _sequence_colors;
1469 List<String> getSingleClickToNames() {
1470 return _click_to_names;
1473 Map<String, Color> getSpeciesColors() {
1474 return _species_colors;
1477 boolean isAntialiasScreenText() {
1481 boolean isColorAccordingToAnnotation() {
1482 return ( ( _color_according_to_annotation != null ) && _color_according_to_annotation.isSelected() );
1485 boolean isColorAccordingToSequence() {
1486 return ( ( _color_acc_sequence != null ) && _color_acc_sequence.isSelected() );
1489 boolean isColorAccordingToTaxonomy() {
1490 return ( ( _color_acc_species != null ) && _color_acc_species.isSelected() );
1493 boolean isDrawPhylogram() {
1494 return isDrawPhylogram( getMainPanel().getCurrentTabIndex() );
1497 boolean isDynamicallyHideData() {
1498 return ( ( getDynamicallyHideData() != null ) && getDynamicallyHideData().isSelected() );
1501 boolean isEvents() {
1502 return ( ( getShowEventsCb() != null ) && getShowEventsCb().isSelected() );
1505 boolean isNodeDescPopup() {
1506 return ( ( getNodeDescPopupCb() != null ) && getNodeDescPopupCb().isSelected() );
1509 boolean isShowAnnotation() {
1510 return ( ( _show_annotation != null ) && _show_annotation.isSelected() );
1513 boolean isShowBinaryCharacterCounts() {
1514 return ( ( _show_binary_character_counts != null ) && _show_binary_character_counts.isSelected() );
1517 boolean isShowBinaryCharacters() {
1518 return ( ( _show_binary_characters != null ) && _show_binary_characters.isSelected() );
1521 boolean isShowConfidenceValues() {
1522 return ( ( getWriteConfidenceCb() != null ) && getWriteConfidenceCb().isSelected() );
1525 boolean isShowDomainArchitectures() {
1526 return ( ( _show_domain_architectures != null ) && _show_domain_architectures.isSelected() );
1529 boolean isShowGeneNames() {
1530 return ( ( _show_gene_names != null ) && _show_gene_names.isSelected() );
1533 boolean isShowInternalData() {
1534 return ( ( _display_internal_data == null ) || _display_internal_data.isSelected() );
1537 boolean isShowNodeNames() {
1538 return ( ( _show_node_names != null ) && _show_node_names.isSelected() );
1541 boolean isShowSeqNames() {
1542 return ( ( _show_seq_names != null ) && _show_seq_names.isSelected() );
1545 boolean isShowSeqSymbols() {
1546 return ( ( _show_seq_symbols != null ) && _show_seq_symbols.isSelected() );
1549 boolean isShowSequenceAcc() {
1550 return ( ( _show_sequence_acc != null ) && _show_sequence_acc.isSelected() );
1553 boolean isShowSequenceRelationConfidence() {
1554 return ( ( _seq_relation_confidence_switch != null ) && ( _seq_relation_confidence_switch.isSelected() ) );
1557 boolean isShowSequenceRelations() {
1558 return ( ( _show_sequence_relations != null ) && ( _show_sequence_relations.getSelectedIndex() > 0 ) );
1561 boolean isShowTaxonomyCode() {
1562 return ( ( _show_taxo_code != null ) && _show_taxo_code.isSelected() );
1565 boolean isShowTaxonomyCommonNames() {
1566 return ( ( _show_taxo_common_names != null ) && _show_taxo_common_names.isSelected() );
1569 boolean isShowTaxonomyScientificNames() {
1570 return ( ( _show_taxo_scientific_names != null ) && _show_taxo_scientific_names.isSelected() );
1573 boolean isUseVisualStyles() {
1574 return ( ( ( getUseVisualStylesCb() != null ) && getUseVisualStylesCb().isSelected() ) || ( ( getUseVisualStylesCb() == null ) && _color_branches ) );
1577 boolean isWidthBranches() {
1578 return ( ( _width_branches != null ) && _width_branches.isSelected() );
1581 boolean isWriteBranchLengthValues() {
1582 return ( ( _write_branch_length_values != null ) && _write_branch_length_values.isSelected() );
1585 void phylogenyAdded( final Configuration configuration ) {
1586 getIsDrawPhylogramList().add( configuration.isDrawAsPhylogram() );
1589 void phylogenyRemoved( final int index ) {
1590 getIsDrawPhylogramList().remove( index );
1594 final MainPanel main_panel = getMainPanel();
1595 final Phylogeny tree = main_panel.getCurrentPhylogeny();
1596 if ( ( tree == null ) || tree.isEmpty() ) {
1599 String query = getSearchTextField0().getText();
1600 if ( query != null ) {
1601 query = query.trim();
1603 if ( !ForesterUtil.isEmpty( query ) ) {
1604 search0( main_panel, tree, query );
1607 getSearchFoundCountsLabel0().setVisible( false );
1608 getSearchResetButton0().setEnabled( false );
1609 getSearchResetButton0().setVisible( false );
1615 final MainPanel main_panel = getMainPanel();
1616 final Phylogeny tree = main_panel.getCurrentPhylogeny();
1617 if ( ( tree == null ) || tree.isEmpty() ) {
1620 String query = getSearchTextField1().getText();
1621 if ( query != null ) {
1622 query = query.trim();
1624 if ( !ForesterUtil.isEmpty( query ) ) {
1625 search1( main_panel, tree, query );
1628 getSearchFoundCountsLabel1().setVisible( false );
1629 getSearchResetButton1().setEnabled( false );
1630 getSearchResetButton1().setVisible( false );
1635 void searchReset0() {
1636 if ( getMainPanel().getCurrentTreePanel() != null ) {
1637 getMainPanel().getCurrentTreePanel().setFoundNodes0( null );
1641 void searchReset1() {
1642 if ( getMainPanel().getCurrentTreePanel() != null ) {
1643 getMainPanel().getCurrentTreePanel().setFoundNodes1( null );
1647 void setActionWhenNodeClicked( final NodeClickAction action ) {
1648 _action_when_node_clicked = action;
1651 void setAnnotationColors( final Map<String, Color> annotation_colors ) {
1652 _annotation_colors = annotation_colors;
1655 void setCheckbox( final int which, final boolean state ) {
1657 case Configuration.display_as_phylogram:
1658 if ( getDisplayAsPhylogramCb() != null ) {
1659 getDisplayAsPhylogramCb().setSelected( state );
1662 case Configuration.display_internal_data:
1663 if ( _display_internal_data != null ) {
1664 _display_internal_data.setSelected( state );
1667 case Configuration.color_according_to_species:
1668 if ( _color_acc_species != null ) {
1669 _color_acc_species.setSelected( state );
1672 case Configuration.color_according_to_sequence:
1673 if ( _color_acc_sequence != null ) {
1674 _color_acc_sequence.setSelected( state );
1677 case Configuration.color_according_to_annotation:
1678 if ( _color_according_to_annotation != null ) {
1679 _color_according_to_annotation.setSelected( state );
1682 case Configuration.show_node_names:
1683 if ( _show_node_names != null ) {
1684 _show_node_names.setSelected( state );
1687 case Configuration.show_taxonomy_scientific_names:
1688 if ( _show_taxo_scientific_names != null ) {
1689 _show_taxo_scientific_names.setSelected( state );
1692 case Configuration.show_taxonomy_common_names:
1693 if ( _show_taxo_common_names != null ) {
1694 _show_taxo_common_names.setSelected( state );
1697 case Configuration.show_tax_code:
1698 if ( _show_taxo_code != null ) {
1699 _show_taxo_code.setSelected( state );
1702 case Configuration.show_taxonomy_images:
1703 if ( _show_taxo_images_cb != null ) {
1704 _show_taxo_images_cb.setSelected( state );
1707 case Configuration.show_annotation:
1708 if ( _show_annotation != null ) {
1709 _show_annotation.setSelected( state );
1712 case Configuration.show_binary_characters:
1713 if ( _show_binary_characters != null ) {
1714 _show_binary_characters.setSelected( state );
1717 case Configuration.show_binary_character_counts:
1718 if ( _show_binary_character_counts != null ) {
1719 _show_binary_character_counts.setSelected( state );
1722 case Configuration.write_confidence_values:
1723 if ( getWriteConfidenceCb() != null ) {
1724 getWriteConfidenceCb().setSelected( state );
1727 case Configuration.write_events:
1728 if ( getShowEventsCb() != null ) {
1729 getShowEventsCb().setSelected( state );
1732 case Configuration.use_style:
1733 if ( getUseVisualStylesCb() != null ) {
1734 getUseVisualStylesCb().setSelected( state );
1737 case Configuration.width_branches:
1738 if ( _width_branches != null ) {
1739 _width_branches.setSelected( state );
1742 case Configuration.show_domain_architectures:
1743 if ( _show_domain_architectures != null ) {
1744 _show_domain_architectures.setSelected( state );
1747 case Configuration.write_branch_length_values:
1748 if ( _write_branch_length_values != null ) {
1749 _write_branch_length_values.setSelected( state );
1752 case Configuration.show_mol_seqs:
1753 if ( _show_mol_seqs != null ) {
1754 _show_mol_seqs.setSelected( state );
1757 case Configuration.show_seq_names:
1758 if ( _show_seq_names != null ) {
1759 _show_seq_names.setSelected( state );
1762 case Configuration.show_gene_names:
1763 if ( _show_gene_names != null ) {
1764 _show_gene_names.setSelected( state );
1767 case Configuration.show_seq_symbols:
1768 if ( _show_seq_symbols != null ) {
1769 _show_seq_symbols.setSelected( state );
1772 case Configuration.show_vector_data:
1773 if ( _show_vector_data_cb != null ) {
1774 _show_vector_data_cb.setSelected( state );
1777 case Configuration.show_properties:
1778 if ( _show_properties_cb != null ) {
1779 _show_properties_cb.setSelected( state );
1782 case Configuration.show_sequence_acc:
1783 if ( _show_sequence_acc != null ) {
1784 _show_sequence_acc.setSelected( state );
1787 case Configuration.dynamically_hide_data:
1788 if ( getDynamicallyHideData() != null ) {
1789 getDynamicallyHideData().setSelected( state );
1792 case Configuration.node_data_popup:
1793 if ( getNodeDescPopupCb() != null ) {
1794 getNodeDescPopupCb().setSelected( state );
1798 case Configuration.show_relation_confidence:
1799 if ( _seq_relation_confidence_switch != null ) {
1800 _seq_relation_confidence_switch.setSelected( state );
1805 throw new AssertionError( "unknown checkbox: " + which );
1810 * Set this checkbox state. Not all checkboxes have been instantiated
1811 * depending on the config.
1813 void setCheckbox( final JCheckBox cb, final boolean state ) {
1815 cb.setSelected( state );
1819 void setClickToAction( final int action ) {
1820 // Set click-to action
1821 if ( action == _show_data_item ) {
1822 setActionWhenNodeClicked( NodeClickAction.SHOW_DATA );
1824 else if ( action == _collapse_cb_item ) {
1825 setActionWhenNodeClicked( NodeClickAction.COLLAPSE );
1827 else if ( action == _reroot_cb_item ) {
1828 setActionWhenNodeClicked( NodeClickAction.REROOT );
1830 else if ( action == _subtree_cb_item ) {
1831 setActionWhenNodeClicked( NodeClickAction.SUBTREE );
1833 else if ( action == _swap_cb_item ) {
1834 setActionWhenNodeClicked( NodeClickAction.SWAP );
1836 else if ( action == _color_subtree_cb_item ) {
1837 setActionWhenNodeClicked( NodeClickAction.COLOR_SUBTREE );
1839 else if ( action == _open_seq_web_item ) {
1840 setActionWhenNodeClicked( NodeClickAction.OPEN_SEQ_WEB );
1842 else if ( action == _sort_descendents_item ) {
1843 setActionWhenNodeClicked( NodeClickAction.SORT_DESCENDENTS );
1845 else if ( action == _blast_item ) {
1846 setActionWhenNodeClicked( NodeClickAction.BLAST );
1848 else if ( action == _open_tax_web_item ) {
1849 setActionWhenNodeClicked( NodeClickAction.OPEN_TAX_WEB );
1851 else if ( action == _cut_subtree_item ) {
1852 setActionWhenNodeClicked( NodeClickAction.CUT_SUBTREE );
1854 else if ( action == _copy_subtree_item ) {
1855 setActionWhenNodeClicked( NodeClickAction.COPY_SUBTREE );
1857 else if ( action == _delete_node_or_subtree_item ) {
1858 setActionWhenNodeClicked( NodeClickAction.DELETE_NODE_OR_SUBTREE );
1860 else if ( action == _paste_subtree_item ) {
1861 setActionWhenNodeClicked( NodeClickAction.PASTE_SUBTREE );
1863 else if ( action == _add_new_node_item ) {
1864 setActionWhenNodeClicked( NodeClickAction.ADD_NEW_NODE );
1866 else if ( action == _edit_node_data_item ) {
1867 setActionWhenNodeClicked( NodeClickAction.EDIT_NODE_DATA );
1869 else if ( action == _select_nodes_item ) {
1870 setActionWhenNodeClicked( NodeClickAction.SELECT_NODES );
1872 else if ( action == _get_ext_desc_data ) {
1873 setActionWhenNodeClicked( NodeClickAction.GET_EXT_DESC_DATA );
1875 else if ( action == _open_pdb_item ) {
1876 setActionWhenNodeClicked( NodeClickAction.OPEN_PDB_WEB );
1878 else if ( action == _color_node_font_item ) {
1879 setActionWhenNodeClicked( NodeClickAction.COLOR_NODE_FONT );
1881 else if ( action == _change_node_font_item ) {
1882 setActionWhenNodeClicked( NodeClickAction.CHANGE_NODE_FONT );
1885 throw new RuntimeException( "unknown action: " + action );
1887 // make sure drop down is displaying the correct action
1888 // in case this was called from outside the class
1889 _click_to_combobox.setSelectedIndex( action );
1892 void setColorBranches( final boolean color_branches ) {
1893 _color_branches = color_branches;
1896 void setDrawPhylogram( final boolean b ) {
1897 getDisplayAsPhylogramCb().setSelected( b );
1898 setDrawPhylogram( getMainPanel().getCurrentTabIndex(), b );
1901 void setDrawPhylogramEnabled( final boolean b ) {
1902 getDisplayAsPhylogramCb().setEnabled( b );
1905 void setDynamicHidingIsOn( final boolean is_on ) {
1907 getDynamicallyHideData().setForeground( getConfiguration().getGuiCheckboxAndButtonActiveColor() );
1910 if ( !_configuration.isUseNativeUI() ) {
1911 getDynamicallyHideData().setForeground( getConfiguration().getGuiButtonTextColor() );
1914 getDynamicallyHideData().setForeground( Color.BLACK );
1919 void setSearchFoundCountsOnLabel0( final int counts ) {
1920 getSearchFoundCountsLabel0().setText( "Found: " + counts );
1923 void setSearchFoundCountsOnLabel1( final int counts ) {
1924 getSearchFoundCountsLabel1().setText( "Found: " + counts );
1927 void setSequenceColors( final Map<String, Color> sequence_colors ) {
1928 _sequence_colors = sequence_colors;
1931 void setShowEvents( final boolean show_events ) {
1932 if ( getShowEventsCb() == null ) {
1933 _show_events = new JCheckBox( "" );
1935 getShowEventsCb().setSelected( show_events );
1938 void setSpeciesColors( final Map<String, Color> species_colors ) {
1939 _species_colors = species_colors;
1942 void setupControls() {
1943 // The tree display options:
1944 setupDisplayCheckboxes();
1946 // The sequence relation query selection combo-box
1947 if ( _configuration.displaySequenceRelations() ) {
1948 addSequenceRelationBlock();
1952 startClickToOptions();
1953 setupClickToOptions();
1954 endClickToOptions();
1955 // Zoom and quick edit buttons
1957 setupSearchTools0();
1958 setupSearchTools1();
1961 void setUpControlsForDomainStrucures() {
1962 _domain_display_label = new JLabel( "Domain Architectures:" );
1963 add( customizeLabel( _domain_display_label, getConfiguration() ) );
1964 add( _domain_display_label );
1965 _zoom_in_domain_structure = new JButton( "d+" );
1966 _zoom_out_domain_structure = new JButton( "d-" );
1967 _decr_domain_structure_evalue_thr = new JButton( "-" );
1968 _incr_domain_structure_evalue_thr = new JButton( "+" );
1969 _zoom_in_domain_structure.setPreferredSize( new Dimension( 10, 10 ) );
1970 _zoom_out_domain_structure.setPreferredSize( new Dimension( 10, 10 ) );
1971 _decr_domain_structure_evalue_thr.setPreferredSize( new Dimension( 10, 10 ) );
1972 _incr_domain_structure_evalue_thr.setPreferredSize( new Dimension( 10, 10 ) );
1973 _incr_domain_structure_evalue_thr.setToolTipText( "Increase the E-value threshold by a factor of 10" );
1974 _decr_domain_structure_evalue_thr.setToolTipText( "Decrease the E-value threshold by a factor of 10" );
1975 _domain_structure_evalue_thr_tf = new JTextField( 3 );
1976 _domain_structure_evalue_thr_tf.setEditable( false );
1977 if ( !getConfiguration().isUseNativeUI() ) {
1978 _domain_structure_evalue_thr_tf.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
1979 _domain_structure_evalue_thr_tf.setBackground( getConfiguration().getGuiCheckboxTextColor() );
1980 _domain_structure_evalue_thr_tf.setBorder( null );
1982 final JPanel d1_panel = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
1983 final JPanel d2_panel = new JPanel( new GridLayout( 1, 3, 0, 0 ) );
1984 if ( !_configuration.isUseNativeUI() ) {
1985 d1_panel.setBackground( getBackground() );
1986 d2_panel.setBackground( getBackground() );
1990 addJButton( _zoom_out_domain_structure, d1_panel );
1991 addJButton( _zoom_in_domain_structure, d1_panel );
1992 addJButton( _decr_domain_structure_evalue_thr, d2_panel );
1993 addJTextField( _domain_structure_evalue_thr_tf, d2_panel );
1994 addJButton( _incr_domain_structure_evalue_thr, d2_panel );
1997 void setupSearchTools0() {
1998 final JLabel search_label = new JLabel( "Search (A):" );
1999 search_label.setFont( ControlPanel.jcb_bold_font );
2000 if ( !getConfiguration().isUseNativeUI() ) {
2001 search_label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
2003 add( search_label );
2004 search_label.setToolTipText( SEARCH_TIP_TEXT );
2005 _search_found_label_0 = new JLabel();
2006 getSearchFoundCountsLabel0().setVisible( false );
2007 _search_found_label_0.setFont( ControlPanel.jcb_bold_font );
2008 if ( !getConfiguration().isUseNativeUI() ) {
2009 _search_found_label_0.setForeground( getConfiguration().getGuiCheckboxTextColor() );
2011 _search_tf_0 = new JTextField( 3 );
2012 _search_tf_0.setToolTipText( SEARCH_TIP_TEXT );
2013 _search_tf_0.setEditable( true );
2014 if ( !getConfiguration().isUseNativeUI() ) {
2015 _search_tf_0.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
2016 _search_tf_0.setBackground( getConfiguration().getGuiCheckboxTextColor() );
2017 _search_tf_0.setBorder( null );
2019 _search_reset_button_0 = new JButton();
2020 getSearchResetButton0().setText( "Reset" );
2021 getSearchResetButton0().setEnabled( false );
2022 getSearchResetButton0().setVisible( false );
2023 final JPanel s_panel_1 = new JPanel( new BorderLayout() );
2024 final JPanel s_panel_2 = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
2025 s_panel_1.setBackground( getBackground() );
2027 s_panel_2.setBackground( getBackground() );
2029 final KeyAdapter key_adapter = new KeyAdapter() {
2032 public void keyReleased( final KeyEvent key_event ) {
2034 displayedPhylogenyMightHaveChanged( true );
2037 final ActionListener action_listener = new ActionListener() {
2040 public void actionPerformed( final ActionEvent e ) {
2042 setSearchFoundCountsOnLabel0( 0 );
2043 getSearchFoundCountsLabel0().setVisible( false );
2044 getSearchTextField0().setText( "" );
2045 getSearchResetButton0().setEnabled( false );
2046 getSearchResetButton0().setVisible( false );
2047 displayedPhylogenyMightHaveChanged( true );
2050 _search_reset_button_0.addActionListener( action_listener );
2051 _search_tf_0.addKeyListener( key_adapter );
2052 addJTextField( _search_tf_0, s_panel_1 );
2053 s_panel_2.add( _search_found_label_0 );
2054 addJButton( _search_reset_button_0, s_panel_2 );
2057 void setupSearchTools1() {
2058 final JLabel search_label = new JLabel( "Search (B):" );
2059 search_label.setFont( ControlPanel.jcb_bold_font );
2060 if ( !getConfiguration().isUseNativeUI() ) {
2061 search_label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
2063 add( search_label );
2064 search_label.setToolTipText( SEARCH_TIP_TEXT );
2065 _search_found_label_1 = new JLabel();
2066 getSearchFoundCountsLabel1().setVisible( false );
2067 _search_found_label_1.setFont( ControlPanel.jcb_bold_font );
2068 if ( !getConfiguration().isUseNativeUI() ) {
2069 _search_found_label_1.setForeground( getConfiguration().getGuiCheckboxTextColor() );
2071 _search_tf_1 = new JTextField( 3 );
2072 _search_tf_1.setToolTipText( SEARCH_TIP_TEXT );
2073 _search_tf_1.setEditable( true );
2074 if ( !getConfiguration().isUseNativeUI() ) {
2075 _search_tf_1.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
2076 _search_tf_1.setBackground( getConfiguration().getGuiCheckboxTextColor() );
2077 _search_tf_1.setBorder( null );
2079 _search_reset_button_1 = new JButton();
2080 getSearchResetButton1().setText( "Reset" );
2081 getSearchResetButton1().setEnabled( false );
2082 getSearchResetButton1().setVisible( false );
2083 final JPanel s_panel_1 = new JPanel( new BorderLayout() );
2084 final JPanel s_panel_2 = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
2085 s_panel_1.setBackground( getBackground() );
2087 s_panel_2.setBackground( getBackground() );
2089 final KeyAdapter key_adapter = new KeyAdapter() {
2092 public void keyReleased( final KeyEvent key_event ) {
2094 displayedPhylogenyMightHaveChanged( true );
2097 final ActionListener action_listener = new ActionListener() {
2100 public void actionPerformed( final ActionEvent e ) {
2102 setSearchFoundCountsOnLabel1( 0 );
2103 getSearchFoundCountsLabel1().setVisible( false );
2104 getSearchTextField1().setText( "" );
2105 getSearchResetButton1().setEnabled( false );
2106 getSearchResetButton1().setVisible( false );
2107 displayedPhylogenyMightHaveChanged( true );
2110 _search_reset_button_1.addActionListener( action_listener );
2111 _search_tf_1.addKeyListener( key_adapter );
2112 addJTextField( _search_tf_1, s_panel_1 );
2113 s_panel_2.add( _search_found_label_1 );
2114 addJButton( _search_reset_button_1, s_panel_2 );
2117 void setVisibilityOfDomainStrucureCB() {
2119 if ( ( getCurrentTreePanel() != null )
2120 && ( ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) || ( getCurrentTreePanel()
2121 .getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) ) {
2122 if ( getMainPanel().getMainFrame()._right_line_up_domains_cbmi != null ) {
2123 getMainPanel().getMainFrame()._right_line_up_domains_cbmi.setVisible( false );
2125 if ( getMainPanel().getMainFrame()._show_domain_labels != null ) {
2126 getMainPanel().getMainFrame()._show_domain_labels.setVisible( false );
2129 else if ( isShowDomainArchitectures() ) {
2130 if ( getMainPanel().getMainFrame()._right_line_up_domains_cbmi != null ) {
2131 getMainPanel().getMainFrame()._right_line_up_domains_cbmi.setVisible( true );
2133 if ( getMainPanel().getMainFrame()._show_domain_labels != null ) {
2134 getMainPanel().getMainFrame()._show_domain_labels.setVisible( true );
2138 if ( getMainPanel().getMainFrame()._right_line_up_domains_cbmi != null ) {
2139 getMainPanel().getMainFrame()._right_line_up_domains_cbmi.setVisible( false );
2141 if ( getMainPanel().getMainFrame()._show_domain_labels != null ) {
2142 getMainPanel().getMainFrame()._show_domain_labels.setVisible( false );
2146 catch ( final Exception ignore ) {
2151 void setVisibilityOfX() {
2152 final MainFrame mf = getMainFrame();
2154 if ( ( getCurrentTreePanel() != null ) && ( getCurrentTreePanel().getPhylogeny() != null ) ) {
2155 if ( AptxUtil.isHasAtLeastOneBranchWithSupportSD( getCurrentTreePanel().getPhylogeny() ) ) {
2156 if ( mf._show_confidence_stddev_cbmi != null ) {
2157 mf._show_confidence_stddev_cbmi.setVisible( true );
2161 if ( mf._show_confidence_stddev_cbmi != null ) {
2162 mf._show_confidence_stddev_cbmi.setVisible( false );
2165 if ( AptxUtil.isHasAtLeastOneNodeWithScientificName( getCurrentTreePanel().getPhylogeny() ) ) {
2166 if ( mf._abbreviate_scientific_names != null ) {
2167 mf._abbreviate_scientific_names.setVisible( true );
2171 if ( mf._abbreviate_scientific_names != null ) {
2172 mf._abbreviate_scientific_names.setVisible( false );
2175 if ( AptxUtil.isHasAtLeastOneNodeWithSequenceAnnotation( getCurrentTreePanel().getPhylogeny() ) ) {
2176 if ( mf._show_annotation_ref_source != null ) {
2177 mf._show_annotation_ref_source.setVisible( true );
2181 if ( mf._show_annotation_ref_source != null ) {
2182 mf._show_annotation_ref_source.setVisible( false );
2186 if ( isDrawPhylogram()
2187 || ( ( getCurrentTreePanel() != null ) && ( ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) || ( getCurrentTreePanel()
2188 .getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) ) ) {
2189 if ( mf._non_lined_up_cladograms_rbmi != null ) {
2190 mf._non_lined_up_cladograms_rbmi.setVisible( false );
2192 if ( mf._uniform_cladograms_rbmi != null ) {
2193 mf._uniform_cladograms_rbmi.setVisible( false );
2195 if ( mf._ext_node_dependent_cladogram_rbmi != null ) {
2196 mf._ext_node_dependent_cladogram_rbmi.setVisible( false );
2200 if ( mf._non_lined_up_cladograms_rbmi != null ) {
2201 mf._non_lined_up_cladograms_rbmi.setVisible( true );
2203 if ( mf._uniform_cladograms_rbmi != null ) {
2204 mf._uniform_cladograms_rbmi.setVisible( true );
2206 if ( mf._ext_node_dependent_cladogram_rbmi != null ) {
2207 mf._ext_node_dependent_cladogram_rbmi.setVisible( true );
2210 if ( isDrawPhylogram() ) {
2211 if ( mf._show_scale_cbmi != null ) {
2212 mf._show_scale_cbmi.setVisible( true );
2216 if ( mf._show_scale_cbmi != null ) {
2217 mf._show_scale_cbmi.setVisible( false );
2220 if ( getCurrentTreePanel() != null ) {
2221 if ( ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
2222 || ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) {
2223 if ( mf._label_direction_cbmi != null ) {
2224 mf._label_direction_cbmi.setVisible( true );
2228 if ( mf._label_direction_cbmi != null ) {
2229 mf._label_direction_cbmi.setVisible( false );
2236 void showAnnotations() {
2237 if ( _show_annotation != null ) {
2238 _show_annotation.setSelected( true );
2240 if ( _color_according_to_annotation != null ) {
2241 _color_according_to_annotation.setSelected( true );
2243 if ( _color_acc_species != null ) {
2244 _color_acc_species.setSelected( false );
2246 if ( _color_acc_sequence != null ) {
2247 _color_acc_sequence.setSelected( false );
2249 _mainpanel.getCurrentTreePanel().repaint();
2253 * Fit entire tree into window.
2256 if ( ( _mainpanel.getCurrentScrollPane() == null ) || _mainpanel.getCurrentTreePanel().getPhylogeny().isEmpty() ) {
2259 getCurrentTreePanel().updateSetOfCollapsedExternalNodes();
2260 displayedPhylogenyMightHaveChanged( true );
2261 _mainpanel.getCurrentTreePanel().updateOvSettings();
2262 _mainpanel.getCurrentTreePanel().validate();
2263 _mainpanel.validate();
2264 _mainpanel.getCurrentTreePanel().calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
2265 _mainpanel.getSizeOfViewport().height );
2266 _mainpanel.getCurrentTreePanel().resetPreferredSize();
2267 _mainpanel.adjustJScrollPane();
2268 _mainpanel.getCurrentTreePanel().repaint();
2269 _mainpanel.getCurrentTreePanel().validate();
2270 _mainpanel.validate();
2271 _mainpanel.getCurrentTreePanel().calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
2272 _mainpanel.getSizeOfViewport().height );
2273 _mainpanel.getCurrentTreePanel().resetPreferredSize();
2274 _mainpanel.adjustJScrollPane();
2275 _mainpanel.getCurrentTreePanel().repaint();
2276 _mainpanel.getCurrentTreePanel().updateOvSizes();
2279 void showWholeAll() {
2280 for( final TreePanel tree_panel : _mainpanel.getTreePanels() ) {
2281 if ( tree_panel != null ) {
2282 tree_panel.validate();
2283 tree_panel.calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
2284 _mainpanel.getSizeOfViewport().height );
2285 tree_panel.resetPreferredSize();
2286 tree_panel.repaint();
2291 // Create header for click-to combo box.
2292 void startClickToOptions() {
2293 final JLabel spacer = new JLabel( "" );
2294 spacer.setFont( ControlPanel.jcb_font );
2296 _click_to_label = new JLabel( "Click on Node to:" );
2297 add( customizeLabel( _click_to_label, getConfiguration() ) );
2298 _click_to_combobox = new JComboBox<String>();
2299 _click_to_combobox.setFocusable( false );
2300 _click_to_combobox.setMaximumRowCount( 14 );
2301 _click_to_combobox.setFont( ControlPanel.js_font );
2302 if ( !_configuration.isUseNativeUI() ) {
2303 _click_to_combobox.setBackground( getConfiguration().getGuiBackgroundColor() );
2305 // don't add listener until all items are set (or each one will trigger
2307 // click_to_list.addActionListener(this);
2308 add( _click_to_combobox );
2309 // Correlates option names to titles
2310 _all_click_to_names = new HashMap<Integer, String>();
2311 _click_to_names = new ArrayList<String>();
2315 if ( getMainPanel().getTabbedPane().getTabCount() > 0 ) {
2316 if ( getCurrentTreePanel().isPhyHasBranchLengths()
2317 && ( getCurrentTreePanel().getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) {
2318 setDrawPhylogramEnabled( true );
2319 setDrawPhylogram( isDrawPhylogram() );
2322 setDrawPhylogramEnabled( false );
2323 setDrawPhylogram( false );
2325 if ( getMainPanel().getMainFrame() == null ) {
2326 // Must be "E" applet version.
2327 final ArchaeopteryxE e = ( ArchaeopteryxE ) ( ( MainPanelApplets ) getMainPanel() ).getApplet();
2328 e.setSelectedTypeInTypeMenu( e.getCurrentTreePanel().getPhylogenyGraphicsType() );
2331 getMainPanel().getMainFrame().setSelectedTypeInTypeMenu( getMainPanel().getCurrentTreePanel()
2332 .getPhylogenyGraphicsType() );
2334 getMainPanel().getCurrentTreePanel().updateSubSuperTreeButton();
2335 getMainPanel().getControlPanel().search0();
2336 getMainPanel().getControlPanel().search1();
2337 getMainPanel().getControlPanel().updateDomainStructureEvaluethresholdDisplay();
2338 getSequenceRelationTypeBox().removeAllItems();
2339 for( final SequenceRelation.SEQUENCE_RELATION_TYPE type : getMainPanel().getCurrentPhylogeny()
2340 .getRelevantSequenceRelationTypes() ) {
2341 _sequence_relation_type_box.addItem( type );
2343 getMainPanel().getCurrentTreePanel().repaint();
2344 //setSequenceRelationQueries( getMainPanel().getCurrentPhylogeny().getSequenceRelationQueries() );
2345 // according to GUILHEM the line above can be removed.
2350 * Uncollapse all nodes.
2352 void uncollapseAll( final TreePanel tp ) {
2353 final Phylogeny t = tp.getPhylogeny();
2354 if ( ( t != null ) && !t.isEmpty() ) {
2355 for( final PhylogenyNodeIterator iter = t.iteratorPreorder(); iter.hasNext(); ) {
2356 final PhylogenyNode node = iter.next();
2357 node.setCollapse( false );
2359 tp.resetNodeIdToDistToLeafMap();
2360 tp.updateSetOfCollapsedExternalNodes();
2361 t.recalculateNumberOfExternalDescendants( false );
2362 tp.setNodeInPreorderToNull();
2363 t.clearHashIdToNodeMap();
2368 void updateDomainStructureEvaluethresholdDisplay() {
2369 if ( _domain_structure_evalue_thr_tf != null ) {
2370 _domain_structure_evalue_thr_tf.setText( "10^"
2371 + getMainPanel().getCurrentTreePanel().getDomainStructureEvalueThresholdExp() );
2375 void zoomInX( final float factor, final float x_correction_factor ) {
2376 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar();
2377 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
2378 treepanel.multiplyUrtFactor( 1f );
2379 if ( ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
2380 || ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
2381 || isDrawPhylogram( getMainPanel().getCurrentTabIndex() )
2382 || ( getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP ) ) {
2383 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
2384 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
2385 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
2386 getMainPanel().adjustJScrollPane();
2387 treepanel.resetPreferredSize();
2388 getMainPanel().getCurrentScrollPane().getViewport().validate();
2389 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
2390 - ( sb.getVisibleAmount() / 2.0 ) ) );
2393 final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue();
2394 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
2395 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
2396 getMainPanel().adjustJScrollPane();
2397 treepanel.resetPreferredSize();
2398 getMainPanel().getCurrentScrollPane().getViewport().validate();
2399 sb.setValue( sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount() );
2401 treepanel.resetPreferredSize();
2402 treepanel.updateOvSizes();
2405 void zoomInY( final float factor ) {
2406 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getVerticalScrollBar();
2407 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
2408 treepanel.multiplyUrtFactor( 1.1f );
2409 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
2410 treepanel.setYdistance( ( treepanel.getYdistance() * factor ) );
2411 getMainPanel().adjustJScrollPane();
2412 treepanel.resetPreferredSize();
2413 getMainPanel().getCurrentScrollPane().getViewport().validate();
2414 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
2415 - ( sb.getVisibleAmount() / 2.0 ) ) );
2416 treepanel.resetPreferredSize();
2417 treepanel.updateOvSizes();
2420 void zoomOutX( final float factor, final float x_correction_factor ) {
2421 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
2422 treepanel.multiplyUrtFactor( 1f );
2423 if ( ( treepanel.getXdistance() * factor ) > 0.0 ) {
2424 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar();
2425 if ( ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
2426 || ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
2427 || isDrawPhylogram( getMainPanel().getCurrentTabIndex() )
2428 || ( getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP ) ) {
2429 getMainPanel().adjustJScrollPane();
2430 treepanel.resetPreferredSize();
2431 getMainPanel().getCurrentScrollPane().getViewport().validate();
2432 final double x = ( sb.getMaximum() - sb.getMinimum() )
2433 / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
2434 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
2435 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
2436 getMainPanel().adjustJScrollPane();
2437 treepanel.resetPreferredSize();
2438 getMainPanel().getCurrentScrollPane().getViewport().validate();
2439 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
2440 - ( sb.getVisibleAmount() / 2.0 ) ) );
2443 final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue();
2444 treepanel.setXdistance( treepanel.getXdistance() * factor );
2445 treepanel.setXcorrectionFactor( treepanel.getXcorrectionFactor() * x_correction_factor );
2447 getMainPanel().adjustJScrollPane();
2448 treepanel.resetPreferredSize();
2449 getMainPanel().getCurrentScrollPane().getViewport().validate();
2450 sb.setValue( sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount() );
2453 treepanel.resetPreferredSize();
2454 treepanel.updateOvSizes();
2458 void zoomOutY( final float factor ) {
2459 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
2460 treepanel.multiplyUrtFactor( 0.9f );
2461 if ( ( treepanel.getYdistance() * factor ) > 0.0 ) {
2462 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getVerticalScrollBar();
2463 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
2464 treepanel.setYdistance( ( treepanel.getYdistance() * factor ) );
2465 getMainPanel().adjustJScrollPane();
2466 treepanel.resetPreferredSize();
2467 getMainPanel().getCurrentScrollPane().getViewport().validate();
2468 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
2469 - ( sb.getVisibleAmount() / 2.0 ) ) );
2470 treepanel.resetPreferredSize();
2471 treepanel.updateOvSizes();
2475 static JLabel customizeLabel( final JLabel label, final Configuration configuration ) {
2476 label.setFont( ControlPanel.jcb_bold_font );
2477 if ( !configuration.isUseNativeUI() ) {
2478 label.setForeground( configuration.getGuiCheckboxTextColor() );
2479 label.setBackground( configuration.getGuiBackgroundColor() );