1 26 27 package net.sourceforge.groboutils.codecoverage.v2.ant; 28 29 import java.io.File ; 30 import java.io.IOException ; 31 32 import org.apache.tools.ant.BuildException; 33 import org.apache.tools.ant.Project; 34 import org.w3c.dom.Document ; 35 36 37 46 public class SourceHtmlReportStyle extends SourceXslReportStyle 47 { 48 private File stylesheet = null; 49 private String title = null; 50 private String footerText = null; 51 private String footerLink = null; 52 53 private boolean hasSetup = false; 54 55 56 public SourceHtmlReportStyle() 57 { 58 SourceXslReportStyle.StyleType st; 59 60 st = new SourceXslReportStyle.StyleType(); 61 st.setUrl( "xsl/1x1.png" ); 62 st.setDest( "/1x1.png" ); 63 addFile( st ); 64 65 st = new SourceXslReportStyle.StyleType(); 66 st.setUrl( "xsl/source-frame-html.xsl" ); 67 st.setDest( ".html" ); 68 addSourceStyle( st ); 69 70 st = new SourceXslReportStyle.StyleType(); 71 st.setUrl( "xsl/source-frame-html.xsl" ); 72 st.setDest( "/package-frame.html" ); 73 addPackageStyle( st ); 74 75 st = new SourceXslReportStyle.StyleType(); 76 st.setUrl( "xsl/overview-frame.xsl" ); 77 st.setDest( "/package-classes.html" ); 78 addPackageStyle( st ); 79 80 st = new SourceXslReportStyle.StyleType(); 81 st.setUrl( "xsl/index.xsl" ); 82 st.setDest( "/index.html" ); 83 addRootStyle( st ); 84 85 st = new SourceXslReportStyle.StyleType(); 86 st.setUrl( "xsl/overview-frame.xsl" ); 87 st.setDest( "/overview-frame.html" ); 88 addRootStyle( st ); 89 90 st = new SourceXslReportStyle.StyleType(); 91 st.setUrl( "xsl/allclasses-frame.xsl" ); 92 st.setDest( "/allclasses-frame.html" ); 93 addRootStyle( st ); 94 95 st = new SourceXslReportStyle.StyleType(); 96 st.setUrl( "xsl/source-frame-html.xsl" ); 97 st.setDest( "/overview-summary.html" ); 98 addRootStyle( st ); 99 } 100 101 102 103 public void setTitle( String title ) 104 { 105 this.title = title; 106 } 107 108 109 public void setFooterText( String t ) 110 { 111 this.footerText = t; 112 } 113 114 115 public void setFooterHref( String t ) 116 { 117 this.footerLink = t; 118 } 119 120 121 public void setStylesheet( File f ) 122 { 123 this.stylesheet = f; 124 } 125 126 127 public void generateReport( Project project, Document doc, 128 String moduleName ) 129 throws BuildException, IOException 130 { 131 if (!this.hasSetup) 132 { 133 SourceXslReportStyle.StyleType st = 134 new SourceXslReportStyle.StyleType(); 135 st.setDest( "stylesheet.css" ); 136 if (this.stylesheet == null) 137 { 138 st.setUrl( "xsl/stylesheet.css" ); 139 } 140 else 141 { 142 st.setFile( this.stylesheet ); 143 } 144 addFile( st ); 145 st = null; 146 147 addMyParam( "title", this.title ); 148 addMyParam( "footerText", this.footerText ); 149 addMyParam( "footerLink", this.footerLink ); 150 151 this.hasSetup = true; 152 } 153 154 super.generateReport( project, doc, moduleName ); 155 } 156 157 158 private void addMyParam( String name, String value ) 159 { 160 if (value != null) 161 { 162 SimpleXslReportStyle.ParamType pt = 163 new SimpleXslReportStyle.ParamType(); 164 pt.setName( name ); 165 pt.setExpression( value ); 166 addParam( pt ); 167 } 168 } 169 } | Popular Tags |