Source Code Cross Referenced for AbstractTreeWriter.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 1998-2004 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.util.*;
029:
030:        import com.sun.javadoc.*;
031:        import java.io.*;
032:        import java.util.*;
033:
034:        /**
035:         * Abstract class to print the class hierarchy page for all the Classes. This
036:         * is sub-classed by {@link PackageTreeWriter} and {@link TreeWriter} to
037:         * generate the Package Tree and global Tree(for all the classes and packages)
038:         * pages.
039:         *
040:         * @author Atul M Dambalkar
041:         */
042:        public abstract class AbstractTreeWriter extends HtmlDocletWriter {
043:
044:            /**
045:             * The class and interface tree built by using {@link ClassTree}
046:             */
047:            protected final ClassTree classtree;
048:
049:            /**
050:             * Constructor initilises classtree variable. This constructor will be used
051:             * while generating global tree file "overview-tree.html".
052:             *
053:             * @param filename   File to be generated.
054:             * @param classtree  Tree built by {@link ClassTree}.
055:             * @throws IOException
056:             * @throws DocletAbortException
057:             */
058:            protected AbstractTreeWriter(ConfigurationImpl configuration,
059:                    String filename, ClassTree classtree) throws IOException {
060:                super (configuration, filename);
061:                this .classtree = classtree;
062:            }
063:
064:            /**
065:             * Create appropriate directory for the package and also initilise the
066:             * relative path from this generated file to the current or
067:             * the destination directory. This constructor will be used while
068:             * generating "package tree" file.
069:             *
070:             * @param path Directories in this path will be created if they are not
071:             * already there.
072:             * @param filename Name of the package tree file to be generated.
073:             * @param classtree The tree built using {@link ClassTree}.
074:             * for the package pkg.
075:             * @param pkg PackageDoc for which tree file will be generated.
076:             * @throws IOException
077:             * @throws DocletAbortException
078:             */
079:            protected AbstractTreeWriter(ConfigurationImpl configuration,
080:                    String path, String filename, ClassTree classtree,
081:                    PackageDoc pkg) throws IOException {
082:                super (configuration, path, filename, DirectoryManager
083:                        .getRelativePath(pkg.name()));
084:                this .classtree = classtree;
085:            }
086:
087:            /**
088:             * Generate each level of the class tree. For each sub-class or
089:             * sub-interface indents the next level information.
090:             * Recurses itself to generate subclasses info.
091:             * To iterate is human, to recurse is divine - L. Peter Deutsch.
092:             *
093:             * @param parent the superclass or superinterface of the list.
094:             * @param list list of the sub-classes at this level.
095:             * @param isEnum true if we are generating a tree for enums.
096:             */
097:            protected void generateLevelInfo(ClassDoc parent, List list,
098:                    boolean isEnum) {
099:                if (list.size() > 0) {
100:                    ul();
101:                    for (int i = 0; i < list.size(); i++) {
102:                        ClassDoc local = (ClassDoc) list.get(i);
103:                        printPartialInfo(local);
104:                        printExtendsImplements(parent, local);
105:                        generateLevelInfo(local, classtree.subs(local, isEnum),
106:                                isEnum); // Recurse
107:                    }
108:                    ulEnd();
109:                }
110:            }
111:
112:            /**
113:             * Generate the heading for the tree depending upon tree type if it's a
114:             * Class Tree or Interface tree and also print the tree.
115:             *
116:             * @param list List of classes which are at the most base level, all the
117:             * other classes in this run will derive from these classes.
118:             * @param heading Heading for the tree.
119:             */
120:            protected void generateTree(List list, String heading) {
121:                if (list.size() > 0) {
122:                    ClassDoc firstClassDoc = (ClassDoc) list.get(0);
123:                    printTreeHeading(heading);
124:                    generateLevelInfo(
125:                            !firstClassDoc.isInterface() ? firstClassDoc : null,
126:                            list, list == classtree.baseEnums());
127:                }
128:            }
129:
130:            /**
131:             * Print the information regarding the classes which this class extends or
132:             * implements.
133:             *
134:             * @param cd The classdoc under consideration.
135:             */
136:            protected void printExtendsImplements(ClassDoc parent, ClassDoc cd) {
137:                ClassDoc[] interfaces = cd.interfaces();
138:                if (interfaces.length > (cd.isInterface() ? 1 : 0)) {
139:                    Arrays.sort(interfaces);
140:                    int counter = 0;
141:                    for (int i = 0; i < interfaces.length; i++) {
142:                        if (parent != interfaces[i]) {
143:                            if (!(interfaces[i].isPublic() || Util.isLinkable(
144:                                    interfaces[i], configuration()))) {
145:                                continue;
146:                            }
147:                            if (counter == 0) {
148:                                if (cd.isInterface()) {
149:                                    print(" ("
150:                                            + configuration
151:                                                    .getText("doclet.also")
152:                                            + " extends ");
153:                                } else {
154:                                    print(" (implements ");
155:                                }
156:                            } else {
157:                                print(", ");
158:                            }
159:                            printPreQualifiedClassLink(
160:                                    LinkInfoImpl.CONTEXT_TREE, interfaces[i]);
161:                            counter++;
162:                        }
163:                    }
164:                    if (counter > 0) {
165:                        println(")");
166:                    }
167:                }
168:            }
169:
170:            /**
171:             * Print information about the class kind, if it's a "class" or "interface".
172:             *
173:             * @param cd classdoc.
174:             */
175:            protected void printPartialInfo(ClassDoc cd) {
176:                li("circle");
177:                printPreQualifiedBoldClassLink(LinkInfoImpl.CONTEXT_TREE, cd);
178:            }
179:
180:            /**
181:             * Print the heading for the tree.
182:             *
183:             * @param heading Heading for the tree.
184:             */
185:            protected void printTreeHeading(String heading) {
186:                h2();
187:                println(configuration.getText(heading));
188:                h2End();
189:            }
190:
191:            /**
192:             * Highlight "Tree" word in the navigation bar, since this is the tree page.
193:             */
194:            protected void navLinkTree() {
195:                navCellRevStart();
196:                fontStyle("NavBarFont1Rev");
197:                boldText("doclet.Tree");
198:                fontEnd();
199:                navCellEnd();
200:            }
201:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.