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 java.io.*; |
|
29 |
|
30 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr; |
28 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr; |
31 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; |
29 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; |
32 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; |
30 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; |
33 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; |
31 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; |
34 import jdk.javadoc.internal.doclets.toolkit.Content; |
32 import jdk.javadoc.internal.doclets.toolkit.Content; |
35 import jdk.javadoc.internal.doclets.toolkit.Messages; |
33 import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException; |
36 import jdk.javadoc.internal.doclets.toolkit.util.DocPath; |
34 import jdk.javadoc.internal.doclets.toolkit.util.DocPath; |
37 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths; |
35 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths; |
38 import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException; |
|
39 |
36 |
40 |
37 |
41 /** |
38 /** |
42 * Generate the documentation in the Html "frame" format in the browser. The |
39 * Generate the documentation in the Html "frame" format in the browser. The |
43 * generated documentation will have two or three frames depending upon the |
40 * generated documentation will have two or three frames depending upon the |
65 /** |
62 /** |
66 * Constructor to construct FrameOutputWriter object. |
63 * Constructor to construct FrameOutputWriter object. |
67 * |
64 * |
68 * @param configuration for this run |
65 * @param configuration for this run |
69 * @param filename File to be generated. |
66 * @param filename File to be generated. |
70 * @throws java.io.IOException |
|
71 */ |
67 */ |
72 public FrameOutputWriter(ConfigurationImpl configuration, DocPath filename) { |
68 public FrameOutputWriter(ConfigurationImpl configuration, DocPath filename) { |
73 super(configuration, filename); |
69 super(configuration, filename); |
74 noOfPackages = configuration.packages.size(); |
70 noOfPackages = configuration.packages.size(); |
75 } |
71 } |
77 /** |
73 /** |
78 * Construct FrameOutputWriter object and then use it to generate the Html |
74 * Construct FrameOutputWriter object and then use it to generate the Html |
79 * file which will have the description of all the frames in the |
75 * file which will have the description of all the frames in the |
80 * documentation. The name of the generated file is "index.html" which is |
76 * documentation. The name of the generated file is "index.html" which is |
81 * the default first file for Html documents. |
77 * the default first file for Html documents. |
82 * @throws DocletAbortException |
78 * @param configuration the configuration for this doclet |
|
79 * @throws DocFileIOException if there is a problem generating the frame file |
83 */ |
80 */ |
84 public static void generate(ConfigurationImpl configuration) { |
81 public static void generate(ConfigurationImpl configuration) throws DocFileIOException { |
85 FrameOutputWriter framegen; |
82 FrameOutputWriter framegen = new FrameOutputWriter(configuration, DocPaths.INDEX); |
86 DocPath filename = DocPath.empty; |
83 framegen.generateFrameFile(); |
87 try { |
|
88 filename = DocPaths.INDEX; |
|
89 framegen = new FrameOutputWriter(configuration, filename); |
|
90 framegen.generateFrameFile(); |
|
91 } catch (IOException exc) { |
|
92 Messages messages = configuration.getMessages(); |
|
93 messages.error("doclet.exception_encountered", |
|
94 exc.toString(), filename); |
|
95 throw new DocletAbortException(exc); |
|
96 } |
|
97 } |
84 } |
98 |
85 |
99 /** |
86 /** |
100 * Generate the constants in the "index.html" file. Print the frame details |
87 * Generate the constants in the "index.html" file. Print the frame details |
101 * as well as warning if browser is not supporting the Html frames. |
88 * as well as warning if browser is not supporting the Html frames. |
|
89 * @throws DocFileIOException if there is a problem generating the frame file |
102 */ |
90 */ |
103 protected void generateFrameFile() throws IOException { |
91 protected void generateFrameFile() throws DocFileIOException { |
104 Content frame = getFrameDetails(); |
92 Content frame = getFrameDetails(); |
105 HtmlTree body = new HtmlTree(HtmlTag.BODY); |
93 HtmlTree body = new HtmlTree(HtmlTag.BODY); |
106 body.addAttr(HtmlAttr.ONLOAD, "loadFrames()"); |
94 body.addAttr(HtmlAttr.ONLOAD, "loadFrames()"); |
107 if (configuration.allowTag(HtmlTag.MAIN)) { |
95 if (configuration.allowTag(HtmlTag.MAIN)) { |
108 HtmlTree main = HtmlTree.MAIN(frame); |
96 HtmlTree main = HtmlTree.MAIN(frame); |