< prev index next >
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
Print this page
@@ -151,10 +151,12 @@
/**
* The global configuration information for this run.
*/
public final HtmlConfiguration configuration;
+ protected final HtmlOptions options;
+
protected final Utils utils;
protected final Contents contents;
protected final Messages messages;
@@ -206,10 +208,11 @@
* @param configuration the configuration for this doclet
* @param path the file to be generated.
*/
public HtmlDocletWriter(HtmlConfiguration configuration, DocPath path) {
this.configuration = configuration;
+ this.options = configuration.getOptions();
this.contents = configuration.contents;
this.messages = configuration.messages;
this.resources = configuration.resources;
this.links = new Links(path);
this.utils = configuration.utils;
@@ -257,13 +260,13 @@
do {
int match = docrootMatcher.start();
// append htmlstr up to start of next {@docroot}
buf.append(htmlstr.substring(prevEnd, match));
prevEnd = docrootMatcher.end();
- if (configuration.docrootparent.length() > 0 && htmlstr.startsWith("/..", prevEnd)) {
+ if (options.docrootParent.length() > 0 && htmlstr.startsWith("/..", prevEnd)) {
// Insert the absolute link if {@docRoot} is followed by "/..".
- buf.append(configuration.docrootparent);
+ buf.append(options.docrootParent);
prevEnd += 3;
} else {
// Insert relative path where {@docRoot} was located
buf.append(pathToRoot.isEmpty() ? "." : pathToRoot.getPath());
}
@@ -274,11 +277,11 @@
} while (docrootMatcher.find());
buf.append(htmlstr.substring(prevEnd));
return buf.toString();
}
//where:
- // Note: {@docRoot} is not case sensitive when passed in w/command line option:
+ // Note: {@docRoot} is not case sensitive when passed in with a command-line option:
private static final Pattern docrootPattern =
Pattern.compile(Pattern.quote("{@docroot}"), Pattern.CASE_INSENSITIVE);
/**
* Get the script to show or hide the All classes link.
@@ -337,11 +340,11 @@
*
* @param e the Element for which the tags will be generated
* @param htmltree the documentation tree to which the tags will be added
*/
protected void addTagsInfo(Element e, Content htmltree) {
- if (configuration.nocomment) {
+ if (options.noComment) {
return;
}
Content dl = new HtmlTree(HtmlTag.DL);
if (utils.isExecutableElement(e) && !utils.isConstructor(e)) {
addMethodInfo((ExecutableElement)e, dl);
@@ -446,18 +449,18 @@
throws DocFileIOException {
Content htmlComment = contents.newPage;
List<DocPath> additionalStylesheets = configuration.getAdditionalStylesheets();
additionalStylesheets.addAll(localStylesheets);
Head head = new Head(path, configuration.docletVersion, configuration.startTime)
- .setTimestamp(!configuration.notimestamp)
+ .setTimestamp(!options.noTimestamp)
.setDescription(description)
.setGenerator(getGenerator(getClass()))
.setTitle(winTitle)
- .setCharset(configuration.charset)
+ .setCharset(options.charset)
.addKeywords(metakeywords)
.setStylesheets(configuration.getMainStylesheet(), additionalStylesheets)
- .setIndex(configuration.createindex, mainBodyScript)
+ .setIndex(options.createIndex, mainBodyScript)
.addContent(extraHeadContent);
Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(), head.toContent(), body);
HtmlDocument htmlDocument = new HtmlDocument(htmlComment, htmlTree);
htmlDocument.write(DocFile.createFileForOutput(configuration, path));
@@ -468,12 +471,12 @@
*
* @param title the title string to construct the complete window title
* @return the window title string
*/
public String getWindowTitle(String title) {
- if (configuration.windowtitle.length() > 0) {
- title += " (" + configuration.windowtitle + ")";
+ if (options.windowTitle.length() > 0) {
+ title += " (" + options.windowTitle + ")";
}
return title;
}
/**
@@ -483,16 +486,16 @@
* user provided footer.
*/
public Content getUserHeaderFooter(boolean header) {
String content;
if (header) {
- content = replaceDocRootDir(configuration.header);
+ content = replaceDocRootDir(options.header);
} else {
- if (configuration.footer.length() != 0) {
- content = replaceDocRootDir(configuration.footer);
+ if (options.footer.length() != 0) {
+ content = replaceDocRootDir(options.footer);
} else {
- content = replaceDocRootDir(configuration.header);
+ content = replaceDocRootDir(options.header);
}
}
Content rawContent = new RawHtml(content);
return rawContent;
}
@@ -501,21 +504,21 @@
* Adds the user specified top.
*
* @param htmlTree the content tree to which user specified top will be added
*/
public void addTop(Content htmlTree) {
- Content top = new RawHtml(replaceDocRootDir(configuration.top));
+ Content top = new RawHtml(replaceDocRootDir(options.top));
htmlTree.add(top);
}
/**
* Adds the user specified bottom.
*
* @param htmlTree the content tree to which user specified bottom will be added
*/
public void addBottom(Content htmlTree) {
- Content bottom = new RawHtml(replaceDocRootDir(configuration.bottom));
+ Content bottom = new RawHtml(replaceDocRootDir(options.bottom));
Content small = HtmlTree.SMALL(bottom);
Content p = HtmlTree.P(HtmlStyle.legalCopy, small);
htmlTree.add(p);
}
@@ -1257,11 +1260,11 @@
* @param inSummary true if the comment tags are added into the summary section
* @param htmltree the documentation tree to which the comment tags will be added
*/
private void addCommentTags(Element element, DocTree holderTag, List<? extends DocTree> tags, boolean depr,
boolean first, boolean inSummary, Content htmltree) {
- if(configuration.nocomment){
+ if (options.noComment){
return;
}
Content div;
Content result = commentTagsToContent(null, element, tags, first, inSummary);
if (depr) {
@@ -1418,12 +1421,12 @@
boolean isHRef = inAnAtag() && node.getName().toString().equalsIgnoreCase("href");
for (DocTree dt : node.getValue()) {
if (utils.isText(dt) && isHRef) {
String text = ((TextTree) dt).getBody();
- if (text.startsWith("/..") && !configuration.docrootparent.isEmpty()) {
- result.add(configuration.docrootparent);
+ if (text.startsWith("/..") && !options.docrootParent.isEmpty()) {
+ result.add(options.docrootParent);
docRootContent = new ContentBuilder();
result.add(textCleanup(text.substring(3), isLastNode));
} else {
if (!docRootContent.isEmpty()) {
docRootContent = copyDocRootContent(docRootContent);
< prev index next >