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( Constants.BUTTON_ZOOM_IN_FACTOR, Constants.BUTTON_ZOOM_IN_X_CORRECTION_FACTOR );
264 displayedPhylogenyMightHaveChanged( false );
266 else if ( e.getSource() == _zoom_in_y ) {
267 zoomInY( Constants.BUTTON_ZOOM_IN_FACTOR );
268 displayedPhylogenyMightHaveChanged( false );
270 else if ( e.getSource() == _zoom_out_x ) {
271 zoomOutX( Constants.BUTTON_ZOOM_OUT_FACTOR, Constants.BUTTON_ZOOM_OUT_X_CORRECTION_FACTOR );
272 displayedPhylogenyMightHaveChanged( false );
274 else if ( e.getSource() == _zoom_out_y ) {
275 zoomOutY( Constants.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
554 private List<Boolean> getIsDrawPhylogramList() {
555 return _draw_phylogram;
558 // This takes care of ArchaeopteryxE-issue.
559 // Can, and will, return null prior to ArchaeopteryxE initialization completion.
560 final private MainFrame getMainFrame() {
561 MainFrame mf = getMainPanel().getMainFrame();
563 // Must be "E" applet version.
564 final ArchaeopteryxE e = ( ArchaeopteryxE ) ( ( MainPanelApplets ) getMainPanel() ).getApplet();
565 if ( e.getMainPanel() == null ) {
568 mf = e.getMainPanel().getMainFrame();
573 private void init() {
574 _draw_phylogram = new ArrayList<Boolean>();
575 setSpeciesColors( new HashMap<String, Color>() );
576 setSequenceColors( new HashMap<String, Color>() );
577 setAnnotationColors( new HashMap<String, Color>() );
580 private boolean isDrawPhylogram( final int index ) {
581 return getIsDrawPhylogramList().get( index );
584 private void search0( final MainPanel main_panel, final Phylogeny tree, final String query_str ) {
585 getSearchFoundCountsLabel0().setVisible( true );
586 getSearchResetButton0().setEnabled( true );
587 getSearchResetButton0().setVisible( true );
588 String[] queries = null;
589 Set<PhylogenyNode> nodes = null;
590 if ( ( query_str.indexOf( ',' ) >= 0 ) && !getOptions().isSearchWithRegex() ) {
591 queries = query_str.split( ",+" );
594 queries = new String[ 1 ];
595 queries[ 0 ] = query_str.trim();
597 if ( ( queries != null ) && ( queries.length > 0 ) ) {
598 nodes = new HashSet<PhylogenyNode>();
599 for( String query : queries ) {
600 if ( ForesterUtil.isEmpty( query ) ) {
603 query = query.trim();
604 final TreePanel tp = getMainPanel().getCurrentTreePanel();
605 if ( ( query.indexOf( '+' ) > 0 ) && !getOptions().isSearchWithRegex() ) {
606 nodes.addAll( PhylogenyMethods.searchDataLogicalAnd( query.split( "\\++" ),
608 getOptions().isSearchCaseSensitive(),
609 !getOptions().isMatchWholeTermsOnly(),
610 isShowDomainArchitectures(),
611 tp != null ? Math.pow( 10,
612 tp.getDomainStructureEvalueThresholdExp() )
616 nodes.addAll( PhylogenyMethods.searchData( query,
618 getOptions().isSearchCaseSensitive(),
619 !getOptions().isMatchWholeTermsOnly(),
620 getOptions().isSearchWithRegex(),
621 isShowDomainArchitectures(),
622 tp != null ? Math.pow( 10, tp
623 .getDomainStructureEvalueThresholdExp() ) : 0 ) );
626 if ( getOptions().isInverseSearchResult() ) {
627 final List<PhylogenyNode> all = PhylogenyMethods.obtainAllNodesAsList( tree );
628 all.removeAll( nodes );
629 nodes = new HashSet<PhylogenyNode>();
633 if ( ( nodes != null ) && ( nodes.size() > 0 ) ) {
634 main_panel.getCurrentTreePanel().setFoundNodes0( new HashSet<Long>() );
635 for( final PhylogenyNode node : nodes ) {
636 main_panel.getCurrentTreePanel().getFoundNodes0().add( node.getId() );
638 setSearchFoundCountsOnLabel0( nodes.size() );
641 setSearchFoundCountsOnLabel0( 0 );
646 private void search1( final MainPanel main_panel, final Phylogeny tree, final String query_str ) {
647 getSearchFoundCountsLabel1().setVisible( true );
648 getSearchResetButton1().setEnabled( true );
649 getSearchResetButton1().setVisible( true );
650 String[] queries = null;
651 Set<PhylogenyNode> nodes = null;
652 if ( ( query_str.indexOf( ',' ) >= 0 ) && !getOptions().isSearchWithRegex() ) {
653 queries = query_str.split( ",+" );
656 queries = new String[ 1 ];
657 queries[ 0 ] = query_str.trim();
659 if ( ( queries != null ) && ( queries.length > 0 ) ) {
660 nodes = new HashSet<PhylogenyNode>();
661 for( String query : queries ) {
662 if ( ForesterUtil.isEmpty( query ) ) {
665 query = query.trim();
666 final TreePanel tp = getMainPanel().getCurrentTreePanel();
667 if ( ( query.indexOf( '+' ) > 0 ) && !getOptions().isSearchWithRegex() ) {
668 nodes.addAll( PhylogenyMethods.searchDataLogicalAnd( query.split( "\\++" ),
670 getOptions().isSearchCaseSensitive(),
671 !getOptions().isMatchWholeTermsOnly(),
672 isShowDomainArchitectures(),
673 tp != null ? Math.pow( 10,
674 tp.getDomainStructureEvalueThresholdExp() )
678 nodes.addAll( PhylogenyMethods.searchData( query,
680 getOptions().isSearchCaseSensitive(),
681 !getOptions().isMatchWholeTermsOnly(),
682 getOptions().isSearchWithRegex(),
683 isShowDomainArchitectures(),
684 tp != null ? Math.pow( 10, tp
685 .getDomainStructureEvalueThresholdExp() ) : 0 ) );
688 if ( getOptions().isInverseSearchResult() ) {
689 final List<PhylogenyNode> all = PhylogenyMethods.obtainAllNodesAsList( tree );
690 all.removeAll( nodes );
691 nodes = new HashSet<PhylogenyNode>();
695 if ( ( nodes != null ) && ( nodes.size() > 0 ) ) {
696 main_panel.getCurrentTreePanel().setFoundNodes1( new HashSet<Long>() );
697 for( final PhylogenyNode node : nodes ) {
698 main_panel.getCurrentTreePanel().getFoundNodes1().add( node.getId() );
700 setSearchFoundCountsOnLabel1( nodes.size() );
703 setSearchFoundCountsOnLabel1( 0 );
708 private void setDrawPhylogram( final int index, final boolean b ) {
709 getIsDrawPhylogramList().set( index, b );
712 private void setupClickToOptions() {
713 final int default_option = _configuration.getDefaultDisplayClicktoOption();
714 int selected_index = 0;
716 if ( _configuration.doDisplayClickToOption( Configuration.display_node_data ) ) {
717 _show_data_item = cb_index;
718 addClickToOption( Configuration.display_node_data,
719 _configuration.getClickToTitle( Configuration.display_node_data ) );
720 if ( default_option == Configuration.display_node_data ) {
721 selected_index = cb_index;
725 if ( _configuration.doDisplayClickToOption( Configuration.collapse_uncollapse ) ) {
726 _collapse_cb_item = cb_index;
727 addClickToOption( Configuration.collapse_uncollapse,
728 _configuration.getClickToTitle( Configuration.collapse_uncollapse ) );
729 if ( default_option == Configuration.collapse_uncollapse ) {
730 selected_index = cb_index;
734 if ( _configuration.doDisplayClickToOption( Configuration.reroot ) ) {
735 _reroot_cb_item = cb_index;
736 addClickToOption( Configuration.reroot, _configuration.getClickToTitle( Configuration.reroot ) );
737 if ( default_option == Configuration.reroot ) {
738 selected_index = cb_index;
742 if ( _configuration.doDisplayClickToOption( Configuration.subtree ) ) {
743 _subtree_cb_item = cb_index;
744 addClickToOption( Configuration.subtree, _configuration.getClickToTitle( Configuration.subtree ) );
745 if ( default_option == Configuration.subtree ) {
746 selected_index = cb_index;
750 if ( _configuration.doDisplayClickToOption( Configuration.swap ) ) {
751 _swap_cb_item = cb_index;
752 addClickToOption( Configuration.swap, _configuration.getClickToTitle( Configuration.swap ) );
753 if ( default_option == Configuration.swap ) {
754 selected_index = cb_index;
758 if ( _configuration.doDisplayClickToOption( Configuration.sort_descendents ) ) {
759 _sort_descendents_item = cb_index;
760 addClickToOption( Configuration.sort_descendents,
761 _configuration.getClickToTitle( Configuration.sort_descendents ) );
762 if ( default_option == Configuration.sort_descendents ) {
763 selected_index = cb_index;
767 if ( _configuration.doDisplayClickToOption( Configuration.color_node_font ) ) {
768 _color_node_font_item = cb_index;
769 addClickToOption( Configuration.color_node_font,
770 _configuration.getClickToTitle( Configuration.color_node_font ) );
771 if ( default_option == Configuration.color_node_font ) {
772 selected_index = cb_index;
776 if ( _configuration.doDisplayClickToOption( Configuration.change_node_font ) ) {
777 _change_node_font_item = cb_index;
778 addClickToOption( Configuration.change_node_font,
779 _configuration.getClickToTitle( Configuration.change_node_font ) );
780 if ( default_option == Configuration.change_node_font ) {
781 selected_index = cb_index;
785 if ( _configuration.doDisplayClickToOption( Configuration.color_subtree ) ) {
786 _color_subtree_cb_item = cb_index;
787 addClickToOption( Configuration.color_subtree, _configuration.getClickToTitle( Configuration.color_subtree ) );
788 if ( default_option == Configuration.color_subtree ) {
789 selected_index = cb_index;
793 if ( _configuration.doDisplayClickToOption( Configuration.open_seq_web ) ) {
794 _open_seq_web_item = cb_index;
795 addClickToOption( Configuration.open_seq_web, _configuration.getClickToTitle( Configuration.open_seq_web ) );
796 if ( default_option == Configuration.open_seq_web ) {
797 selected_index = cb_index;
801 if ( _configuration.doDisplayClickToOption( Configuration.open_pdb_web ) ) {
802 _open_pdb_item = cb_index;
803 addClickToOption( Configuration.open_pdb_web, _configuration.getClickToTitle( Configuration.open_pdb_web ) );
804 if ( default_option == Configuration.open_pdb_web ) {
805 selected_index = cb_index;
809 if ( _configuration.doDisplayClickToOption( Configuration.open_tax_web ) ) {
810 _open_tax_web_item = cb_index;
811 addClickToOption( Configuration.open_tax_web, _configuration.getClickToTitle( Configuration.open_tax_web ) );
812 if ( default_option == Configuration.open_tax_web ) {
813 selected_index = cb_index;
817 if ( _configuration.doDisplayClickToOption( Configuration.blast ) ) {
818 _blast_item = cb_index;
819 addClickToOption( Configuration.blast, _configuration.getClickToTitle( Configuration.blast ) );
820 if ( default_option == Configuration.blast ) {
821 selected_index = cb_index;
825 if ( _configuration.doDisplayClickToOption( Configuration.select_nodes ) ) {
826 _select_nodes_item = cb_index;
827 addClickToOption( Configuration.select_nodes, _configuration.getClickToTitle( Configuration.select_nodes ) );
828 if ( default_option == Configuration.select_nodes ) {
829 selected_index = cb_index;
833 if ( _configuration.doDisplayClickToOption( Configuration.get_ext_desc_data ) ) {
834 _get_ext_desc_data = cb_index;
835 if ( !ForesterUtil.isEmpty( getConfiguration().getLabelForGetExtDescendentsData() ) ) {
836 addClickToOption( Configuration.get_ext_desc_data, getConfiguration()
837 .getLabelForGetExtDescendentsData() );
840 addClickToOption( Configuration.get_ext_desc_data,
841 getConfiguration().getClickToTitle( Configuration.get_ext_desc_data ) );
843 if ( default_option == Configuration.get_ext_desc_data ) {
844 selected_index = cb_index;
848 if ( getOptions().isEditable() ) {
849 if ( _configuration.doDisplayClickToOption( Configuration.cut_subtree ) ) {
850 _cut_subtree_item = cb_index;
851 addClickToOption( Configuration.cut_subtree, _configuration.getClickToTitle( Configuration.cut_subtree ) );
852 if ( default_option == Configuration.cut_subtree ) {
853 selected_index = cb_index;
857 if ( _configuration.doDisplayClickToOption( Configuration.copy_subtree ) ) {
858 _copy_subtree_item = cb_index;
859 addClickToOption( Configuration.copy_subtree,
860 _configuration.getClickToTitle( Configuration.copy_subtree ) );
861 if ( default_option == Configuration.copy_subtree ) {
862 selected_index = cb_index;
866 if ( _configuration.doDisplayClickToOption( Configuration.paste_subtree ) ) {
867 _paste_subtree_item = cb_index;
868 addClickToOption( Configuration.paste_subtree,
869 _configuration.getClickToTitle( Configuration.paste_subtree ) );
870 if ( default_option == Configuration.paste_subtree ) {
871 selected_index = cb_index;
875 if ( _configuration.doDisplayClickToOption( Configuration.delete_subtree_or_node ) ) {
876 _delete_node_or_subtree_item = cb_index;
877 addClickToOption( Configuration.delete_subtree_or_node,
878 _configuration.getClickToTitle( Configuration.delete_subtree_or_node ) );
879 if ( default_option == Configuration.delete_subtree_or_node ) {
880 selected_index = cb_index;
884 if ( _configuration.doDisplayClickToOption( Configuration.add_new_node ) ) {
885 _add_new_node_item = cb_index;
886 addClickToOption( Configuration.add_new_node,
887 _configuration.getClickToTitle( Configuration.add_new_node ) );
888 if ( default_option == Configuration.add_new_node ) {
889 selected_index = cb_index;
893 if ( _configuration.doDisplayClickToOption( Configuration.edit_node_data ) ) {
894 _edit_node_data_item = cb_index;
895 addClickToOption( Configuration.edit_node_data,
896 _configuration.getClickToTitle( Configuration.edit_node_data ) );
897 if ( default_option == Configuration.edit_node_data ) {
898 selected_index = cb_index;
903 // Set default selection and its action
904 _click_to_combobox.setSelectedIndex( selected_index );
905 setClickToAction( selected_index );
908 private void setupDisplayCheckboxes() {
909 if ( _configuration.doDisplayOption( Configuration.display_as_phylogram ) ) {
910 addCheckbox( Configuration.display_as_phylogram,
911 _configuration.getDisplayTitle( Configuration.display_as_phylogram ) );
912 setCheckbox( Configuration.display_as_phylogram,
913 _configuration.doCheckOption( Configuration.display_as_phylogram ) );
915 if ( _configuration.doDisplayOption( Configuration.dynamically_hide_data ) ) {
916 addCheckbox( Configuration.dynamically_hide_data,
917 _configuration.getDisplayTitle( Configuration.dynamically_hide_data ) );
918 setCheckbox( Configuration.dynamically_hide_data,
919 _configuration.doCheckOption( Configuration.dynamically_hide_data ) );
921 if ( _configuration.doDisplayOption( Configuration.node_data_popup ) ) {
922 addCheckbox( Configuration.node_data_popup, _configuration.getDisplayTitle( Configuration.node_data_popup ) );
923 setCheckbox( Configuration.node_data_popup, _configuration.doCheckOption( Configuration.node_data_popup ) );
925 if ( _configuration.doDisplayOption( Configuration.display_internal_data ) ) {
926 addCheckbox( Configuration.display_internal_data,
927 _configuration.getDisplayTitle( Configuration.display_internal_data ) );
928 setCheckbox( Configuration.display_internal_data,
929 _configuration.doCheckOption( Configuration.display_internal_data ) );
931 if ( _configuration.doDisplayOption( Configuration.color_according_to_sequence ) ) {
932 addCheckbox( Configuration.color_according_to_sequence,
933 _configuration.getDisplayTitle( Configuration.color_according_to_sequence ) );
934 setCheckbox( Configuration.color_according_to_sequence,
935 _configuration.doCheckOption( Configuration.color_according_to_sequence ) );
937 if ( _configuration.doDisplayOption( Configuration.color_according_to_species ) ) {
938 addCheckbox( Configuration.color_according_to_species,
939 _configuration.getDisplayTitle( Configuration.color_according_to_species ) );
940 setCheckbox( Configuration.color_according_to_species,
941 _configuration.doCheckOption( Configuration.color_according_to_species ) );
943 if ( _configuration.doDisplayOption( Configuration.color_according_to_annotation ) ) {
944 addCheckbox( Configuration.color_according_to_annotation,
945 _configuration.getDisplayTitle( Configuration.color_according_to_annotation ) );
946 setCheckbox( Configuration.color_according_to_annotation,
947 _configuration.doCheckOption( Configuration.color_according_to_annotation ) );
949 if ( _configuration.doDisplayOption( Configuration.use_style ) ) {
950 addCheckbox( Configuration.use_style, _configuration.getDisplayTitle( Configuration.use_style ) );
951 setCheckbox( Configuration.use_style, _configuration.doCheckOption( Configuration.use_style ) );
953 if ( _configuration.doDisplayOption( Configuration.width_branches ) ) {
954 addCheckbox( Configuration.width_branches, _configuration.getDisplayTitle( Configuration.width_branches ) );
955 setCheckbox( Configuration.width_branches, _configuration.doCheckOption( Configuration.width_branches ) );
957 final JLabel label = new JLabel( "Display Data:" );
958 label.setFont( ControlPanel.jcb_bold_font );
959 if ( !getConfiguration().isUseNativeUI() ) {
960 label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
963 if ( _configuration.doDisplayOption( Configuration.show_node_names ) ) {
964 addCheckbox( Configuration.show_node_names, _configuration.getDisplayTitle( Configuration.show_node_names ) );
965 setCheckbox( Configuration.show_node_names, _configuration.doCheckOption( Configuration.show_node_names ) );
967 if ( _configuration.doDisplayOption( Configuration.show_tax_code ) ) {
968 addCheckbox( Configuration.show_tax_code, _configuration.getDisplayTitle( Configuration.show_tax_code ) );
969 setCheckbox( Configuration.show_tax_code, _configuration.doCheckOption( Configuration.show_tax_code ) );
971 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_scientific_names ) ) {
972 addCheckbox( Configuration.show_taxonomy_scientific_names,
973 _configuration.getDisplayTitle( Configuration.show_taxonomy_scientific_names ) );
974 setCheckbox( Configuration.show_taxonomy_scientific_names,
975 _configuration.doCheckOption( Configuration.show_taxonomy_scientific_names ) );
977 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_common_names ) ) {
978 addCheckbox( Configuration.show_taxonomy_common_names,
979 _configuration.getDisplayTitle( Configuration.show_taxonomy_common_names ) );
980 setCheckbox( Configuration.show_taxonomy_common_names,
981 _configuration.doCheckOption( Configuration.show_taxonomy_common_names ) );
983 if ( _configuration.doDisplayOption( Configuration.show_seq_names ) ) {
984 addCheckbox( Configuration.show_seq_names, _configuration.getDisplayTitle( Configuration.show_seq_names ) );
985 setCheckbox( Configuration.show_seq_names, _configuration.doCheckOption( Configuration.show_seq_names ) );
987 if ( _configuration.doDisplayOption( Configuration.show_gene_names ) ) {
988 addCheckbox( Configuration.show_gene_names, _configuration.getDisplayTitle( Configuration.show_gene_names ) );
989 setCheckbox( Configuration.show_gene_names, _configuration.doCheckOption( Configuration.show_gene_names ) );
991 if ( _configuration.doDisplayOption( Configuration.show_seq_symbols ) ) {
992 addCheckbox( Configuration.show_seq_symbols,
993 _configuration.getDisplayTitle( Configuration.show_seq_symbols ) );
994 setCheckbox( Configuration.show_seq_symbols, _configuration.doCheckOption( Configuration.show_seq_symbols ) );
996 if ( _configuration.doDisplayOption( Configuration.show_sequence_acc ) ) {
997 addCheckbox( Configuration.show_sequence_acc,
998 _configuration.getDisplayTitle( Configuration.show_sequence_acc ) );
999 setCheckbox( Configuration.show_sequence_acc,
1000 _configuration.doCheckOption( Configuration.show_sequence_acc ) );
1002 if ( _configuration.doDisplayOption( Configuration.show_annotation ) ) {
1003 addCheckbox( Configuration.show_annotation, _configuration.getDisplayTitle( Configuration.show_annotation ) );
1004 setCheckbox( Configuration.show_annotation, _configuration.doCheckOption( Configuration.show_annotation ) );
1006 if ( _configuration.doDisplayOption( Configuration.write_confidence_values ) ) {
1007 addCheckbox( Configuration.write_confidence_values,
1008 _configuration.getDisplayTitle( Configuration.write_confidence_values ) );
1009 setCheckbox( Configuration.write_confidence_values,
1010 _configuration.doCheckOption( Configuration.write_confidence_values ) );
1012 if ( _configuration.doDisplayOption( Configuration.write_branch_length_values ) ) {
1013 addCheckbox( Configuration.write_branch_length_values,
1014 _configuration.getDisplayTitle( Configuration.write_branch_length_values ) );
1015 setCheckbox( Configuration.write_branch_length_values,
1016 _configuration.doCheckOption( Configuration.write_branch_length_values ) );
1018 if ( _configuration.doDisplayOption( Configuration.show_binary_characters ) ) {
1019 addCheckbox( Configuration.show_binary_characters,
1020 _configuration.getDisplayTitle( Configuration.show_binary_characters ) );
1021 setCheckbox( Configuration.show_binary_characters,
1022 _configuration.doCheckOption( Configuration.show_binary_characters ) );
1024 if ( _configuration.doDisplayOption( Configuration.show_binary_character_counts ) ) {
1025 addCheckbox( Configuration.show_binary_character_counts,
1026 _configuration.getDisplayTitle( Configuration.show_binary_character_counts ) );
1027 setCheckbox( Configuration.show_binary_character_counts,
1028 _configuration.doCheckOption( Configuration.show_binary_character_counts ) );
1030 if ( _configuration.doDisplayOption( Configuration.show_domain_architectures ) ) {
1031 addCheckbox( Configuration.show_domain_architectures,
1032 _configuration.getDisplayTitle( Configuration.show_domain_architectures ) );
1033 setCheckbox( Configuration.show_domain_architectures,
1034 _configuration.doCheckOption( Configuration.show_domain_architectures ) );
1036 if ( _configuration.doDisplayOption( Configuration.show_mol_seqs ) ) {
1037 addCheckbox( Configuration.show_mol_seqs, _configuration.getDisplayTitle( Configuration.show_mol_seqs ) );
1038 setCheckbox( Configuration.show_mol_seqs, _configuration.doCheckOption( Configuration.show_mol_seqs ) );
1040 if ( _configuration.doDisplayOption( Configuration.write_events ) ) {
1041 addCheckbox( Configuration.write_events, _configuration.getDisplayTitle( Configuration.write_events ) );
1042 setCheckbox( Configuration.write_events, _configuration.doCheckOption( Configuration.write_events ) );
1044 if ( _configuration.doDisplayOption( Configuration.show_vector_data ) ) {
1045 addCheckbox( Configuration.show_vector_data,
1046 _configuration.getDisplayTitle( Configuration.show_vector_data ) );
1047 setCheckbox( Configuration.show_vector_data, _configuration.doCheckOption( Configuration.show_vector_data ) );
1049 if ( _configuration.doDisplayOption( Configuration.show_properties ) ) {
1050 addCheckbox( Configuration.show_properties, _configuration.getDisplayTitle( Configuration.show_properties ) );
1051 setCheckbox( Configuration.show_properties, _configuration.doCheckOption( Configuration.show_properties ) );
1053 if ( _configuration.doDisplayOption( Configuration.show_taxonomy_images ) ) {
1054 addCheckbox( Configuration.show_taxonomy_images,
1055 _configuration.getDisplayTitle( Configuration.show_taxonomy_images ) );
1056 setCheckbox( Configuration.show_taxonomy_images,
1057 _configuration.doCheckOption( Configuration.show_taxonomy_images ) );
1061 private void setVisibilityOfDomainStrucureControls() {
1062 if ( _zoom_in_domain_structure != null ) {
1063 final MainFrame mf = getMainFrame();
1065 if ( isShowDomainArchitectures() ) {
1066 _domain_display_label.setVisible( true );
1067 _zoom_in_domain_structure.setVisible( true );
1068 _zoom_out_domain_structure.setVisible( true );
1069 _decr_domain_structure_evalue_thr.setVisible( true );
1070 _incr_domain_structure_evalue_thr.setVisible( true );
1071 _domain_structure_evalue_thr_tf.setVisible( true );
1072 if ( mf._right_line_up_domains_cbmi != null ) {
1073 mf._right_line_up_domains_cbmi.setVisible( true );
1075 if ( mf._show_domain_labels != null ) {
1076 mf._show_domain_labels.setVisible( true );
1080 _domain_display_label.setVisible( false );
1081 _zoom_in_domain_structure.setVisible( false );
1082 _zoom_out_domain_structure.setVisible( false );
1083 _decr_domain_structure_evalue_thr.setVisible( false );
1084 _incr_domain_structure_evalue_thr.setVisible( false );
1085 _domain_structure_evalue_thr_tf.setVisible( false );
1086 if ( mf._right_line_up_domains_cbmi != null ) {
1087 mf._right_line_up_domains_cbmi.setVisible( false );
1089 if ( mf._show_domain_labels != null ) {
1090 mf._show_domain_labels.setVisible( false );
1097 void activateButtonToReturnToSuperTree( int index ) {
1100 _return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT + " " + index );
1103 _return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT );
1105 _return_to_super_tree.setForeground( getConfiguration().getGuiCheckboxAndButtonActiveColor() );
1106 _return_to_super_tree.setEnabled( true );
1110 * Add zoom and quick edit buttons. (Last modified 8/9/04)
1113 final JLabel spacer = new JLabel( "" );
1114 spacer.setOpaque( false );
1116 final JPanel x_panel = new JPanel( new GridLayout( 1, 1, 0, 0 ) );
1117 final JPanel y_panel = new JPanel( new GridLayout( 1, 3, 0, 0 ) );
1118 final JPanel z_panel = new JPanel( new GridLayout( 1, 1, 0, 0 ) );
1119 if ( !getConfiguration().isUseNativeUI() ) {
1120 x_panel.setBackground( getBackground() );
1121 y_panel.setBackground( getBackground() );
1122 z_panel.setBackground( getBackground() );
1124 add( _zoom_label = new JLabel( "Zoom:" ) );
1125 customizeLabel( _zoom_label, getConfiguration() );
1129 if ( getConfiguration().isUseNativeUI() ) {
1130 _zoom_in_x = new JButton( "+" );
1131 _zoom_out_x = new JButton( "-" );
1134 _zoom_in_x = new JButton( "X+" );
1135 _zoom_out_x = new JButton( "X-" );
1137 _zoom_in_y = new JButton( "Y+" );
1138 _zoom_out_y = new JButton( "Y-" );
1139 _show_whole = new JButton( "F" );
1140 _show_whole.setToolTipText( "To fit the complete phylogeny to the current display size [F or Home]" );
1141 _zoom_in_x.setToolTipText( "To zoom in horizontally [Shift+cursor-right]" );
1142 _zoom_in_y.setToolTipText( "To zoom in vertically [Shift+cursor-up]" );
1143 _zoom_out_x.setToolTipText( "To zoom out horizontally [Shift+cursor-left]" );
1144 _zoom_out_y.setToolTipText( "To zoom out vertically [Shift+cursor-down]" );
1145 if ( getConfiguration().isUseNativeUI() && ForesterUtil.isMac() ) {
1146 _zoom_out_x.setPreferredSize( new Dimension( 55, 10 ) );
1147 _zoom_in_x.setPreferredSize( new Dimension( 55, 10 ) );
1150 _zoom_out_x.setPreferredSize( new Dimension( 10, 10 ) );
1151 _zoom_in_x.setPreferredSize( new Dimension( 10, 10 ) );
1153 _zoom_out_y.setPreferredSize( new Dimension( 10, 10 ) );
1154 _zoom_in_y.setPreferredSize( new Dimension( 10, 10 ) );
1155 _show_whole.setPreferredSize( new Dimension( 10, 10 ) );
1156 _return_to_super_tree = new JButton( RETURN_TO_SUPER_TREE_TEXT );
1157 _return_to_super_tree.setEnabled( false );
1158 _order = new JButton( "Order Subtrees" );
1159 _uncollapse_all = new JButton( "Uncollapse All" );
1160 addJButton( _zoom_in_y, x_panel );
1161 addJButton( _zoom_out_x, y_panel );
1162 addJButton( _show_whole, y_panel );
1163 addJButton( _zoom_in_x, y_panel );
1164 addJButton( _zoom_out_y, z_panel );
1165 if ( getConfiguration().doDisplayOption( Configuration.show_domain_architectures ) ) {
1166 setUpControlsForDomainStrucures();
1168 final JLabel spacer2 = new JLabel( "" );
1170 addJButton( _return_to_super_tree, this );
1171 addJButton( _order, this );
1172 addJButton( _uncollapse_all, this );
1173 final JLabel spacer3 = new JLabel( "" );
1175 setVisibilityOfDomainStrucureControls();
1178 void addCheckbox( final int which, final String title ) {
1179 final JPanel ch_panel = new JPanel( new BorderLayout( 0, 0 ) );
1181 case Configuration.display_as_phylogram:
1182 _display_as_phylogram_cb = new JCheckBox( title );
1183 getDisplayAsPhylogramCb().setToolTipText( "To switch between phylogram and cladogram display" );
1184 addJCheckBox( getDisplayAsPhylogramCb(), ch_panel );
1187 case Configuration.display_internal_data:
1188 _display_internal_data = new JCheckBox( title );
1189 _display_internal_data.setToolTipText( "To allow or disallow display of internal labels" );
1190 addJCheckBox( _display_internal_data, ch_panel );
1193 case Configuration.color_according_to_species:
1194 _color_acc_species = new JCheckBox( title );
1195 _color_acc_species.setToolTipText( "To colorize node labels as a function of taxonomy" );
1196 addJCheckBox( _color_acc_species, ch_panel );
1199 case Configuration.color_according_to_sequence:
1200 _color_acc_sequence = new JCheckBox( title );
1201 _color_acc_sequence.setToolTipText( "To colorize node labels as a function of sequence name" );
1202 addJCheckBox( _color_acc_sequence, ch_panel );
1205 case Configuration.color_according_to_annotation:
1206 _color_according_to_annotation = new JCheckBox( title );
1207 _color_according_to_annotation
1208 .setToolTipText( "To colorize sequence annotation labels as a function of sequence annotation" );
1209 addJCheckBox( _color_according_to_annotation, ch_panel );
1212 case Configuration.show_node_names:
1213 _show_node_names = new JCheckBox( title );
1214 addJCheckBox( _show_node_names, ch_panel );
1217 case Configuration.show_taxonomy_scientific_names:
1218 _show_taxo_scientific_names = new JCheckBox( title );
1219 addJCheckBox( _show_taxo_scientific_names, ch_panel );
1222 case Configuration.show_taxonomy_common_names:
1223 _show_taxo_common_names = new JCheckBox( title );
1224 addJCheckBox( _show_taxo_common_names, ch_panel );
1227 case Configuration.show_tax_code:
1228 _show_taxo_code = new JCheckBox( title );
1229 addJCheckBox( _show_taxo_code, ch_panel );
1232 case Configuration.show_taxonomy_images:
1233 _show_taxo_images_cb = new JCheckBox( title );
1234 addJCheckBox( _show_taxo_images_cb, ch_panel );
1237 case Configuration.show_binary_characters:
1238 _show_binary_characters = new JCheckBox( title );
1239 addJCheckBox( _show_binary_characters, ch_panel );
1242 case Configuration.show_annotation:
1243 _show_annotation = new JCheckBox( title );
1244 addJCheckBox( _show_annotation, ch_panel );
1247 case Configuration.show_binary_character_counts:
1248 _show_binary_character_counts = new JCheckBox( title );
1249 addJCheckBox( _show_binary_character_counts, ch_panel );
1252 case Configuration.write_confidence_values:
1253 _write_confidence = new JCheckBox( title );
1254 addJCheckBox( getWriteConfidenceCb(), ch_panel );
1257 case Configuration.write_events:
1258 _show_events = new JCheckBox( title );
1259 addJCheckBox( getShowEventsCb(), ch_panel );
1262 case Configuration.use_style:
1263 _use_visual_styles_cb = new JCheckBox( title );
1264 getUseVisualStylesCb()
1265 .setToolTipText( "To use visual styles (node colors, fonts) and branch colors, if present" );
1266 addJCheckBox( getUseVisualStylesCb(), ch_panel );
1269 case Configuration.width_branches:
1270 _width_branches = new JCheckBox( title );
1271 _width_branches.setToolTipText( "To use branch width values, if present" );
1272 addJCheckBox( _width_branches, ch_panel );
1275 case Configuration.write_branch_length_values:
1276 _write_branch_length_values = new JCheckBox( title );
1277 addJCheckBox( _write_branch_length_values, ch_panel );
1280 case Configuration.show_domain_architectures:
1281 _show_domain_architectures = new JCheckBox( title );
1282 addJCheckBox( _show_domain_architectures, ch_panel );
1285 case Configuration.show_mol_seqs:
1286 _show_mol_seqs = new JCheckBox( title );
1287 addJCheckBox( _show_mol_seqs, ch_panel );
1290 case Configuration.show_seq_names:
1291 _show_seq_names = new JCheckBox( title );
1292 addJCheckBox( _show_seq_names, ch_panel );
1295 case Configuration.show_gene_names:
1296 _show_gene_names = new JCheckBox( title );
1297 addJCheckBox( _show_gene_names, ch_panel );
1300 case Configuration.show_seq_symbols:
1301 _show_seq_symbols = new JCheckBox( title );
1302 addJCheckBox( _show_seq_symbols, ch_panel );
1305 case Configuration.show_sequence_acc:
1306 _show_sequence_acc = new JCheckBox( title );
1307 addJCheckBox( _show_sequence_acc, ch_panel );
1310 case Configuration.dynamically_hide_data:
1311 _dynamically_hide_data = new JCheckBox( title );
1312 getDynamicallyHideData().setToolTipText( "To hide labels depending on expected visibility" );
1313 addJCheckBox( getDynamicallyHideData(), ch_panel );
1316 case Configuration.node_data_popup:
1317 _node_desc_popup_cb = new JCheckBox( title );
1318 getNodeDescPopupCb().setToolTipText( "To enable mouse rollover display of basic node data" );
1319 addJCheckBox( getNodeDescPopupCb(), ch_panel );
1322 case Configuration.show_relation_confidence:
1323 _seq_relation_confidence_switch = new JCheckBox( title );
1324 addJCheckBox( _seq_relation_confidence_switch, ch_panel );
1327 case Configuration.show_vector_data:
1328 _show_vector_data_cb = new JCheckBox( title );
1329 addJCheckBox( _show_vector_data_cb, ch_panel );
1332 case Configuration.show_properties:
1333 _show_properties_cb = new JCheckBox( title );
1334 addJCheckBox( _show_properties_cb, ch_panel );
1338 throw new RuntimeException( "unknown checkbox: " + which );
1342 void addJButton( final JButton jb, final JPanel p ) {
1343 jb.setFocusPainted( false );
1344 jb.setFont( ControlPanel.jcb_font );
1345 if ( !_configuration.isUseNativeUI() ) {
1346 jb.setBorder( BorderFactory.createLineBorder( getConfiguration().getGuiButtonBorderColor() ) );
1347 jb.setBackground( getConfiguration().getGuiButtonBackgroundColor() );
1348 jb.setForeground( getConfiguration().getGuiButtonTextColor() );
1351 jb.addActionListener( this );
1354 void addJCheckBox( final JCheckBox jcb, final JPanel p ) {
1355 jcb.setFocusPainted( false );
1356 jcb.setFont( ControlPanel.jcb_font );
1357 if ( !_configuration.isUseNativeUI() ) {
1358 jcb.setBackground( getConfiguration().getGuiBackgroundColor() );
1359 jcb.setForeground( getConfiguration().getGuiCheckboxTextColor() );
1361 p.add( jcb, "Center" );
1362 jcb.addActionListener( this );
1365 void addJTextField( final JTextField tf, final JPanel p ) {
1366 if ( !_configuration.isUseNativeUI() ) {
1367 tf.setForeground( getConfiguration().getGuiBackgroundColor() );
1368 tf.setFont( ControlPanel.jcb_font );
1371 tf.addActionListener( this );
1374 void deactivateButtonToReturnToSuperTree() {
1375 _return_to_super_tree.setText( RETURN_TO_SUPER_TREE_TEXT );
1376 _return_to_super_tree.setForeground( getConfiguration().getGuiButtonTextColor() );
1377 _return_to_super_tree.setEnabled( false );
1380 void displayedPhylogenyMightHaveChanged( final boolean recalc_longest_ext_node_info ) {
1381 if ( ( _mainpanel != null )
1382 && ( ( _mainpanel.getCurrentPhylogeny() != null ) && !_mainpanel.getCurrentPhylogeny().isEmpty() ) ) {
1383 if ( getOptions().isShowOverview() ) {
1384 _mainpanel.getCurrentTreePanel().updateOvSizes();
1386 _mainpanel.getCurrentTreePanel().recalculateMaxDistanceToRoot();
1387 setVisibilityOfDomainStrucureControls();
1388 updateDomainStructureEvaluethresholdDisplay();
1389 _mainpanel.getCurrentTreePanel().calculateScaleDistance();
1390 _mainpanel.getCurrentTreePanel().calcMaxDepth();
1391 _mainpanel.adjustJScrollPane();
1392 if ( recalc_longest_ext_node_info ) {
1393 _mainpanel.getCurrentTreePanel().initNodeData();
1394 _mainpanel.getCurrentTreePanel().calculateLongestExtNodeInfo();
1396 _mainpanel.getCurrentTreePanel().repaint();
1397 // _mainpanel.getCurrentTreePanel().setUpUrtFactors();
1401 void endClickToOptions() {
1402 _click_to_combobox.addActionListener( this );
1406 * Indicates what action should be execute when a node is clicked
1408 * @return the click-on action
1410 NodeClickAction getActionWhenNodeClicked() {
1411 return _action_when_node_clicked;
1414 Map<Integer, String> getAllClickToItems() {
1415 return _all_click_to_names;
1418 Map<String, Color> getAnnotationColors() {
1419 return _annotation_colors;
1422 Configuration getConfiguration() {
1423 return _configuration;
1426 TreePanel getCurrentTreePanel() {
1427 return getMainPanel().getCurrentTreePanel();
1430 MainPanel getMainPanel() {
1434 Options getOptions() {
1435 return getMainPanel().getOptions();
1438 JLabel getSearchFoundCountsLabel0() {
1439 return _search_found_label_0;
1442 JLabel getSearchFoundCountsLabel1() {
1443 return _search_found_label_1;
1446 JButton getSearchResetButton0() {
1447 return _search_reset_button_0;
1450 JButton getSearchResetButton1() {
1451 return _search_reset_button_1;
1454 JTextField getSearchTextField0() {
1455 return _search_tf_0;
1458 JTextField getSearchTextField1() {
1459 return _search_tf_1;
1462 Map<String, Color> getSequenceColors() {
1463 return _sequence_colors;
1466 List<String> getSingleClickToNames() {
1467 return _click_to_names;
1470 Map<String, Color> getSpeciesColors() {
1471 return _species_colors;
1474 boolean isAntialiasScreenText() {
1478 boolean isColorAccordingToAnnotation() {
1479 return ( ( _color_according_to_annotation != null ) && _color_according_to_annotation.isSelected() );
1482 boolean isColorAccordingToSequence() {
1483 return ( ( _color_acc_sequence != null ) && _color_acc_sequence.isSelected() );
1486 boolean isColorAccordingToTaxonomy() {
1487 return ( ( _color_acc_species != null ) && _color_acc_species.isSelected() );
1490 boolean isDrawPhylogram() {
1491 return isDrawPhylogram( getMainPanel().getCurrentTabIndex() );
1494 boolean isDynamicallyHideData() {
1495 return ( ( getDynamicallyHideData() != null ) && getDynamicallyHideData().isSelected() );
1498 boolean isEvents() {
1499 return ( ( getShowEventsCb() != null ) && getShowEventsCb().isSelected() );
1502 boolean isNodeDescPopup() {
1503 return ( ( getNodeDescPopupCb() != null ) && getNodeDescPopupCb().isSelected() );
1506 boolean isShowAnnotation() {
1507 return ( ( _show_annotation != null ) && _show_annotation.isSelected() );
1510 boolean isShowBinaryCharacterCounts() {
1511 return ( ( _show_binary_character_counts != null ) && _show_binary_character_counts.isSelected() );
1514 boolean isShowBinaryCharacters() {
1515 return ( ( _show_binary_characters != null ) && _show_binary_characters.isSelected() );
1518 boolean isShowConfidenceValues() {
1519 return ( ( getWriteConfidenceCb() != null ) && getWriteConfidenceCb().isSelected() );
1522 boolean isShowDomainArchitectures() {
1523 return ( ( _show_domain_architectures != null ) && _show_domain_architectures.isSelected() );
1526 boolean isShowGeneNames() {
1527 return ( ( _show_gene_names != null ) && _show_gene_names.isSelected() );
1530 boolean isShowInternalData() {
1531 return ( ( _display_internal_data == null ) || _display_internal_data.isSelected() );
1534 boolean isShowNodeNames() {
1535 return ( ( _show_node_names != null ) && _show_node_names.isSelected() );
1538 boolean isShowSeqNames() {
1539 return ( ( _show_seq_names != null ) && _show_seq_names.isSelected() );
1542 boolean isShowSeqSymbols() {
1543 return ( ( _show_seq_symbols != null ) && _show_seq_symbols.isSelected() );
1546 boolean isShowSequenceAcc() {
1547 return ( ( _show_sequence_acc != null ) && _show_sequence_acc.isSelected() );
1550 boolean isShowSequenceRelationConfidence() {
1551 return ( ( _seq_relation_confidence_switch != null ) && ( _seq_relation_confidence_switch.isSelected() ) );
1554 boolean isShowSequenceRelations() {
1555 return ( ( _show_sequence_relations != null ) && ( _show_sequence_relations.getSelectedIndex() > 0 ) );
1558 boolean isShowTaxonomyCode() {
1559 return ( ( _show_taxo_code != null ) && _show_taxo_code.isSelected() );
1562 boolean isShowTaxonomyCommonNames() {
1563 return ( ( _show_taxo_common_names != null ) && _show_taxo_common_names.isSelected() );
1566 boolean isShowTaxonomyScientificNames() {
1567 return ( ( _show_taxo_scientific_names != null ) && _show_taxo_scientific_names.isSelected() );
1570 boolean isUseVisualStyles() {
1571 return ( ( ( getUseVisualStylesCb() != null ) && getUseVisualStylesCb().isSelected() ) || ( ( getUseVisualStylesCb() == null ) && _color_branches ) );
1574 boolean isWidthBranches() {
1575 return ( ( _width_branches != null ) && _width_branches.isSelected() );
1578 boolean isWriteBranchLengthValues() {
1579 return ( ( _write_branch_length_values != null ) && _write_branch_length_values.isSelected() );
1582 void phylogenyAdded( final Configuration configuration ) {
1583 getIsDrawPhylogramList().add( configuration.isDrawAsPhylogram() );
1586 void phylogenyRemoved( final int index ) {
1587 getIsDrawPhylogramList().remove( index );
1591 final MainPanel main_panel = getMainPanel();
1592 final Phylogeny tree = main_panel.getCurrentPhylogeny();
1593 if ( ( tree == null ) || tree.isEmpty() ) {
1596 String query = getSearchTextField0().getText();
1597 if ( query != null ) {
1598 query = query.trim();
1600 if ( !ForesterUtil.isEmpty( query ) ) {
1601 search0( main_panel, tree, query );
1604 getSearchFoundCountsLabel0().setVisible( false );
1605 getSearchResetButton0().setEnabled( false );
1606 getSearchResetButton0().setVisible( false );
1612 final MainPanel main_panel = getMainPanel();
1613 final Phylogeny tree = main_panel.getCurrentPhylogeny();
1614 if ( ( tree == null ) || tree.isEmpty() ) {
1617 String query = getSearchTextField1().getText();
1618 if ( query != null ) {
1619 query = query.trim();
1621 if ( !ForesterUtil.isEmpty( query ) ) {
1622 search1( main_panel, tree, query );
1625 getSearchFoundCountsLabel1().setVisible( false );
1626 getSearchResetButton1().setEnabled( false );
1627 getSearchResetButton1().setVisible( false );
1632 void searchReset0() {
1633 if ( getMainPanel().getCurrentTreePanel() != null ) {
1634 getMainPanel().getCurrentTreePanel().setFoundNodes0( null );
1638 void searchReset1() {
1639 if ( getMainPanel().getCurrentTreePanel() != null ) {
1640 getMainPanel().getCurrentTreePanel().setFoundNodes1( null );
1644 void setActionWhenNodeClicked( final NodeClickAction action ) {
1645 _action_when_node_clicked = action;
1648 void setAnnotationColors( final Map<String, Color> annotation_colors ) {
1649 _annotation_colors = annotation_colors;
1652 void setCheckbox( final int which, final boolean state ) {
1654 case Configuration.display_as_phylogram:
1655 if ( getDisplayAsPhylogramCb() != null ) {
1656 getDisplayAsPhylogramCb().setSelected( state );
1659 case Configuration.display_internal_data:
1660 if ( _display_internal_data != null ) {
1661 _display_internal_data.setSelected( state );
1664 case Configuration.color_according_to_species:
1665 if ( _color_acc_species != null ) {
1666 _color_acc_species.setSelected( state );
1669 case Configuration.color_according_to_sequence:
1670 if ( _color_acc_sequence != null ) {
1671 _color_acc_sequence.setSelected( state );
1674 case Configuration.color_according_to_annotation:
1675 if ( _color_according_to_annotation != null ) {
1676 _color_according_to_annotation.setSelected( state );
1679 case Configuration.show_node_names:
1680 if ( _show_node_names != null ) {
1681 _show_node_names.setSelected( state );
1684 case Configuration.show_taxonomy_scientific_names:
1685 if ( _show_taxo_scientific_names != null ) {
1686 _show_taxo_scientific_names.setSelected( state );
1689 case Configuration.show_taxonomy_common_names:
1690 if ( _show_taxo_common_names != null ) {
1691 _show_taxo_common_names.setSelected( state );
1694 case Configuration.show_tax_code:
1695 if ( _show_taxo_code != null ) {
1696 _show_taxo_code.setSelected( state );
1699 case Configuration.show_taxonomy_images:
1700 if ( _show_taxo_images_cb != null ) {
1701 _show_taxo_images_cb.setSelected( state );
1704 case Configuration.show_annotation:
1705 if ( _show_annotation != null ) {
1706 _show_annotation.setSelected( state );
1709 case Configuration.show_binary_characters:
1710 if ( _show_binary_characters != null ) {
1711 _show_binary_characters.setSelected( state );
1714 case Configuration.show_binary_character_counts:
1715 if ( _show_binary_character_counts != null ) {
1716 _show_binary_character_counts.setSelected( state );
1719 case Configuration.write_confidence_values:
1720 if ( getWriteConfidenceCb() != null ) {
1721 getWriteConfidenceCb().setSelected( state );
1724 case Configuration.write_events:
1725 if ( getShowEventsCb() != null ) {
1726 getShowEventsCb().setSelected( state );
1729 case Configuration.use_style:
1730 if ( getUseVisualStylesCb() != null ) {
1731 getUseVisualStylesCb().setSelected( state );
1734 case Configuration.width_branches:
1735 if ( _width_branches != null ) {
1736 _width_branches.setSelected( state );
1739 case Configuration.show_domain_architectures:
1740 if ( _show_domain_architectures != null ) {
1741 _show_domain_architectures.setSelected( state );
1744 case Configuration.write_branch_length_values:
1745 if ( _write_branch_length_values != null ) {
1746 _write_branch_length_values.setSelected( state );
1749 case Configuration.show_mol_seqs:
1750 if ( _show_mol_seqs != null ) {
1751 _show_mol_seqs.setSelected( state );
1754 case Configuration.show_seq_names:
1755 if ( _show_seq_names != null ) {
1756 _show_seq_names.setSelected( state );
1759 case Configuration.show_gene_names:
1760 if ( _show_gene_names != null ) {
1761 _show_gene_names.setSelected( state );
1764 case Configuration.show_seq_symbols:
1765 if ( _show_seq_symbols != null ) {
1766 _show_seq_symbols.setSelected( state );
1769 case Configuration.show_vector_data:
1770 if ( _show_vector_data_cb != null ) {
1771 _show_vector_data_cb.setSelected( state );
1774 case Configuration.show_properties:
1775 if ( _show_properties_cb != null ) {
1776 _show_properties_cb.setSelected( state );
1779 case Configuration.show_sequence_acc:
1780 if ( _show_sequence_acc != null ) {
1781 _show_sequence_acc.setSelected( state );
1784 case Configuration.dynamically_hide_data:
1785 if ( getDynamicallyHideData() != null ) {
1786 getDynamicallyHideData().setSelected( state );
1789 case Configuration.node_data_popup:
1790 if ( getNodeDescPopupCb() != null ) {
1791 getNodeDescPopupCb().setSelected( state );
1795 case Configuration.show_relation_confidence:
1796 if ( _seq_relation_confidence_switch != null ) {
1797 _seq_relation_confidence_switch.setSelected( state );
1802 throw new AssertionError( "unknown checkbox: " + which );
1807 * Set this checkbox state. Not all checkboxes have been instantiated
1808 * depending on the config.
1810 void setCheckbox( final JCheckBox cb, final boolean state ) {
1812 cb.setSelected( state );
1816 void setClickToAction( final int action ) {
1817 // Set click-to action
1818 if ( action == _show_data_item ) {
1819 setActionWhenNodeClicked( NodeClickAction.SHOW_DATA );
1821 else if ( action == _collapse_cb_item ) {
1822 setActionWhenNodeClicked( NodeClickAction.COLLAPSE );
1824 else if ( action == _reroot_cb_item ) {
1825 setActionWhenNodeClicked( NodeClickAction.REROOT );
1827 else if ( action == _subtree_cb_item ) {
1828 setActionWhenNodeClicked( NodeClickAction.SUBTREE );
1830 else if ( action == _swap_cb_item ) {
1831 setActionWhenNodeClicked( NodeClickAction.SWAP );
1833 else if ( action == _color_subtree_cb_item ) {
1834 setActionWhenNodeClicked( NodeClickAction.COLOR_SUBTREE );
1836 else if ( action == _open_seq_web_item ) {
1837 setActionWhenNodeClicked( NodeClickAction.OPEN_SEQ_WEB );
1839 else if ( action == _sort_descendents_item ) {
1840 setActionWhenNodeClicked( NodeClickAction.SORT_DESCENDENTS );
1842 else if ( action == _blast_item ) {
1843 setActionWhenNodeClicked( NodeClickAction.BLAST );
1845 else if ( action == _open_tax_web_item ) {
1846 setActionWhenNodeClicked( NodeClickAction.OPEN_TAX_WEB );
1848 else if ( action == _cut_subtree_item ) {
1849 setActionWhenNodeClicked( NodeClickAction.CUT_SUBTREE );
1851 else if ( action == _copy_subtree_item ) {
1852 setActionWhenNodeClicked( NodeClickAction.COPY_SUBTREE );
1854 else if ( action == _delete_node_or_subtree_item ) {
1855 setActionWhenNodeClicked( NodeClickAction.DELETE_NODE_OR_SUBTREE );
1857 else if ( action == _paste_subtree_item ) {
1858 setActionWhenNodeClicked( NodeClickAction.PASTE_SUBTREE );
1860 else if ( action == _add_new_node_item ) {
1861 setActionWhenNodeClicked( NodeClickAction.ADD_NEW_NODE );
1863 else if ( action == _edit_node_data_item ) {
1864 setActionWhenNodeClicked( NodeClickAction.EDIT_NODE_DATA );
1866 else if ( action == _select_nodes_item ) {
1867 setActionWhenNodeClicked( NodeClickAction.SELECT_NODES );
1869 else if ( action == _get_ext_desc_data ) {
1870 setActionWhenNodeClicked( NodeClickAction.GET_EXT_DESC_DATA );
1872 else if ( action == _open_pdb_item ) {
1873 setActionWhenNodeClicked( NodeClickAction.OPEN_PDB_WEB );
1875 else if ( action == _color_node_font_item ) {
1876 setActionWhenNodeClicked( NodeClickAction.COLOR_NODE_FONT );
1878 else if ( action == _change_node_font_item ) {
1879 setActionWhenNodeClicked( NodeClickAction.CHANGE_NODE_FONT );
1882 throw new RuntimeException( "unknown action: " + action );
1884 // make sure drop down is displaying the correct action
1885 // in case this was called from outside the class
1886 _click_to_combobox.setSelectedIndex( action );
1889 void setColorBranches( final boolean color_branches ) {
1890 _color_branches = color_branches;
1893 void setDrawPhylogram( final boolean b ) {
1894 getDisplayAsPhylogramCb().setSelected( b );
1895 setDrawPhylogram( getMainPanel().getCurrentTabIndex(), b );
1898 void setDrawPhylogramEnabled( final boolean b ) {
1899 getDisplayAsPhylogramCb().setEnabled( b );
1902 void setDynamicHidingIsOn( final boolean is_on ) {
1904 getDynamicallyHideData().setForeground( getConfiguration().getGuiCheckboxAndButtonActiveColor() );
1907 if ( !_configuration.isUseNativeUI() ) {
1908 getDynamicallyHideData().setForeground( getConfiguration().getGuiButtonTextColor() );
1911 getDynamicallyHideData().setForeground( Color.BLACK );
1916 void setSearchFoundCountsOnLabel0( final int counts ) {
1917 getSearchFoundCountsLabel0().setText( "Found: " + counts );
1920 void setSearchFoundCountsOnLabel1( final int counts ) {
1921 getSearchFoundCountsLabel1().setText( "Found: " + counts );
1924 void setSequenceColors( final Map<String, Color> sequence_colors ) {
1925 _sequence_colors = sequence_colors;
1928 void setShowEvents( final boolean show_events ) {
1929 if ( getShowEventsCb() == null ) {
1930 _show_events = new JCheckBox( "" );
1932 getShowEventsCb().setSelected( show_events );
1935 void setSpeciesColors( final Map<String, Color> species_colors ) {
1936 _species_colors = species_colors;
1939 void setupControls() {
1940 // The tree display options:
1941 setupDisplayCheckboxes();
1943 // The sequence relation query selection combo-box
1944 if ( _configuration.displaySequenceRelations() ) {
1945 addSequenceRelationBlock();
1949 startClickToOptions();
1950 setupClickToOptions();
1951 endClickToOptions();
1952 // Zoom and quick edit buttons
1954 setupSearchTools0();
1955 setupSearchTools1();
1958 void setUpControlsForDomainStrucures() {
1959 _domain_display_label = new JLabel( "Domain Architectures:" );
1960 add( customizeLabel( _domain_display_label, getConfiguration() ) );
1961 add( _domain_display_label );
1962 _zoom_in_domain_structure = new JButton( "d+" );
1963 _zoom_out_domain_structure = new JButton( "d-" );
1964 _decr_domain_structure_evalue_thr = new JButton( "-" );
1965 _incr_domain_structure_evalue_thr = new JButton( "+" );
1966 _zoom_in_domain_structure.setPreferredSize( new Dimension( 10, 10 ) );
1967 _zoom_out_domain_structure.setPreferredSize( new Dimension( 10, 10 ) );
1968 _decr_domain_structure_evalue_thr.setPreferredSize( new Dimension( 10, 10 ) );
1969 _incr_domain_structure_evalue_thr.setPreferredSize( new Dimension( 10, 10 ) );
1970 _incr_domain_structure_evalue_thr.setToolTipText( "Increase the E-value threshold by a factor of 10" );
1971 _decr_domain_structure_evalue_thr.setToolTipText( "Decrease the E-value threshold by a factor of 10" );
1972 _domain_structure_evalue_thr_tf = new JTextField( 3 );
1973 _domain_structure_evalue_thr_tf.setEditable( false );
1974 if ( !getConfiguration().isUseNativeUI() ) {
1975 _domain_structure_evalue_thr_tf.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
1976 _domain_structure_evalue_thr_tf.setBackground( getConfiguration().getGuiCheckboxTextColor() );
1977 _domain_structure_evalue_thr_tf.setBorder( null );
1979 final JPanel d1_panel = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
1980 final JPanel d2_panel = new JPanel( new GridLayout( 1, 3, 0, 0 ) );
1981 if ( !_configuration.isUseNativeUI() ) {
1982 d1_panel.setBackground( getBackground() );
1983 d2_panel.setBackground( getBackground() );
1987 addJButton( _zoom_out_domain_structure, d1_panel );
1988 addJButton( _zoom_in_domain_structure, d1_panel );
1989 addJButton( _decr_domain_structure_evalue_thr, d2_panel );
1990 addJTextField( _domain_structure_evalue_thr_tf, d2_panel );
1991 addJButton( _incr_domain_structure_evalue_thr, d2_panel );
1994 void setupSearchTools0() {
1995 final JLabel search_label = new JLabel( "Search (A):" );
1996 search_label.setFont( ControlPanel.jcb_bold_font );
1997 if ( !getConfiguration().isUseNativeUI() ) {
1998 search_label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
2000 add( search_label );
2001 search_label.setToolTipText( SEARCH_TIP_TEXT );
2002 _search_found_label_0 = new JLabel();
2003 getSearchFoundCountsLabel0().setVisible( false );
2004 _search_found_label_0.setFont( ControlPanel.jcb_bold_font );
2005 if ( !getConfiguration().isUseNativeUI() ) {
2006 _search_found_label_0.setForeground( getConfiguration().getGuiCheckboxTextColor() );
2008 _search_tf_0 = new JTextField( 3 );
2009 _search_tf_0.setToolTipText( SEARCH_TIP_TEXT );
2010 _search_tf_0.setEditable( true );
2011 if ( !getConfiguration().isUseNativeUI() ) {
2012 _search_tf_0.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
2013 _search_tf_0.setBackground( getConfiguration().getGuiCheckboxTextColor() );
2014 _search_tf_0.setBorder( null );
2016 _search_reset_button_0 = new JButton();
2017 getSearchResetButton0().setText( "Reset" );
2018 getSearchResetButton0().setEnabled( false );
2019 getSearchResetButton0().setVisible( false );
2020 final JPanel s_panel_1 = new JPanel( new BorderLayout() );
2021 final JPanel s_panel_2 = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
2022 s_panel_1.setBackground( getBackground() );
2024 s_panel_2.setBackground( getBackground() );
2026 final KeyAdapter key_adapter = new KeyAdapter() {
2029 public void keyReleased( final KeyEvent key_event ) {
2031 displayedPhylogenyMightHaveChanged( true );
2034 final ActionListener action_listener = new ActionListener() {
2037 public void actionPerformed( final ActionEvent e ) {
2039 setSearchFoundCountsOnLabel0( 0 );
2040 getSearchFoundCountsLabel0().setVisible( false );
2041 getSearchTextField0().setText( "" );
2042 getSearchResetButton0().setEnabled( false );
2043 getSearchResetButton0().setVisible( false );
2044 displayedPhylogenyMightHaveChanged( true );
2047 _search_reset_button_0.addActionListener( action_listener );
2048 _search_tf_0.addKeyListener( key_adapter );
2049 addJTextField( _search_tf_0, s_panel_1 );
2050 s_panel_2.add( _search_found_label_0 );
2051 addJButton( _search_reset_button_0, s_panel_2 );
2054 void setupSearchTools1() {
2055 final JLabel search_label = new JLabel( "Search (B):" );
2056 search_label.setFont( ControlPanel.jcb_bold_font );
2057 if ( !getConfiguration().isUseNativeUI() ) {
2058 search_label.setForeground( getConfiguration().getGuiCheckboxTextColor() );
2060 add( search_label );
2061 search_label.setToolTipText( SEARCH_TIP_TEXT );
2062 _search_found_label_1 = new JLabel();
2063 getSearchFoundCountsLabel1().setVisible( false );
2064 _search_found_label_1.setFont( ControlPanel.jcb_bold_font );
2065 if ( !getConfiguration().isUseNativeUI() ) {
2066 _search_found_label_1.setForeground( getConfiguration().getGuiCheckboxTextColor() );
2068 _search_tf_1 = new JTextField( 3 );
2069 _search_tf_1.setToolTipText( SEARCH_TIP_TEXT );
2070 _search_tf_1.setEditable( true );
2071 if ( !getConfiguration().isUseNativeUI() ) {
2072 _search_tf_1.setForeground( getConfiguration().getGuiMenuBackgroundColor() );
2073 _search_tf_1.setBackground( getConfiguration().getGuiCheckboxTextColor() );
2074 _search_tf_1.setBorder( null );
2076 _search_reset_button_1 = new JButton();
2077 getSearchResetButton1().setText( "Reset" );
2078 getSearchResetButton1().setEnabled( false );
2079 getSearchResetButton1().setVisible( false );
2080 final JPanel s_panel_1 = new JPanel( new BorderLayout() );
2081 final JPanel s_panel_2 = new JPanel( new GridLayout( 1, 2, 0, 0 ) );
2082 s_panel_1.setBackground( getBackground() );
2084 s_panel_2.setBackground( getBackground() );
2086 final KeyAdapter key_adapter = new KeyAdapter() {
2089 public void keyReleased( final KeyEvent key_event ) {
2091 displayedPhylogenyMightHaveChanged( true );
2094 final ActionListener action_listener = new ActionListener() {
2097 public void actionPerformed( final ActionEvent e ) {
2099 setSearchFoundCountsOnLabel1( 0 );
2100 getSearchFoundCountsLabel1().setVisible( false );
2101 getSearchTextField1().setText( "" );
2102 getSearchResetButton1().setEnabled( false );
2103 getSearchResetButton1().setVisible( false );
2104 displayedPhylogenyMightHaveChanged( true );
2107 _search_reset_button_1.addActionListener( action_listener );
2108 _search_tf_1.addKeyListener( key_adapter );
2109 addJTextField( _search_tf_1, s_panel_1 );
2110 s_panel_2.add( _search_found_label_1 );
2111 addJButton( _search_reset_button_1, s_panel_2 );
2114 void setVisibilityOfDomainStrucureCB() {
2116 if ( ( getCurrentTreePanel() != null )
2117 && ( ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) || ( getCurrentTreePanel()
2118 .getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) ) {
2119 if ( getMainPanel().getMainFrame()._right_line_up_domains_cbmi != null ) {
2120 getMainPanel().getMainFrame()._right_line_up_domains_cbmi.setVisible( false );
2122 if ( getMainPanel().getMainFrame()._show_domain_labels != null ) {
2123 getMainPanel().getMainFrame()._show_domain_labels.setVisible( false );
2126 else if ( isShowDomainArchitectures() ) {
2127 if ( getMainPanel().getMainFrame()._right_line_up_domains_cbmi != null ) {
2128 getMainPanel().getMainFrame()._right_line_up_domains_cbmi.setVisible( true );
2130 if ( getMainPanel().getMainFrame()._show_domain_labels != null ) {
2131 getMainPanel().getMainFrame()._show_domain_labels.setVisible( true );
2135 if ( getMainPanel().getMainFrame()._right_line_up_domains_cbmi != null ) {
2136 getMainPanel().getMainFrame()._right_line_up_domains_cbmi.setVisible( false );
2138 if ( getMainPanel().getMainFrame()._show_domain_labels != null ) {
2139 getMainPanel().getMainFrame()._show_domain_labels.setVisible( false );
2143 catch ( final Exception ignore ) {
2148 void setVisibilityOfX() {
2149 final MainFrame mf = getMainFrame();
2151 if ( ( getCurrentTreePanel() != null ) && ( getCurrentTreePanel().getPhylogeny() != null ) ) {
2152 if ( AptxUtil.isHasAtLeastOneBranchWithSupportSD( getCurrentTreePanel().getPhylogeny() ) ) {
2153 if ( mf._show_confidence_stddev_cbmi != null ) {
2154 mf._show_confidence_stddev_cbmi.setVisible( true );
2158 if ( mf._show_confidence_stddev_cbmi != null ) {
2159 mf._show_confidence_stddev_cbmi.setVisible( false );
2162 if ( AptxUtil.isHasAtLeastOneNodeWithScientificName( getCurrentTreePanel().getPhylogeny() ) ) {
2163 if ( mf._abbreviate_scientific_names != null ) {
2164 mf._abbreviate_scientific_names.setVisible( true );
2168 if ( mf._abbreviate_scientific_names != null ) {
2169 mf._abbreviate_scientific_names.setVisible( false );
2172 if ( AptxUtil.isHasAtLeastOneNodeWithSequenceAnnotation( getCurrentTreePanel().getPhylogeny() ) ) {
2173 if ( mf._show_annotation_ref_source != null ) {
2174 mf._show_annotation_ref_source.setVisible( true );
2178 if ( mf._show_annotation_ref_source != null ) {
2179 mf._show_annotation_ref_source.setVisible( false );
2183 if ( isDrawPhylogram()
2184 || ( ( getCurrentTreePanel() != null ) && ( ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) || ( getCurrentTreePanel()
2185 .getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) ) ) {
2186 if ( mf._non_lined_up_cladograms_rbmi != null ) {
2187 mf._non_lined_up_cladograms_rbmi.setVisible( false );
2189 if ( mf._uniform_cladograms_rbmi != null ) {
2190 mf._uniform_cladograms_rbmi.setVisible( false );
2192 if ( mf._ext_node_dependent_cladogram_rbmi != null ) {
2193 mf._ext_node_dependent_cladogram_rbmi.setVisible( false );
2197 if ( mf._non_lined_up_cladograms_rbmi != null ) {
2198 mf._non_lined_up_cladograms_rbmi.setVisible( true );
2200 if ( mf._uniform_cladograms_rbmi != null ) {
2201 mf._uniform_cladograms_rbmi.setVisible( true );
2203 if ( mf._ext_node_dependent_cladogram_rbmi != null ) {
2204 mf._ext_node_dependent_cladogram_rbmi.setVisible( true );
2207 if ( isDrawPhylogram() ) {
2208 if ( mf._show_scale_cbmi != null ) {
2209 mf._show_scale_cbmi.setVisible( true );
2213 if ( mf._show_scale_cbmi != null ) {
2214 mf._show_scale_cbmi.setVisible( false );
2217 if ( getCurrentTreePanel() != null ) {
2218 if ( ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
2219 || ( getCurrentTreePanel().getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED ) ) {
2220 if ( mf._label_direction_cbmi != null ) {
2221 mf._label_direction_cbmi.setVisible( true );
2225 if ( mf._label_direction_cbmi != null ) {
2226 mf._label_direction_cbmi.setVisible( false );
2233 void showAnnotations() {
2234 if ( _show_annotation != null ) {
2235 _show_annotation.setSelected( true );
2237 if ( _color_according_to_annotation != null ) {
2238 _color_according_to_annotation.setSelected( true );
2240 if ( _color_acc_species != null ) {
2241 _color_acc_species.setSelected( false );
2243 if ( _color_acc_sequence != null ) {
2244 _color_acc_sequence.setSelected( false );
2246 _mainpanel.getCurrentTreePanel().repaint();
2250 * Fit entire tree into window.
2253 if ( ( _mainpanel.getCurrentScrollPane() == null ) || _mainpanel.getCurrentTreePanel().getPhylogeny().isEmpty() ) {
2256 getCurrentTreePanel().updateSetOfCollapsedExternalNodes();
2257 displayedPhylogenyMightHaveChanged( true );
2258 _mainpanel.getCurrentTreePanel().updateOvSettings();
2259 _mainpanel.getCurrentTreePanel().validate();
2260 _mainpanel.validate();
2261 _mainpanel.getCurrentTreePanel().calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
2262 _mainpanel.getSizeOfViewport().height );
2263 _mainpanel.getCurrentTreePanel().resetPreferredSize();
2264 _mainpanel.adjustJScrollPane();
2265 _mainpanel.getCurrentTreePanel().repaint();
2266 _mainpanel.getCurrentTreePanel().validate();
2267 _mainpanel.validate();
2268 _mainpanel.getCurrentTreePanel().calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
2269 _mainpanel.getSizeOfViewport().height );
2270 _mainpanel.getCurrentTreePanel().resetPreferredSize();
2271 _mainpanel.adjustJScrollPane();
2272 _mainpanel.getCurrentTreePanel().repaint();
2273 _mainpanel.getCurrentTreePanel().updateOvSizes();
2276 void showWholeAll() {
2277 for( final TreePanel tree_panel : _mainpanel.getTreePanels() ) {
2278 if ( tree_panel != null ) {
2279 tree_panel.validate();
2280 tree_panel.calcParametersForPainting( _mainpanel.getSizeOfViewport().width,
2281 _mainpanel.getSizeOfViewport().height );
2282 tree_panel.resetPreferredSize();
2283 tree_panel.repaint();
2288 // Create header for click-to combo box.
2289 void startClickToOptions() {
2290 final JLabel spacer = new JLabel( "" );
2291 spacer.setFont( ControlPanel.jcb_font );
2293 _click_to_label = new JLabel( "Click on Node to:" );
2294 add( customizeLabel( _click_to_label, getConfiguration() ) );
2295 _click_to_combobox = new JComboBox<String>();
2296 _click_to_combobox.setFocusable( false );
2297 _click_to_combobox.setMaximumRowCount( 14 );
2298 _click_to_combobox.setFont( ControlPanel.js_font );
2299 if ( !_configuration.isUseNativeUI() ) {
2300 _click_to_combobox.setBackground( getConfiguration().getGuiBackgroundColor() );
2302 // don't add listener until all items are set (or each one will trigger
2304 // click_to_list.addActionListener(this);
2305 add( _click_to_combobox );
2306 // Correlates option names to titles
2307 _all_click_to_names = new HashMap<Integer, String>();
2308 _click_to_names = new ArrayList<String>();
2312 if ( getMainPanel().getTabbedPane().getTabCount() > 0 ) {
2313 if ( getCurrentTreePanel().isPhyHasBranchLengths()
2314 && ( getCurrentTreePanel().getPhylogenyGraphicsType() != PHYLOGENY_GRAPHICS_TYPE.CIRCULAR ) ) {
2315 setDrawPhylogramEnabled( true );
2316 setDrawPhylogram( isDrawPhylogram() );
2319 setDrawPhylogramEnabled( false );
2320 setDrawPhylogram( false );
2322 if ( getMainPanel().getMainFrame() == null ) {
2323 // Must be "E" applet version.
2324 final ArchaeopteryxE e = ( ArchaeopteryxE ) ( ( MainPanelApplets ) getMainPanel() ).getApplet();
2325 e.setSelectedTypeInTypeMenu( e.getCurrentTreePanel().getPhylogenyGraphicsType() );
2328 getMainPanel().getMainFrame().setSelectedTypeInTypeMenu( getMainPanel().getCurrentTreePanel()
2329 .getPhylogenyGraphicsType() );
2331 getMainPanel().getCurrentTreePanel().updateSubSuperTreeButton();
2332 getMainPanel().getControlPanel().search0();
2333 getMainPanel().getControlPanel().search1();
2334 getMainPanel().getControlPanel().updateDomainStructureEvaluethresholdDisplay();
2335 getSequenceRelationTypeBox().removeAllItems();
2336 for( final SequenceRelation.SEQUENCE_RELATION_TYPE type : getMainPanel().getCurrentPhylogeny()
2337 .getRelevantSequenceRelationTypes() ) {
2338 _sequence_relation_type_box.addItem( type );
2340 getMainPanel().getCurrentTreePanel().repaint();
2341 //setSequenceRelationQueries( getMainPanel().getCurrentPhylogeny().getSequenceRelationQueries() );
2342 // according to GUILHEM the line above can be removed.
2347 * Uncollapse all nodes.
2349 void uncollapseAll( final TreePanel tp ) {
2350 final Phylogeny t = tp.getPhylogeny();
2351 if ( ( t != null ) && !t.isEmpty() ) {
2352 for( final PhylogenyNodeIterator iter = t.iteratorPreorder(); iter.hasNext(); ) {
2353 final PhylogenyNode node = iter.next();
2354 node.setCollapse( false );
2356 tp.resetNodeIdToDistToLeafMap();
2357 tp.updateSetOfCollapsedExternalNodes();
2358 t.recalculateNumberOfExternalDescendants( false );
2359 tp.setNodeInPreorderToNull();
2360 t.clearHashIdToNodeMap();
2365 void updateDomainStructureEvaluethresholdDisplay() {
2366 if ( _domain_structure_evalue_thr_tf != null ) {
2367 _domain_structure_evalue_thr_tf.setText( "10^"
2368 + getMainPanel().getCurrentTreePanel().getDomainStructureEvalueThresholdExp() );
2372 void zoomInX( final float factor, final float x_correction_factor ) {
2373 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar();
2374 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
2375 treepanel.multiplyUrtFactor( 1f );
2376 if ( ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
2377 || ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
2378 || isDrawPhylogram( getMainPanel().getCurrentTabIndex() )
2379 || ( getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP ) ) {
2380 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
2381 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
2382 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
2383 getMainPanel().adjustJScrollPane();
2384 treepanel.resetPreferredSize();
2385 getMainPanel().getCurrentScrollPane().getViewport().validate();
2386 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
2387 - ( sb.getVisibleAmount() / 2.0 ) ) );
2390 final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue();
2391 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
2392 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
2393 getMainPanel().adjustJScrollPane();
2394 treepanel.resetPreferredSize();
2395 getMainPanel().getCurrentScrollPane().getViewport().validate();
2396 sb.setValue( sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount() );
2398 treepanel.resetPreferredSize();
2399 treepanel.updateOvSizes();
2402 void zoomInY( final float factor ) {
2403 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getVerticalScrollBar();
2404 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
2405 treepanel.multiplyUrtFactor( 1.1f );
2406 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
2407 treepanel.setYdistance( ( treepanel.getYdistance() * factor ) );
2408 getMainPanel().adjustJScrollPane();
2409 treepanel.resetPreferredSize();
2410 getMainPanel().getCurrentScrollPane().getViewport().validate();
2411 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
2412 - ( sb.getVisibleAmount() / 2.0 ) ) );
2413 treepanel.resetPreferredSize();
2414 treepanel.updateOvSizes();
2417 void zoomOutX( final float factor, final float x_correction_factor ) {
2418 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
2419 treepanel.multiplyUrtFactor( 1f );
2420 if ( ( treepanel.getXdistance() * factor ) > 0.0 ) {
2421 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getHorizontalScrollBar();
2422 if ( ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.CIRCULAR )
2423 || ( treepanel.getPhylogenyGraphicsType() == PHYLOGENY_GRAPHICS_TYPE.UNROOTED )
2424 || isDrawPhylogram( getMainPanel().getCurrentTabIndex() )
2425 || ( getOptions().getCladogramType() == CLADOGRAM_TYPE.NON_LINED_UP ) ) {
2426 getMainPanel().adjustJScrollPane();
2427 treepanel.resetPreferredSize();
2428 getMainPanel().getCurrentScrollPane().getViewport().validate();
2429 final double x = ( sb.getMaximum() - sb.getMinimum() )
2430 / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
2431 treepanel.setXdistance( ( treepanel.getXdistance() * factor ) );
2432 treepanel.setXcorrectionFactor( ( treepanel.getXcorrectionFactor() * x_correction_factor ) );
2433 getMainPanel().adjustJScrollPane();
2434 treepanel.resetPreferredSize();
2435 getMainPanel().getCurrentScrollPane().getViewport().validate();
2436 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
2437 - ( sb.getVisibleAmount() / 2.0 ) ) );
2440 final int x = sb.getMaximum() - sb.getMinimum() - sb.getVisibleAmount() - sb.getValue();
2441 treepanel.setXdistance( treepanel.getXdistance() * factor );
2442 treepanel.setXcorrectionFactor( treepanel.getXcorrectionFactor() * x_correction_factor );
2444 getMainPanel().adjustJScrollPane();
2445 treepanel.resetPreferredSize();
2446 getMainPanel().getCurrentScrollPane().getViewport().validate();
2447 sb.setValue( sb.getMaximum() - sb.getMinimum() - x - sb.getVisibleAmount() );
2450 treepanel.resetPreferredSize();
2451 treepanel.updateOvSizes();
2455 void zoomOutY( final float factor ) {
2456 final TreePanel treepanel = getMainPanel().getCurrentTreePanel();
2457 treepanel.multiplyUrtFactor( 0.9f );
2458 if ( ( treepanel.getYdistance() * factor ) > 0.0 ) {
2459 final JScrollBar sb = getMainPanel().getCurrentScrollPane().getVerticalScrollBar();
2460 final double x = ( sb.getMaximum() - sb.getMinimum() ) / ( sb.getValue() + ( sb.getVisibleAmount() / 2.0 ) );
2461 treepanel.setYdistance( ( treepanel.getYdistance() * factor ) );
2462 getMainPanel().adjustJScrollPane();
2463 treepanel.resetPreferredSize();
2464 getMainPanel().getCurrentScrollPane().getViewport().validate();
2465 sb.setValue( ForesterUtil.roundToInt( ( ( sb.getMaximum() - sb.getMinimum() ) / x )
2466 - ( sb.getVisibleAmount() / 2.0 ) ) );
2467 treepanel.resetPreferredSize();
2468 treepanel.updateOvSizes();
2472 static JLabel customizeLabel( final JLabel label, final Configuration configuration ) {
2473 label.setFont( ControlPanel.jcb_bold_font );
2474 if ( !configuration.isUseNativeUI() ) {
2475 label.setForeground( configuration.getGuiCheckboxTextColor() );
2476 label.setBackground( configuration.getGuiBackgroundColor() );