X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FBioJsHTMLOutput.java;h=9db3df2021214fd62c65c8715c2e8ba44e547ea0;hb=7a1b05d3e521e5d532ad03b23a33ab21675ebd1f;hp=fd9c584eedf291d58652e469526288819f3a34f2;hpb=26371ff5c38bbb092e432d5616313bc1088e87a2;p=jalview.git diff --git a/src/jalview/io/BioJsHTMLOutput.java b/src/jalview/io/BioJsHTMLOutput.java index fd9c584..9db3df2 100644 --- a/src/jalview/io/BioJsHTMLOutput.java +++ b/src/jalview/io/BioJsHTMLOutput.java @@ -20,7 +20,6 @@ */ package jalview.io; -import jalview.exceptions.NoFileSelectedException; import jalview.gui.AlignmentPanel; import jalview.gui.OOMWarning; import jalview.json.binding.biojs.BioJSReleasePojo; @@ -41,7 +40,6 @@ import java.util.TreeMap; public class BioJsHTMLOutput extends HTMLOutput { - private static File currentBJSTemplateFile; private static TreeMap bioJsMSAVersions; @@ -53,44 +51,14 @@ public class BioJsHTMLOutput extends HTMLOutput .getDefault("biojs_template_directory", DEFAULT_DIR); public static final String BJS_TEMPLATE_GIT_REPO = jalview.bin.Cache - .getDefault( - "biojs_template_git_repo", + .getDefault("biojs_template_git_repo", "https://raw.githubusercontent.com/jalview/exporter-templates/master/biojs/package.json"); public BioJsHTMLOutput(AlignmentPanel ap) { - super(ap); + super(ap, "BioJS MSA"); } - @Override - public void exportHTML(String outputFile) - { - exportStarted(); - try - { - if (outputFile == null) - { - outputFile = getOutputFile(); - } - generatedFile = new File(outputFile); - } catch (NoFileSelectedException e) - { - setProgressMessage(MessageManager.formatMessage( - "status.cancelled_image_export_operation", "BioJS MSA")); - return; - } catch (Exception e) - { - setProgressMessage(MessageManager.formatMessage( - "info.error_creating_file", "BioJS MSA")); - e.printStackTrace(); - return; - } - new Thread(this).start(); - - } - - - public static void refreshVersionInfo(String dirName) throws URISyntaxException { @@ -133,7 +101,8 @@ public class BioJsHTMLOutput extends HTMLOutput { try { - String gitRepoPkgJson = getURLContentAsString(BJS_TEMPLATE_GIT_REPO); + String gitRepoPkgJson = getURLContentAsString( + BJS_TEMPLATE_GIT_REPO); if (gitRepoPkgJson != null) { BioJSRepositoryPojo release = new BioJSRepositoryPojo( @@ -235,8 +204,8 @@ public class BioJsHTMLOutput extends HTMLOutput } } } - return responseStrBuilder == null ? null : responseStrBuilder - .toString(); + return responseStrBuilder == null ? null + : responseStrBuilder.toString(); } public static File getCurrentBJSTemplateFile() @@ -273,12 +242,6 @@ public class BioJsHTMLOutput extends HTMLOutput } @Override - public File getExportedFile() - { - return generatedFile; - } - - @Override public void run() { try @@ -289,13 +252,13 @@ public class BioJsHTMLOutput extends HTMLOutput String generatedBioJsWithJalviewAlignmentAsJson = bioJSTemplateString .replaceAll("#sequenceData#", bioJSON).toString(); - PrintWriter out = new java.io.PrintWriter(new java.io.FileWriter( - generatedFile)); + PrintWriter out = new java.io.PrintWriter( + new java.io.FileWriter(generatedFile)); out.print(generatedBioJsWithJalviewAlignmentAsJson); out.flush(); out.close(); - setProgressMessage(MessageManager.formatMessage( - "status.export_complete", "BioJS")); + setProgressMessage(MessageManager + .formatMessage("status.export_complete", getDescription())); exportCompleted(); } catch (OutOfMemoryError err) @@ -305,8 +268,8 @@ public class BioJsHTMLOutput extends HTMLOutput new OOMWarning("Creating Image for " + generatedFile, err); } catch (Exception e) { - setProgressMessage(MessageManager.formatMessage( - "info.error_creating_file", "HTML")); + setProgressMessage(MessageManager + .formatMessage("info.error_creating_file", getDescription())); e.printStackTrace(); }