author | bpatel |
Thu, 08 Jan 2009 16:26:59 -0800 | |
changeset 1787 | 1aa079321cd2 |
parent 10 | 06bc494ca11e |
child 1789 | 7ac8c0815000 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
2 |
* Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved. |
|
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 |
|
7 |
* published by the Free Software Foundation. Sun designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Sun in the LICENSE file that accompanied this code. |
|
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 |
* |
|
21 |
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
22 |
* CA 95054 USA or visit www.sun.com if you need additional information or |
|
23 |
* have any questions. |
|
24 |
*/ |
|
25 |
||
26 |
package com.sun.tools.doclets.formats.html; |
|
27 |
||
28 |
import com.sun.tools.doclets.internal.toolkit.*; |
|
29 |
import com.sun.tools.doclets.internal.toolkit.taglets.*; |
|
30 |
import com.sun.tools.doclets.internal.toolkit.util.*; |
|
31 |
import com.sun.javadoc.*; |
|
32 |
import java.util.*; |
|
33 |
||
34 |
/** |
|
35 |
* Generate serialized form for serializable fields. |
|
36 |
* Documentation denoted by the tags <code>serial</code> and |
|
37 |
* <code>serialField</code> is processed. |
|
38 |
* |
|
39 |
* @author Joe Fialli |
|
40 |
*/ |
|
41 |
public class HtmlSerialFieldWriter extends FieldWriterImpl |
|
42 |
implements SerializedFormWriter.SerialFieldWriter { |
|
43 |
ProgramElementDoc[] members = null; |
|
44 |
||
45 |
private boolean printedOverallAnchor = false; |
|
46 |
||
47 |
private boolean printedFirstMember = false; |
|
48 |
||
49 |
public HtmlSerialFieldWriter(SubWriterHolderWriter writer, |
|
50 |
ClassDoc classdoc) { |
|
51 |
super(writer, classdoc); |
|
52 |
} |
|
53 |
||
54 |
public List members(ClassDoc cd) { |
|
55 |
return Util.asList(cd.serializableFields()); |
|
56 |
} |
|
57 |
||
58 |
protected void printTypeLinkNoDimension(Type type) { |
|
59 |
ClassDoc cd = type.asClassDoc(); |
|
60 |
//Linking to package private classes in serialized for causes |
|
61 |
//broken links. Don't link to them. |
|
62 |
if (type.isPrimitive() || cd.isPackagePrivate()) { |
|
63 |
print(type.typeName()); |
|
64 |
} else { |
|
65 |
writer.printLink(new LinkInfoImpl( |
|
66 |
LinkInfoImpl.CONTEXT_SERIAL_MEMBER, type)); |
|
67 |
} |
|
68 |
} |
|
69 |
||
70 |
public void writeHeader(String heading) { |
|
71 |
if (! printedOverallAnchor) { |
|
72 |
writer.anchor("serializedForm"); |
|
73 |
printedOverallAnchor = true; |
|
74 |
writer.printTableHeadingBackground(heading); |
|
75 |
writer.println(); |
|
76 |
if (heading.equals( |
|
77 |
configuration().getText("doclet.Serialized_Form_class"))) { |
|
78 |
writer.dl(); |
|
79 |
} |
|
80 |
} else { |
|
81 |
writer.printTableHeadingBackground(heading); |
|
82 |
writer.println(); |
|
83 |
} |
|
84 |
} |
|
85 |
||
86 |
public void writeMemberHeader(ClassDoc fieldType, String fieldTypeStr, |
|
87 |
String fieldDimensions, String fieldName) { |
|
88 |
if (printedFirstMember) { |
|
89 |
writer.printMemberHeader(); |
|
90 |
} |
|
91 |
printedFirstMember = true; |
|
92 |
writer.h3(); |
|
93 |
writer.print(fieldName); |
|
94 |
writer.h3End(); |
|
95 |
writer.pre(); |
|
96 |
if (fieldType == null) { |
|
97 |
writer.print(fieldTypeStr); |
|
98 |
} else { |
|
99 |
writer.printLink(new LinkInfoImpl(LinkInfoImpl.CONTEXT_SERIAL_MEMBER, |
|
100 |
fieldType)); |
|
101 |
} |
|
102 |
print(fieldDimensions + ' '); |
|
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
103 |
strong(fieldName); |
10 | 104 |
writer.preEnd(); |
105 |
writer.dl(); |
|
106 |
} |
|
107 |
||
108 |
/** |
|
109 |
* Write the deprecated information for this member. |
|
110 |
* |
|
111 |
* @param field the field to document. |
|
112 |
*/ |
|
113 |
public void writeMemberDeprecatedInfo(FieldDoc field) { |
|
114 |
print(((TagletOutputImpl) |
|
115 |
(new DeprecatedTaglet()).getTagletOutput(field, |
|
116 |
writer.getTagletWriterInstance(false))).toString()); |
|
117 |
} |
|
118 |
||
119 |
/** |
|
120 |
* Write the description text for this member. |
|
121 |
* |
|
122 |
* @param field the field to document. |
|
123 |
*/ |
|
124 |
public void writeMemberDescription(FieldDoc field) { |
|
125 |
if (field.inlineTags().length > 0) { |
|
126 |
writer.dd(); |
|
127 |
writer.printInlineComment(field); |
|
128 |
} |
|
129 |
Tag[] tags = field.tags("serial"); |
|
130 |
if (tags.length > 0) { |
|
131 |
writer.dt(); |
|
132 |
writer.dd(); |
|
133 |
writer.printInlineComment(field, tags[0]); |
|
134 |
} |
|
135 |
} |
|
136 |
||
137 |
/** |
|
138 |
* Write the description text for this member represented by the tag. |
|
139 |
* |
|
140 |
* @param serialFieldTag the field to document (represented by tag). |
|
141 |
*/ |
|
142 |
public void writeMemberDescription(SerialFieldTag serialFieldTag) { |
|
143 |
writer.dd(); |
|
144 |
writer.print(serialFieldTag.description()); |
|
145 |
writer.dlEnd(); |
|
146 |
} |
|
147 |
||
148 |
/** |
|
149 |
* Write the tag information for this member. |
|
150 |
* |
|
151 |
* @param field the field to document. |
|
152 |
*/ |
|
153 |
public void writeMemberTags(FieldDoc field) { |
|
154 |
writer.dl(); |
|
155 |
TagletOutputImpl output = new TagletOutputImpl(""); |
|
156 |
TagletWriter.genTagOuput(configuration().tagletManager, field, |
|
157 |
configuration().tagletManager.getCustomTags(field), |
|
158 |
writer.getTagletWriterInstance(false), output); |
|
159 |
if (output.toString().length() > 0) { |
|
160 |
print(output.toString()); |
|
161 |
} |
|
162 |
writer.dlEnd(); |
|
163 |
} |
|
164 |
public void writeMemberFooter(FieldDoc member) { |
|
165 |
writer.dlEnd(); |
|
166 |
} |
|
167 |
} |