From 90f6f3090a255a7059d0d0f26ddd848253bf9df6 Mon Sep 17 00:00:00 2001 From: tcofoegbu Date: Tue, 11 Aug 2015 14:07:59 +0100 Subject: [PATCH] add ability to launch jalview from exported html + svg file. Abstracted Jalview build details so that jalview version can be obtained dynmaicaly from JSONFile class. --- src/jalview/api/BuildDetailsI.java | 10 +++++++ src/jalview/bin/BuildDetails.java | 58 ++++++++++++++++++++++++++++++++++++ src/jalview/bin/Cache.java | 2 +- src/jalview/io/HtmlSvgOutput.java | 32 ++++++++++++++++++-- src/jalview/io/JSONFile.java | 6 ++-- 5 files changed, 102 insertions(+), 6 deletions(-) create mode 100644 src/jalview/api/BuildDetailsI.java create mode 100644 src/jalview/bin/BuildDetails.java diff --git a/src/jalview/api/BuildDetailsI.java b/src/jalview/api/BuildDetailsI.java new file mode 100644 index 0000000..7a9bbff --- /dev/null +++ b/src/jalview/api/BuildDetailsI.java @@ -0,0 +1,10 @@ +package jalview.api; + +public interface BuildDetailsI +{ + public String getBuildDate(); + + public String getVersion(); + + public String getInstallation(); +} diff --git a/src/jalview/bin/BuildDetails.java b/src/jalview/bin/BuildDetails.java new file mode 100644 index 0000000..0a1e227 --- /dev/null +++ b/src/jalview/bin/BuildDetails.java @@ -0,0 +1,58 @@ +package jalview.bin; + +import jalview.api.BuildDetailsI; + + +public class BuildDetails implements BuildDetailsI +{ + private static String buildDate; + + private static String version; + + private static String installation; + + public BuildDetails() + { + + } + + public BuildDetails(String version, String buildDate, String installation) + { + BuildDetails.version = version; + BuildDetails.buildDate = buildDate; + BuildDetails.installation = installation; + } + + public String getBuildDate() + { + return buildDate; + } + + public static void setBuilddate(String buildDate) + { + BuildDetails.buildDate = buildDate; + } + + public String getVersion() + { + return version; + } + + public static void setVersion(String version) + { + BuildDetails.version = version; + } + + public String getInstallation() + { + return installation; + } + + public static void setInstallation(String installation) + { + BuildDetails.installation = installation; + } + + + +} diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java index 10aba00..641815d 100755 --- a/src/jalview/bin/Cache.java +++ b/src/jalview/bin/Cache.java @@ -391,7 +391,7 @@ public class Cache { codeInstallation = " (" + codeInstallation + ")"; } - + new BuildDetails(codeVersion, null, codeInstallation); System.out .println("Jalview Version: " + codeVersion + codeInstallation); diff --git a/src/jalview/io/HtmlSvgOutput.java b/src/jalview/io/HtmlSvgOutput.java index 781eace..1eb86b7 100644 --- a/src/jalview/io/HtmlSvgOutput.java +++ b/src/jalview/io/HtmlSvgOutput.java @@ -276,6 +276,7 @@ public class HtmlSvgOutput htmlSvg.append("\n"); if (jsonData != null) { + htmlSvg.append(""); htmlSvg.append(""); } @@ -310,8 +311,35 @@ public class HtmlSvgOutput + "subCatContainer.scroll(\nfunction() {\n" + "subCatContainer.scrollTop($(this).scrollTop());\n});\n"); - htmlSvg.append(""); - + htmlSvg.append("\n"); + + // javascript for launching file in Jalview + + htmlSvg.append("\n"); + htmlSvg.append(""); return htmlSvg.toString(); } } diff --git a/src/jalview/io/JSONFile.java b/src/jalview/io/JSONFile.java index b079a3c..b8e2454 100644 --- a/src/jalview/io/JSONFile.java +++ b/src/jalview/io/JSONFile.java @@ -27,6 +27,7 @@ import jalview.api.AlignmentViewPanel; import jalview.api.ComplexAlignFile; import jalview.api.FeatureRenderer; import jalview.api.FeaturesDisplayedI; +import jalview.bin.BuildDetails; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; import jalview.datamodel.Annotation; @@ -64,9 +65,9 @@ public class JSONFile extends AlignFile implements ComplexAlignFile { private ColourSchemeI colourScheme; - private String version = "2.9"; + private static String version = new BuildDetails().getVersion(); - private String webstartUrl = "www.jalview.org/services/launchApp"; + private String webstartUrl = "http://www.jalview.org/services/launchApp"; private String application = "Jalview"; @@ -176,7 +177,6 @@ public class JSONFile extends AlignFile implements ComplexAlignFile jsonSeqPojo.setSeq(seq.getSequenceAsString()); jsonAlignmentPojo.getSeqs().add(jsonSeqPojo); } - jsonAlignmentPojo.setGlobalColorScheme(globalColorScheme); jsonAlignmentPojo.getAppSettings().put("application", application); jsonAlignmentPojo.getAppSettings().put("version", version); -- 1.7.10.2