JAL-629 Add --renderer arg/subval for vector output and fixed annotation renderer...
[jalview.git] / src / jalview / io / HtmlSvgOutput.java
index 9fb3720..c5ce35b 100644 (file)
@@ -25,6 +25,7 @@ import java.awt.print.PrinterException;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.util.Locale;
 import java.util.concurrent.Callable;
 import java.util.concurrent.atomic.AtomicBoolean;
 
@@ -202,12 +203,20 @@ public class HtmlSvgOutput extends HTMLOutput
   @Override
   public void run()
   {
+    run(null);
+  }
+
+  @Override
+  public void run(String renderer)
+  {
     try
     {
-      String renderStyle = Cache.getDefault("HTML_RENDERING",
-              "Prompt each time");
+      String renderStyle = renderer == null
+              ? Cache.getDefault("HTML_RENDERING",
+                      LineartOptions.PROMPT_EACH_TIME)
+              : renderer;
       AtomicBoolean textOption = new AtomicBoolean(
-              !"Lineart".equals(renderStyle));
+              !"lineart".equals(renderStyle.toLowerCase(Locale.ROOT)));
 
       /*
        * configure the action to run on OK in the dialog
@@ -220,7 +229,8 @@ public class HtmlSvgOutput extends HTMLOutput
       /*
        * Prompt for character rendering style if preference is not set
        */
-      if (renderStyle.equalsIgnoreCase("Prompt each time") && !isHeadless())
+      if (renderStyle.equalsIgnoreCase(LineartOptions.PROMPT_EACH_TIME)
+              && !isHeadless())
       {
         LineartOptions svgOption = new LineartOptions("HTML", textOption);
         svgOption.setResponseAction(1, () -> {