TYPE type;
+ private IProgressIndicator pIndicator;
+
+ private long pSessionId;
+
+ private boolean headless;
+
public enum TYPE
{
EPS("EPS", MessageManager.getString("label.eps_file"), getEPSChooser()), PNG(
int height, File file, String fileTitle,
IProgressIndicator pIndicator, long pSessionId, boolean headless)
{
+ this.pIndicator = pIndicator;
this.type = type;
-
+ this.pSessionId = pSessionId;
+ this.headless = headless;
if (file == null)
{
- if (pIndicator != null && !headless)
- {
- pIndicator.setProgressBar(
- MessageManager.formatMessage(
- "status.waiting_for_user_to_select_output_file",
- type.name), pSessionId);
- }
+ setProgressMessage(MessageManager.formatMessage(
+ "status.waiting_for_user_to_select_output_file", type.name));
JalviewFileChooser chooser;
chooser = type.getChooser();
chooser.setFileView(new jalview.io.JalviewFileView());
}
else
{
- if (pIndicator != null && !headless)
- {
- pIndicator.setProgressBar(MessageManager.formatMessage(
- "status.cancelled_image_export_operation", type.name),
- pSessionId);
- }
+ setProgressMessage(MessageManager.formatMessage(
+ "status.cancelled_image_export_operation", type.name));
}
}
try
{
out = new FileOutputStream(file);
- pIndicator.setProgressBar(null, pSessionId);
- pIndicator.setProgressBar(MessageManager.formatMessage(
- "status.exporting_alignment_as_x_file", type.getName()),
- pSessionId);
+ setProgressMessage(null);
+ setProgressMessage(MessageManager.formatMessage(
+ "status.exporting_alignment_as_x_file", type.getName()));
if (type == TYPE.SVG)
{
setupSVG(width, height, fileTitle);
{
setupPNG(width, height);
}
- if (pIndicator != null && !headless)
- {
- pIndicator.setProgressBar(
-MessageManager.formatMessage(
- "status.export_complete", type.getName()),
- pSessionId);
- }
+
} catch (Exception ex)
{
System.out.println("Error creating " + type.getName() + " file.");
- pIndicator.setProgressBar(MessageManager.formatMessage(
- "info.error_creating_file", type.getName()), pSessionId);
+ setProgressMessage(MessageManager.formatMessage(
+ "info.error_creating_file", type.getName()));
}
}
}
if (renderStyle == null || eps.cancelled)
{
+ setProgressMessage(MessageManager.formatMessage(
+ "status.cancelled_image_export_operation", "EPS"));
return;
}
}
pg.setAccurateTextMode(accurateText);
graphics = pg;
+ setProgressMessage(MessageManager.formatMessage(
+ "status.export_complete", type.getName()));
} catch (Exception ex)
{
}
Graphics2D ig2 = (Graphics2D) graphics;
ig2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
+ setProgressMessage(MessageManager.formatMessage(
+ "status.export_complete", type.getName()));
}
if (renderStyle == null || svgOption.cancelled)
{
+ setProgressMessage(MessageManager.formatMessage(
+ "status.cancelled_image_export_operation", "SVG"));
return;
}
}
SVGHints.VALUE_DRAW_STRING_TYPE_VECTOR);
}
+ setProgressMessage(MessageManager.formatMessage(
+ "status.export_complete", type.getName()));
graphics = g2;
}
"Encapsulated Postscript");
}
+ private void setProgressMessage(String message)
+ {
+ if (pIndicator != null && !headless)
+ {
+ pIndicator.setProgressBar(message, pSessionId);
+ }
+ }
+
static JalviewFileChooser getSVGChooser()
{
if (Jalview.isHeadlessMode())