Source Code Cross Referenced for PackageFrameWriter.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-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.util.*;
029:        import com.sun.tools.doclets.internal.toolkit.*;
030:
031:        import com.sun.javadoc.*;
032:        import java.io.*;
033:        import java.util.*;
034:
035:        /**
036:         * Class to generate file for each package contents in the left-hand bottom
037:         * frame. This will list all the Class Kinds in the package. A click on any
038:         * class-kind will update the right-hand frame with the clicked class-kind page.
039:         *
040:         * @author Atul M Dambalkar
041:         */
042:        public class PackageFrameWriter extends HtmlDocletWriter {
043:
044:            /**
045:             * The package being documented.
046:             */
047:            private PackageDoc packageDoc;
048:
049:            /**
050:             * The classes to be documented.  Use this to filter out classes
051:             * that will not be documented.
052:             */
053:            private Set documentedClasses;
054:
055:            /**
056:             * The name of the output file.
057:             */
058:            public static final String OUTPUT_FILE_NAME = "package-frame.html";
059:
060:            /**
061:             * Constructor to construct PackageFrameWriter object and to generate
062:             * "package-frame.html" file in the respective package directory.
063:             * For example for package "java.lang" this will generate file
064:             * "package-frame.html" file in the "java/lang" directory. It will also
065:             * create "java/lang" directory in the current or the destination directory
066:             * if it doesen't exist.
067:             *
068:             * @param configuration the configuration of the doclet.
069:             * @param packageDoc PackageDoc under consideration.
070:             */
071:            public PackageFrameWriter(ConfigurationImpl configuration,
072:                    PackageDoc packageDoc) throws IOException {
073:                super (configuration, DirectoryManager
074:                        .getDirectoryPath(packageDoc), OUTPUT_FILE_NAME,
075:                        DirectoryManager.getRelativePath(packageDoc));
076:                this .packageDoc = packageDoc;
077:                if (configuration.root.specifiedPackages().length == 0) {
078:                    documentedClasses = new HashSet(Arrays
079:                            .asList(configuration.root.classes()));
080:                }
081:            }
082:
083:            /**
084:             * Generate a package summary page for the left-hand bottom frame. Construct
085:             * the PackageFrameWriter object and then uses it generate the file.
086:             *
087:             * @param configuration the current configuration of the doclet.
088:             * @param packageDoc The package for which "pacakge-frame.html" is to be generated.
089:             */
090:            public static void generate(ConfigurationImpl configuration,
091:                    PackageDoc packageDoc) {
092:                PackageFrameWriter packgen;
093:                try {
094:                    packgen = new PackageFrameWriter(configuration, packageDoc);
095:                    String pkgName = Util.getPackageName(packageDoc);
096:                    packgen.printHtmlHeader(pkgName, configuration.metakeywords
097:                            .getMetaKeywords(packageDoc), false);
098:                    packgen.printPackageHeader(pkgName);
099:                    packgen.generateClassListing();
100:                    packgen.printBodyHtmlEnd();
101:                    packgen.close();
102:                } catch (IOException exc) {
103:                    configuration.standardmessage.error(
104:                            "doclet.exception_encountered", exc.toString(),
105:                            OUTPUT_FILE_NAME);
106:                    throw new DocletAbortException();
107:                }
108:            }
109:
110:            /**
111:             * Generate class listing for all the classes in this package. Divide class
112:             * listing as per the class kind and generate separate listing for
113:             * Classes, Interfaces, Exceptions and Errors.
114:             */
115:            protected void generateClassListing() {
116:                Configuration config = configuration();
117:                if (packageDoc.isIncluded()) {
118:                    generateClassKindListing(packageDoc.interfaces(),
119:                            configuration.getText("doclet.Interfaces"));
120:                    generateClassKindListing(packageDoc.ordinaryClasses(),
121:                            configuration.getText("doclet.Classes"));
122:                    generateClassKindListing(packageDoc.enums(), configuration
123:                            .getText("doclet.Enums"));
124:                    generateClassKindListing(packageDoc.exceptions(),
125:                            configuration.getText("doclet.Exceptions"));
126:                    generateClassKindListing(packageDoc.errors(), configuration
127:                            .getText("doclet.Errors"));
128:                    generateClassKindListing(packageDoc.annotationTypes(),
129:                            configuration.getText("doclet.AnnotationTypes"));
130:                } else {
131:                    String name = Util.getPackageName(packageDoc);
132:                    generateClassKindListing(config.classDocCatalog
133:                            .interfaces(name), configuration
134:                            .getText("doclet.Interfaces"));
135:                    generateClassKindListing(config.classDocCatalog
136:                            .ordinaryClasses(name), configuration
137:                            .getText("doclet.Classes"));
138:                    generateClassKindListing(
139:                            config.classDocCatalog.enums(name), configuration
140:                                    .getText("doclet.Enums"));
141:                    generateClassKindListing(config.classDocCatalog
142:                            .exceptions(name), configuration
143:                            .getText("doclet.Exceptions"));
144:                    generateClassKindListing(config.classDocCatalog
145:                            .errors(name), configuration
146:                            .getText("doclet.Errors"));
147:                    generateClassKindListing(config.classDocCatalog
148:                            .annotationTypes(name), configuration
149:                            .getText("doclet.AnnotationTypes"));
150:                }
151:            }
152:
153:            /**
154:             * Generate specific class kind listing. Also add label to the listing.
155:             *
156:             * @param arr Array of specific class kinds, namely Class or Interface or
157:             * Exception or Error.
158:             * @param label Label for the listing
159:             */
160:            protected void generateClassKindListing(ClassDoc[] arr, String label) {
161:                if (arr.length > 0) {
162:                    Arrays.sort(arr);
163:                    printPackageTableHeader();
164:                    fontSizeStyle("+1", "FrameHeadingFont");
165:                    boolean printedHeader = false;
166:                    for (int i = 0; i < arr.length; i++) {
167:                        if (documentedClasses != null
168:                                && !documentedClasses.contains(arr[i])) {
169:                            continue;
170:                        }
171:                        if (!Util.isCoreClass(arr[i])
172:                                || !configuration.isGeneratedDoc(arr[i])) {
173:                            continue;
174:                        }
175:                        if (!printedHeader) {
176:                            print(label);
177:                            fontEnd();
178:                            println("&nbsp;");
179:                            fontStyle("FrameItemFont");
180:                            printedHeader = true;
181:                        }
182:                        br();
183:                        printLink(new LinkInfoImpl(LinkInfoImpl.PACKAGE_FRAME,
184:                                arr[i],
185:                                (arr[i].isInterface() ? italicsText(arr[i]
186:                                        .name()) : arr[i].name()), "classFrame"));
187:                    }
188:                    fontEnd();
189:                    printPackageTableFooter();
190:                    println();
191:                }
192:            }
193:
194:            /**
195:             * Print the package link at the top of the class kind listing. Clicking
196:             * this link, package-summary page will appear in the right hand frame.
197:             *
198:             * @param heading Top Heading to be used for the class kind listing.
199:             */
200:            protected void printPackageHeader(String heading) {
201:                fontSizeStyle("+1", "FrameTitleFont");
202:                printTargetPackageLink(packageDoc, "classFrame", heading);
203:                fontEnd();
204:            }
205:
206:            /**
207:             * The table for the class kind listing.
208:             */
209:            protected void printPackageTableHeader() {
210:                table();
211:                tr();
212:                tdNowrap();
213:            }
214:
215:            /**
216:             * Closing Html tags for table of class kind listing.
217:             */
218:            protected void printPackageTableFooter() {
219:                tdEnd();
220:                trEnd();
221:                tableEnd();
222:            }
223:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.