src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DocFilesHandlerImpl.java
changeset 59210 78184b74af6e
parent 54936 8c63164bd540
child 59294 48b88b9c11eb
equal deleted inserted replaced
59209:8a24f1e73c0d 59210:78184b74af6e
   167     }
   167     }
   168 
   168 
   169     private void handleHtmlFile(DocFile srcfile, DocPath dstPath) throws DocFileIOException {
   169     private void handleHtmlFile(DocFile srcfile, DocPath dstPath) throws DocFileIOException {
   170         Utils utils = configuration.utils;
   170         Utils utils = configuration.utils;
   171         FileObject fileObject = srcfile.getFileObject();
   171         FileObject fileObject = srcfile.getFileObject();
   172         DocFileElement dfElement = new DocFileElement(element, fileObject);
   172         DocFileElement dfElement = new DocFileElement(utils, element, fileObject);
   173 
   173 
   174         DocPath dfilePath = dstPath.resolve(srcfile.getName());
   174         DocPath dfilePath = dstPath.resolve(srcfile.getName());
   175         HtmlDocletWriter docletWriter = new DocFileWriter(configuration, dfilePath, element);
   175         HtmlDocletWriter docletWriter = new DocFileWriter(configuration, dfilePath, element);
   176         configuration.messages.notice("doclet.Generating_0", docletWriter.filename.getPath());
   176         configuration.messages.notice("doclet.Generating_0", docletWriter.filename.getPath());
   177 
   177 
   179         Content localTagsContent = docletWriter.commentTagsToContent(null, dfElement, localTags, false);
   179         Content localTagsContent = docletWriter.commentTagsToContent(null, dfElement, localTags, false);
   180 
   180 
   181         String title = getWindowTitle(docletWriter, dfElement).trim();
   181         String title = getWindowTitle(docletWriter, dfElement).trim();
   182         HtmlTree htmlContent = docletWriter.getBody(title);
   182         HtmlTree htmlContent = docletWriter.getBody(title);
   183         docletWriter.addTop(htmlContent);
   183         docletWriter.addTop(htmlContent);
   184         PackageElement pkg = (PackageElement) element;
   184         PackageElement pkg = dfElement.getPackageElement();
   185         this.navBar = new Navigation(pkg, configuration, docletWriter.fixedNavDiv,
   185         this.navBar = new Navigation(element, configuration, docletWriter.fixedNavDiv,
   186                 PageMode.DOCFILE, docletWriter.path);
   186                 PageMode.DOCFILE, docletWriter.path);
   187         Content mdleLinkContent = docletWriter.getModuleLink(utils.elementUtils.getModuleOf(pkg),
   187         Content mdleLinkContent = docletWriter.getModuleLink(utils.elementUtils.getModuleOf(pkg),
   188                 docletWriter.contents.moduleLabel);
   188                 docletWriter.contents.moduleLabel);
   189         navBar.setNavLinkModule(mdleLinkContent);
   189         navBar.setNavLinkModule(mdleLinkContent);
   190         Content pkgLinkContent = docletWriter.getPackageLink(pkg, docletWriter.contents.packageLabel);
   190         Content pkgLinkContent = docletWriter.getPackageLink(pkg, docletWriter.contents.packageLabel);
   297         return docletWriter.getWindowTitle(sb.toString().trim());
   297         return docletWriter.getWindowTitle(sb.toString().trim());
   298     }
   298     }
   299 
   299 
   300     private static class DocFileWriter extends HtmlDocletWriter {
   300     private static class DocFileWriter extends HtmlDocletWriter {
   301 
   301 
   302         final PackageElement pkg;
       
   303 
       
   304         /**
   302         /**
   305          * Constructor to construct the HtmlDocletWriter object.
   303          * Constructor to construct the HtmlDocletWriter object.
   306          *
   304          *
   307          * @param configuration the configuruation of this doclet.
   305          * @param configuration the configuruation of this doclet.
   308          * @param path          the file to be generated.
   306          * @param path          the file to be generated.
   310          */
   308          */
   311         public DocFileWriter(HtmlConfiguration configuration, DocPath path, Element e) {
   309         public DocFileWriter(HtmlConfiguration configuration, DocPath path, Element e) {
   312             super(configuration, path);
   310             super(configuration, path);
   313             switch (e.getKind()) {
   311             switch (e.getKind()) {
   314                 case PACKAGE:
   312                 case PACKAGE:
   315                     pkg = (PackageElement)e;
   313                 case MODULE:
   316                     break;
   314                     break;
   317                 default:
   315                 default:
   318                     throw new AssertionError("unsupported element: " + e.getKind());
   316                     throw new AssertionError("unsupported element: " + e.getKind());
   319             }
   317             }
   320         }
   318         }