aboutsummaryrefslogtreecommitdiff
path: root/org.jacoco.report/src
diff options
context:
space:
mode:
authorMarc R. Hoffmann <hoffmann@mountainminds.com>2011-03-16 21:32:05 +0000
committerMarc R. Hoffmann <hoffmann@mountainminds.com>2011-03-16 21:32:05 +0000
commit0e99a259a4c85819cec139e8f32b9537be716521 (patch)
treed02e8495826804febf34b7454a59c8706fc865d6 /org.jacoco.report/src
parent601f2f7064005c18fba90dfd2cf10d05e78b1b89 (diff)
downloadjacoco-0e99a259a4c85819cec139e8f32b9537be716521.tar.gz
Move tabwidth property to HTML report context.
Diffstat (limited to 'org.jacoco.report/src')
-rw-r--r--org.jacoco.report/src/org/jacoco/report/html/HTMLFormatter.java16
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/IHTMLReportContext.java7
-rw-r--r--org.jacoco.report/src/org/jacoco/report/internal/html/page/SourceFilePage.java15
3 files changed, 24 insertions, 14 deletions
diff --git a/org.jacoco.report/src/org/jacoco/report/html/HTMLFormatter.java b/org.jacoco.report/src/org/jacoco/report/html/HTMLFormatter.java
index 86f9b7b8..3e5b0e91 100644
--- a/org.jacoco.report/src/org/jacoco/report/html/HTMLFormatter.java
+++ b/org.jacoco.report/src/org/jacoco/report/html/HTMLFormatter.java
@@ -62,6 +62,8 @@ public class HTMLFormatter implements IHTMLReportContext {
private String outputEncoding = "UTF-8";
+ private int tabWidth = 4;
+
private Resources resources;
private ElementIndex index;
@@ -118,6 +120,16 @@ public class HTMLFormatter implements IHTMLReportContext {
this.outputEncoding = outputEncoding;
}
+ /**
+ * Sets the number of blank characters that represent a tab in source code.
+ *
+ * @param tabWidth
+ * tab width as number of blanks
+ */
+ public void setTabWidth(final int tabWidth) {
+ this.tabWidth = tabWidth;
+ }
+
// === IHTMLReportContext ===
public ILanguageNames getLanguageNames() {
@@ -172,6 +184,10 @@ public class HTMLFormatter implements IHTMLReportContext {
return outputEncoding;
}
+ public int getTabWidth() {
+ return tabWidth;
+ }
+
public IIndexUpdate getIndexUpdate() {
return index;
}
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/IHTMLReportContext.java b/org.jacoco.report/src/org/jacoco/report/internal/html/IHTMLReportContext.java
index 44379970..a1a56912 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/IHTMLReportContext.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/IHTMLReportContext.java
@@ -79,4 +79,11 @@ public interface IHTMLReportContext {
*/
public Locale getLocale();
+ /**
+ * Returns number of blank characters that represent a tab in source code.
+ *
+ * @return tab width as number of blanks
+ */
+ public int getTabWidth();
+
} \ No newline at end of file
diff --git a/org.jacoco.report/src/org/jacoco/report/internal/html/page/SourceFilePage.java b/org.jacoco.report/src/org/jacoco/report/internal/html/page/SourceFilePage.java
index 11e85450..d70fd912 100644
--- a/org.jacoco.report/src/org/jacoco/report/internal/html/page/SourceFilePage.java
+++ b/org.jacoco.report/src/org/jacoco/report/internal/html/page/SourceFilePage.java
@@ -29,7 +29,6 @@ import org.jacoco.report.internal.html.resources.Resources;
public class SourceFilePage extends NodePage<ISourceFileCoverage> {
private final Reader sourceReader;
- private int tabWidth;
/**
* Creates a new page with given information.
@@ -45,18 +44,6 @@ public class SourceFilePage extends NodePage<ISourceFileCoverage> {
final ReportOutputFolder folder, final IHTMLReportContext context) {
super(sourceFileNode, parent, folder, context);
this.sourceReader = sourceReader;
- setTabWidth(4);
- }
-
- /**
- * Specifies the number of spaces that are represented by a single tab.
- * Default is 4.
- *
- * @param width
- * spaces per tab
- */
- public void setTabWidth(final int width) {
- this.tabWidth = width;
}
@Override
@@ -82,7 +69,7 @@ public class SourceFilePage extends NodePage<ISourceFileCoverage> {
@Override
protected String getOnload() {
return format("window['PR_TAB_WIDTH']=%d;prettyPrint()",
- Integer.valueOf(tabWidth));
+ Integer.valueOf(context.getTabWidth()));
}
@Override