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 );
}
catch ( final IOException e ) {
e.printStackTrace();
- JOptionPane.showMessageDialog( _mf,
+ JOptionPane.showMessageDialog( _mf.getThisFrame(),
e.toString(),
"Failed to obtain taxonomic information",
JOptionPane.ERROR_MESSAGE );
}
catch ( final AncestralTaxonomyInferenceException e ) {
e.printStackTrace();
- JOptionPane.showMessageDialog( _mf,
+ JOptionPane.showMessageDialog( _mf.getThisFrame(),
e.toString(),
"Failed to obtain taxonomic information",
JOptionPane.ERROR_MESSAGE );
}
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 );
sb.append( "..." );
}
try {
- JOptionPane.showMessageDialog( _mf,
+ JOptionPane.showMessageDialog( _mf.getThisFrame(),
sb.toString(),
"Taxonomy Tool Completed",
JOptionPane.WARNING_MESSAGE );
}
else {
try {
- JOptionPane.showMessageDialog( _mf,
+ JOptionPane.showMessageDialog( _mf.getThisFrame(),
"Taxonomy tool successfully completed",
"Taxonomy Tool Completed",
JOptionPane.INFORMATION_MESSAGE );
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;
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();
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;
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 );
// 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.
*/
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() );
_writetopdf_filechooser,
_current_dir,
getContentPane(),
- this );
+ getThisFrame() );
if ( curr_dir != null ) {
setCurrentDir( curr_dir );
}
GraphicsExportType.JPG,
_mainpanel,
_writetographics_filechooser,
- this,
+ getThisFrame(),
getContentPane(),
_current_dir );
if ( new_dir != null ) {
GraphicsExportType.GIF,
_mainpanel,
_writetographics_filechooser,
- this,
+ getThisFrame(),
getContentPane(),
_current_dir );
if ( new_dir != null ) {
GraphicsExportType.TIFF,
_mainpanel,
_writetographics_filechooser,
- this,
+ getThisFrame(),
getContentPane(),
_current_dir );
if ( new_dir != null ) {
GraphicsExportType.BMP,
_mainpanel,
_writetographics_filechooser,
- this,
+ getThisFrame(),
getContentPane(),
_current_dir );
if ( new_dir != null ) {
GraphicsExportType.PNG,
_mainpanel,
_writetographics_filechooser,
- this,
+ getThisFrame(),
getContentPane(),
_current_dir );
if ( new_dir != null ) {
}
}
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(),
_save_filechooser,
_current_dir,
getContentPane(),
- this );
+ _frame.getThisFrame() );
if ( new_dir != null ) {
setCurrentDir( new_dir );
}
}
else if ( o == _lineage_inference ) {
if ( isSubtreeDisplayed() ) {
- JOptionPane.showMessageDialog( this,
+ JOptionPane.showMessageDialog( getThisFrame(),
"Subtree is shown.",
"Cannot infer ancestral taxonomies",
JOptionPane.ERROR_MESSAGE );
_contentpane.repaint();
}
+
public Configuration getConfiguration() {
return _configuration;
}
}
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 );
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 );
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 ) {
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",
}
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 );
res = ext - todo;
}
if ( res < 1 ) {
- JOptionPane.showMessageDialog( this,
+ JOptionPane.showMessageDialog( getThisFrame(),
"Cannot delete all nodes",
"Attempt to delete all nodes ",
JOptionPane.ERROR_MESSAGE );
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,
file.delete();
}
catch ( final Exception e ) {
- JOptionPane.showMessageDialog( this,
+ JOptionPane.showMessageDialog( getThisFrame(),
"Failed to delete: " + file,
"Error",
JOptionPane.WARNING_MESSAGE );
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 );
}
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",
final Map<String, Integer> 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,
catch ( final Exception ex ) {
// Do nothing.
}
- JOptionPane.showMessageDialog( this,
+ JOptionPane.showMessageDialog( getThisFrame(),
ForesterUtil.wordWrap( e.getLocalizedMessage(), 80 ),
"Error during File|Open",
JOptionPane.ERROR_MESSAGE );
return;
}
if ( !_mainpanel.getCurrentPhylogeny().isRooted() ) {
- JOptionPane.showMessageDialog( this,
+ JOptionPane.showMessageDialog( getThisFrame(),
"Gene tree is not rooted.",
"Cannot execute GSDI",
JOptionPane.ERROR_MESSAGE );
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 );
_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"
JOptionPane.WARNING_MESSAGE );
}
else {
- JOptionPane.showMessageDialog( this,
+ JOptionPane.showMessageDialog( getThisFrame(),
"Duplications: " + gsdi.getDuplicationsSum() + "\n"
+ "Potential duplications: "
+ gsdi.getSpeciationOrDuplicationEventsSum() + "\n"
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 );
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 );
_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: "
JOptionPane.WARNING_MESSAGE );
}
else {
- JOptionPane.showMessageDialog( this,
+ JOptionPane.showMessageDialog( getThisFrame(),
"Minimal duplications: " + gsdir.getMinDuplicationsSum() + "\n"
+ "Speciations: " + gsdir.getSpeciationsSum() + "\n"
+ "Stripped gene tree nodes: "
return;
}
if ( !_mainpanel.getCurrentPhylogeny().isRooted() ) {
- JOptionPane.showMessageDialog( this,
+ JOptionPane.showMessageDialog( getThisFrame(),
"Phylogeny is not rooted.",
"Cannot infer ancestral taxonomies",
JOptionPane.ERROR_MESSAGE );
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 );
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 );
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 );
}
return new_current_dir;
}
+
+
}
class DefaultFilter extends FileFilter {
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();
}
} );
_contentpane.repaint();
}
+
+
private MainFrameApplication( final Phylogeny[] phys, final Configuration config, final String title ) {
this( phys, config, title, null );
}
// 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,
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 );
}
catch ( final MsaFormatException e ) {
setArrowCursor();
- JOptionPane.showMessageDialog( this,
+ JOptionPane.showMessageDialog( getThisFrame(),
e.getLocalizedMessage(),
"Multiple sequence alignment format error",
JOptionPane.ERROR_MESSAGE );
}
catch ( final IOException e ) {
setArrowCursor();
- JOptionPane.showMessageDialog( this,
+ JOptionPane.showMessageDialog( getThisFrame(),
e.getLocalizedMessage(),
"Failed to read multiple sequence alignment",
JOptionPane.ERROR_MESSAGE );
}
catch ( final IllegalArgumentException e ) {
setArrowCursor();
- JOptionPane.showMessageDialog( this,
+ JOptionPane.showMessageDialog( getThisFrame(),
e.getLocalizedMessage(),
"Unexpected error during reading of multiple sequence alignment",
JOptionPane.ERROR_MESSAGE );
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 );
}
catch ( final MsaFormatException e ) {
setArrowCursor();
- JOptionPane.showMessageDialog( this,
+ JOptionPane.showMessageDialog( getThisFrame(),
e.getLocalizedMessage(),
"Multiple sequence file format error",
JOptionPane.ERROR_MESSAGE );
}
catch ( final IOException e ) {
setArrowCursor();
- JOptionPane.showMessageDialog( this,
+ JOptionPane.showMessageDialog( getThisFrame(),
e.getLocalizedMessage(),
"Failed to read multiple sequence file",
JOptionPane.ERROR_MESSAGE );
}
catch ( final IllegalArgumentException e ) {
setArrowCursor();
- JOptionPane.showMessageDialog( this,
+ JOptionPane.showMessageDialog( getThisFrame(),
e.getLocalizedMessage(),
"Unexpected error during reading of multiple sequence file",
JOptionPane.ERROR_MESSAGE );
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 );
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 );
}
}
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 );
}
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",
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 );
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",
}
if ( not_found > 0 ) {
JOptionPane
- .showMessageDialog( this,
+ .showMessageDialog( getThisFrame(),
"Could not fine expression values for " + not_found + " external node(s)",
"Warning",
JOptionPane.WARNING_MESSAGE );
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 );
}
}
else {
- JOptionPane.showMessageDialog( this,
+ JOptionPane.showMessageDialog( getThisFrame(),
"Format does not appear to be Fasta",
"Multiple sequence file format error",
JOptionPane.ERROR_MESSAGE );
}
catch ( final MsaFormatException e ) {
setArrowCursor();
- JOptionPane.showMessageDialog( this,
+ JOptionPane.showMessageDialog( getThisFrame(),
e.getLocalizedMessage(),
"Multiple sequence file format error",
JOptionPane.ERROR_MESSAGE );
}
catch ( final IOException e ) {
setArrowCursor();
- JOptionPane.showMessageDialog( this,
+ JOptionPane.showMessageDialog( getThisFrame(),
e.getLocalizedMessage(),
"Failed to read multiple sequence file",
JOptionPane.ERROR_MESSAGE );
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 );
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 );
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",
+ " 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",
}
}
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 );
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 );
repaint();
}
if ( to_be_removed.size() > 0 ) {
- JOptionPane.showMessageDialog( this,
+ JOptionPane.showMessageDialog( getThisFrame(),
"Collapsed " + to_be_removed.size()
+ " branches with\nconfidence values below "
+ getMinNotCollapseConfidenceValue(),
JOptionPane.INFORMATION_MESSAGE );
}
else {
- JOptionPane.showMessageDialog( this,
+ JOptionPane.showMessageDialog( getThisFrame(),
"No branch collapsed,\nminimum confidence value per branch is "
+ min_support,
"No branch collapsed",
}
}
else {
- JOptionPane.showMessageDialog( this,
+ JOptionPane.showMessageDialog( getThisFrame(),
"No branch collapsed because no confidence values present",
"No confidence values present",
JOptionPane.INFORMATION_MESSAGE );
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,
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,
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(),
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 );
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 );
new Thread( inferrer ).start();
}
else {
- JOptionPane.showMessageDialog( this,
+ JOptionPane.showMessageDialog( getThisFrame(),
"No multiple sequence alignment selected",
"Phylogenetic Inference Not Launched",
JOptionPane.WARNING_MESSAGE );
new Thread( inferrer ).start();
}
else {
- JOptionPane.showMessageDialog( this,
+ JOptionPane.showMessageDialog( getThisFrame(),
"No input sequences selected",
"Phylogenetic Inference Not Launched",
JOptionPane.WARNING_MESSAGE );
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",
: 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",
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.",
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 );
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 );
exception = true;
t = null;
JOptionPane
- .showMessageDialog( this,
+ .showMessageDialog( getThisFrame(),
"Taxonomy [" + node.getNodeData().getTaxonomy().asSimpleText()
+ "] is not unique in species tree",
"Species tree not loaded",
}
if ( !exception && ( t != null ) ) {
setSpeciesTree( t );
- JOptionPane.showMessageDialog( this,
+ JOptionPane.showMessageDialog( getThisFrame(),
"Species tree successfully loaded",
"Species tree loaded",
JOptionPane.INFORMATION_MESSAGE );
@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 );
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 );
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 );
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();
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 );
}
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 );
catch ( final Exception e ) {
exception = true;
e.printStackTrace();
- JOptionPane.showMessageDialog( _main_frame,
+ JOptionPane.showMessageDialog( _main_frame.getThisFrame(),
e.getLocalizedMessage(),
"Unexpected Exception",
JOptionPane.ERROR_MESSAGE );
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 );
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 );
}
catch ( final AncestralTaxonomyInferenceException e ) {
end( _mf );
- JOptionPane.showMessageDialog( _mf,
+ JOptionPane.showMessageDialog( _mf.getThisFrame(),
e.getMessage(),
"Error during ancestral taxonomy inference",
JOptionPane.ERROR_MESSAGE );
}
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 );
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 );
}
catch ( final Error e ) {
end( _mf );
- JOptionPane.showMessageDialog( _mf,
+ JOptionPane.showMessageDialog( _mf.getThisFrame(),
e.toString(),
"Unexpected error during ancestral taxonomy inference",
JOptionPane.ERROR_MESSAGE );
_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 );
_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 ) {
}
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: "
}
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: "
}
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() + "\"",
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",
_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 );
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 );
}
catch ( final IOException e ) {
e.printStackTrace();
- JOptionPane.showMessageDialog( _mf,
+ JOptionPane.showMessageDialog( _mf.getThisFrame(),
e.toString(),
"Failed to obtain sequence data",
JOptionPane.ERROR_MESSAGE );
sb.append( "..." );
}
try {
- JOptionPane.showMessageDialog( _mf,
+ JOptionPane.showMessageDialog( _mf.getThisFrame(),
sb.toString(),
"Sequence Tool Completed",
JOptionPane.WARNING_MESSAGE );
}
else {
try {
- JOptionPane.showMessageDialog( _mf,
+ JOptionPane.showMessageDialog( _mf.getThisFrame(),
"Sequence tool successfully completed",
"Sequence Tool Completed",
JOptionPane.INFORMATION_MESSAGE );