diff options
Diffstat (limited to 'collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/html/HTMLWrapper.java')
-rwxr-xr-x | collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/html/HTMLWrapper.java | 121 |
1 files changed, 57 insertions, 64 deletions
diff --git a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/html/HTMLWrapper.java b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/html/HTMLWrapper.java index e53c9ff90f..8feedd84b1 100755 --- a/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/html/HTMLWrapper.java +++ b/collaboration/GSoC-2011-Nirmal/CompositeDiagramGeneratorUsingBatik/src/main/java/org/apache/tuscany/sca/impl/html/HTMLWrapper.java @@ -22,76 +22,69 @@ package org.apache.tuscany.sca.impl.html; import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; -import java.io.StringWriter; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; +public class HTMLWrapper { -import org.w3c.dom.Document; + private File htmlFilePath; + private String compositeName; + private String svg; + /** + * + * @param svg + * @param compositeName + * @param htmlFilePath + */ + public HTMLWrapper(String svg, String compositeName, File htmlFilePath) { -public class HTMLWrapper { - - private File htmlFilePath; - private String compositeName; - private String svg; - - - /** - * - * @param svg - * @param compositeName - * @param htmlFilePath - */ - public HTMLWrapper(String svg, String compositeName, File htmlFilePath) { - - this.svg = svg; - this.compositeName = compositeName; - this.htmlFilePath = htmlFilePath; - } - - public String buildHTML() throws Exception{ - String content = "" + - "<html>\n" + - "<head>\n" + - "<h1 align='center'>Apache Tuscany - Composite Diagram Generator</h1>\n" + - "<h2 align='center'>"+compositeName+"</h2>\n" + - "</br>\n" + -// "<script type=\"text/javascript\" src=\""+CANVG_LIB_DIR+RGB_FILE+"\"></script>\n" + -// "<script type=\"text/javascript\" src=\""+CANVG_LIB_DIR+CANVG_FILE+"\"></script>\n" + -// "<script type=\"text/javascript\">\n" + -// "window.onload = function() {\n" + -// "//load '../path/to/your.svg' in the canvas with id = 'canvas'\n" + -// "canvg('canvas', '"+svgFileName+"')\n" + -// "//load a svg snippet in the canvas with id = 'drawingArea'\n" + -// "canvg(document.getElementById('drawingArea'), '<svg>...</svg>')\n" + -// "canvg('canvas', '"+svgFileName+"', {})\n" + -// "}\n" + -// "</script>\n" + - "</head>\n" + - "<body>\n" + - svg+"\n"+ -// "<canvas id=\"canvas\" width=\""+compositeWidth+"px\" height=\""+compositeHeight+"px\">\n" + -// "</canvas>\n" + - "</body>\n" + - "</html>"; - - fileWriter(content); - - return content; - - } + this.svg = svg; + this.compositeName = compositeName; + this.htmlFilePath = htmlFilePath; + } + + public String buildHTML() throws Exception { + String content = + "" + "<html>\n" + + "<head>\n" + + "<h1 align='center'>Apache Tuscany - Composite Diagram Generator</h1>\n" + + "<h2 align='center'>" + + compositeName + + "</h2>\n" + + "</br>\n" + + + // "<script type=\"text/javascript\" src=\""+CANVG_LIB_DIR+RGB_FILE+"\"></script>\n" + + // "<script type=\"text/javascript\" src=\""+CANVG_LIB_DIR+CANVG_FILE+"\"></script>\n" + + // "<script type=\"text/javascript\">\n" + + // "window.onload = function() {\n" + + // "//load '../path/to/your.svg' in the canvas with id = 'canvas'\n" + + // "canvg('canvas', '"+svgFileName+"')\n" + + // "//load a svg snippet in the canvas with id = 'drawingArea'\n" + + // "canvg(document.getElementById('drawingArea'), '<svg>...</svg>')\n" + + // "canvg('canvas', '"+svgFileName+"', {})\n" + + // "}\n" + + // "</script>\n" + + "</head>\n" + + "<body>\n" + + svg + + "\n" + + + // "<canvas id=\"canvas\" width=\""+compositeWidth+"px\" height=\""+compositeHeight+"px\">\n" + + // "</canvas>\n" + + "</body>\n" + + "</html>"; + + fileWriter(content); + + return content; + } - private void fileWriter(String content) throws Exception{ + private void fileWriter(String content) throws Exception { - FileWriter fileWriter = new FileWriter(htmlFilePath); - BufferedWriter bufferedWriter = new BufferedWriter(fileWriter); - bufferedWriter.append(content); - bufferedWriter.close(); + FileWriter fileWriter = new FileWriter(htmlFilePath); + BufferedWriter bufferedWriter = new BufferedWriter(fileWriter); + bufferedWriter.append(content); + bufferedWriter.close(); - } + } } |