}
+ public boolean isRepainting()
+ {
+ if (renderPanel!=null && renderPanel.isVisible())
+ {
+ return renderPanel.repainting;
+ }
+ return false;
+ }
/**
* Outputs the Jmol viewer image as an image file, after prompting the user to
* choose a file and (for EPS) choice of Text or Lineart character rendering
@Override
public void makePDBImage(ImageMaker.TYPE type)
{
+ while (!isRepainting())
+ {
+ try {
+ Thread.sleep(2);
+ } catch (Exception q)
+ {}
+ }
try
{
makePDBImage(null, type, null,
}
});
runner.start();
+ long time = 0;
do
{
Thread.sleep(25);
- } while (runner.isAlive());
+ } while (runner.isAlive() && time++ < 4000);
+ if (time >= 4000)
+ {
+ runner.interrupt();
+ throw new ImageOutputException(
+ "Jmol took too long to export. Waited for 100 seconds.");
+ }
} catch (Throwable e)
{
throw new ImageOutputException(
}
else
{
- jmb.jmolViewer.renderScreenImage(g, currentSize.width,
- currentSize.height);
+ repainting=true;
+ synchronized (jmb)
+ {
+ jmb.jmolViewer.renderScreenImage(g, currentSize.width,
+ currentSize.height);
+
+ }
+ repainting=false;
}
}
+ volatile boolean repainting=false;
}
@Override