package jalview.io;
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;
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)
{
try
{
String outputFile = getOutputFile();
- String jalviewAlignmentJson = JSONFile.getJSONData(ap);
+ // String jalviewAlignmentJson = JSONFile.getJSONData(ap);
+ AlignmentExportData exportData = jalview.gui.AlignFrame
+ .getAlignmentForExport(
+ JSONFile.FILE_DESC, ap.getAlignViewport());
+ 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(
{ "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);
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();