Source Code Cross Referenced for HtmlDocWriter.java in  » 6.0-JDK-Modules-com.sun » tools » com » sun » tools » doclets » formats » html » markup » 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.markup 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 1997-2007 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.markup;
027:
028:        import com.sun.tools.doclets.internal.toolkit.*;
029:
030:        import com.sun.javadoc.*;
031:        import java.io.*;
032:        import java.util.*;
033:        import com.sun.tools.doclets.internal.toolkit.util.*;
034:
035:        /**
036:         * Class for the Html Format Code Generation specific to JavaDoc.
037:         * This Class contains methods related to the Html Code Generation which
038:         * are used by the Sub-Classes in the package com.sun.tools.doclets.standard
039:         * and com.sun.tools.doclets.oneone.
040:         *
041:         * @since 1.2
042:         * @author Atul M Dambalkar
043:         * @author Robert Field
044:         */
045:        public abstract class HtmlDocWriter extends HtmlWriter {
046:
047:            /**
048:             * Constructor. Initializes the destination file name through the super
049:             * class HtmlWriter.
050:             *
051:             * @param filename String file name.
052:             */
053:            public HtmlDocWriter(Configuration configuration, String filename)
054:                    throws IOException {
055:                super (configuration, null,
056:                        configuration.destDirName + filename,
057:                        configuration.docencoding);
058:                configuration.message.notice("doclet.Generating_0",
059:                        configuration.destDirName + filename);
060:            }
061:
062:            public HtmlDocWriter(Configuration configuration, String path,
063:                    String filename) throws IOException {
064:                super (configuration, configuration.destDirName + path,
065:                        filename, configuration.docencoding);
066:                configuration.message.notice("doclet.Generating_0",
067:                        configuration.destDirName
068:                                + ((path.length() > 0) ? path + File.separator
069:                                        : "") + filename);
070:            }
071:
072:            /**
073:             * Accessor for configuration.
074:             */
075:            public abstract Configuration configuration();
076:
077:            /**
078:             * Print Html Hyper Link.
079:             *
080:             * @param link String name of the file.
081:             * @param where Position of the link in the file. Character '#' is not
082:             * needed.
083:             * @param label Tag for the link.
084:             * @param bold  Boolean that sets label to bold.
085:             */
086:            public void printHyperLink(String link, String where, String label,
087:                    boolean bold) {
088:                print(getHyperLink(link, where, label, bold, "", "", ""));
089:            }
090:
091:            /**
092:             * Print Html Hyper Link.
093:             *
094:             * @param link String name of the file.
095:             * @param where Position of the link in the file. Character '#' is not
096:             * needed.
097:             * @param label Tag for the link.
098:             */
099:            public void printHyperLink(String link, String where, String label) {
100:                printHyperLink(link, where, label, false);
101:            }
102:
103:            /**
104:             * Print Html Hyper Link.
105:             *
106:             * @param link       String name of the file.
107:             * @param where      Position of the link in the file. Character '#' is not
108:             * needed.
109:             * @param label      Tag for the link.
110:             * @param bold       Boolean that sets label to bold.
111:             * @param stylename  String style of text defined in style sheet.
112:             */
113:            public void printHyperLink(String link, String where, String label,
114:                    boolean bold, String stylename) {
115:                print(getHyperLink(link, where, label, bold, stylename, "", ""));
116:            }
117:
118:            /**
119:             * Return Html Hyper Link string.
120:             *
121:             * @param link       String name of the file.
122:             * @param where      Position of the link in the file. Character '#' is not
123:             * needed.
124:             * @param label      Tag for the link.
125:             * @param bold       Boolean that sets label to bold.
126:             * @return String    Hyper Link.
127:             */
128:            public String getHyperLink(String link, String where, String label,
129:                    boolean bold) {
130:                return getHyperLink(link, where, label, bold, "", "", "");
131:            }
132:
133:            /**
134:             * Get Html Hyper Link string.
135:             *
136:             * @param link       String name of the file.
137:             * @param where      Position of the link in the file. Character '#' is not
138:             *                   needed.
139:             * @param label      Tag for the link.
140:             * @param bold       Boolean that sets label to bold.
141:             * @param stylename  String style of text defined in style sheet.
142:             * @return String    Hyper Link.
143:             */
144:            public String getHyperLink(String link, String where, String label,
145:                    boolean bold, String stylename) {
146:                return getHyperLink(link, where, label, bold, stylename, "", "");
147:            }
148:
149:            /**
150:             * Get Html Hyper Link string.
151:             *
152:             * @param link       String name of the file.
153:             * @param where      Position of the link in the file. Character '#' is not
154:             *                   needed.
155:             * @param label      Tag for the link.
156:             * @param bold       Boolean that sets label to bold.
157:             * @param stylename  String style of text defined in style sheet.
158:             * @param title      String that describes the link's content for accessibility.
159:             * @param target     Target frame.
160:             * @return String    Hyper Link.
161:             */
162:            public String getHyperLink(String link, String where, String label,
163:                    boolean bold, String stylename, String title, String target) {
164:                StringBuffer retlink = new StringBuffer();
165:                retlink.append("<A HREF=\"");
166:                retlink.append(link);
167:                if (where != null && where.length() != 0) {
168:                    retlink.append("#");
169:                    retlink.append(where);
170:                }
171:                retlink.append("\"");
172:                if (title != null && title.length() != 0) {
173:                    retlink.append(" title=\"" + title + "\"");
174:                }
175:                if (target != null && target.length() != 0) {
176:                    retlink.append(" target=\"" + target + "\"");
177:                }
178:                retlink.append(">");
179:                if (stylename != null && stylename.length() != 0) {
180:                    retlink.append("<FONT CLASS=\"");
181:                    retlink.append(stylename);
182:                    retlink.append("\">");
183:                }
184:                if (bold) {
185:                    retlink.append("<B>");
186:                }
187:                retlink.append(label);
188:                if (bold) {
189:                    retlink.append("</B>");
190:                }
191:                if (stylename != null && stylename.length() != 0) {
192:                    retlink.append("</FONT>");
193:                }
194:                retlink.append("</A>");
195:                return retlink.toString();
196:            }
197:
198:            /**
199:             * Print link without positioning in the file.
200:             *
201:             * @param link       String name of the file.
202:             * @param label      Tag for the link.
203:             */
204:            public void printHyperLink(String link, String label) {
205:                print(getHyperLink(link, "", label, false));
206:            }
207:
208:            /**
209:             * Get link string without positioning in the file.
210:             *
211:             * @param link       String name of the file.
212:             * @param label      Tag for the link.
213:             * @return Strign    Hyper link.
214:             */
215:            public String getHyperLink(String link, String label) {
216:                return getHyperLink(link, "", label, false);
217:            }
218:
219:            /**
220:             * Print the name of the package, this class is in.
221:             *
222:             * @param cd    ClassDoc.
223:             */
224:            public void printPkgName(ClassDoc cd) {
225:                print(getPkgName(cd));
226:            }
227:
228:            /**
229:             * Get the name of the package, this class is in.
230:             *
231:             * @param cd    ClassDoc.
232:             */
233:            public String getPkgName(ClassDoc cd) {
234:                String pkgName = cd.containingPackage().name();
235:                if (pkgName.length() > 0) {
236:                    pkgName += ".";
237:                    return pkgName;
238:                }
239:                return "";
240:            }
241:
242:            /**
243:             * Print the frameset version of the Html file header.
244:             * Called only when generating an HTML frameset file.
245:             *
246:             * @param title    Title of this HTML document.
247:             */
248:            public void printFramesetHeader(String title) {
249:                printFramesetHeader(title, false);
250:            }
251:
252:            /**
253:             * Print the frameset version of the Html file header.
254:             * Called only when generating an HTML frameset file.
255:             *
256:             * @param title        Title of this HTML document.
257:             * @param noTimeStamp  If true, don't print time stamp in header.
258:             */
259:            public void printFramesetHeader(String title, boolean noTimeStamp) {
260:                println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 "
261:                        + "Frameset//EN\" "
262:                        + "\"http://www.w3.org/TR/html4/frameset.dtd\">");
263:                println("<!--NewPage-->");
264:                html();
265:                head();
266:                if (!noTimeStamp) {
267:                    print("<!-- Generated by javadoc on ");
268:                    print(today());
269:                    println("-->");
270:                }
271:                if (configuration.charset.length() > 0) {
272:                    println("<META http-equiv=\"Content-Type\" content=\"text/html; "
273:                            + "charset=" + configuration.charset + "\">");
274:                }
275:                title();
276:                println(title);
277:                titleEnd();
278:                //Script to set the classFrame if necessary.
279:                script();
280:                println("    targetPage = \"\" + window.location.search;");
281:                println("    if (targetPage != \"\" && targetPage != \"undefined\")");
282:                println("        targetPage = targetPage.substring(1);");
283:                println("    if (targetPage.indexOf(\":\") != -1)");
284:                println("        targetPage = \"undefined\";");
285:
286:                println("    function loadFrames() {");
287:                println("        if (targetPage != \"\" && targetPage != \"undefined\")");
288:                println("             top.classFrame.location = top.targetPage;");
289:                println("    }");
290:                scriptEnd();
291:                noScript();
292:                noScriptEnd();
293:                headEnd();
294:            }
295:
296:            /**
297:             * Print the appropriate spaces to format the class tree in the class page.
298:             *
299:             * @param len   Number of spaces.
300:             */
301:            public String spaces(int len) {
302:                String space = "";
303:
304:                for (int i = 0; i < len; i++) {
305:                    space += " ";
306:                }
307:                return space;
308:            }
309:
310:            /**
311:             * Print the closing &lt;/body&gt; and &lt;/html&gt; tags.
312:             */
313:            public void printBodyHtmlEnd() {
314:                println();
315:                bodyEnd();
316:                htmlEnd();
317:            }
318:
319:            /**
320:             * Calls {@link #printBodyHtmlEnd()} method.
321:             */
322:            public void printFooter() {
323:                printBodyHtmlEnd();
324:            }
325:
326:            /**
327:             * Print closing &lt;/html&gt; tag.
328:             */
329:            public void printFrameFooter() {
330:                htmlEnd();
331:            }
332:
333:            /**
334:             * Print ten non-breaking spaces("&#38;nbsp;").
335:             */
336:            public void printNbsps() {
337:                print("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
338:            }
339:
340:            /**
341:             * Get the day and date information for today, depending upon user option.
342:             *
343:             * @return String Today.
344:             * @see java.util.Calendar
345:             * @see java.util.GregorianCalendar
346:             * @see java.util.TimeZone
347:             */
348:            public String today() {
349:                Calendar calendar = new GregorianCalendar(TimeZone.getDefault());
350:                return calendar.getTime().toString();
351:            }
352:        }
w___w__w.j___a__v__a_2___s.__co__m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.