package jalview.io;
import jalview.bin.Cache;
+import jalview.bin.Jalview;
import jalview.gui.AlignmentPanel;
import jalview.gui.LineartOptions;
import jalview.gui.OOMWarning;
import jalview.math.AlignmentDimension;
import jalview.util.MessageManager;
-import jalview.util.dialogrunner.RunResponse;
import java.awt.Graphics;
import java.awt.print.PrinterException;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicBoolean;
-import javax.swing.JOptionPane;
-
import org.jfree.graphics2d.svg.SVGGraphics2D;
import org.jfree.graphics2d.svg.SVGHints;
{
public HtmlSvgOutput(AlignmentPanel ap)
{
- super(ap);
- }
-
- @Override
- public void exportHTML(String outputFile)
- {
- exportStarted();
- try
- {
- if (outputFile == null)
- {
- outputFile = getOutputFile();
- if (outputFile == null)
- {
- setProgressMessage(MessageManager.formatMessage(
- "status.cancelled_image_export_operation", "HTML"));
- return;
- }
- }
- generatedFile = new File(outputFile);
- } catch (Exception e)
- {
- setProgressMessage(MessageManager
- .formatMessage("info.error_creating_file", "HTML"));
- e.printStackTrace();
- return;
- }
- new Thread(this).start();
+ super(ap, "HTML");
}
public int printUnwrapped(int pwidth, int pheight, int pi,
{
try
{
- setProgressMessage(null);
- setProgressMessage(MessageManager.formatMessage(
- "status.exporting_alignment_as_x_file", getDescription()));
-
String renderStyle = Cache.getDefault("HTML_RENDERING",
"Prompt each time");
AtomicBoolean textOption = new AtomicBoolean(
/*
* configure the action to run on OK in the dialog
*/
- RunResponse okAction = new RunResponse(JOptionPane.OK_OPTION)
+ Runnable okAction = new Runnable()
{
@Override
public void run()
/*
* Prompt for character rendering style if preference is not set
*/
- if (renderStyle.equalsIgnoreCase("Prompt each time") && !isHeadless())
+ if (renderStyle.equalsIgnoreCase("Prompt each time")
+ && !Jalview.isHeadlessMode())
{
LineartOptions svgOption = new LineartOptions("HTML", textOption);
- svgOption.setResponseAction(1, new RunResponse(JOptionPane.NO_OPTION)
+ svgOption.setResponseAction(1, new Runnable()
{
@Override
public void run()
.formatMessage("info.error_creating_file", getDescription()));
}
}
-
- @Override
- protected String getDescription()
- {
- return "HTML";
- }
}