X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FBioJsHTMLOutput.java;h=50486f229d9d2bd77bb37ba9a70ae35a416c5ba4;hb=d131f05c68757d57e5e4a1f440196ae1b70f3b8a;hp=74fb147e08b14fc917947acc8d3ffdac567b347e;hpb=294cc8b0cf3d28310a95e1ffdb2a0f871304b70d;p=jalview.git diff --git a/src/jalview/io/BioJsHTMLOutput.java b/src/jalview/io/BioJsHTMLOutput.java index 74fb147..50486f2 100644 --- a/src/jalview/io/BioJsHTMLOutput.java +++ b/src/jalview/io/BioJsHTMLOutput.java @@ -1,9 +1,11 @@ package jalview.io; +import jalview.api.AlignExportSettingI; import jalview.api.AlignmentViewPanel; +import jalview.datamodel.AlignmentExportData; import jalview.exceptions.NoFileSelectedException; -import jalview.json.binding.v1.BioJSReleasePojo; -import jalview.json.binding.v1.BioJSRepositoryPojo; +import jalview.json.binding.biojs.BioJSReleasePojo; +import jalview.json.binding.biojs.BioJSRepositoryPojo; import jalview.util.MessageManager; import java.io.BufferedInputStream; @@ -36,7 +38,7 @@ public class BioJsHTMLOutput public static final String BJS_TEMPLATE_GIT_REPO = jalview.bin.Cache .getDefault( "biojs_template_git_repo", - "https://raw.githubusercontent.com/tcofoegbu/bjs-template/master/package.json"); + "https://raw.githubusercontent.com/jalview/exporter-templates/master/biojs/package.json"); public BioJsHTMLOutput(AlignmentViewPanel ap) { @@ -51,7 +53,60 @@ public class BioJsHTMLOutput try { String outputFile = getOutputFile(); - String jalviewAlignmentJson = JSONFile.getJSONData(ap); + // String jalviewAlignmentJson = JSONFile.getJSONData(ap); + AlignExportSettingI exportSettings = new AlignExportSettingI() + { + @Override + public boolean isExportHiddenSequences() + { + return true; + } + + @Override + public boolean isExportHiddenColumns() + { + return true; + } + + @Override + public boolean isExportAnnotations() + { + return true; + } + + @Override + public boolean isExportFeatures() + { + return true; + } + + @Override + public boolean isExportGroups() + { + return true; + } + + @Override + public boolean isCancelled() + { + return false; + } + + }; + AlignmentExportData exportData = jalview.gui.AlignFrame + .getAlignmentForExport( +JSONFile.FILE_DESC, + ap.getAlignViewport(), exportSettings); + if (exportData.getSettings().isCancelled()) + { + return; + } + String jalviewAlignmentJson = new FormatAdapter(ap, + exportData.getSettings()).formatSequences(JSONFile.FILE_DESC, + exportData.getAlignment(), exportData.getOmitHidden(), + exportData.getStartEndPostions(), ap.getAlignViewport() + .getColumnSelection()); + String bioJSTemplateString = getBioJsTemplateAsString(); String generatedBioJsWithJalviewAlignmentAsJson = bioJSTemplateString .replaceAll( @@ -82,10 +137,8 @@ public class BioJsHTMLOutput { "HTML files" }, "HTML files"); jvFileChooser.setFileView(new JalviewFileView()); - // TODO uncomment when supported by MassageManager jvFileChooser.setDialogTitle(MessageManager .getString("label.save_as_biojs_html")); - jvFileChooser.setDialogTitle("save as BioJs HTML"); jvFileChooser.setToolTipText(MessageManager.getString("action.save")); int fileChooserOpt = jvFileChooser.showSaveDialog(null); @@ -187,10 +240,13 @@ public class BioJsHTMLOutput try { String gitRepoPkgJson = getURLContentAsString(BJS_TEMPLATE_GIT_REPO); - BioJSRepositoryPojo release = new BioJSRepositoryPojo( - gitRepoPkgJson); - syncUpdates(BJS_TEMPLATES_LOCAL_DIRECTORY, release); - refreshBioJSVersionsInfo(BJS_TEMPLATES_LOCAL_DIRECTORY); + if (gitRepoPkgJson != null) + { + BioJSRepositoryPojo release = new BioJSRepositoryPojo( + gitRepoPkgJson); + syncUpdates(BJS_TEMPLATES_LOCAL_DIRECTORY, release); + refreshBioJSVersionsInfo(BJS_TEMPLATES_LOCAL_DIRECTORY); + } } catch (URISyntaxException e) { e.printStackTrace();