Source Code Cross Referenced for JavaDocComponent.java in  » UML » jrefactory » org » acm » seguin » pretty » 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 » UML » jrefactory » org.acm.seguin.pretty 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Author:  Chris Seguin
003:         *
004:         *  This software has been developed under the copyleft
005:         *  rules of the GNU General Public License.  Please
006:         *  consult the GNU General Public License for more
007:         *  details about use and distribution of this software.
008:         */
009:        package org.acm.seguin.pretty;
010:
011:        import java.util.StringTokenizer;
012:
013:        /**
014:         *  Store a portion of a javadoc item
015:         *
016:         *@author     Chris Seguin
017:         *@created    April 15, 1999
018:         */
019:        public class JavaDocComponent {
020:            private int longestLength = 0;
021:            private String description;
022:            private boolean printed;
023:            private boolean required;
024:            //  Instance Variable
025:            private String type;
026:
027:            /**
028:             *  Create an instance of this java doc object
029:             */
030:            public JavaDocComponent() {
031:                type = "";
032:                description = "";
033:                printed = false;
034:                required = false;
035:            }
036:
037:            /**
038:             *  Set the description
039:             *
040:             *@param  newDescription  the new description
041:             */
042:            public void setDescription(String newDescription) {
043:                if (newDescription != null) {
044:                    description = newDescription;
045:                }
046:            }
047:
048:            /**
049:             *  Set the longestLength
050:             *
051:             *@param  newLongestLength  the new longestLength
052:             */
053:            public void setLongestLength(int newLongestLength) {
054:                longestLength = newLongestLength;
055:            }
056:
057:            /**
058:             *  Note that this node is required
059:             *
060:             *@param  req  true if it is required
061:             */
062:            public void setRequired(boolean req) {
063:                required = req;
064:            }
065:
066:            /**
067:             *  Set the type
068:             *
069:             *@param  newType  the new type
070:             */
071:            public void setType(String newType) {
072:                if (newType != null) {
073:                    type = newType;
074:                    setLongestLength(type.length() + 2);
075:                }
076:            }
077:
078:            /**
079:             *  Return the description
080:             *
081:             *@return    the description
082:             */
083:            public String getDescription() {
084:                return description;
085:            }
086:
087:            /**
088:             *  Return the longestLength
089:             *
090:             *@return    the longestLength
091:             */
092:            public int getLongestLength() {
093:                return longestLength;
094:            }
095:
096:            /**
097:             *  Return the type
098:             *
099:             *@return    the type
100:             */
101:            public String getType() {
102:                return type;
103:            }
104:
105:            /**
106:             *  Return whether this node has been printed
107:             *
108:             *@return    true if it was printed
109:             */
110:            public boolean isPrinted() {
111:                return printed;
112:            }
113:
114:            /**
115:             *  Return whether this node is required
116:             *
117:             *@return    true if it is required
118:             */
119:            public boolean isRequired() {
120:                return required;
121:            }
122:
123:            /**
124:             *  Print this tag
125:             *
126:             *@param  printData  printData
127:             */
128:            public void print(PrintData printData) {
129:                //  We are now printing it
130:                setPrinted(true);
131:
132:                //  Start the line
133:                if (!printData.isCurrentSingle()) {
134:                    printData.indent();
135:                    if (!printData.isStarsAlignedWithSlash()) {
136:                        printData.space();
137:                    }
138:                    printData.appendComment("*", PrintData.JAVADOC_COMMENT);
139:                }
140:
141:                if (printData.isSpaceBeforeAt() && !isDescription()) {
142:                    printData.appendComment(" ", PrintData.JAVADOC_COMMENT);
143:                }
144:
145:                //  Print the type
146:                if (!isDescription()) {
147:                    printData.appendComment(getType(),
148:                            PrintData.JAVADOC_COMMENT);
149:                }
150:
151:                //  Pad extra spaces after the ID
152:                if (!isDescription() && printData.isJavadocLinedUp()) {
153:                    int extra = getLongestLength() - getType().length();
154:                    for (int ndx = 0; ndx < extra; ndx++) {
155:                        printData.appendComment(" ", PrintData.JAVADOC_COMMENT);
156:                    }
157:                }
158:
159:                // Pad any extra spaces after the stars and before the text
160:                if (printData.isReformatComments() || !isDescription()) {
161:                    for (int i = 0; i < printData.getJavadocIndent(); ++i) {
162:                        printData.appendComment(" ", PrintData.JAVADOC_COMMENT);
163:                    }
164:                }
165:
166:                //  Print the description
167:                printDescription(printData);
168:
169:                if (!printData.isCurrentSingle()) {
170:                    printData.newline();
171:                }
172:            }
173:
174:            /**
175:             *  Note that this node has been printed
176:             *
177:             *@param  prn  Description of Parameter
178:             */
179:            protected void setPrinted(boolean prn) {
180:                printed = prn;
181:            }
182:
183:            /**
184:             *  Print the drescription
185:             *
186:             *@param  printData  the print data
187:             */
188:            protected void leaveDescription(PrintData printData) {
189:                StringBuffer sb = new StringBuffer(printData.getJavadocIndent());
190:                for (int i = 0; i < printData.getJavadocIndent(); ++i) {
191:                    sb.append(" ");
192:                }
193:                String indent = sb.toString();
194:
195:                StringTokenizer tok = new StringTokenizer(getDescription(),
196:                        "\n\r");
197:                boolean first = true;
198:                while (tok.hasMoreTokens()) {
199:                    String nextToken = tok.nextToken();
200:                    if (!first) {
201:                        printData.indent();
202:                        if (!printData.isStarsAlignedWithSlash()) {
203:                            printData.space();
204:                        }
205:                        printData.appendComment("*", PrintData.JAVADOC_COMMENT);
206:                        printData.appendComment(indent,
207:                                PrintData.JAVADOC_COMMENT);
208:                    }
209:                    printData.appendComment(nextToken,
210:                            PrintData.JAVADOC_COMMENT);
211:                    first = false;
212:                }
213:            }
214:
215:            /**
216:             *  Print the drescription
217:             *
218:             *@param  printData  the print data
219:             */
220:            protected void printDescription(PrintData printData) {
221:                int indent = 0;
222:
223:                if (getType().length() == 0) {
224:                    indent = printData.getJavadocIndent();
225:                } else {
226:                    indent = printData.getTaggedJavadocDescription();
227:                }
228:
229:                wordwrapDescription(printData, indent);
230:            }
231:
232:            /**
233:             *  Print the drescription
234:             *
235:             *@param  printData  the print data
236:             *@param  indent     the number of spaces to indent
237:             */
238:            protected void wordwrapDescription(PrintData printData, int indent) {
239:                JavadocDescriptionPrinter jdp = new JavadocDescriptionPrinter(
240:                        printData, getDescription(), indent);
241:
242:                jdp.run();
243:            }
244:
245:            /**
246:             *  returns true if this is a description
247:             *
248:             *@return    true if it is a description
249:             */
250:            boolean isDescription() {
251:                return (getType().length() == 0);
252:            }
253:        }
254:        /*******\
255:         \*******/
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.