langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlDocWriter.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
29 |
29 |
30 import javax.lang.model.element.ModuleElement; |
30 import javax.lang.model.element.ModuleElement; |
31 import javax.lang.model.element.PackageElement; |
31 import javax.lang.model.element.PackageElement; |
32 import javax.lang.model.element.TypeElement; |
32 import javax.lang.model.element.TypeElement; |
33 |
33 |
34 import jdk.javadoc.internal.doclets.formats.html.ConfigurationImpl; |
34 import jdk.javadoc.internal.doclets.formats.html.HtmlConfiguration; |
35 import jdk.javadoc.internal.doclets.formats.html.SectionName; |
35 import jdk.javadoc.internal.doclets.formats.html.SectionName; |
36 import jdk.javadoc.internal.doclets.toolkit.Configuration; |
36 import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration; |
37 import jdk.javadoc.internal.doclets.toolkit.Content; |
37 import jdk.javadoc.internal.doclets.toolkit.Content; |
38 import jdk.javadoc.internal.doclets.toolkit.Messages; |
38 import jdk.javadoc.internal.doclets.toolkit.Messages; |
39 import jdk.javadoc.internal.doclets.toolkit.util.DocFile; |
39 import jdk.javadoc.internal.doclets.toolkit.util.DocFile; |
40 import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException; |
40 import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException; |
41 import jdk.javadoc.internal.doclets.toolkit.util.DocLink; |
41 import jdk.javadoc.internal.doclets.toolkit.util.DocLink; |
67 * class HtmlWriter. |
67 * class HtmlWriter. |
68 * |
68 * |
69 * @param configuration the configuration for this doclet |
69 * @param configuration the configuration for this doclet |
70 * @param filename String file name. |
70 * @param filename String file name. |
71 */ |
71 */ |
72 public HtmlDocWriter(Configuration configuration, DocPath filename) { |
72 public HtmlDocWriter(BaseConfiguration configuration, DocPath filename) { |
73 super(configuration, filename); |
73 super(configuration, filename); |
74 this.pathToRoot = filename.parent().invert(); |
74 this.pathToRoot = filename.parent().invert(); |
75 Messages messages = configuration.getMessages(); |
75 Messages messages = configuration.getMessages(); |
76 messages.notice("doclet.Generating_0", |
76 messages.notice("doclet.Generating_0", |
77 DocFile.createFileForOutput(configuration, filename).getPath()); |
77 DocFile.createFileForOutput(configuration, filename).getPath()); |
79 |
79 |
80 /** |
80 /** |
81 * Accessor for configuration. |
81 * Accessor for configuration. |
82 * @return the configuration for this doclet |
82 * @return the configuration for this doclet |
83 */ |
83 */ |
84 public abstract Configuration configuration(); |
84 public abstract BaseConfiguration configuration(); |
85 |
85 |
86 public Content getHyperLink(DocPath link, String label) { |
86 public Content getHyperLink(DocPath link, String label) { |
87 return getHyperLink(link, new StringContent(label), false, "", "", ""); |
87 return getHyperLink(link, new StringContent(label), false, "", "", ""); |
88 } |
88 } |
89 |
89 |
316 * @param title Title of this HTML document |
316 * @param title Title of this HTML document |
317 * @param configuration the configuration object |
317 * @param configuration the configuration object |
318 * @param body the body content tree to be added to the HTML document |
318 * @param body the body content tree to be added to the HTML document |
319 * @throws DocFileIOException if there is an error writing the frames document |
319 * @throws DocFileIOException if there is an error writing the frames document |
320 */ |
320 */ |
321 public void printFramesDocument(String title, ConfigurationImpl configuration, |
321 public void printFramesDocument(String title, HtmlConfiguration configuration, |
322 HtmlTree body) throws DocFileIOException { |
322 HtmlTree body) throws DocFileIOException { |
323 Content htmlDocType = configuration.isOutputHtml5() |
323 Content htmlDocType = configuration.isOutputHtml5() |
324 ? DocType.HTML5 |
324 ? DocType.HTML5 |
325 : DocType.TRANSITIONAL; |
325 : DocType.TRANSITIONAL; |
326 Content htmlComment = new Comment(configuration.getText("doclet.New_Page")); |
326 Content htmlComment = new Comment(configuration.getText("doclet.New_Page")); |
345 * Returns a link to the stylesheet file. |
345 * Returns a link to the stylesheet file. |
346 * |
346 * |
347 * @param configuration the configuration for this doclet |
347 * @param configuration the configuration for this doclet |
348 * @return an HtmlTree for the lINK tag which provides the stylesheet location |
348 * @return an HtmlTree for the lINK tag which provides the stylesheet location |
349 */ |
349 */ |
350 public HtmlTree getStyleSheetProperties(ConfigurationImpl configuration) { |
350 public HtmlTree getStyleSheetProperties(HtmlConfiguration configuration) { |
351 String stylesheetfile = configuration.stylesheetfile; |
351 String stylesheetfile = configuration.stylesheetfile; |
352 DocPath stylesheet; |
352 DocPath stylesheet; |
353 if (stylesheetfile.isEmpty()) { |
353 if (stylesheetfile.isEmpty()) { |
354 stylesheet = DocPaths.STYLESHEET; |
354 stylesheet = DocPaths.STYLESHEET; |
355 } else { |
355 } else { |