author | hannesw |
Wed, 27 Nov 2019 13:08:16 +0100 | |
changeset 59294 | 48b88b9c11eb |
parent 59210 | 78184b74af6e |
permissions | -rw-r--r-- |
48029
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
1 |
/* |
53863
d001808c57e8
8218998: Add metadata to generated API documentation files
jjg
parents:
53562
diff
changeset
|
2 |
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. |
48029
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
4 |
* |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
10 |
* |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
15 |
* accompanied this code). |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
16 |
* |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
20 |
* |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
23 |
* questions. |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
24 |
*/ |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
25 |
|
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
26 |
package jdk.javadoc.internal.doclets.formats.html; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
27 |
|
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
28 |
import com.sun.source.doctree.DocTree; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
29 |
import com.sun.source.doctree.EndElementTree; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
30 |
import com.sun.source.doctree.StartElementTree; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
31 |
import com.sun.source.doctree.TextTree; |
53164
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
32 |
import com.sun.source.util.DocTreeFactory; |
48552
f94706337b07
8194953: doclet corrupts HTML files when adding navbar
ksrini
parents:
48029
diff
changeset
|
33 |
import com.sun.tools.doclint.HtmlTag; |
59294
48b88b9c11eb
8223378: CSS solution for navbar problem with <a> elements is not ideal
hannesw
parents:
59210
diff
changeset
|
34 |
import jdk.javadoc.internal.doclets.formats.html.markup.BodyContents; |
48b88b9c11eb
8223378: CSS solution for navbar problem with <a> elements is not ideal
hannesw
parents:
59210
diff
changeset
|
35 |
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; |
48b88b9c11eb
8223378: CSS solution for navbar problem with <a> elements is not ideal
hannesw
parents:
59210
diff
changeset
|
36 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; |
48029
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
37 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; |
49551
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
38 |
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation; |
48029
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
39 |
import jdk.javadoc.internal.doclets.toolkit.Content; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
40 |
import jdk.javadoc.internal.doclets.toolkit.DocFileElement; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
41 |
import jdk.javadoc.internal.doclets.toolkit.DocFilesHandler; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
42 |
import jdk.javadoc.internal.doclets.toolkit.util.DocFile; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
43 |
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
44 |
import jdk.javadoc.internal.doclets.toolkit.util.DocPath; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
45 |
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths; |
53164
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
46 |
import jdk.javadoc.internal.doclets.toolkit.util.DocletConstants; |
48029
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
47 |
import jdk.javadoc.internal.doclets.toolkit.util.Utils; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
48 |
|
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
49 |
import javax.lang.model.element.Element; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
50 |
import javax.lang.model.element.ModuleElement; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
51 |
import javax.lang.model.element.PackageElement; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
52 |
import javax.tools.FileObject; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
53 |
import javax.tools.JavaFileManager.Location; |
49551
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
54 |
|
53164
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
55 |
import java.util.ArrayList; |
48029
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
56 |
import java.util.Collections; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
57 |
import java.util.List; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
58 |
|
49551
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
59 |
import jdk.javadoc.internal.doclets.formats.html.markup.Navigation.PageMode; |
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
60 |
|
48029
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
61 |
public class DocFilesHandlerImpl implements DocFilesHandler { |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
62 |
|
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
63 |
public final Element element; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
64 |
public final Location location; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
65 |
public final DocPath source; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
66 |
public final HtmlConfiguration configuration; |
49551
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
67 |
private Navigation navBar; |
48029
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
68 |
|
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
69 |
/** |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
70 |
* Constructor to construct the DocFilesWriter object. |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
71 |
* |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
72 |
* @param configuration the configuration of this doclet. |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
73 |
* @param element the containing element of the doc-files. |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
74 |
* |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
75 |
*/ |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
76 |
public DocFilesHandlerImpl(HtmlConfiguration configuration, Element element) { |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
77 |
this.configuration = configuration; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
78 |
this.element = element; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
79 |
|
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
80 |
switch (element.getKind()) { |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
81 |
case MODULE: |
48759
ffa68af7da87
8195795: Organize output files by module/package, not just package
jjg
parents:
48552
diff
changeset
|
82 |
ModuleElement mdle = (ModuleElement)element; |
ffa68af7da87
8195795: Organize output files by module/package, not just package
jjg
parents:
48552
diff
changeset
|
83 |
location = configuration.utils.getLocationForModule(mdle); |
48029
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
84 |
source = DocPaths.DOC_FILES; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
85 |
break; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
86 |
case PACKAGE: |
48759
ffa68af7da87
8195795: Organize output files by module/package, not just package
jjg
parents:
48552
diff
changeset
|
87 |
PackageElement pkg = (PackageElement)element; |
ffa68af7da87
8195795: Organize output files by module/package, not just package
jjg
parents:
48552
diff
changeset
|
88 |
location = configuration.utils.getLocationForPackage(pkg); |
ffa68af7da87
8195795: Organize output files by module/package, not just package
jjg
parents:
48552
diff
changeset
|
89 |
// Note, given that we have a module-specific location, |
ffa68af7da87
8195795: Organize output files by module/package, not just package
jjg
parents:
48552
diff
changeset
|
90 |
// we want a module-relative path for the source, and not the |
ffa68af7da87
8195795: Organize output files by module/package, not just package
jjg
parents:
48552
diff
changeset
|
91 |
// standard path that may include the module directory |
ffa68af7da87
8195795: Organize output files by module/package, not just package
jjg
parents:
48552
diff
changeset
|
92 |
source = DocPath.create(pkg.getQualifiedName().toString().replace('.', '/')) |
ffa68af7da87
8195795: Organize output files by module/package, not just package
jjg
parents:
48552
diff
changeset
|
93 |
.resolve(DocPaths.DOC_FILES); |
48029
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
94 |
break; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
95 |
default: |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
96 |
throw new AssertionError("unsupported element " + element); |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
97 |
} |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
98 |
} |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
99 |
|
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
100 |
/** |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
101 |
* Copy doc-files directory and its contents from the source |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
102 |
* elements directory to the generated documentation directory. |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
103 |
* |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
104 |
* @throws DocFileIOException if there is a problem while copying |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
105 |
* the documentation files |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
106 |
*/ |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
107 |
|
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
108 |
public void copyDocFiles() throws DocFileIOException { |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
109 |
boolean first = true; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
110 |
for (DocFile srcdir : DocFile.list(configuration, location, source)) { |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
111 |
if (!srcdir.isDirectory()) { |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
112 |
continue; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
113 |
} |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
114 |
DocPath path = null; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
115 |
switch (this.element.getKind()) { |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
116 |
case MODULE: |
48759
ffa68af7da87
8195795: Organize output files by module/package, not just package
jjg
parents:
48552
diff
changeset
|
117 |
path = DocPaths.forModule((ModuleElement)this.element); |
48029
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
118 |
break; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
119 |
case PACKAGE: |
48759
ffa68af7da87
8195795: Organize output files by module/package, not just package
jjg
parents:
48552
diff
changeset
|
120 |
path = configuration.docPaths.forPackage((PackageElement)this.element); |
48029
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
121 |
break; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
122 |
default: |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
123 |
throw new AssertionError("unknown kind:" + this.element.getKind()); |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
124 |
} |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
125 |
copyDirectory(srcdir, path.resolve(DocPaths.DOC_FILES), first); |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
126 |
first = false; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
127 |
} |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
128 |
} |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
129 |
|
53866
880baf6db17b
8213354: Support package-specific stylesheets
pmuthuswamy
parents:
53863
diff
changeset
|
130 |
public List<DocPath> getStylesheets() throws DocFileIOException { |
880baf6db17b
8213354: Support package-specific stylesheets
pmuthuswamy
parents:
53863
diff
changeset
|
131 |
List<DocPath> stylesheets = new ArrayList<DocPath>(); |
880baf6db17b
8213354: Support package-specific stylesheets
pmuthuswamy
parents:
53863
diff
changeset
|
132 |
for (DocFile srcdir : DocFile.list(configuration, location, source)) { |
880baf6db17b
8213354: Support package-specific stylesheets
pmuthuswamy
parents:
53863
diff
changeset
|
133 |
for (DocFile srcFile : srcdir.list()) { |
880baf6db17b
8213354: Support package-specific stylesheets
pmuthuswamy
parents:
53863
diff
changeset
|
134 |
if (srcFile.getName().endsWith(".css")) |
880baf6db17b
8213354: Support package-specific stylesheets
pmuthuswamy
parents:
53863
diff
changeset
|
135 |
stylesheets.add(DocPaths.DOC_FILES.resolve(srcFile.getName())); |
880baf6db17b
8213354: Support package-specific stylesheets
pmuthuswamy
parents:
53863
diff
changeset
|
136 |
} |
880baf6db17b
8213354: Support package-specific stylesheets
pmuthuswamy
parents:
53863
diff
changeset
|
137 |
} |
880baf6db17b
8213354: Support package-specific stylesheets
pmuthuswamy
parents:
53863
diff
changeset
|
138 |
return stylesheets; |
880baf6db17b
8213354: Support package-specific stylesheets
pmuthuswamy
parents:
53863
diff
changeset
|
139 |
} |
48029
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
140 |
|
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
141 |
private void copyDirectory(DocFile srcdir, final DocPath dstDocPath, |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
142 |
boolean first) throws DocFileIOException { |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
143 |
DocFile dstdir = DocFile.createFileForOutput(configuration, dstDocPath); |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
144 |
if (srcdir.isSameFile(dstdir)) { |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
145 |
return; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
146 |
} |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
147 |
for (DocFile srcfile: srcdir.list()) { |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
148 |
DocFile destfile = dstdir.resolve(srcfile.getName()); |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
149 |
if (srcfile.isFile()) { |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
150 |
if (destfile.exists() && !first) { |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
151 |
configuration.messages.warning("doclet.Copy_Overwrite_warning", |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
152 |
srcfile.getPath(), dstdir.getPath()); |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
153 |
} else { |
48552
f94706337b07
8194953: doclet corrupts HTML files when adding navbar
ksrini
parents:
48029
diff
changeset
|
154 |
if (Utils.toLowerCase(srcfile.getPath()).endsWith(".html")) { |
53164
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
155 |
handleHtmlFile(srcfile, dstDocPath); |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
156 |
} else { |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
157 |
configuration.messages.notice("doclet.Copying_File_0_To_Dir_1", |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
158 |
srcfile.getPath(), dstdir.getPath()); |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
159 |
destfile.copyFile(srcfile); |
48552
f94706337b07
8194953: doclet corrupts HTML files when adding navbar
ksrini
parents:
48029
diff
changeset
|
160 |
} |
48029
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
161 |
} |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
162 |
} else if (srcfile.isDirectory()) { |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
163 |
if (configuration.copydocfilesubdirs |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
164 |
&& !configuration.shouldExcludeDocFileDir(srcfile.getName())) { |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
165 |
DocPath dirDocPath = dstDocPath.resolve(srcfile.getName()); |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
166 |
copyDirectory(srcfile, dirDocPath, first); |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
167 |
} |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
168 |
} |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
169 |
} |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
170 |
} |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
171 |
|
53164
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
172 |
private void handleHtmlFile(DocFile srcfile, DocPath dstPath) throws DocFileIOException { |
48552
f94706337b07
8194953: doclet corrupts HTML files when adding navbar
ksrini
parents:
48029
diff
changeset
|
173 |
Utils utils = configuration.utils; |
f94706337b07
8194953: doclet corrupts HTML files when adding navbar
ksrini
parents:
48029
diff
changeset
|
174 |
FileObject fileObject = srcfile.getFileObject(); |
59210
78184b74af6e
8234051: doclet crashes if HTML files in module doc-files directories
jjg
parents:
54936
diff
changeset
|
175 |
DocFileElement dfElement = new DocFileElement(utils, element, fileObject); |
48552
f94706337b07
8194953: doclet corrupts HTML files when adding navbar
ksrini
parents:
48029
diff
changeset
|
176 |
|
48029
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
177 |
DocPath dfilePath = dstPath.resolve(srcfile.getName()); |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
178 |
HtmlDocletWriter docletWriter = new DocFileWriter(configuration, dfilePath, element); |
52685
6d243dcde190
8213956: javadoc crash using {@index} in doc-files file
jjg
parents:
49551
diff
changeset
|
179 |
configuration.messages.notice("doclet.Generating_0", docletWriter.filename.getPath()); |
48029
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
180 |
|
53164
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
181 |
List<? extends DocTree> localTags = getLocalHeaderTags(utils.getPreamble(dfElement)); |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
182 |
Content localTagsContent = docletWriter.commentTagsToContent(null, dfElement, localTags, false); |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
183 |
|
48029
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
184 |
String title = getWindowTitle(docletWriter, dfElement).trim(); |
54350
4f9772f4403d
8215599: Remove support for javadoc "frames" mode
pmuthuswamy
parents:
54060
diff
changeset
|
185 |
HtmlTree htmlContent = docletWriter.getBody(title); |
59210
78184b74af6e
8234051: doclet crashes if HTML files in module doc-files directories
jjg
parents:
54936
diff
changeset
|
186 |
PackageElement pkg = dfElement.getPackageElement(); |
59294
48b88b9c11eb
8223378: CSS solution for navbar problem with <a> elements is not ideal
hannesw
parents:
59210
diff
changeset
|
187 |
this.navBar = new Navigation(element, configuration, PageMode.DOCFILE, docletWriter.path); |
48b88b9c11eb
8223378: CSS solution for navbar problem with <a> elements is not ideal
hannesw
parents:
59210
diff
changeset
|
188 |
Content headerContent = new ContentBuilder(); |
48b88b9c11eb
8223378: CSS solution for navbar problem with <a> elements is not ideal
hannesw
parents:
59210
diff
changeset
|
189 |
docletWriter.addTop(headerContent); |
49551
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
190 |
Content mdleLinkContent = docletWriter.getModuleLink(utils.elementUtils.getModuleOf(pkg), |
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
191 |
docletWriter.contents.moduleLabel); |
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
192 |
navBar.setNavLinkModule(mdleLinkContent); |
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
193 |
Content pkgLinkContent = docletWriter.getPackageLink(pkg, docletWriter.contents.packageLabel); |
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
194 |
navBar.setNavLinkPackage(pkgLinkContent); |
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
195 |
navBar.setUserHeader(docletWriter.getUserHeaderFooter(true)); |
59294
48b88b9c11eb
8223378: CSS solution for navbar problem with <a> elements is not ideal
hannesw
parents:
59210
diff
changeset
|
196 |
headerContent.add(navBar.getContent(true)); |
53270
f3a42c440fcb
8199892: Missing landmarks when generating docs using html sources
pmuthuswamy
parents:
53164
diff
changeset
|
197 |
|
48029
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
198 |
List<? extends DocTree> fullBody = utils.getFullBody(dfElement); |
59294
48b88b9c11eb
8223378: CSS solution for navbar problem with <a> elements is not ideal
hannesw
parents:
59210
diff
changeset
|
199 |
Content pageContent = docletWriter.commentTagsToContent(null, dfElement, fullBody, false); |
48b88b9c11eb
8223378: CSS solution for navbar problem with <a> elements is not ideal
hannesw
parents:
59210
diff
changeset
|
200 |
docletWriter.addTagsInfo(dfElement, pageContent); |
48029
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
201 |
|
49551
0d4786e42471
8196200: Implement a navigation builder in javadoc
bpatel
parents:
48759
diff
changeset
|
202 |
navBar.setUserFooter(docletWriter.getUserHeaderFooter(false)); |
53562 | 203 |
Content footer = HtmlTree.FOOTER(); |
54060
53a95878619f
8220202: Simplify/standardize method naming for HtmlTree
jjg
parents:
53880
diff
changeset
|
204 |
footer.add(navBar.getContent(false)); |
53270
f3a42c440fcb
8199892: Missing landmarks when generating docs using html sources
pmuthuswamy
parents:
53164
diff
changeset
|
205 |
docletWriter.addBottom(footer); |
59294
48b88b9c11eb
8223378: CSS solution for navbar problem with <a> elements is not ideal
hannesw
parents:
59210
diff
changeset
|
206 |
htmlContent.add(new BodyContents() |
48b88b9c11eb
8223378: CSS solution for navbar problem with <a> elements is not ideal
hannesw
parents:
59210
diff
changeset
|
207 |
.setHeader(headerContent) |
48b88b9c11eb
8223378: CSS solution for navbar problem with <a> elements is not ideal
hannesw
parents:
59210
diff
changeset
|
208 |
.addMainContent(HtmlTree.DIV(HtmlStyle.contentContainer, pageContent)) |
48b88b9c11eb
8223378: CSS solution for navbar problem with <a> elements is not ideal
hannesw
parents:
59210
diff
changeset
|
209 |
.setFooter(footer) |
48b88b9c11eb
8223378: CSS solution for navbar problem with <a> elements is not ideal
hannesw
parents:
59210
diff
changeset
|
210 |
.toContent()); |
54936 | 211 |
docletWriter.printHtmlDocument(Collections.emptyList(), null, localTagsContent, Collections.emptyList(), htmlContent); |
48552
f94706337b07
8194953: doclet corrupts HTML files when adding navbar
ksrini
parents:
48029
diff
changeset
|
212 |
} |
f94706337b07
8194953: doclet corrupts HTML files when adding navbar
ksrini
parents:
48029
diff
changeset
|
213 |
|
f94706337b07
8194953: doclet corrupts HTML files when adding navbar
ksrini
parents:
48029
diff
changeset
|
214 |
|
53164
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
215 |
private List<? extends DocTree> getLocalHeaderTags(List<? extends DocTree> dtrees) { |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
216 |
List<DocTree> localTags = new ArrayList<>(); |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
217 |
DocTreeFactory docTreeFactory = configuration.docEnv.getDocTrees().getDocTreeFactory(); |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
218 |
boolean inHead = false; |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
219 |
boolean inTitle = false; |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
220 |
loop: |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
221 |
for (DocTree dt : dtrees) { |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
222 |
switch (dt.getKind()) { |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
223 |
case START_ELEMENT: |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
224 |
StartElementTree startElem = (StartElementTree)dt; |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
225 |
switch (HtmlTag.get(startElem.getName())) { |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
226 |
case HEAD: |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
227 |
inHead = true; |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
228 |
break; |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
229 |
case META: |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
230 |
break; |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
231 |
case TITLE: |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
232 |
inTitle = true; |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
233 |
break; |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
234 |
default: |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
235 |
if (inHead) { |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
236 |
localTags.add(startElem); |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
237 |
localTags.add(docTreeFactory.newTextTree(DocletConstants.NL)); |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
238 |
} |
48552
f94706337b07
8194953: doclet corrupts HTML files when adding navbar
ksrini
parents:
48029
diff
changeset
|
239 |
} |
53164
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
240 |
break; |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
241 |
case END_ELEMENT: |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
242 |
EndElementTree endElem = (EndElementTree)dt; |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
243 |
switch (HtmlTag.get(endElem.getName())) { |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
244 |
case HEAD: |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
245 |
inHead = false; |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
246 |
break loop; |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
247 |
case TITLE: |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
248 |
inTitle = false; |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
249 |
break; |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
250 |
default: |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
251 |
if (inHead) { |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
252 |
localTags.add(endElem); |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
253 |
localTags.add(docTreeFactory.newTextTree(DocletConstants.NL)); |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
254 |
} |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
255 |
} |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
256 |
break; |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
257 |
case ENTITY: |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
258 |
case TEXT: |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
259 |
if (inHead && !inTitle) { |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
260 |
localTags.add(dt); |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
261 |
} |
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
262 |
break; |
48552
f94706337b07
8194953: doclet corrupts HTML files when adding navbar
ksrini
parents:
48029
diff
changeset
|
263 |
} |
f94706337b07
8194953: doclet corrupts HTML files when adding navbar
ksrini
parents:
48029
diff
changeset
|
264 |
} |
53164
f2140eebd91b
8214738: javadoc should honor styles in doc-files
pmuthuswamy
parents:
52685
diff
changeset
|
265 |
return localTags; |
48029
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
266 |
} |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
267 |
|
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
268 |
private String getWindowTitle(HtmlDocletWriter docletWriter, Element element) { |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
269 |
List<? extends DocTree> preamble = configuration.utils.getPreamble(element); |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
270 |
StringBuilder sb = new StringBuilder(); |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
271 |
boolean titleFound = false; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
272 |
loop: |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
273 |
for (DocTree dt : preamble) { |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
274 |
switch (dt.getKind()) { |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
275 |
case START_ELEMENT: |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
276 |
StartElementTree nodeStart = (StartElementTree)dt; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
277 |
if (Utils.toLowerCase(nodeStart.getName().toString()).equals("title")) { |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
278 |
titleFound = true; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
279 |
} |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
280 |
break; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
281 |
|
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
282 |
case END_ELEMENT: |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
283 |
EndElementTree nodeEnd = (EndElementTree)dt; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
284 |
if (Utils.toLowerCase(nodeEnd.getName().toString()).equals("title")) { |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
285 |
break loop; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
286 |
} |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
287 |
break; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
288 |
|
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
289 |
case TEXT: |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
290 |
TextTree nodeText = (TextTree)dt; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
291 |
if (titleFound) |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
292 |
sb.append(nodeText.getBody()); |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
293 |
break; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
294 |
|
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
295 |
default: |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
296 |
// do nothing |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
297 |
} |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
298 |
} |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
299 |
return docletWriter.getWindowTitle(sb.toString().trim()); |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
300 |
} |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
301 |
|
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
302 |
private static class DocFileWriter extends HtmlDocletWriter { |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
303 |
|
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
304 |
/** |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
305 |
* Constructor to construct the HtmlDocletWriter object. |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
306 |
* |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
307 |
* @param configuration the configuruation of this doclet. |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
308 |
* @param path the file to be generated. |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
309 |
* @param e the anchoring element. |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
310 |
*/ |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
311 |
public DocFileWriter(HtmlConfiguration configuration, DocPath path, Element e) { |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
312 |
super(configuration, path); |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
313 |
switch (e.getKind()) { |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
314 |
case PACKAGE: |
59210
78184b74af6e
8234051: doclet crashes if HTML files in module doc-files directories
jjg
parents:
54936
diff
changeset
|
315 |
case MODULE: |
48029
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
316 |
break; |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
317 |
default: |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
318 |
throw new AssertionError("unsupported element: " + e.getKind()); |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
319 |
} |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
320 |
} |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
321 |
} |
e9dab2492924
8185985: Html files in doc-files directories should be wrapped with standard header and footer
ksrini
parents:
diff
changeset
|
322 |
} |