/**
* Current filename for this alignment
*/
- String fileName = null;
+ private String fileName = null;
- File fileObject;
+ private File fileObject;
/**
* Creates a new AlignFrame object with specific width and height.
@Override
public void reload_actionPerformed(ActionEvent e)
{
- if (fileName != null)
+ if (fileName == null)
{
- // TODO: JAL-1108 - ensure all associated frames are closed regardless of
- // originating file's format
- // TODO: work out how to recover feature settings for correct view(s) when
- // file is reloaded.
- if (FileFormat.Jalview.equals(currentFileFormat))
+ return;
+ }
+ // TODO: JAL-1108 - ensure all associated frames are closed regardless of
+ // originating file's format
+ // TODO: work out how to recover feature settings for correct view(s) when
+ // file is reloaded.
+ if (FileFormat.Jalview.equals(currentFileFormat))
+ {
+ JInternalFrame[] frames = Desktop.getDesktopPane().getAllFrames();
+ for (int i = 0; i < frames.length; i++)
{
- JInternalFrame[] frames = Desktop.getDesktopPane().getAllFrames();
- for (int i = 0; i < frames.length; i++)
+ if (frames[i] instanceof AlignFrame && frames[i] != this
+ && ((AlignFrame) frames[i]).fileName != null
+ && ((AlignFrame) frames[i]).fileName.equals(fileName))
{
- if (frames[i] instanceof AlignFrame && frames[i] != this
- && ((AlignFrame) frames[i]).fileName != null
- && ((AlignFrame) frames[i]).fileName.equals(fileName))
+ try
+ {
+ frames[i].setSelected(true);
+ Desktop.getInstance().closeAssociatedWindows();
+ } catch (java.beans.PropertyVetoException ex)
{
- try
- {
- frames[i].setSelected(true);
- Desktop.getInstance().closeAssociatedWindows();
- } catch (java.beans.PropertyVetoException ex)
- {
- }
}
-
}
- Desktop.getInstance().closeAssociatedWindows();
- FileLoader loader = new FileLoader();
- DataSourceType protocol = fileName.startsWith("http:")
- ? DataSourceType.URL
- : DataSourceType.FILE;
- loader.loadFile(viewport, fileName, protocol, currentFileFormat);
}
- else
- {
- Rectangle bounds = this.getBounds();
+ Desktop.getInstance().closeAssociatedWindows();
- FileLoader loader = new FileLoader();
+ FileLoader loader = new FileLoader();
+ DataSourceType protocol = fileName.startsWith("http:")
+ ? DataSourceType.URL
+ : DataSourceType.FILE;
+ loader.loadFile(viewport,
+ (fileObject == null ? fileName : fileObject), protocol,
+ currentFileFormat);
+ }
+ else
+ {
+ Rectangle bounds = this.getBounds();
- AlignFrame newframe = null;
+ FileLoader loader = new FileLoader();
- if (fileObject == null)
- {
+ AlignFrame newframe = null;
- DataSourceType protocol = (fileName.startsWith("http:")
- ? DataSourceType.URL
- : DataSourceType.FILE);
- newframe = loader.loadFileWaitTillLoaded(fileName, protocol,
- currentFileFormat);
- }
- else
- {
- newframe = loader.loadFileWaitTillLoaded(fileObject,
- DataSourceType.FILE, currentFileFormat);
- }
+ if (fileObject == null)
+ {
- newframe.setBounds(bounds);
- if (featureSettings != null && featureSettings.isShowing())
+ DataSourceType protocol = (fileName.startsWith("http:")
+ ? DataSourceType.URL
+ : DataSourceType.FILE);
+ newframe = loader.loadFileWaitTillLoaded(fileName, protocol,
+ currentFileFormat);
+ }
+ else
+ {
+ newframe = loader.loadFileWaitTillLoaded(fileObject,
+ DataSourceType.FILE, currentFileFormat);
+ }
+
+ newframe.setBounds(bounds);
+ if (featureSettings != null && featureSettings.isShowing())
+ {
+ final Rectangle fspos = featureSettings.frame.getBounds();
+ // TODO: need a 'show feature settings' function that takes bounds -
+ // need to refactor Desktop.addFrame
+ newframe.featureSettings_actionPerformed(null);
+ final FeatureSettings nfs = newframe.featureSettings;
+ Jalview.execRunnable(new Runnable()
{
- final Rectangle fspos = featureSettings.frame.getBounds();
- // TODO: need a 'show feature settings' function that takes bounds -
- // need to refactor Desktop.addFrame
- newframe.featureSettings_actionPerformed(null);
- final FeatureSettings nfs = newframe.featureSettings;
- SwingUtilities.invokeLater(new Runnable()
+ @Override
+ public void run()
{
- @Override
- public void run()
- {
- nfs.frame.setBounds(fspos);
- }
- });
- this.featureSettings.close();
- this.featureSettings = null;
- }
- this.closeMenuItem_actionPerformed(true);
+ nfs.frame.setBounds(fspos);
+ }
+ });
+ this.featureSettings.close();
+ this.featureSettings = null;
}
+ this.closeMenuItem_actionPerformed(true);
}
}
// undecorated overview with defined size
frame.setName(Jalview.getAppID("overview"));
//
- Dimension dim = (Dimension) Platform.getEmbeddedAttribute(frame,
- Platform.EMBEDDED_DIM);
+ Dimension dim = Platform.getDimIfEmbedded(frame, -1, -1);
if (dim != null && dim.width == 0)
{
dim = null; // hidden, not embedded
}
-
OverviewPanel overview = new OverviewPanel(alignPanel, dim);
frame.setContentPane(overview);
frameTitle += this.title;
- Desktop.addInternalFrame(tp, frameTitle, 600, 500);
+ Dimension dim = Platform.getDimIfEmbedded(tp, 600, 500);
+ Desktop.addInternalFrame(tp, frameTitle, dim.width, dim.height);
}
/**
if (nf.getTree() != null)
{
tp = new TreePanel(alignPanel, nf, treeTitle, input);
-
- tp.setSize(w, h);
+ Dimension dim = Platform.getDimIfEmbedded(tp, -1, -1);
+ if (dim == null)
+ {
+ dim = new Dimension(w, h);
+ }
+ else
+ {
+ // no offset, either
+ x = 0;
+ }
+ tp.setSize(dim.width, dim.height);
if (x > 0 && y > 0)
{
tp.setLocation(x, y);
}
- Desktop.addInternalFrame(tp, treeTitle, w, h);
+ Desktop.addInternalFrame(tp, treeTitle, dim.width, dim.height);
}
} catch (Exception ex)
{
*/
public void BuildWebServiceMenu()
{
+ if (Jalview.isSynchronous())
+ {
+ return;
+ }
while (buildingMenu)
{
try
});
rfetch.add(fetchr);
- new Thread(new Runnable()
+ Jalview.execThread(new Thread(new Runnable()
{
@Override
public void run()
{
- javax.swing.SwingUtilities.invokeLater(new Runnable()
+ Jalview.execRunnable(new Runnable()
{
@Override
public void run()
}
});
}
- }).start();
+ }));
}