+ outputFile = getOutputFile();
+ }
+ generatedFile = new File(outputFile);
+ } catch (NoFileSelectedException e)
+ {
+ setProgressMessage(MessageManager.formatMessage(
+ "status.cancelled_image_export_operation", "HTML"));
+ return;
+ } catch (Exception e)
+ {
+ setProgressMessage(MessageManager.formatMessage(
+ "info.error_creating_file", "HTML"));
+ e.printStackTrace();
+ return;
+ }
+ new Thread(this).start();
+ }
+
+ public int printUnwrapped(int pwidth, int pheight, int pi,
+ Graphics idGraphics, Graphics alignmentGraphics)
+ throws PrinterException
+ {
+ return ap.printUnwrapped(pwidth, pheight, pi, idGraphics,
+ alignmentGraphics);
+ }
+
+ public int printWrapped(int pwidth, int pheight, int pi, Graphics... pg)
+ throws PrinterException
+ {
+ return ap.printWrappedAlignment(pwidth, pheight, pi, pg[0]);
+ }
+
+ private String getHtml(String titleSvg, String alignmentSvg,
+ String jsonData, boolean wrapped)
+ {
+ StringBuilder htmlSvg = new StringBuilder();
+ htmlSvg.append("<html>\n");
+ if (jsonData != null)
+ {
+ htmlSvg.append("<button onclick=\"javascipt:openJalviewUsingCurrentUrl();\">Launch in Jalview</button> ");
+ htmlSvg.append("<input type=\"submit\" value=\"View raw BioJSON Data\" onclick=\"jQuery.facebox({ div:'#seqData' }); return false;\" />");
+ htmlSvg.append("<div style=\"display: none;\" name=\"seqData\" id=\"seqData\" >"
+ + jsonData + "</div>");
+ htmlSvg.append("<br/> ");
+ }
+ htmlSvg.append("\n<style type=\"text/css\"> "
+ + "div.parent{ width:100%;<!-- overflow: auto; -->}\n"
+ + "div.titlex{ width:11%; float: left; }\n"
+ + "div.align{ width:89%; float: right; }\n"
+ + "div.main-container{ border: 2px solid blue; border: 2px solid blue; width: 99%; min-height: 99%; }\n"
+ + ".sub-category-container {overflow-y: scroll; overflow-x: hidden; width: 100%; height: 100%;}\n"
+ + "object {pointer-events: none;}");
+ if (jsonData != null)
+ {
+ // facebox style sheet for displaying raw BioJSON data
+ htmlSvg.append("#facebox { position: absolute; top: 0; left: 0; z-index: 100; text-align: left; }\n"
+ + "#facebox .popup{ position:relative; border:3px solid rgba(0,0,0,0); -webkit-border-radius:5px;"
+ + "-moz-border-radius:5px; border-radius:5px; -webkit-box-shadow:0 0 18px rgba(0,0,0,0.4); -moz-box-shadow:0 0 18px rgba(0,0,0,0.4);"
+ + "box-shadow:0 0 18px rgba(0,0,0,0.4); }\n"
+ + "#facebox .content { display:table; width: 98%; padding: 10px; background: #fff; -webkit-border-radius:4px; -moz-border-radius:4px;"
+ + " border-radius:4px; }\n"
+ + "#facebox .content > p:first-child{ margin-top:0; }\n"
+ + "#facebox .content > p:last-child{ margin-bottom:0; }\n"
+ + "#facebox .close{ position:absolute; top:5px; right:5px; padding:2px; background:#fff; }\n"
+ + "#facebox .close img{ opacity:0.3; }\n"
+ + "#facebox .close:hover img{ opacity:1.0; }\n"
+ + "#facebox .loading { text-align: center; }\n"
+ + "#facebox .image { text-align: center;}\n"
+ + "#facebox img { border: 0; margin: 0; }\n"
+ + "#facebox_overlay { position: fixed; top: 0px; left: 0px; height:100%; width:100%; }\n"
+ + ".facebox_hide { z-index:-100; }\n"
+ + ".facebox_overlayBG { background-color: #000; z-index: 99; }");
+ }
+ htmlSvg.append("</style>");
+ if (!wrapped)
+ {
+ htmlSvg.append("<div class=\"main-container\" \n>");
+ htmlSvg.append("<div class=\"titlex\">\n");
+ htmlSvg.append("<div class=\"sub-category-container\"> \n");
+ htmlSvg.append(titleSvg);
+ htmlSvg.append("</div>");
+ htmlSvg.append("</div>\n\n<!-- ========================================================================================== -->\n\n");
+ htmlSvg.append("<div class=\"align\" >");
+ htmlSvg.append(
+ "<div class=\"sub-category-container\"> <div style=\"overflow-x: scroll;\">")
+ .append(alignmentSvg).append("</div></div>").append("</div>");
+ htmlSvg.append("</div>");
+
+ htmlSvg.append("<script language=\"JavaScript\" type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js\"></script>\n"
+ + "<script language=\"JavaScript\" type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js\"></script>\n"
+ + "<script>\n"
+ + "var subCatContainer = $(\".sub-category-container\");\n"
+ + "subCatContainer.scroll(\nfunction() {\n"
+ + "subCatContainer.scrollTop($(this).scrollTop());\n});\n");
+
+ htmlSvg.append("</script>\n");
+ }
+ else
+ {
+ htmlSvg.append("<div>\n")
+ .append(alignmentSvg).append("</div>");
+ htmlSvg.append("<script language=\"JavaScript\" type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js\"></script>\n"
+ + "<script language=\"JavaScript\" type=\"text/javascript\" src=\"http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js\"></script>\n");
+ }