- public static final String BJS_TEMPLATES_LOCAL_DIRECTORY = jalview.bin.Cache
- .getDefault("biojs_template_directory", "/biojs_templates/");
-
- public static final String BJS_FTP_USER = jalview.bin.Cache.getDefault(
- "biojs_ftp_user", "test");
-
- public static final String BJS_FTP_PWD = jalview.bin.Cache.getDefault(
- "biojs_ftp_pwd", "test");
-
- public static final String BJS_FTP_PORT = jalview.bin.Cache.getDefault(
- "biojs_ftp_port", "22");
-
- public static final String BJS_FTP_SERVER = jalview.bin.Cache.getDefault(
- "biojs_ftp_server", "localhost");
-
- public BioJsHTMLOutput(AlignmentPanel ap,
- FeatureRenderer fr1)
- {
-
- if (ap != null)
- {
-
- this.av = ap.av;
- av.setFeatureRenderer(new FeatureRenderer(ap));
- }
-
- }
-
- public void exportJalviewAlignmentAsBioJsHtmlFile()
- {
- try
- {
- String outputFile = getOutputFile();
- String jalviewAlignmentJson = JSONFile.getJSONData(av);
- String bioJSTemplateString = getBioJsTemplateAsString();
- String generatedBioJsWithJalviewAlignmentAsJson = bioJSTemplateString
- .replaceAll(
-"#sequenceData#", jalviewAlignmentJson)
- .toString();
-
- PrintWriter out = new java.io.PrintWriter(new java.io.FileWriter(
- outputFile));
- out.print(generatedBioJsWithJalviewAlignmentAsJson);
- out.flush();
- out.close();
- jalview.util.BrowserLauncher.openURL("file:///" + outputFile);
- } catch (NoFileSelectedException ex)
- {
- // do noting if no file was selected
- } catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- public String getOutputFile() throws NoFileSelectedException
- {
- String selectedFile = null;
- JalviewFileChooser jvFileChooser = new JalviewFileChooser(
- jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
- { "html" }, new String[]
- { "HTML files" }, "HTML files");
- jvFileChooser.setFileView(new JalviewFileView());