author | bpatel |
Mon, 02 May 2011 02:13:02 -0700 | |
changeset 9606 | e5a619cb5dd3 |
parent 7681 | 1f0819a3341f |
child 14258 | 8d2148961366 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
9606
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
7681
diff
changeset
|
2 |
* Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved. |
10 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5520 | 7 |
* published by the Free Software Foundation. Oracle designates this |
10 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5520 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
10 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5520 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
10 | 24 |
*/ |
25 |
||
26 |
package com.sun.tools.doclets.formats.html; |
|
27 |
||
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
28 |
import java.io.*; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
29 |
import com.sun.javadoc.*; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
30 |
import com.sun.tools.doclets.internal.toolkit.*; |
10 | 31 |
import com.sun.tools.doclets.internal.toolkit.util.*; |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
32 |
import com.sun.tools.doclets.formats.html.markup.*; |
10 | 33 |
|
34 |
/** |
|
35 |
* Generate the package index for the left-hand frame in the generated output. |
|
36 |
* A click on the package name in this frame will update the page in the bottom |
|
37 |
* left hand frame with the listing of contents of the clicked package. |
|
38 |
* |
|
39 |
* @author Atul M Dambalkar |
|
40 |
*/ |
|
41 |
public class PackageIndexFrameWriter extends AbstractPackageIndexWriter { |
|
42 |
||
43 |
/** |
|
44 |
* Construct the PackageIndexFrameWriter object. |
|
45 |
* |
|
46 |
* @param filename Name of the package index file to be generated. |
|
47 |
*/ |
|
48 |
public PackageIndexFrameWriter(ConfigurationImpl configuration, |
|
49 |
String filename) throws IOException { |
|
50 |
super(configuration, filename); |
|
51 |
} |
|
52 |
||
53 |
/** |
|
54 |
* Generate the package index file named "overview-frame.html". |
|
55 |
* @throws DocletAbortException |
|
56 |
*/ |
|
57 |
public static void generate(ConfigurationImpl configuration) { |
|
58 |
PackageIndexFrameWriter packgen; |
|
59 |
String filename = "overview-frame.html"; |
|
60 |
try { |
|
61 |
packgen = new PackageIndexFrameWriter(configuration, filename); |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
62 |
packgen.buildPackageIndexFile("doclet.Window_Overview", false); |
10 | 63 |
packgen.close(); |
64 |
} catch (IOException exc) { |
|
65 |
configuration.standardmessage.error( |
|
66 |
"doclet.exception_encountered", |
|
67 |
exc.toString(), filename); |
|
68 |
throw new DocletAbortException(); |
|
69 |
} |
|
70 |
} |
|
71 |
||
72 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
73 |
* {@inheritDoc} |
10 | 74 |
*/ |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
75 |
protected void addPackagesList(PackageDoc[] packages, String text, |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
76 |
String tableSummary, Content body) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
77 |
Content heading = HtmlTree.HEADING(HtmlConstants.PACKAGE_HEADING, true, |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
78 |
packagesLabel); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
79 |
Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
80 |
HtmlTree ul = new HtmlTree(HtmlTag.UL); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
81 |
ul.addAttr(HtmlAttr.TITLE, packagesLabel.toString()); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
82 |
for(int i = 0; i < packages.length; i++) { |
9606
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
7681
diff
changeset
|
83 |
// Do not list the package if -nodeprecated option is set and the |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
7681
diff
changeset
|
84 |
// package is marked as deprecated. |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
7681
diff
changeset
|
85 |
if (packages[i] != null && |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
7681
diff
changeset
|
86 |
(!(configuration.nodeprecated && Util.isDeprecated(packages[i])))) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
87 |
ul.addContent(getPackage(packages[i])); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
88 |
} |
10 | 89 |
} |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
90 |
div.addContent(ul); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
91 |
body.addContent(div); |
10 | 92 |
} |
93 |
||
94 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
95 |
* Gets each package name as a separate link. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
96 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
97 |
* @param pd PackageDoc |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
98 |
* @return content for the package link |
10 | 99 |
*/ |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
100 |
protected Content getPackage(PackageDoc pd) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
101 |
Content packageLinkContent; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
102 |
Content packageLabel; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
103 |
if (pd.name().length() > 0) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
104 |
packageLabel = getPackageLabel(pd.name()); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
105 |
packageLinkContent = getHyperLink(pathString(pd, |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
106 |
"package-frame.html"), "", packageLabel, "", |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
107 |
"packageFrame"); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
108 |
} else { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
109 |
packageLabel = new RawHtml("<unnamed package>"); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
110 |
packageLinkContent = getHyperLink("package-frame.html", |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
111 |
"", packageLabel, "", "packageFrame"); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
112 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
113 |
Content li = HtmlTree.LI(packageLinkContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
114 |
return li; |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
115 |
} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
116 |
|
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
117 |
/** |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
118 |
* {@inheritDoc} |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
119 |
*/ |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
120 |
protected void addNavigationBarHeader(Content body) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
121 |
Content headerContent; |
10 | 122 |
if (configuration.packagesheader.length() > 0) { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
123 |
headerContent = new RawHtml(replaceDocRootDir(configuration.packagesheader)); |
10 | 124 |
} else { |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
125 |
headerContent = new RawHtml(replaceDocRootDir(configuration.header)); |
10 | 126 |
} |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
127 |
Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, true, |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
128 |
HtmlStyle.bar, headerContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
129 |
body.addContent(heading); |
10 | 130 |
} |
131 |
||
132 |
/** |
|
133 |
* Do nothing as there is no overview information in this page. |
|
134 |
*/ |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
135 |
protected void addOverviewHeader(Content body) { |
10 | 136 |
} |
137 |
||
138 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
139 |
* Adds "All Classes" link for the top of the left-hand frame page to the |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
140 |
* documentation tree. |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
141 |
* |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
142 |
* @param body the Content object to which the all classes link should be added |
10 | 143 |
*/ |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
144 |
protected void addAllClassesLink(Content body) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
145 |
Content linkContent = getHyperLink("allclasses-frame.html", "", |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
146 |
allclassesLabel, "", "packageFrame"); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
147 |
Content div = HtmlTree.DIV(HtmlStyle.indexHeader, linkContent); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
148 |
body.addContent(div); |
10 | 149 |
} |
150 |
||
151 |
/** |
|
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
152 |
* {@inheritDoc} |
10 | 153 |
*/ |
7614
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
154 |
protected void addNavigationBarFooter(Content body) { |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
155 |
Content p = HtmlTree.P(getSpace()); |
cfadc977ca75
6851834: Javadoc doclet needs a structured approach to generate the output HTML.
bpatel
parents:
5520
diff
changeset
|
156 |
body.addContent(p); |
10 | 157 |
} |
158 |
} |