X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FHtmlSvgOutput.java;h=7b661f300f1683115f15039ea077f935671c9c8a;hb=d4271d32477e99e9fbbfa5db3e11f1b79324e60d;hp=b79d35d1917c22f5e3d19445d83fb8f0dce2309d;hpb=e18a55983523b534b2317b64104d32948275b1cd;p=jalview.git
diff --git a/src/jalview/io/HtmlSvgOutput.java b/src/jalview/io/HtmlSvgOutput.java
index b79d35d..7b661f3 100644
--- a/src/jalview/io/HtmlSvgOutput.java
+++ b/src/jalview/io/HtmlSvgOutput.java
@@ -1,271 +1,316 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see .
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.io;
-import jalview.datamodel.SequenceI;
-import jalview.gui.AlignViewport;
-import jalview.gui.AlignmentPanel;
-import jalview.gui.AnnotationPanel;
-import jalview.gui.FeatureRenderer;
-import jalview.gui.HTMLOptions;
-import jalview.math.AlignmentDimension;
-import jalview.util.MessageManager;
-
-import java.awt.Color;
-import java.awt.FontMetrics;
import java.awt.Graphics;
-import java.awt.print.Printable;
import java.awt.print.PrinterException;
import java.io.File;
import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Locale;
+import java.util.concurrent.atomic.AtomicBoolean;
import org.jfree.graphics2d.svg.SVGGraphics2D;
import org.jfree.graphics2d.svg.SVGHints;
-public class HtmlSvgOutput
-{
- AlignViewport av;
-
- FeatureRenderer fr;
- AlignmentPanel ap;
+import jalview.bin.Cache;
+import jalview.gui.AlignmentPanel;
+import jalview.gui.LineartOptions;
+import jalview.gui.OOMWarning;
+import jalview.math.AlignmentDimension;
+import jalview.util.MessageManager;
- AnnotationPanel annotationPanel;
+public class HtmlSvgOutput extends HTMLOutput
+{
+ public HtmlSvgOutput(AlignmentPanel ap)
+ {
+ super(ap, "HTML");
+ }
- public HtmlSvgOutput(File file, AlignmentPanel ap)
+ public int printUnwrapped(int pwidth, int pheight, int pi,
+ Graphics idGraphics, Graphics alignmentGraphics)
+ throws PrinterException
{
+ return ap.printUnwrapped(pwidth, pheight, pi, idGraphics,
+ alignmentGraphics);
+ }
- this.av = ap.av;
- this.ap = ap;
- this.annotationPanel = ap.getAnnotationPanel();
- generateHtmlSvgOutput(file);
+ public int printWrapped(int pwidth, int pheight, int pi, Graphics... pg)
+ throws PrinterException
+ {
+ return ap.printWrappedAlignment(pwidth, pheight, pi, pg[0]);
}
- public void generateHtmlSvgOutput(File file)
+ String getHtml(String titleSvg, String alignmentSvg, String jsonData,
+ boolean wrapped)
{
- try
+ StringBuilder htmlSvg = new StringBuilder();
+ htmlSvg.append("\n");
+ if (jsonData != null)
{
- if (file == null /*
- * && !(System.getProperty("java.awt.headless") != null
- * && System
- * .getProperty("java.awt.headless").equals("true"))
- */)
- {
-
- JalviewFileChooser chooser = getHTMLChooser();
- chooser.setFileView(new jalview.io.JalviewFileView());
- chooser.setDialogTitle(ap.alignFrame.getTitle());
- chooser.setToolTipText(MessageManager.getString("action.save"));
- int value = chooser.showSaveDialog(ap.alignFrame);
-
- if (value == jalview.io.JalviewFileChooser.APPROVE_OPTION)
- {
- jalview.bin.Cache.setProperty("LAST_DIRECTORY", chooser
- .getSelectedFile().getParent());
- file = chooser.getSelectedFile();
- }
- }
-
- AlignmentDimension aDimension = ap.getAlignmentDimension();
- SVGGraphics2D g1 = new SVGGraphics2D(aDimension.getWidth(),
- aDimension.getHeight());
- SVGGraphics2D g2 = new SVGGraphics2D(aDimension.getWidth(),
- aDimension.getHeight());
-
- String renderStyle = jalview.bin.Cache.getDefault("HTML_RENDERING",
- "Prompt each time");
+ htmlSvg.append(
+ " ");
+ htmlSvg.append(
+ "");
+ htmlSvg.append(
+ "