Source Code Cross Referenced for TagletWriterImpl.java in  » 6.0-JDK-Modules-com.sun » tools » com » sun » tools » doclets » formats » html » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules com.sun » tools » com.sun.tools.doclets.formats.html 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2003-2005 Sun Microsystems, Inc.  All Rights Reserved.
003:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004:         *
005:         * This code is free software; you can redistribute it and/or modify it
006:         * under the terms of the GNU General Public License version 2 only, as
007:         * published by the Free Software Foundation.  Sun designates this
008:         * particular file as subject to the "Classpath" exception as provided
009:         * by Sun in the LICENSE file that accompanied this code.
010:         *
011:         * This code is distributed in the hope that it will be useful, but WITHOUT
012:         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013:         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014:         * version 2 for more details (a copy is included in the LICENSE file that
015:         * accompanied this code).
016:         *
017:         * You should have received a copy of the GNU General Public License version
018:         * 2 along with this work; if not, write to the Free Software Foundation,
019:         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020:         *
021:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022:         * CA 95054 USA or visit www.sun.com if you need additional information or
023:         * have any questions.
024:         */
025:
026:        package com.sun.tools.doclets.formats.html;
027:
028:        import com.sun.tools.doclets.internal.toolkit.*;
029:        import com.sun.tools.doclets.internal.toolkit.builders.SerializedFormBuilder;
030:        import com.sun.tools.doclets.internal.toolkit.taglets.*;
031:        import com.sun.tools.doclets.internal.toolkit.util.*;
032:        import com.sun.javadoc.*;
033:
034:        /**
035:         * The taglet writer that writes HTML.
036:         *
037:         * @since 1.5
038:         * @author Jamie Ho
039:         */
040:
041:        public class TagletWriterImpl extends TagletWriter {
042:
043:            private HtmlDocletWriter htmlWriter;
044:
045:            public TagletWriterImpl(HtmlDocletWriter htmlWriter,
046:                    boolean isFirstSentence) {
047:                this .htmlWriter = htmlWriter;
048:                this .isFirstSentence = isFirstSentence;
049:            }
050:
051:            /**
052:             * {@inheritDoc}
053:             */
054:            public TagletOutput getOutputInstance() {
055:                return new TagletOutputImpl("");
056:            }
057:
058:            /**
059:             * {@inheritDoc}
060:             */
061:            public TagletOutput getDocRootOutput() {
062:                return new TagletOutputImpl(htmlWriter.relativepathNoSlash);
063:            }
064:
065:            /**
066:             * {@inheritDoc}
067:             */
068:            public TagletOutput deprecatedTagOutput(Doc doc) {
069:                StringBuffer output = new StringBuffer();
070:                Tag[] deprs = doc.tags("deprecated");
071:                if (doc instanceof  ClassDoc) {
072:                    if (Util.isDeprecated((ProgramElementDoc) doc)) {
073:                        output.append("<B>"
074:                                + ConfigurationImpl.getInstance().getText(
075:                                        "doclet.Deprecated") + "</B>&nbsp;");
076:                        if (deprs.length > 0) {
077:                            Tag[] commentTags = deprs[0].inlineTags();
078:                            if (commentTags.length > 0) {
079:
080:                                output.append(commentTagsToOutput(null, doc,
081:                                        deprs[0].inlineTags(), false)
082:                                        .toString());
083:                            }
084:                        }
085:                        output.append("<p>");
086:                    }
087:                } else {
088:                    MemberDoc member = (MemberDoc) doc;
089:                    if (Util.isDeprecated((ProgramElementDoc) doc)) {
090:                        output.append("<DD><B>"
091:                                + ConfigurationImpl.getInstance().getText(
092:                                        "doclet.Deprecated") + "</B>&nbsp;");
093:                        if (deprs.length > 0) {
094:                            output.append("<I>");
095:                            output.append(commentTagsToOutput(null, doc,
096:                                    deprs[0].inlineTags(), false).toString());
097:                            output.append("</I>");
098:                        }
099:                        if (member instanceof  ExecutableMemberDoc) {
100:                            output.append(DocletConstants.NL + "<P>"
101:                                    + DocletConstants.NL);
102:                        }
103:                    } else {
104:                        if (Util.isDeprecated(member.containingClass())) {
105:                            output
106:                                    .append("<DD><B>"
107:                                            + ConfigurationImpl
108:                                                    .getInstance()
109:                                                    .getText(
110:                                                            "doclet.Deprecated")
111:                                            + "</B>&nbsp;");
112:                        }
113:                    }
114:                }
115:                return new TagletOutputImpl(output.toString());
116:            }
117:
118:            /**
119:             * {@inheritDoc}
120:             */
121:            public MessageRetriever getMsgRetriever() {
122:                return htmlWriter.configuration.message;
123:            }
124:
125:            /**
126:             * {@inheritDoc}
127:             */
128:            public TagletOutput getParamHeader(String header) {
129:                StringBuffer result = new StringBuffer();
130:                result.append("<DT>");
131:                result.append("<B>" + header + "</B>");
132:                return new TagletOutputImpl(result.toString());
133:            }
134:
135:            /**
136:             * {@inheritDoc}
137:             */
138:            public TagletOutput paramTagOutput(ParamTag paramTag,
139:                    String paramName) {
140:                TagletOutput result = new TagletOutputImpl("<DD><CODE>"
141:                        + paramName
142:                        + "</CODE>"
143:                        + " - "
144:                        + htmlWriter.commentTagsToString(paramTag, null,
145:                                paramTag.inlineTags(), false));
146:                return result;
147:            }
148:
149:            /**
150:             * {@inheritDoc}
151:             */
152:            public TagletOutput returnTagOutput(Tag returnTag) {
153:                TagletOutput result = new TagletOutputImpl(DocletConstants.NL
154:                        + "<DT>"
155:                        + "<B>"
156:                        + htmlWriter.configuration.getText("doclet.Returns")
157:                        + "</B>"
158:                        + "<DD>"
159:                        + htmlWriter.commentTagsToString(returnTag, null,
160:                                returnTag.inlineTags(), false));
161:                return result;
162:            }
163:
164:            /**
165:             * {@inheritDoc}
166:             */
167:            public TagletOutput seeTagOutput(Doc holder, SeeTag[] seeTags) {
168:                String result = "";
169:                if (seeTags.length > 0) {
170:                    result = addSeeHeader(result);
171:                    for (int i = 0; i < seeTags.length; ++i) {
172:                        if (i > 0) {
173:                            result += ", " + DocletConstants.NL;
174:                        }
175:                        result += htmlWriter.seeTagToString(seeTags[i]);
176:                    }
177:                }
178:                if (holder.isField()
179:                        && ((FieldDoc) holder).constantValue() != null
180:                        && htmlWriter instanceof  ClassWriterImpl) {
181:                    //Automatically add link to constant values page for constant fields.
182:                    result = addSeeHeader(result);
183:                    result += htmlWriter.getHyperLink(htmlWriter.relativePath
184:                            + ConfigurationImpl.CONSTANTS_FILE_NAME
185:                            + "#"
186:                            + ((ClassWriterImpl) htmlWriter).getClassDoc()
187:                                    .qualifiedName() + "."
188:                            + ((FieldDoc) holder).name(),
189:                            htmlWriter.configuration
190:                                    .getText("doclet.Constants_Summary"));
191:                }
192:                if (holder.isClass() && ((ClassDoc) holder).isSerializable()) {
193:                    //Automatically add link to serialized form page for serializable classes.
194:                    if (!(SerializedFormBuilder.serialInclude(holder) && SerializedFormBuilder
195:                            .serialInclude(((ClassDoc) holder)
196:                                    .containingPackage()))) {
197:                        return result.equals("") ? null : new TagletOutputImpl(
198:                                result);
199:                    }
200:                    result = addSeeHeader(result);
201:                    result += htmlWriter.getHyperLink(htmlWriter.relativePath
202:                            + "serialized-form.html", ((ClassDoc) holder)
203:                            .qualifiedName(), htmlWriter.configuration
204:                            .getText("doclet.Serialized_Form"), false);
205:                }
206:                return result.equals("") ? null : new TagletOutputImpl(result);
207:            }
208:
209:            private String addSeeHeader(String result) {
210:                if (result != null && result.length() > 0) {
211:                    return result + ", " + DocletConstants.NL;
212:                } else {
213:                    return "<DT><B>"
214:                            + htmlWriter.configuration().getText(
215:                                    "doclet.See_Also") + "</B><DD>";
216:                }
217:            }
218:
219:            /**
220:             * {@inheritDoc}
221:             */
222:            public TagletOutput simpleTagOutput(Tag[] simpleTags, String header) {
223:                String result = "<DT><B>" + header + "</B></DT>"
224:                        + DocletConstants.NL + "  <DD>";
225:                for (int i = 0; i < simpleTags.length; i++) {
226:                    if (i > 0) {
227:                        result += ", ";
228:                    }
229:                    result += htmlWriter.commentTagsToString(simpleTags[i],
230:                            null, simpleTags[i].inlineTags(), false);
231:                }
232:                return new TagletOutputImpl(result + "</DD>"
233:                        + DocletConstants.NL);
234:            }
235:
236:            /**
237:             * {@inheritDoc}
238:             */
239:            public TagletOutput simpleTagOutput(Tag simpleTag, String header) {
240:                return new TagletOutputImpl("<DT><B>"
241:                        + header
242:                        + "</B></DT>"
243:                        + "  <DD>"
244:                        + htmlWriter.commentTagsToString(simpleTag, null,
245:                                simpleTag.inlineTags(), false) + "</DD>"
246:                        + DocletConstants.NL);
247:            }
248:
249:            /**
250:             * {@inheritDoc}
251:             */
252:            public TagletOutput getThrowsHeader() {
253:                return new TagletOutputImpl(DocletConstants.NL + "<DT>" + "<B>"
254:                        + htmlWriter.configuration().getText("doclet.Throws")
255:                        + "</B>");
256:            }
257:
258:            /**
259:             * {@inheritDoc}
260:             */
261:            public TagletOutput throwsTagOutput(ThrowsTag throwsTag) {
262:                String result = DocletConstants.NL + "<DD>";
263:                result += throwsTag.exceptionType() == null ? htmlWriter
264:                        .codeText(throwsTag.exceptionName()) : htmlWriter
265:                        .codeText(htmlWriter.getLink(new LinkInfoImpl(
266:                                LinkInfoImpl.CONTEXT_MEMBER, throwsTag
267:                                        .exceptionType())));
268:                TagletOutput text = new TagletOutputImpl(htmlWriter
269:                        .commentTagsToString(throwsTag, null, throwsTag
270:                                .inlineTags(), false));
271:                if (text != null && text.toString().length() > 0) {
272:                    result += " - " + text;
273:                }
274:                return new TagletOutputImpl(result);
275:            }
276:
277:            /**
278:             * {@inheritDoc}
279:             */
280:            public TagletOutput throwsTagOutput(Type throwsType) {
281:                return new TagletOutputImpl(DocletConstants.NL
282:                        + "<DD>"
283:                        + htmlWriter
284:                                .codeText(htmlWriter
285:                                        .getLink(new LinkInfoImpl(
286:                                                LinkInfoImpl.CONTEXT_MEMBER,
287:                                                throwsType))));
288:            }
289:
290:            /**
291:             * {@inheritDoc}
292:             */
293:            public TagletOutput valueTagOutput(FieldDoc field,
294:                    String constantVal, boolean includeLink) {
295:                return new TagletOutputImpl(includeLink ? htmlWriter
296:                        .getDocLink(LinkInfoImpl.CONTEXT_VALUE_TAG, field,
297:                                constantVal, false) : constantVal);
298:            }
299:
300:            /**
301:             * {@inheritDoc}
302:             */
303:            public TagletOutput commentTagsToOutput(Tag holderTag, Tag[] tags) {
304:                return commentTagsToOutput(holderTag, null, tags, false);
305:            }
306:
307:            /**
308:             * {@inheritDoc}
309:             */
310:            public TagletOutput commentTagsToOutput(Doc holderDoc, Tag[] tags) {
311:                return commentTagsToOutput(null, holderDoc, tags, false);
312:            }
313:
314:            /**
315:             * {@inheritDoc}
316:             */
317:            public TagletOutput commentTagsToOutput(Tag holderTag,
318:                    Doc holderDoc, Tag[] tags, boolean isFirstSentence) {
319:                return new TagletOutputImpl(htmlWriter.commentTagsToString(
320:                        holderTag, holderDoc, tags, isFirstSentence));
321:            }
322:
323:            /**
324:             * {@inheritDoc}
325:             */
326:            public Configuration configuration() {
327:                return htmlWriter.configuration();
328:            }
329:
330:            /**
331:             * Return an instance of a TagletWriter that knows how to write HTML.
332:             *
333:             * @return an instance of a TagletWriter that knows how to write HTML.
334:             */
335:            public TagletOutput getTagletOutputInstance() {
336:                return new TagletOutputImpl("");
337:            }
338:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.