From 56cc12bcb9783e1bd16f57e12534434c31901879 Mon Sep 17 00:00:00 2001 From: kjvdheide Date: Sat, 10 Feb 2018 18:36:23 +0100 Subject: [PATCH] JAL-2797 the big switch, all GUI method calls now go via the AptxFrame interface --- .../org/forester/analysis/TaxonomyDataManager.java | 12 +- .../src/org/forester/archaeopteryx/MainFrame.java | 156 +++++++++++++++----- .../archaeopteryx/MainFrameApplication.java | 129 ++++++++-------- .../org/forester/archaeopteryx/UrlTreeReader.java | 16 +- .../tools/AncestralTaxonomyInferrer.java | 10 +- .../archaeopteryx/tools/PhyloInferenceDialog.java | 4 +- .../archaeopteryx/tools/PhylogeneticInferrer.java | 10 +- .../archaeopteryx/tools/SequenceDataRetriver.java | 8 +- 8 files changed, 217 insertions(+), 128 deletions(-) diff --git a/forester/java/src/org/forester/analysis/TaxonomyDataManager.java b/forester/java/src/org/forester/analysis/TaxonomyDataManager.java index 78c75f9..f99dc7f 100644 --- a/forester/java/src/org/forester/analysis/TaxonomyDataManager.java +++ b/forester/java/src/org/forester/analysis/TaxonomyDataManager.java @@ -482,7 +482,7 @@ public final class TaxonomyDataManager extends RunnableProcess { not_found = obtainDetailedTaxonomicInformation( _phy, _delete, _allow_simple_names ); } catch ( final UnknownHostException e ) { - JOptionPane.showMessageDialog( _mf, + JOptionPane.showMessageDialog( _mf.getThisFrame(), "Could not connect to \"" + getBaseUrl() + "\"", "Network error during taxonomic information gathering", JOptionPane.ERROR_MESSAGE ); @@ -490,7 +490,7 @@ public final class TaxonomyDataManager extends RunnableProcess { } catch ( final IOException e ) { e.printStackTrace(); - JOptionPane.showMessageDialog( _mf, + JOptionPane.showMessageDialog( _mf.getThisFrame(), e.toString(), "Failed to obtain taxonomic information", JOptionPane.ERROR_MESSAGE ); @@ -498,7 +498,7 @@ public final class TaxonomyDataManager extends RunnableProcess { } catch ( final AncestralTaxonomyInferenceException e ) { e.printStackTrace(); - JOptionPane.showMessageDialog( _mf, + JOptionPane.showMessageDialog( _mf.getThisFrame(), e.toString(), "Failed to obtain taxonomic information", JOptionPane.ERROR_MESSAGE ); @@ -509,7 +509,7 @@ public final class TaxonomyDataManager extends RunnableProcess { } if ( ( _phy == null ) || _phy.isEmpty() ) { try { - JOptionPane.showMessageDialog( _mf, + JOptionPane.showMessageDialog( _mf.getThisFrame(), "None of the external node taxonomies could be resolved", "Taxonomy Tool Failed", JOptionPane.WARNING_MESSAGE ); @@ -561,7 +561,7 @@ public final class TaxonomyDataManager extends RunnableProcess { sb.append( "..." ); } try { - JOptionPane.showMessageDialog( _mf, + JOptionPane.showMessageDialog( _mf.getThisFrame(), sb.toString(), "Taxonomy Tool Completed", JOptionPane.WARNING_MESSAGE ); @@ -572,7 +572,7 @@ public final class TaxonomyDataManager extends RunnableProcess { } else { try { - JOptionPane.showMessageDialog( _mf, + JOptionPane.showMessageDialog( _mf.getThisFrame(), "Taxonomy tool successfully completed", "Taxonomy Tool Completed", JOptionPane.INFORMATION_MESSAGE ); diff --git a/forester/java/src/org/forester/archaeopteryx/MainFrame.java b/forester/java/src/org/forester/archaeopteryx/MainFrame.java index e15becb..3cdbca2 100644 --- a/forester/java/src/org/forester/archaeopteryx/MainFrame.java +++ b/forester/java/src/org/forester/archaeopteryx/MainFrame.java @@ -30,6 +30,8 @@ import java.awt.Container; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.ComponentAdapter; +import java.awt.event.ComponentListener; import java.io.File; import java.io.IOException; import java.util.ArrayList; @@ -82,7 +84,7 @@ import org.forester.util.ForesterConstants; import org.forester.util.ForesterUtil; import org.forester.util.WindowsUtils; -public abstract class MainFrame extends JInternalFrame implements ActionListener { +public abstract class MainFrame implements ActionListener { public final static NHFilter nhfilter = new NHFilter(); public final static NHXFilter nhxfilter = new NHXFilter(); @@ -148,6 +150,8 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener static final String LINE_UP_RENDERABLE_DATA = "Line Up Diagrams (such as Domain Architectures)"; static final String INFER_ANCESTOR_TAXONOMIES = "Infer Ancestor Taxonomies"; static final String OBTAIN_DETAILED_TAXONOMIC_INFORMATION = "Obtain Detailed Taxonomic Information"; + + final AptxFrame _frame; JMenuBar _jmenubar; JMenu _file_jmenu; JMenu _tools_menu; @@ -297,6 +301,15 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener private String _previous_node_annotation_ref; MainFrame() { + this(false); + } + MainFrame(boolean embedded){ + if (embedded) { + _frame = new EmbeddedFrame(); + } + else { + _frame = new StandaloneFrame(); + } _process_pool = ProcessPool.createInstance(); _writetopdf_filechooser = new JFileChooser(); _writetopdf_filechooser.setMultiSelectionEnabled( false ); @@ -321,7 +334,69 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener // Do nothing. Not important. } } - + public void addComponentListener( ComponentListener componentListener ) { + _frame.addComponentListener( componentListener ); + + } + + public void dispose() { + _frame.dispose(); + } + public Container getContentPane() { + return _frame.getContentPane(); + } + + public void repaint() { + _frame.repaint(); + } + + + public void addFrameListener(FrameListener frameListener) { + _frame.addFrameListener(frameListener); + } + + public void setSize(int x, int y) { + _frame.setSize(x,y); + } + public Container getJMenuBar() { + return _frame.getJMenuBar(); + } + public void setDefaultCloseOperation( int doNothingOnClose ) { + _frame.setDefaultCloseOperation(doNothingOnClose); + + } + public Container getParent() { + return _frame.getParent(); + } + public void setVisible(boolean visible) { + _frame.setVisible(visible); + } + public void requestFocusInWindow() { + _frame.requestFocusInWindow(); + } + public void setJMenuBar( JMenuBar jmenubar ) { + _frame.setJMenuBar(jmenubar); + } + public void setLocationRelativeTo( Component component ) { + _frame.setLocationRelativeTo(component); + } + public void setTitle(String title) { + _frame.setTitle(title); + } + + public Container getThisFrame() { + return _frame.getThisFrame(); + } + + public void validate() { + _frame.validate(); + } + + + + + + /** * Action performed. */ @@ -448,7 +523,7 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener chooseMinimalConfidence(); } else if ( o == _choose_node_size_mi ) { - chooseNodeSize( getOptions(), this ); + chooseNodeSize( getOptions(), _frame.getThisFrame() ); } else if ( o == _overview_placment_mi ) { MainFrame.cycleOverview( getOptions(), getCurrentTreePanel() ); @@ -661,7 +736,7 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener _writetopdf_filechooser, _current_dir, getContentPane(), - this ); + getThisFrame() ); if ( curr_dir != null ) { setCurrentDir( curr_dir ); } @@ -674,7 +749,7 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener GraphicsExportType.JPG, _mainpanel, _writetographics_filechooser, - this, + getThisFrame(), getContentPane(), _current_dir ); if ( new_dir != null ) { @@ -686,7 +761,7 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener GraphicsExportType.GIF, _mainpanel, _writetographics_filechooser, - this, + getThisFrame(), getContentPane(), _current_dir ); if ( new_dir != null ) { @@ -698,7 +773,7 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener GraphicsExportType.TIFF, _mainpanel, _writetographics_filechooser, - this, + getThisFrame(), getContentPane(), _current_dir ); if ( new_dir != null ) { @@ -710,7 +785,7 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener GraphicsExportType.BMP, _mainpanel, _writetographics_filechooser, - this, + getThisFrame(), getContentPane(), _current_dir ); if ( new_dir != null ) { @@ -722,7 +797,7 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener GraphicsExportType.PNG, _mainpanel, _writetographics_filechooser, - this, + getThisFrame(), getContentPane(), _current_dir ); if ( new_dir != null ) { @@ -730,7 +805,7 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener } } else if ( o == _print_item ) { - print( getCurrentTreePanel(), getOptions(), this ); + print( getCurrentTreePanel(), getOptions(), _frame.getThisFrame() ); } else if ( o == _save_item ) { final File new_dir = writeToFile( _mainpanel.getCurrentPhylogeny(), @@ -738,7 +813,7 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener _save_filechooser, _current_dir, getContentPane(), - this ); + _frame.getThisFrame() ); if ( new_dir != null ) { setCurrentDir( new_dir ); } @@ -757,7 +832,7 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener } else if ( o == _lineage_inference ) { if ( isSubtreeDisplayed() ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Subtree is shown.", "Cannot infer ancestral taxonomies", JOptionPane.ERROR_MESSAGE ); @@ -777,6 +852,7 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener _contentpane.repaint(); } + public Configuration getConfiguration() { return _configuration; } @@ -847,7 +923,7 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener } if ( ( nodes == null ) || nodes.isEmpty() ) { JOptionPane - .showMessageDialog( this, + .showMessageDialog( getThisFrame(), "Need to select nodes, either via direct selection or via the \"Search\" function", "No nodes selected for annotation", JOptionPane.ERROR_MESSAGE ); @@ -878,7 +954,7 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener ref = ref.replaceAll( "\\s+", " " ); if ( ( ref.indexOf( ':' ) < 1 ) || ( ref.indexOf( ':' ) > ( ref.length() - 2 ) ) || ( ref.length() < 3 ) ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Reference needs to be in the form of \"GO:1234567\"", "Illegal Format for Annotation Reference", JOptionPane.ERROR_MESSAGE ); @@ -912,7 +988,7 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener private void chooseFont() { final FontChooser fc = new FontChooser(); fc.setFont( getMainPanel().getTreeFontSet().getLargeFont() ); - fc.showDialog( this, "Select the Base Font" ); + fc.showDialog( getThisFrame(), "Select the Base Font" ); getMainPanel().getTreeFontSet().setBaseFont( fc.getFont() ); getControlPanel().displayedPhylogenyMightHaveChanged( true ); if ( getMainPanel().getCurrentTreePanel() != null ) { @@ -925,7 +1001,7 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener private void chooseMinimalConfidence() { final String s = ( String ) JOptionPane - .showInputDialog( this, + .showInputDialog( getThisFrame(), "Please enter the minimum for confidence values to be displayed.\n" + "[current value: " + getOptions().getMinConfidenceValue() + "]\n", "Minimal Confidence Value", @@ -974,7 +1050,7 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener } if ( ( nodes == null ) || nodes.isEmpty() ) { JOptionPane - .showMessageDialog( this, + .showMessageDialog( getThisFrame(), "Need to select external nodes, either via direct selection or via the \"Search\" function", "No external nodes selected to " + function.toLowerCase(), JOptionPane.ERROR_MESSAGE ); @@ -987,7 +1063,7 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener res = ext - todo; } if ( res < 1 ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Cannot delete all nodes", "Attempt to delete all nodes ", JOptionPane.ERROR_MESSAGE ); @@ -1085,7 +1161,7 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener setCurrentDir( _save_filechooser.getCurrentDirectory() ); if ( ( file != null ) && ( result == JFileChooser.APPROVE_OPTION ) ) { if ( file.exists() ) { - final int i = JOptionPane.showConfirmDialog( this, + final int i = JOptionPane.showConfirmDialog( getThisFrame(), file + " already exists. Overwrite?", "Warning", JOptionPane.OK_CANCEL_OPTION, @@ -1098,7 +1174,7 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener file.delete(); } catch ( final Exception e ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Failed to delete: " + file, "Error", JOptionPane.WARNING_MESSAGE ); @@ -1121,7 +1197,7 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener writer.toPhyloXML( file, trees, 0, ForesterUtil.LINE_SEPARATOR ); } catch ( final IOException e ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Failed to write to: " + file, "Error", JOptionPane.WARNING_MESSAGE ); @@ -1267,7 +1343,7 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener } void choosePdfWidth() { - final String s = ( String ) JOptionPane.showInputDialog( this, + final String s = ( String ) JOptionPane.showInputDialog( getThisFrame(), "Please enter the default line width for PDF export.\n" + "[current value: " + getOptions().getPrintLineWidth() + "]\n", @@ -1314,7 +1390,7 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener final Map present_ranks = AptxUtil.getRankCounts( _mainpanel.getCurrentTreePanel().getPhylogeny()); final String[] ranks = AptxUtil.getAllPossibleRanks(present_ranks); String rank = ( String ) JOptionPane - .showInputDialog( this, + .showInputDialog( getThisFrame(), "What rank should the colorization be based on", "Rank Selection", JOptionPane.QUESTION_MESSAGE, @@ -1389,7 +1465,7 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener catch ( final Exception ex ) { // Do nothing. } - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), ForesterUtil.wordWrap( e.getLocalizedMessage(), 80 ), "Error during File|Open", JOptionPane.ERROR_MESSAGE ); @@ -1400,7 +1476,7 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener return; } if ( !_mainpanel.getCurrentPhylogeny().isRooted() ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Gene tree is not rooted.", "Cannot execute GSDI", JOptionPane.ERROR_MESSAGE ); @@ -1415,7 +1491,7 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener gsdi = new GSDI( gene_tree, species_tree, false, true, true, true ); } catch ( final SDIException e ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), e.getLocalizedMessage(), "Error during GSDI", JOptionPane.ERROR_MESSAGE ); @@ -1439,7 +1515,7 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener _mainpanel.getCurrentTreePanel().setEdited( true ); final int poly = PhylogenyMethods.countNumberOfPolytomies( species_tree ); if ( gsdi.getStrippedExternalGeneTreeNodes().size() > 0 ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Duplications: " + gsdi.getDuplicationsSum() + "\n" + "Potential duplications: " + gsdi.getSpeciationOrDuplicationEventsSum() + "\n" @@ -1452,7 +1528,7 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener JOptionPane.WARNING_MESSAGE ); } else { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Duplications: " + gsdi.getDuplicationsSum() + "\n" + "Potential duplications: " + gsdi.getSpeciationOrDuplicationEventsSum() + "\n" @@ -1473,7 +1549,7 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener final int p = PhylogenyMethods.countNumberOfPolytomies( _mainpanel.getCurrentPhylogeny() ); if ( ( p > 0 ) && !( ( p == 1 ) && ( _mainpanel.getCurrentPhylogeny().getRoot().getNumberOfDescendants() == 3 ) ) ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Gene tree is not completely binary", "Cannot execute GSDI", JOptionPane.ERROR_MESSAGE ); @@ -1488,7 +1564,7 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener gsdir = new GSDIR( gene_tree, species_tree, true, true, true ); } catch ( final SDIException e ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), e.getLocalizedMessage(), "Error during GSDIR", JOptionPane.ERROR_MESSAGE ); @@ -1514,7 +1590,7 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener _mainpanel.getCurrentTreePanel().setEdited( true ); final int poly = PhylogenyMethods.countNumberOfPolytomies( species_tree ); if ( gsdir.getStrippedExternalGeneTreeNodes().size() > 0 ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Minimal duplications: " + gsdir.getMinDuplicationsSum() + "\n" + "Speciations: " + gsdir.getSpeciationsSum() + "\n" + "Stripped gene tree nodes: " @@ -1525,7 +1601,7 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener JOptionPane.WARNING_MESSAGE ); } else { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Minimal duplications: " + gsdir.getMinDuplicationsSum() + "\n" + "Speciations: " + gsdir.getSpeciationsSum() + "\n" + "Stripped gene tree nodes: " @@ -1542,7 +1618,7 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener return; } if ( !_mainpanel.getCurrentPhylogeny().isRooted() ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Phylogeny is not rooted.", "Cannot infer ancestral taxonomies", JOptionPane.ERROR_MESSAGE ); @@ -1557,14 +1633,14 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener boolean GAndSDoHaveMoreThanOneSpeciesInComman( final Phylogeny gene_tree ) { if ( ( gene_tree == null ) || gene_tree.isEmpty() ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Gene tree and species tree have no species in common.", "Error during SDI", JOptionPane.ERROR_MESSAGE ); return false; } else if ( gene_tree.getNumberOfExternalNodes() < 2 ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Gene tree and species tree have only one species in common.", "Error during SDI", JOptionPane.ERROR_MESSAGE ); @@ -1656,21 +1732,21 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener return false; } else if ( ( getSpeciesTree() == null ) || getSpeciesTree().isEmpty() ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "No species tree loaded", "Cannot execute GSDI", JOptionPane.ERROR_MESSAGE ); return false; } else if ( species_tree_has_to_binary && !getSpeciesTree().isCompletelyBinary() ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Species tree is not completely binary", "Cannot execute GSDI", JOptionPane.ERROR_MESSAGE ); return false; } else if ( gene_tree_has_to_binary && !_mainpanel.getCurrentPhylogeny().isCompletelyBinary() ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Gene tree is not completely binary", "Cannot execute GSDI", JOptionPane.ERROR_MESSAGE ); @@ -1685,7 +1761,7 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener if ( getCurrentTreePanel() != null ) { if ( getCurrentTreePanel().isCurrentTreeIsSubtree() ) { JOptionPane - .showMessageDialog( this, + .showMessageDialog( getThisFrame(), "This operation can only be performed on a complete tree, not on the currently displayed sub-tree only.", "Operation can not be exectuted on a sub-tree", JOptionPane.WARNING_MESSAGE ); @@ -2620,6 +2696,8 @@ public abstract class MainFrame extends JInternalFrame implements ActionListener } return new_current_dir; } + + } class DefaultFilter extends FileFilter { diff --git a/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java b/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java index 07984fc..45ae79d 100644 --- a/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java +++ b/forester/java/src/org/forester/archaeopteryx/MainFrameApplication.java @@ -163,10 +163,11 @@ public final class MainFrameApplication extends MainFrame { setSize( MainFrameApplication.FRAME_X_SIZE, MainFrameApplication.FRAME_Y_SIZE ); // The window listener setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE ); - addInternalFrameListener( new InternalFrameAdapter() { + addFrameListener( new FrameAdapter() { @Override - public void internalFrameClosing (final InternalFrameEvent e ) { + public void FrameClosing () { + exit(); } } ); @@ -182,6 +183,8 @@ public final class MainFrameApplication extends MainFrame { _contentpane.repaint(); } + + private MainFrameApplication( final Phylogeny[] phys, final Configuration config, final String title ) { this( phys, config, title, null ); } @@ -305,10 +308,10 @@ public final class MainFrameApplication extends MainFrame { // The window listener setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE ); - addInternalFrameListener( new InternalFrameAdapter() { + addFrameListener( new FrameAdapter() { @Override - public void internalFrameClosing( final InternalFrameEvent e ) { + public void FrameClosing( ) { if (MainFrameApplication.this.getParent() == null) { if ( isUnsavedDataPresent() ) { final int r = JOptionPane.showConfirmDialog( _mainpanel, @@ -356,6 +359,12 @@ public final class MainFrameApplication extends MainFrame { System.gc(); } + + + + + + private MainFrameApplication( final Phylogeny[] phys, final String config_file, final String title ) { // Reads the config file (false, false => not url, not applet): this( phys, new Configuration( config_file, false, false, true ), title ); @@ -524,7 +533,7 @@ public final class MainFrameApplication extends MainFrame { } catch ( final MsaFormatException e ) { setArrowCursor(); - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), e.getLocalizedMessage(), "Multiple sequence alignment format error", JOptionPane.ERROR_MESSAGE ); @@ -532,7 +541,7 @@ public final class MainFrameApplication extends MainFrame { } catch ( final IOException e ) { setArrowCursor(); - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), e.getLocalizedMessage(), "Failed to read multiple sequence alignment", JOptionPane.ERROR_MESSAGE ); @@ -540,7 +549,7 @@ public final class MainFrameApplication extends MainFrame { } catch ( final IllegalArgumentException e ) { setArrowCursor(); - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), e.getLocalizedMessage(), "Unexpected error during reading of multiple sequence alignment", JOptionPane.ERROR_MESSAGE ); @@ -549,28 +558,28 @@ public final class MainFrameApplication extends MainFrame { catch ( final Exception e ) { setArrowCursor(); e.printStackTrace(); - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), e.getLocalizedMessage(), "Unexpected error during reading of multiple sequence alignment", JOptionPane.ERROR_MESSAGE ); return; } if ( ( msa == null ) || ( msa.getNumberOfSequences() < 1 ) ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Multiple sequence alignment is empty", "Illegal Multiple Sequence Alignment", JOptionPane.ERROR_MESSAGE ); return; } if ( msa.getNumberOfSequences() < 4 ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Multiple sequence alignment needs to contain at least 3 sequences", "Illegal multiple sequence alignment", JOptionPane.ERROR_MESSAGE ); return; } if ( msa.getLength() < 2 ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Multiple sequence alignment needs to contain at least 2 residues", "Illegal multiple sequence alignment", JOptionPane.ERROR_MESSAGE ); @@ -611,7 +620,7 @@ public final class MainFrameApplication extends MainFrame { } catch ( final MsaFormatException e ) { setArrowCursor(); - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), e.getLocalizedMessage(), "Multiple sequence file format error", JOptionPane.ERROR_MESSAGE ); @@ -619,7 +628,7 @@ public final class MainFrameApplication extends MainFrame { } catch ( final IOException e ) { setArrowCursor(); - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), e.getLocalizedMessage(), "Failed to read multiple sequence file", JOptionPane.ERROR_MESSAGE ); @@ -627,7 +636,7 @@ public final class MainFrameApplication extends MainFrame { } catch ( final IllegalArgumentException e ) { setArrowCursor(); - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), e.getLocalizedMessage(), "Unexpected error during reading of multiple sequence file", JOptionPane.ERROR_MESSAGE ); @@ -636,21 +645,21 @@ public final class MainFrameApplication extends MainFrame { catch ( final Exception e ) { setArrowCursor(); e.printStackTrace(); - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), e.getLocalizedMessage(), "Unexpected error during reading of multiple sequence file", JOptionPane.ERROR_MESSAGE ); return; } if ( ( seqs == null ) || ( seqs.size() < 1 ) ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Multiple sequence file is empty", "Illegal multiple sequence file", JOptionPane.ERROR_MESSAGE ); return; } if ( seqs.size() < 4 ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Multiple sequence file needs to contain at least 3 sequences", "Illegal multiple sequence file", JOptionPane.ERROR_MESSAGE ); @@ -671,7 +680,7 @@ public final class MainFrameApplication extends MainFrame { private void addExpressionValuesFromFile() { if ( ( getCurrentTreePanel() == null ) || ( getCurrentTreePanel().getPhylogeny() == null ) ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Need to load evolutionary tree first", "Can Not Read Expression Values", JOptionPane.WARNING_MESSAGE ); @@ -695,21 +704,21 @@ public final class MainFrameApplication extends MainFrame { } } catch ( final IOException e ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), e.getMessage(), "Could Not Read Expression Value Table", JOptionPane.ERROR_MESSAGE ); return; } if ( t.getNumberOfColumns() < 2 ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Table contains " + t.getNumberOfColumns() + " column(s)", "Problem with Expression Value Table", JOptionPane.ERROR_MESSAGE ); return; } if ( t.getNumberOfRows() < 1 ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Table contains zero rows", "Problem with Expression Value Table", JOptionPane.ERROR_MESSAGE ); @@ -717,7 +726,7 @@ public final class MainFrameApplication extends MainFrame { } final Phylogeny phy = getCurrentTreePanel().getPhylogeny(); if ( t.getNumberOfRows() != phy.getNumberOfExternalNodes() ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Table contains " + t.getNumberOfRows() + " rows, but tree contains " + phy.getNumberOfExternalNodes() + " external nodes", "Warning", @@ -734,7 +743,7 @@ public final class MainFrameApplication extends MainFrame { row = t.findRow( node_name ); } catch ( final IllegalArgumentException e ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), e.getMessage(), "Error Mapping Node Identifiers to Expression Value Identifiers", JOptionPane.ERROR_MESSAGE ); @@ -753,7 +762,7 @@ public final class MainFrameApplication extends MainFrame { d = Double.parseDouble( t.getValueAsString( col, row ) ); } catch ( final NumberFormatException e ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Could not parse \"" + t.getValueAsString( col, row ) + "\" into a decimal value", "Issue with Expression Value Table", @@ -771,7 +780,7 @@ public final class MainFrameApplication extends MainFrame { } if ( not_found > 0 ) { JOptionPane - .showMessageDialog( this, + .showMessageDialog( getThisFrame(), "Could not fine expression values for " + not_found + " external node(s)", "Warning", JOptionPane.WARNING_MESSAGE ); @@ -782,7 +791,7 @@ public final class MainFrameApplication extends MainFrame { private void addSequencesFromFile() { if ( ( getCurrentTreePanel() == null ) || ( getCurrentTreePanel().getPhylogeny() == null ) ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Need to load evolutionary tree first", "Can Not Read Sequences", JOptionPane.WARNING_MESSAGE ); @@ -809,7 +818,7 @@ public final class MainFrameApplication extends MainFrame { } } else { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Format does not appear to be Fasta", "Multiple sequence file format error", JOptionPane.ERROR_MESSAGE ); @@ -824,7 +833,7 @@ public final class MainFrameApplication extends MainFrame { } catch ( final MsaFormatException e ) { setArrowCursor(); - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), e.getLocalizedMessage(), "Multiple sequence file format error", JOptionPane.ERROR_MESSAGE ); @@ -832,7 +841,7 @@ public final class MainFrameApplication extends MainFrame { } catch ( final IOException e ) { setArrowCursor(); - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), e.getLocalizedMessage(), "Failed to read multiple sequence file", JOptionPane.ERROR_MESSAGE ); @@ -841,14 +850,14 @@ public final class MainFrameApplication extends MainFrame { catch ( final Exception e ) { setArrowCursor(); e.printStackTrace(); - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), e.getLocalizedMessage(), "Unexpected error during reading of multiple sequence file", JOptionPane.ERROR_MESSAGE ); return; } if ( ( seqs == null ) || ( seqs.size() < 1 ) ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Multiple sequence file is empty", "Empty multiple sequence file", JOptionPane.ERROR_MESSAGE ); @@ -878,7 +887,7 @@ public final class MainFrameApplication extends MainFrame { nodes = phy.getNodes( seq_name ); } if ( nodes.size() > 1 ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Sequence name \"" + seq_name + "\" is not unique", "Sequence name not unique", JOptionPane.ERROR_MESSAGE ); @@ -896,7 +905,7 @@ public final class MainFrameApplication extends MainFrame { nodes = phy.getNodes( seq_name_split ); } if ( nodes.size() > 1 ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Split sequence name \"" + seq_name_split + "\" is not unique", "Sequence name not unique", @@ -938,13 +947,13 @@ public final class MainFrameApplication extends MainFrame { + " external nodes now have a molecular sequence attached to them."; } if ( ( attached_counter == total_counter ) && ( ext_nodes == ext_nodes_with_seq ) ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Attached all " + total_counter + " sequences to tree nodes.\n" + s, "All sequences attached", JOptionPane.INFORMATION_MESSAGE ); } else { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Attached " + attached_counter + " sequences out of a total of " + total_counter + " sequences.\n" + s, attached_counter + " sequences attached", @@ -952,7 +961,7 @@ public final class MainFrameApplication extends MainFrame { } } else { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "No maching tree node for any of the " + total_counter + " sequences", "Could not attach any sequences", JOptionPane.ERROR_MESSAGE ); @@ -963,7 +972,7 @@ public final class MainFrameApplication extends MainFrame { private void closeCurrentPane() { if ( getMainPanel().getCurrentTreePanel() != null ) { if ( getMainPanel().getCurrentTreePanel().isEdited() ) { - final int r = JOptionPane.showConfirmDialog( this, + final int r = JOptionPane.showConfirmDialog( getThisFrame(), "Close tab despite potentially unsaved changes?", "Close Tab?", JOptionPane.YES_NO_OPTION ); @@ -1021,7 +1030,7 @@ public final class MainFrameApplication extends MainFrame { repaint(); } if ( to_be_removed.size() > 0 ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Collapsed " + to_be_removed.size() + " branches with\nconfidence values below " + getMinNotCollapseConfidenceValue(), @@ -1029,7 +1038,7 @@ public final class MainFrameApplication extends MainFrame { JOptionPane.INFORMATION_MESSAGE ); } else { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "No branch collapsed,\nminimum confidence value per branch is " + min_support, "No branch collapsed", @@ -1037,7 +1046,7 @@ public final class MainFrameApplication extends MainFrame { } } else { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "No branch collapsed because no confidence values present", "No confidence values present", JOptionPane.INFORMATION_MESSAGE ); @@ -1048,7 +1057,7 @@ public final class MainFrameApplication extends MainFrame { if ( getCurrentTreePanel() != null ) { final Phylogeny phy = getCurrentTreePanel().getPhylogeny(); if ( ( phy != null ) && !phy.isEmpty() ) { - final String s = ( String ) JOptionPane.showInputDialog( this, + final String s = ( String ) JOptionPane.showInputDialog( getThisFrame(), "Please enter the minimum branch length value\n", "Minimal Branch Length Value", JOptionPane.QUESTION_MESSAGE, @@ -1083,7 +1092,7 @@ public final class MainFrameApplication extends MainFrame { if ( getCurrentTreePanel() != null ) { final Phylogeny phy = getCurrentTreePanel().getPhylogeny(); if ( ( phy != null ) && !phy.isEmpty() ) { - final String s = ( String ) JOptionPane.showInputDialog( this, + final String s = ( String ) JOptionPane.showInputDialog( getThisFrame(), "Please enter the minimum confidence value\n", "Minimal Confidence Value", JOptionPane.QUESTION_MESSAGE, @@ -1153,7 +1162,7 @@ public final class MainFrameApplication extends MainFrame { repaint(); } if ( to_be_removed.size() > 0 ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Collapsed " + to_be_removed.size() + " branches with\nbranch length values below " + getMinNotCollapseBlValue(), @@ -1161,14 +1170,14 @@ public final class MainFrameApplication extends MainFrame { JOptionPane.INFORMATION_MESSAGE ); } else { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "No branch collapsed,\nminimum branch length is " + min_bl, "No branch collapsed", JOptionPane.INFORMATION_MESSAGE ); } } else { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "No branch collapsed because no branch length values present", "No branch length values present", JOptionPane.INFORMATION_MESSAGE ); @@ -1182,7 +1191,7 @@ public final class MainFrameApplication extends MainFrame { xml_parser = PhyloXmlParser.createPhyloXmlParserXsdValidating(); } catch ( final Exception e ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), e.getLocalizedMessage(), "failed to create validating XML parser", JOptionPane.WARNING_MESSAGE ); @@ -1209,7 +1218,7 @@ public final class MainFrameApplication extends MainFrame { new Thread( inferrer ).start(); } else { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "No multiple sequence alignment selected", "Phylogenetic Inference Not Launched", JOptionPane.WARNING_MESSAGE ); @@ -1224,7 +1233,7 @@ public final class MainFrameApplication extends MainFrame { new Thread( inferrer ).start(); } else { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "No input sequences selected", "Phylogenetic Inference Not Launched", JOptionPane.WARNING_MESSAGE ); @@ -1276,7 +1285,7 @@ public final class MainFrameApplication extends MainFrame { failed = "\nCould not extract taxonomic data for " + counter_failed + " named external nodes:\n" + sb_failed; } - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Extracted taxonomic data from " + all + counter + " named external nodes:\n" + sb.toString() + failed, "Taxonomic Data Extraction Completed", @@ -1284,7 +1293,7 @@ public final class MainFrameApplication extends MainFrame { : JOptionPane.INFORMATION_MESSAGE ); } else { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Could not extract any taxonomic data.\nMaybe node names are empty\n" + "or not in the forms \"XYZ_CAEEL\", \"XYZ_6239\", or \"XYZ_Caenorhabditis_elegans\"\n" + "or nodes already have taxonomic data?\n", @@ -1548,7 +1557,7 @@ public final class MainFrameApplication extends MainFrame { getMainPanel() ); _mainpanel.getControlPanel().showWhole(); if ( nhx_or_nexus && one_desc ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "One or more trees contain (a) node(s) with one descendant, " + ForesterUtil.LINE_SEPARATOR + "possibly indicating illegal parentheses within node names.", @@ -1610,7 +1619,7 @@ public final class MainFrameApplication extends MainFrame { if ( !exception && ( t != null ) && !t.isRooted() ) { exception = true; t = null; - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Species tree is not rooted", "Species tree not loaded", JOptionPane.ERROR_MESSAGE ); @@ -1622,7 +1631,7 @@ public final class MainFrameApplication extends MainFrame { if ( !node.getNodeData().isHasTaxonomy() ) { exception = true; t = null; - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Species tree contains external node(s) without taxonomy information", "Species tree not loaded", JOptionPane.ERROR_MESSAGE ); @@ -1633,7 +1642,7 @@ public final class MainFrameApplication extends MainFrame { exception = true; t = null; JOptionPane - .showMessageDialog( this, + .showMessageDialog( getThisFrame(), "Taxonomy [" + node.getNodeData().getTaxonomy().asSimpleText() + "] is not unique in species tree", "Species tree not loaded", @@ -1648,7 +1657,7 @@ public final class MainFrameApplication extends MainFrame { } if ( !exception && ( t != null ) ) { setSpeciesTree( t ); - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Species tree successfully loaded", "Species tree loaded", JOptionPane.INFORMATION_MESSAGE ); @@ -2094,7 +2103,7 @@ public final class MainFrameApplication extends MainFrame { @Override void close() { if ( isUnsavedDataPresent() ) { - final int r = JOptionPane.showConfirmDialog( this, + final int r = JOptionPane.showConfirmDialog( getThisFrame(), "Exit despite potentially unsaved changes?", "Exit?", JOptionPane.YES_NO_OPTION ); @@ -2119,7 +2128,7 @@ public final class MainFrameApplication extends MainFrame { Phylogeny[] phys = null; final String message = "Please enter a complete URL, for example \"http://purl.org/phylo/treebase/phylows/study/TB2:S15480?format=nexus\""; final String url_string = JOptionPane - .showInputDialog( this, + .showInputDialog( getThisFrame(), message, "Use URL/webservice to obtain a phylogeny", JOptionPane.QUESTION_MESSAGE ); @@ -2152,20 +2161,20 @@ public final class MainFrameApplication extends MainFrame { phys = factory.create( url.openStream(), parser ); } catch ( final MalformedURLException e ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Malformed URL: " + url + "\n" + e.getLocalizedMessage(), "Malformed URL", JOptionPane.ERROR_MESSAGE ); } catch ( final IOException e ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), "Could not read from " + url + "\n" + ForesterUtil.wordWrap( e.getLocalizedMessage(), 80 ), "Failed to read URL", JOptionPane.ERROR_MESSAGE ); } catch ( final Exception e ) { - JOptionPane.showMessageDialog( this, + JOptionPane.showMessageDialog( getThisFrame(), ForesterUtil.wordWrap( e.getLocalizedMessage(), 80 ), "Unexpected Exception", JOptionPane.ERROR_MESSAGE ); diff --git a/forester/java/src/org/forester/archaeopteryx/UrlTreeReader.java b/forester/java/src/org/forester/archaeopteryx/UrlTreeReader.java index ce6f712..e3c81f9 100644 --- a/forester/java/src/org/forester/archaeopteryx/UrlTreeReader.java +++ b/forester/java/src/org/forester/archaeopteryx/UrlTreeReader.java @@ -67,7 +67,7 @@ public class UrlTreeReader implements Runnable { final WebservicesManager webservices_manager = WebservicesManager.getInstance(); final PhylogeniesWebserviceClient client = webservices_manager .getAvailablePhylogeniesWebserviceClient( _webservice_client_index ); - String identifier = JOptionPane.showInputDialog( _main_frame, client.getInstructions() + "\n(Reference: " + String identifier = JOptionPane.showInputDialog( _main_frame.getThisFrame(), client.getInstructions() + "\n(Reference: " + client.getReference() + ")", client.getDescription(), JOptionPane.QUESTION_MESSAGE ); if ( ( identifier != null ) && ( identifier.trim().length() > 0 ) ) { identifier = identifier.trim(); @@ -81,7 +81,7 @@ public class UrlTreeReader implements Runnable { id = -1; } if ( id < 1 ) { - JOptionPane.showMessageDialog( _main_frame, + JOptionPane.showMessageDialog( _main_frame.getThisFrame(), "Identifier is expected to be a number", "Can not open URL", JOptionPane.ERROR_MESSAGE ); @@ -154,21 +154,21 @@ public class UrlTreeReader implements Runnable { } catch ( final MalformedURLException e ) { exception = true; - JOptionPane.showMessageDialog( _main_frame, + JOptionPane.showMessageDialog( _main_frame.getThisFrame(), "Malformed URL: " + url + "\n" + e.getLocalizedMessage(), "Malformed URL", JOptionPane.ERROR_MESSAGE ); } catch ( final IOException e ) { exception = true; - JOptionPane.showMessageDialog( _main_frame, + JOptionPane.showMessageDialog( _main_frame.getThisFrame(), "Could not read from " + url + "\n" + e.getLocalizedMessage(), "Failed to read tree from " + client.getName() + " for " + identifier, JOptionPane.ERROR_MESSAGE ); } catch ( final NumberFormatException e ) { exception = true; - JOptionPane.showMessageDialog( _main_frame, + JOptionPane.showMessageDialog( _main_frame.getThisFrame(), "Could not read from " + url + "\n" + e.getLocalizedMessage(), "Failed to read tree from " + client.getName() + " for " + identifier, JOptionPane.ERROR_MESSAGE ); @@ -176,7 +176,7 @@ public class UrlTreeReader implements Runnable { catch ( final Exception e ) { exception = true; e.printStackTrace(); - JOptionPane.showMessageDialog( _main_frame, + JOptionPane.showMessageDialog( _main_frame.getThisFrame(), e.getLocalizedMessage(), "Unexpected Exception", JOptionPane.ERROR_MESSAGE ); @@ -201,7 +201,7 @@ public class UrlTreeReader implements Runnable { WebserviceUtil.processInstructions( client, phylogeny ); } catch ( final PhyloXmlDataFormatException e ) { - JOptionPane.showMessageDialog( _main_frame, + JOptionPane.showMessageDialog( _main_frame.getThisFrame(), "Error:\n" + e.getLocalizedMessage(), "Error", JOptionPane.ERROR_MESSAGE ); @@ -212,7 +212,7 @@ public class UrlTreeReader implements Runnable { PhylogenyMethods.transferNodeNameToField( phylogeny, client.getNodeField(), false ); } catch ( final PhyloXmlDataFormatException e ) { - JOptionPane.showMessageDialog( _main_frame, + JOptionPane.showMessageDialog( _main_frame.getThisFrame(), "Error:\n" + e.getLocalizedMessage(), "Error", JOptionPane.ERROR_MESSAGE ); diff --git a/forester/java/src/org/forester/archaeopteryx/tools/AncestralTaxonomyInferrer.java b/forester/java/src/org/forester/archaeopteryx/tools/AncestralTaxonomyInferrer.java index 19ab6d5..a8143a8 100644 --- a/forester/java/src/org/forester/archaeopteryx/tools/AncestralTaxonomyInferrer.java +++ b/forester/java/src/org/forester/archaeopteryx/tools/AncestralTaxonomyInferrer.java @@ -59,7 +59,7 @@ public class AncestralTaxonomyInferrer extends RunnableProcess { } catch ( final AncestralTaxonomyInferenceException e ) { end( _mf ); - JOptionPane.showMessageDialog( _mf, + JOptionPane.showMessageDialog( _mf.getThisFrame(), e.getMessage(), "Error during ancestral taxonomy inference", JOptionPane.ERROR_MESSAGE ); @@ -67,7 +67,7 @@ public class AncestralTaxonomyInferrer extends RunnableProcess { } catch ( final UnknownHostException e ) { end( _mf ); - JOptionPane.showMessageDialog( _mf, + JOptionPane.showMessageDialog( _mf.getThisFrame(), "Could not connect to \"" + getBaseUrl() + "\"", "Network error during ancestral taxonomy inference", JOptionPane.ERROR_MESSAGE ); @@ -76,7 +76,7 @@ public class AncestralTaxonomyInferrer extends RunnableProcess { catch ( final Exception e ) { end( _mf ); e.printStackTrace(); - JOptionPane.showMessageDialog( _mf, + JOptionPane.showMessageDialog( _mf.getThisFrame(), e.toString(), "Unexpected exception during ancestral taxonomy inference", JOptionPane.ERROR_MESSAGE ); @@ -84,7 +84,7 @@ public class AncestralTaxonomyInferrer extends RunnableProcess { } catch ( final Error e ) { end( _mf ); - JOptionPane.showMessageDialog( _mf, + JOptionPane.showMessageDialog( _mf.getThisFrame(), e.toString(), "Unexpected error during ancestral taxonomy inference", JOptionPane.ERROR_MESSAGE ); @@ -96,7 +96,7 @@ public class AncestralTaxonomyInferrer extends RunnableProcess { _treepanel.setEdited( true ); end( _mf ); try { - JOptionPane.showMessageDialog( _mf, + JOptionPane.showMessageDialog( _mf.getThisFrame(), "Ancestral taxonomy inference successfully completed", "Ancestral Taxonomy Inference Completed", JOptionPane.INFORMATION_MESSAGE ); diff --git a/forester/java/src/org/forester/archaeopteryx/tools/PhyloInferenceDialog.java b/forester/java/src/org/forester/archaeopteryx/tools/PhyloInferenceDialog.java index b6e65b6..94c1359 100644 --- a/forester/java/src/org/forester/archaeopteryx/tools/PhyloInferenceDialog.java +++ b/forester/java/src/org/forester/archaeopteryx/tools/PhyloInferenceDialog.java @@ -235,10 +235,12 @@ public class PhyloInferenceDialog extends JDialog implements ActionListener { _pnl.add( launch_pnl ); initializeValues( from_unaligned_seqs ); pack(); - setLocationRelativeTo( getParentFrame() ); + setLocationRelativeTo( getParentFrame().getThisFrame() ); setResizable( false ); } + + @Override public void actionPerformed( final ActionEvent e ) { if ( e.getSource() == _select_input_msa_btn ) { diff --git a/forester/java/src/org/forester/archaeopteryx/tools/PhylogeneticInferrer.java b/forester/java/src/org/forester/archaeopteryx/tools/PhylogeneticInferrer.java index cc62751..6734d1b 100644 --- a/forester/java/src/org/forester/archaeopteryx/tools/PhylogeneticInferrer.java +++ b/forester/java/src/org/forester/archaeopteryx/tools/PhylogeneticInferrer.java @@ -163,7 +163,7 @@ public class PhylogeneticInferrer extends RunnableProcess { } catch ( final IOException e ) { end( _mf ); - JOptionPane.showMessageDialog( _mf, + JOptionPane.showMessageDialog( _mf.getThisFrame(), "Could not create multiple sequence alignment with \"" + _options.getMsaPrg() + "\" and the following parameters:\n\"" + _options.getMsaPrgParameters() + "\"\nError: " @@ -177,7 +177,7 @@ public class PhylogeneticInferrer extends RunnableProcess { } catch ( final Exception e ) { end( _mf ); - JOptionPane.showMessageDialog( _mf, + JOptionPane.showMessageDialog( _mf.getThisFrame(), "Could not create multiple sequence alignment with \"" + _options.getMsaPrg() + "\" and the following parameters:\n\"" + _options.getMsaPrgParameters() + "\"\nError: " @@ -191,7 +191,7 @@ public class PhylogeneticInferrer extends RunnableProcess { } if ( msa == null ) { end( _mf ); - JOptionPane.showMessageDialog( _mf, + JOptionPane.showMessageDialog( _mf.getThisFrame(), "Could not create multiple sequence alignment with " + _options.getMsaPrg() + "\nand the following parameters:\n\"" + _options.getMsaPrgParameters() + "\"", @@ -210,7 +210,7 @@ public class PhylogeneticInferrer extends RunnableProcess { msa ); if ( msa == null ) { end( _mf ); - JOptionPane.showMessageDialog( _mf, + JOptionPane.showMessageDialog( _mf.getThisFrame(), "Less than two sequences longer than " + _options.getMsaProcessingMinAllowedLength() + " residues left after MSA processing", @@ -243,7 +243,7 @@ public class PhylogeneticInferrer extends RunnableProcess { _mf.getMainPanel().addPhylogenyInNewTab( master_phy, _mf.getConfiguration(), "nj", "njpath" ); // _mf.getMainPanel().getCurrentTreePanel().setArrowCursor(); end( _mf ); - JOptionPane.showMessageDialog( _mf, + JOptionPane.showMessageDialog( _mf.getThisFrame(), "Inference successfully completed", "Inference Completed", JOptionPane.INFORMATION_MESSAGE ); diff --git a/forester/java/src/org/forester/archaeopteryx/tools/SequenceDataRetriver.java b/forester/java/src/org/forester/archaeopteryx/tools/SequenceDataRetriver.java index 1cd6b54..8e512a4 100644 --- a/forester/java/src/org/forester/archaeopteryx/tools/SequenceDataRetriver.java +++ b/forester/java/src/org/forester/archaeopteryx/tools/SequenceDataRetriver.java @@ -64,7 +64,7 @@ public final class SequenceDataRetriver extends RunnableProcess { SequenceDbWsTools.DEFAULT_LINES_TO_RETURN ); } catch ( final UnknownHostException e ) { - JOptionPane.showMessageDialog( _mf, + JOptionPane.showMessageDialog( _mf.getThisFrame(), e.getLocalizedMessage(), "Network error during sequence data gathering", JOptionPane.ERROR_MESSAGE ); @@ -72,7 +72,7 @@ public final class SequenceDataRetriver extends RunnableProcess { } catch ( final IOException e ) { e.printStackTrace(); - JOptionPane.showMessageDialog( _mf, + JOptionPane.showMessageDialog( _mf.getThisFrame(), e.toString(), "Failed to obtain sequence data", JOptionPane.ERROR_MESSAGE ); @@ -111,7 +111,7 @@ public final class SequenceDataRetriver extends RunnableProcess { sb.append( "..." ); } try { - JOptionPane.showMessageDialog( _mf, + JOptionPane.showMessageDialog( _mf.getThisFrame(), sb.toString(), "Sequence Tool Completed", JOptionPane.WARNING_MESSAGE ); @@ -122,7 +122,7 @@ public final class SequenceDataRetriver extends RunnableProcess { } else { try { - JOptionPane.showMessageDialog( _mf, + JOptionPane.showMessageDialog( _mf.getThisFrame(), "Sequence tool successfully completed", "Sequence Tool Completed", JOptionPane.INFORMATION_MESSAGE ); -- 1.7.10.2