/**
  * Write the output to the file.
  *
  * @param body the documentation content to be written to the file.
  * @param path the path for the file.
  */
 private void writeToFile(Content body, DocPath path) throws IOException {
   Content htmlDocType = configuration.isOutputHtml5() ? DocType.HTML5 : DocType.TRANSITIONAL;
   Content head = new HtmlTree(HtmlTag.HEAD);
   head.addContent(
       HtmlTree.TITLE(new StringContent(configuration.getText("doclet.Window_Source_title"))));
   head.addContent(getStyleSheetProperties());
   Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(), head, body);
   Content htmlDocument = new HtmlDocument(htmlDocType, htmlTree);
   configuration.message.notice("doclet.Generating_0", path.getPath());
   DocFile df = DocFile.createFileForOutput(configuration, path);
   try (Writer w = df.openWriter()) {
     htmlDocument.write(w, true);
   }
 }
Esempio n. 2
0
 /**
  * Print the frames version of the Html file header. Called only when generating an HTML frames
  * file.
  *
  * @param title Title of this HTML document
  * @param configuration the configuration object
  * @param body the body content tree to be added to the HTML document
  */
 public void printFramesDocument(String title, ConfigurationImpl configuration, HtmlTree body)
     throws IOException {
   Content htmlDocType = configuration.isOutputHtml5() ? DocType.HTML5 : DocType.TRANSITIONAL;
   Content htmlComment = new Comment(configuration.getText("doclet.New_Page"));
   Content head = new HtmlTree(HtmlTag.HEAD);
   head.addContent(getGeneratedBy(!configuration.notimestamp));
   Content windowTitle = HtmlTree.TITLE(new StringContent(title));
   head.addContent(windowTitle);
   Content meta =
       HtmlTree.META(
           "Content-Type",
           CONTENT_TYPE,
           (configuration.charset.length() > 0)
               ? configuration.charset
               : HtmlConstants.HTML_DEFAULT_CHARSET);
   head.addContent(meta);
   head.addContent(getStyleSheetProperties(configuration));
   head.addContent(getFramesJavaScript());
   Content htmlTree = HtmlTree.HTML(configuration.getLocale().getLanguage(), head, body);
   Content htmlDocument = new HtmlDocument(htmlDocType, htmlComment, htmlTree);
   write(htmlDocument);
 }