From: Charles Ofoegbu Date: Fri, 5 Dec 2014 14:58:00 +0000 (+0000) Subject: JAL-1605 added command line support for html export option X-Git-Tag: Jalview_2_9~121^2~1 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=afcdc36e5f65333f8ff9ca3229b6cffdb27edca7;p=jalview.git JAL-1605 added command line support for html export option --- diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index f80f341..e5a22e0 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -22,6 +22,7 @@ package jalview.bin; import jalview.gui.AlignFrame; import jalview.gui.Desktop; +import jalview.io.HtmlSvgOutput; import jalview.util.MessageManager; import jalview.util.Platform; import jalview.ws.jws2.Jws2Discoverer; @@ -489,6 +490,14 @@ public class Jalview System.out.println("Creating SVG image: " + file); continue; } + else if (format.equalsIgnoreCase("html")) + { + File imageFile = new java.io.File(file); + imageName = imageFile.getName(); + new HtmlSvgOutput(new java.io.File(file), af.alignPanel); + System.out.println("Creating HTML image: " + file); + continue; + } else if (format.equalsIgnoreCase("imgMap")) { af.createImageMap(new java.io.File(file), imageName); @@ -621,6 +630,8 @@ public class Jalview + "-blc FILE\tCreate alignment file FILE in BLC format.\n" + "-jalview FILE\tCreate alignment file FILE in Jalview format.\n" + "-png FILE\tCreate PNG image FILE from alignment.\n" + + "-svg FILE\tCreate SVG image FILE from alignment.\n" + + "-html FILE\tCreate HTML file from alignment.\n" + "-imgMap FILE\tCreate HTML file FILE with image map of PNG image.\n" + "-eps FILE\tCreate EPS file FILE from alignment.\n" + "-questionnaire URL\tQueries the given URL for information about any Jalview user questionnaires.\n" diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index 3180993..42460dc 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -1230,7 +1230,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, // new HTMLOutput(alignPanel, // alignPanel.getSeqPanel().seqCanvas.getSequenceRenderer(), // alignPanel.getSeqPanel().seqCanvas.getFeatureRenderer()); - new HtmlSvgOutput(alignPanel); + new HtmlSvgOutput(null, alignPanel); } public void createImageMap(File file, String image) diff --git a/src/jalview/io/HtmlSvgOutput.java b/src/jalview/io/HtmlSvgOutput.java index 4643858..4793ac4 100644 --- a/src/jalview/io/HtmlSvgOutput.java +++ b/src/jalview/io/HtmlSvgOutput.java @@ -29,20 +29,26 @@ public class HtmlSvgOutput AnnotationPanel annotationPanel; - public HtmlSvgOutput(AlignmentPanel ap) + public HtmlSvgOutput(File file, AlignmentPanel ap) { this.av = ap.av; this.ap = ap; this.annotationPanel = ap.getAnnotationPanel(); - generateHtmlSvgOutput(); + generateHtmlSvgOutput(file); } - public void generateHtmlSvgOutput() + public void generateHtmlSvgOutput(File file) { - File file = null; try { + 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()); @@ -55,6 +61,7 @@ public class HtmlSvgOutput .getSelectedFile().getParent()); file = chooser.getSelectedFile(); } + } AlignmentDimension aDimension = ap.getAlignmentDimension(); SVGGraphics2D g1 = new SVGGraphics2D(aDimension.getWidth(),