From e950d7035158d0dca7bcc466aecfb32450d4bd52 Mon Sep 17 00:00:00 2001 From: tcofoegbu Date: Tue, 25 Oct 2016 11:22:10 +0100 Subject: [PATCH] JAL-2277 Improvement to support html+svg export in wrap mode --- src/jalview/io/HtmlSvgOutput.java | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/src/jalview/io/HtmlSvgOutput.java b/src/jalview/io/HtmlSvgOutput.java index 68173ff..decb06f 100644 --- a/src/jalview/io/HtmlSvgOutput.java +++ b/src/jalview/io/HtmlSvgOutput.java @@ -148,8 +148,16 @@ public class HtmlSvgOutput g2.setRenderingHint(SVGHints.KEY_DRAW_STRING_TYPE, SVGHints.VALUE_DRAW_STRING_TYPE_VECTOR); } + if (av.getWrapAlignment()) + { + printWrapped(aDimension.getWidth(), aDimension.getHeight(), 0, + g1, g2); + } + else + { printUnwrapped(aDimension.getWidth(), aDimension.getHeight(), 0, g1, g2); + } String titleSvgData = g1.getSVGDocument(); String alignSvgData = g2.getSVGDocument(); @@ -207,7 +215,8 @@ public class HtmlSvgOutput exportData.getStartEndPostions(), av.getColumnSelection()); } - String htmlData = getHtml(titleSvgData, alignSvgData, jsonData); + String htmlData = getHtml(titleSvgData, alignSvgData, jsonData, + av.getWrapAlignment()); FileOutputStream out = new FileOutputStream(fileX); out.write(htmlData.getBytes()); out.flush(); @@ -388,8 +397,14 @@ public class HtmlSvgOutput return Printable.PAGE_EXISTS; } + public int printWrapped(int pwidth, int pheight, int pi, Graphics... pg) + throws PrinterException + { + return ap.printWrappedAlignment(pg[1], pwidth, pheight, pi); + } + private String getHtml(String titleSvg, String alignmentSvg, - String jsonData) + String jsonData, boolean wrapped) { StringBuilder htmlSvg = new StringBuilder(); htmlSvg.append("\n"); @@ -429,8 +444,9 @@ public class HtmlSvgOutput + ".facebox_hide { z-index:-100; }\n" + ".facebox_overlayBG { background-color: #000; z-index: 99; }"); } - htmlSvg.append(""); + if (!wrapped) + { htmlSvg.append("
"); htmlSvg.append("
\n"); htmlSvg.append("
\n"); @@ -451,6 +467,15 @@ public class HtmlSvgOutput + "subCatContainer.scrollTop($(this).scrollTop());\n});\n"); htmlSvg.append("\n"); + } + else + { + htmlSvg.append("
\n") + .append(alignmentSvg).append("
"); + htmlSvg.append("\n" + + "\n"); + + } // javascript for launching file in Jalview -- 1.7.10.2