23 * questions. |
23 * questions. |
24 */ |
24 */ |
25 |
25 |
26 package jdk.javadoc.internal.doclets.formats.html; |
26 package jdk.javadoc.internal.doclets.formats.html; |
27 |
27 |
|
28 import jdk.javadoc.internal.doclets.formats.html.markup.BodyContents; |
|
29 import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; |
28 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; |
30 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; |
29 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; |
31 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; |
30 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; |
32 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; |
31 import jdk.javadoc.internal.doclets.formats.html.markup.Navigation; |
33 import jdk.javadoc.internal.doclets.formats.html.markup.Navigation; |
32 import jdk.javadoc.internal.doclets.formats.html.markup.Navigation.PageMode; |
34 import jdk.javadoc.internal.doclets.formats.html.markup.Navigation.PageMode; |
48 * |
50 * |
49 * @author Atul M Dambalkar |
51 * @author Atul M Dambalkar |
50 */ |
52 */ |
51 public class HelpWriter extends HtmlDocletWriter { |
53 public class HelpWriter extends HtmlDocletWriter { |
52 |
54 |
53 HtmlTree mainTree = HtmlTree.MAIN(); |
|
54 |
|
55 private final Navigation navBar; |
55 private final Navigation navBar; |
56 |
56 |
57 /** |
57 /** |
58 * Constructor to construct HelpWriter object. |
58 * Constructor to construct HelpWriter object. |
59 * @param configuration the configuration |
59 * @param configuration the configuration |
60 * @param filename File to be generated. |
60 * @param filename File to be generated. |
61 */ |
61 */ |
62 public HelpWriter(HtmlConfiguration configuration, |
62 public HelpWriter(HtmlConfiguration configuration, |
63 DocPath filename) { |
63 DocPath filename) { |
64 super(configuration, filename); |
64 super(configuration, filename); |
65 this.navBar = new Navigation(null, configuration, fixedNavDiv, PageMode.HELP, path); |
65 this.navBar = new Navigation(null, configuration, PageMode.HELP, path); |
66 } |
66 } |
67 |
67 |
68 /** |
68 /** |
69 * Construct the HelpWriter object and then use it to generate the help |
69 * Construct the HelpWriter object and then use it to generate the help |
70 * file. The name of the generated file is "help-doc.html". The help file |
70 * file. The name of the generated file is "help-doc.html". The help file |
86 * @throws DocFileIOException if there is a problem while generating the documentation |
86 * @throws DocFileIOException if there is a problem while generating the documentation |
87 */ |
87 */ |
88 protected void generateHelpFile() throws DocFileIOException { |
88 protected void generateHelpFile() throws DocFileIOException { |
89 String title = resources.getText("doclet.Window_Help_title"); |
89 String title = resources.getText("doclet.Window_Help_title"); |
90 HtmlTree body = getBody(getWindowTitle(title)); |
90 HtmlTree body = getBody(getWindowTitle(title)); |
91 HtmlTree htmlTree = HtmlTree.HEADER(); |
91 Content headerContent = new ContentBuilder(); |
92 addTop(htmlTree); |
92 addTop(headerContent); |
93 navBar.setUserHeader(getUserHeaderFooter(true)); |
93 navBar.setUserHeader(getUserHeaderFooter(true)); |
94 htmlTree.add(navBar.getContent(true)); |
94 headerContent.add(navBar.getContent(true)); |
95 body.add(htmlTree); |
95 ContentBuilder helpFileContent = new ContentBuilder(); |
96 addHelpFileContents(body); |
96 addHelpFileContents(helpFileContent); |
97 htmlTree = HtmlTree.FOOTER(); |
97 HtmlTree footer = HtmlTree.FOOTER(); |
98 navBar.setUserFooter(getUserHeaderFooter(false)); |
98 navBar.setUserFooter(getUserHeaderFooter(false)); |
99 htmlTree.add(navBar.getContent(false)); |
99 footer.add(navBar.getContent(false)); |
100 addBottom(htmlTree); |
100 addBottom(footer); |
101 body.add(htmlTree); |
101 body.add(new BodyContents() |
|
102 .setHeader(headerContent) |
|
103 .addMainContent(helpFileContent) |
|
104 .setFooter(footer) |
|
105 .toContent()); |
102 printHtmlDocument(null, "help", body); |
106 printHtmlDocument(null, "help", body); |
103 } |
107 } |
104 |
108 |
105 /** |
109 /** |
106 * Add the help file contents from the resource file to the content tree. While adding the |
110 * Add the help file contents from the resource file to the content tree. While adding the |
116 contents.getContent("doclet.help.main_heading")); |
120 contents.getContent("doclet.help.main_heading")); |
117 Content div = HtmlTree.DIV(HtmlStyle.header, heading); |
121 Content div = HtmlTree.DIV(HtmlStyle.header, heading); |
118 Content intro = HtmlTree.DIV(HtmlStyle.subTitle, |
122 Content intro = HtmlTree.DIV(HtmlStyle.subTitle, |
119 contents.getContent("doclet.help.intro")); |
123 contents.getContent("doclet.help.intro")); |
120 div.add(intro); |
124 div.add(intro); |
121 mainTree.add(div); |
125 contentTree.add(div); |
122 HtmlTree htmlTree; |
126 HtmlTree htmlTree; |
123 HtmlTree ul = new HtmlTree(HtmlTag.UL); |
127 HtmlTree ul = new HtmlTree(HtmlTag.UL); |
124 ul.setStyle(HtmlStyle.blockList); |
128 ul.setStyle(HtmlStyle.blockList); |
125 |
129 |
126 // Overview |
130 // Overview |
330 Content divContent = HtmlTree.DIV(HtmlStyle.contentContainer, ul); |
334 Content divContent = HtmlTree.DIV(HtmlStyle.contentContainer, ul); |
331 divContent.add(new HtmlTree(HtmlTag.HR)); |
335 divContent.add(new HtmlTree(HtmlTag.HR)); |
332 Content footnote = HtmlTree.SPAN(HtmlStyle.emphasizedPhrase, |
336 Content footnote = HtmlTree.SPAN(HtmlStyle.emphasizedPhrase, |
333 contents.getContent("doclet.help.footnote")); |
337 contents.getContent("doclet.help.footnote")); |
334 divContent.add(footnote); |
338 divContent.add(footnote); |
335 mainTree.add(divContent); |
339 contentTree.add(divContent); |
336 contentTree.add(mainTree); |
|
337 } |
340 } |
338 } |
341 } |