+ if ( ( _mainpanel.getCurrentPhylogeny() != null ) && !_mainpanel.getCurrentPhylogeny().isEmpty() ) {
+ String title = "phyloXML";
+ if ( !ForesterUtil.isEmpty( _mainpanel.getCurrentPhylogeny().getName() ) ) {
+ title = _mainpanel.getCurrentPhylogeny().getName() + " " + title;
+ }
+ showTextFrame( _mainpanel.getCurrentPhylogeny().toPhyloXML( 0 ), title );
+ }
+ }
+
+ private void annotateSequences() {
+ if ( getCurrentTreePanel() != null ) {
+ final Set<Integer> nodes = getCurrentTreePanel().getFoundNodes();
+ if ( ( nodes == null ) || nodes.isEmpty() ) {
+ JOptionPane
+ .showMessageDialog( this,
+ "Need to select nodes, either via direct selection or via the \"Search\" function",
+ "No nodes selected for annotation",
+ JOptionPane.ERROR_MESSAGE );
+ return;
+ }
+ final Phylogeny phy = getMainPanel().getCurrentPhylogeny();
+ if ( ( phy != null ) && !phy.isEmpty() ) {
+ final JTextField ref_field = new JTextField( 10 );
+ final JTextField desc_filed = new JTextField( 20 );
+ ref_field.setText( ForesterUtil.isEmpty( getPreviousNodeAnnotationReference() ) ? ""
+ : getPreviousNodeAnnotationReference() );
+ final JPanel my_panel = new JPanel();
+ my_panel.add( new JLabel( "Reference " ) );
+ my_panel.add( ref_field );
+ my_panel.add( Box.createHorizontalStrut( 15 ) );
+ my_panel.add( new JLabel( "Description " ) );
+ my_panel.add( desc_filed );
+ final int result = JOptionPane.showConfirmDialog( null,
+ my_panel,
+ "Enter the sequence annotation(s) for the "
+ + nodes.size() + " selected nodes",
+ JOptionPane.OK_CANCEL_OPTION );
+ if ( result == JOptionPane.OK_OPTION ) {
+ String ref = ref_field.getText();
+ String desc = desc_filed.getText();
+ if ( !ForesterUtil.isEmpty( ref ) ) {
+ ref = ref.trim();
+ ref = ref.replaceAll( "\\s+", " " );
+ if ( ( ref.indexOf( ':' ) < 1 ) || ( ref.indexOf( ':' ) > ref.length() - 2 )
+ || ( ref.length() < 3 ) ) {
+ JOptionPane.showMessageDialog( this,
+ "Reference needs to be in the form of \"GO:1234567\"",
+ "Illegal Format for Annotation Reference",
+ JOptionPane.ERROR_MESSAGE );
+ return;
+ }
+ }
+ if ( ref != null ) {
+ setPreviousNodeAnnotationReference( ref );
+ }
+ if ( desc != null ) {
+ desc = desc.trim();
+ desc = desc.replaceAll( "\\s+", " " );
+ }
+ if ( !ForesterUtil.isEmpty( ref ) || !ForesterUtil.isEmpty( desc ) ) {
+ for( final Integer id : nodes ) {
+ final PhylogenyNode n = phy.getNode( id );
+ ForesterUtil.ensurePresenceOfSequence( n );
+ final Annotation ann = ForesterUtil.isEmpty( ref ) ? new Annotation()
+ : new Annotation( ref );
+ if ( !ForesterUtil.isEmpty( desc ) ) {
+ ann.setDesc( desc );
+ }
+ n.getNodeData().getSequence().addAnnotation( ann );
+ }
+ }
+ getMainPanel().getControlPanel().showAnnotations();
+ }
+ }
+ }
+ }
+
+ private void chooseFont() {
+ final FontChooser fc = new FontChooser();
+ fc.setFont( getMainPanel().getTreeFontSet().getLargeFont() );
+ fc.showDialog( this, "Select the Base Font" );
+ getMainPanel().getTreeFontSet().setBaseFont( fc.getFont() );
+ }
+
+ private void chooseMinimalConfidence() {
+ final String s = ( String ) JOptionPane
+ .showInputDialog( this,
+ "Please enter the minimum for confidence values to be displayed.\n"
+ + "[current value: " + getOptions().getMinConfidenceValue() + "]\n",
+ "Minimal Confidence Value",
+ JOptionPane.QUESTION_MESSAGE,
+ null,
+ null,
+ getOptions().getMinConfidenceValue() );
+ if ( !ForesterUtil.isEmpty( s ) ) {
+ boolean success = true;
+ double m = 0.0;
+ final String m_str = s.trim();
+ if ( !ForesterUtil.isEmpty( m_str ) ) {
+ try {
+ m = Double.parseDouble( m_str );
+ }
+ catch ( final Exception ex ) {
+ success = false;
+ }
+ }
+ else {
+ success = false;
+ }
+ if ( success && ( m >= 0.0 ) ) {
+ getOptions().setMinConfidenceValue( m );
+ }
+ }
+ }
+
+ private void doUpdateProcessMenu() {
+ if ( _process_pool.size() > 0 ) {
+ if ( _process_menu == null ) {
+ _process_menu = createMenu( "", getConfiguration() );
+ _process_menu.setForeground( Color.RED );
+ }
+ _process_menu.removeAll();
+ final String text = "processes running: " + _process_pool.size();
+ _process_menu.setText( text );
+ _jmenubar.add( _process_menu );
+ for( int i = 0; i < _process_pool.size(); ++i ) {
+ final ProcessRunning p = _process_pool.getProcessByIndex( i );
+ _process_menu.add( customizeJMenuItem( new JMenuItem( p.getName() + " [" + p.getStart() + "]" ) ) );
+ }
+ }
+ else {
+ if ( _process_menu != null ) {
+ _process_menu.removeAll();
+ _jmenubar.remove( _process_menu );
+ }
+ }
+ _jmenubar.validate();
+ _jmenubar.repaint();
+ repaint();
+ }
+
+ private String getPreviousNodeAnnotationReference() {
+ return _previous_node_annotation_ref;
+ }
+
+ private void removeBranchColors() {
+ if ( getMainPanel().getCurrentPhylogeny() != null ) {
+ AptxUtil.removeBranchColors( getMainPanel().getCurrentPhylogeny() );