X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Futil%2FImageMaker.java;h=72fa605acb6170e9349e8950e5dc032b73c9281f;hb=cbdd0bde03d210649623b4576dd75e6c25fe4582;hp=b410be660f026e503612ab24402d31ec1bf736de;hpb=2273eba5668e5340354da60fed329c6c716cc439;p=jalview.git diff --git a/src/jalview/util/ImageMaker.java b/src/jalview/util/ImageMaker.java index b410be6..72fa605 100755 --- a/src/jalview/util/ImageMaker.java +++ b/src/jalview/util/ImageMaker.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2) - * Copyright (C) 2014 The Jalview Authors + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors * * This file is part of Jalview. * @@ -20,7 +20,9 @@ */ package jalview.util; +import jalview.bin.Jalview; import jalview.gui.EPSOptions; +import jalview.gui.IProgressIndicator; import jalview.gui.SVGOptions; import jalview.io.JalviewFileChooser; @@ -88,14 +90,21 @@ public class ImageMaker } - public ImageMaker(Component parent, TYPE type, String title, int width, - int height, File file, String fileTitle) + int height, File file, String fileTitle, + IProgressIndicator pIndicator, long pSessionId, boolean headless) { this.type = type; if (file == null) { + if (pIndicator != null && !headless) + { + pIndicator.setProgressBar( + MessageManager.formatMessage( + "status.waiting_for_user_to_select_output_file", + type.name), pSessionId); + } JalviewFileChooser chooser; chooser = type.getChooser(); chooser.setFileView(new jalview.io.JalviewFileView()); @@ -109,6 +118,15 @@ public class ImageMaker .getSelectedFile().getParent()); file = chooser.getSelectedFile(); } + else + { + if (pIndicator != null && !headless) + { + pIndicator.setProgressBar(MessageManager.formatMessage( + "status.cancelled_image_export_operation", type.name), + pSessionId); + } + } } if (file != null) @@ -128,11 +146,19 @@ public class ImageMaker { 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."); + System.out.println("Error creating " + type.getName() + " file."); + + pIndicator.setProgressBar(MessageManager.formatMessage( + "info.error_creating_file", type.getName()), pSessionId); } } } @@ -142,8 +168,6 @@ public class ImageMaker return graphics; } - - public void writeImage() { try @@ -248,7 +272,7 @@ public class ImageMaker } } - if (renderStyle.equalsIgnoreCase("lineart")) + if (renderStyle.equalsIgnoreCase("Lineart")) { ig2.setRenderingHint(SVGHints.KEY_DRAW_STRING_TYPE, SVGHints.VALUE_DRAW_STRING_TYPE_VECTOR); @@ -259,25 +283,40 @@ public class ImageMaker static JalviewFileChooser getPNGChooser() { + if (Jalview.isHeadlessMode()) + { + return null; + } return new jalview.io.JalviewFileChooser( - jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[] - { "png" }, new String[] - { "Portable network graphics" }, "Portable network graphics"); + jalview.bin.Cache.getProperty("LAST_DIRECTORY"), + new String[] { "png" }, + new String[] { "Portable network graphics" }, + "Portable network graphics"); } static JalviewFileChooser getEPSChooser() { + if (Jalview.isHeadlessMode()) + { + return null; + } return new jalview.io.JalviewFileChooser( - jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[] - { "eps" }, new String[] - { "Encapsulated Postscript" }, "Encapsulated Postscript"); + jalview.bin.Cache.getProperty("LAST_DIRECTORY"), + new String[] { "eps" }, + new String[] { "Encapsulated Postscript" }, + "Encapsulated Postscript"); } static JalviewFileChooser getSVGChooser() { + if (Jalview.isHeadlessMode()) + { + return null; + } return new jalview.io.JalviewFileChooser( - jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[] - { "svg" }, new String[] - { "Scalable Vector Graphics" }, "Scalable Vector Graphics"); + jalview.bin.Cache.getProperty("LAST_DIRECTORY"), + new String[] { "svg" }, + new String[] { "Scalable Vector Graphics" }, + "Scalable Vector Graphics"); } }