Source Code Cross Referenced for ICUTaglet.java in  » Internationalization-Localization » icu4j » com » ibm » icu » dev » tool » docs » 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 » Internationalization Localization » icu4j » com.ibm.icu.dev.tool.docs 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        //##header  VERSION_1.5
002:        /**
003:         *******************************************************************************
004:         * Copyright (C) 2002-2006, International Business Machines Corporation and    *
005:         * others. All Rights Reserved.                                                *
006:         *******************************************************************************
007:         */
008:
009:        /**
010:         * Preprocess with com.ibm.icu.dev.tool.docs.CodeMangler to generate
011:         * either a JDK 1.4 or JDK 1.5 version.  For the 1.5 version, define
012:         * VERSION_1.5.
013:         */package com.ibm.icu.dev.tool.docs;
014:
015:        import com.sun.javadoc.*;
016:        import com.sun.tools.doclets.*; //#ifdef VERSION_1.5
017:
018:        import com.sun.tools.doclets.internal.toolkit.taglets.*;
019:        import com.sun.tools.doclets.internal.toolkit.taglets.Taglet;
020:
021:        // jdk 1.5 contains both com.sun.tools.doclets.Taglet and
022:        // com.sun.tools.doclets.internal.toolkit.taglets.Taglet.
023:        // Their registration code casts to the second, not the first, and the
024:        // second doesn't implement the first, so if you just implement the
025:        // first, you die.
026:        //#endif
027:
028:        import java.text.BreakIterator;
029:        import java.util.Locale;
030:        import java.util.Map;
031:
032:        public abstract class ICUTaglet implements  Taglet {
033:            protected final String name;
034:            protected final int mask;
035:
036:            protected static final int MASK_FIELD = 1;
037:            protected static final int MASK_CONSTRUCTOR = 2;
038:            protected static final int MASK_METHOD = 4;
039:            protected static final int MASK_OVERVIEW = 8;
040:            protected static final int MASK_PACKAGE = 16;
041:            protected static final int MASK_TYPE = 32;
042:            protected static final int MASK_INLINE = 64;
043:
044:            protected static final int MASK_DEFAULT = 0x003f; // no inline
045:            protected static final int MASK_VALID = 0x007f; // includes inline
046:
047:            public static void register(Map taglets) {
048:                ICUInternalTaglet.register(taglets);
049:                ICUDraftTaglet.register(taglets);
050:                ICUStableTaglet.register(taglets);
051:                //#ifndef VERSION_1.5
052:                //##        ICUDeprecatedTaglet.register(taglets);
053:                //#endif
054:                ICUProvisionalTaglet.register(taglets);
055:                ICUObsoleteTaglet.register(taglets);
056:                ICUIgnoreTaglet.register(taglets);
057:            }
058:
059:            protected ICUTaglet(String name, int mask) {
060:                this .name = name;
061:                this .mask = mask & MASK_VALID;
062:            }
063:
064:            public boolean inField() {
065:                return (mask & MASK_FIELD) != 0;
066:            }
067:
068:            public boolean inConstructor() {
069:                return (mask & MASK_CONSTRUCTOR) != 0;
070:            }
071:
072:            public boolean inMethod() {
073:                return (mask & MASK_METHOD) != 0;
074:            }
075:
076:            public boolean inOverview() {
077:                return (mask & MASK_OVERVIEW) != 0;
078:            }
079:
080:            public boolean inPackage() {
081:                return (mask & MASK_PACKAGE) != 0;
082:            }
083:
084:            public boolean inType() {
085:                return (mask & MASK_TYPE) != 0;
086:            }
087:
088:            public boolean isInlineTag() {
089:                return (mask & MASK_INLINE) != 0;
090:            }
091:
092:            public String getName() {
093:                return name;
094:            }
095:
096:            public String toString(Tag tag) {
097:                return tag.text();
098:            }
099:
100:            public String toString(Tag[] tags) {
101:                if (tags != null) {
102:                    if (tags.length > 1) {
103:                        String msg = "Should not have more than one ICU tag per element:\n";
104:                        for (int i = 0; i < tags.length; ++i) {
105:                            msg += "  [" + i + "] " + tags[i] + "\n";
106:                        }
107:                        throw new IllegalStateException(msg);
108:                    } else if (tags.length > 0) {
109:                        return toString(tags[0]);
110:                    }
111:                }
112:                return null;
113:            }
114:
115:            //#ifdef VERSION_1.5
116:
117:            public TagletOutput getTagletOutput(Tag tag, TagletWriter writer)
118:                    throws IllegalArgumentException {
119:                TagletOutput out = writer.getTagletOutputInstance();
120:                out.setOutput(toString(tag));
121:                return out;
122:            }
123:
124:            public TagletOutput getTagletOutput(Doc holder, TagletWriter writer)
125:                    throws IllegalArgumentException {
126:                TagletOutput out = writer.getTagletOutputInstance();
127:                Tag[] tags = holder.tags(getName());
128:                if (tags.length == 0) {
129:                    return null;
130:                }
131:                out.setOutput(toString(tags[0]));
132:                return out;
133:            }
134:
135:            //#endif
136:
137:            protected static final String STATUS = "<dt><b>Status:</b></dt>";
138:
139:            public static class ICUInternalTaglet extends ICUTaglet {
140:                private static final String NAME = "internal";
141:
142:                public static void register(Map taglets) {
143:                    taglets.put(NAME, new ICUInternalTaglet());
144:                }
145:
146:                private ICUInternalTaglet() {
147:                    super (NAME, MASK_DEFAULT);
148:                }
149:
150:                public String toString(Tag tag) {
151:                    return STATUS
152:                            + "<dd><em>Internal</em>. <font color='red'>This API is <em>ICU internal only</em>.</font></dd>";
153:                }
154:            }
155:
156:            public static class ICUDraftTaglet extends ICUTaglet {
157:                private static final String NAME = "draft";
158:
159:                public static void register(Map taglets) {
160:                    taglets.put(NAME, new ICUDraftTaglet());
161:                }
162:
163:                private ICUDraftTaglet() {
164:                    super (NAME, MASK_DEFAULT);
165:                }
166:
167:                public String toString(Tag tag) {
168:                    String text = tag.text();
169:                    if (text.length() == 0) {
170:                        System.err.println("Warning: empty draft tag");
171:                    }
172:                    return STATUS + "<dd>Draft " + tag.text() + ".</dd>";
173:                }
174:            }
175:
176:            public static class ICUStableTaglet extends ICUTaglet {
177:                private static final String NAME = "stable";
178:
179:                public static void register(Map taglets) {
180:                    taglets.put(NAME, new ICUStableTaglet());
181:                }
182:
183:                private ICUStableTaglet() {
184:                    super (NAME, MASK_DEFAULT);
185:                }
186:
187:                public String toString(Tag tag) {
188:                    String text = tag.text();
189:                    if (text.length() > 0) {
190:                        return STATUS + "<dd>Stable " + text + ".</dd>";
191:                    } else {
192:                        return STATUS + "<dd>Stable.</dd>";
193:                    }
194:                }
195:            }
196:
197:            //#ifndef VERSION_1.5
198:            //##
199:            //##    /*
200:            //##     * sigh, in JDK 1.5 we can't override the standard deprecated taglet
201:            //##     * so easily.  I'm not impressed with the javadoc code.
202:            //##     */
203:            //##    public static class ICUDeprecatedTaglet extends ICUTaglet {
204:            //##        private static final String NAME = "deprecated";
205:            //##
206:            //##        public static void register(Map taglets) {
207:            //##	    taglets.remove(NAME); // override standard deprecated taglet
208:            //##            taglets.put(NAME, new ICUDeprecatedTaglet());
209:            //##        }
210:            //##
211:            //##        private ICUDeprecatedTaglet() {
212:            //##            super(NAME, MASK_DEFAULT);
213:            //##        }
214:            //##
215:            //##        public String toString(Tag tag) {
216:            //##            BreakIterator bi = BreakIterator.getSentenceInstance(Locale.US);
217:            //##            String text = tag.text();
218:            //##            bi.setText(text);
219:            //##            int first = bi.first();
220:            //##            int next = bi.next();
221:            //##            if (first == -1 || next == -1) {
222:            //##                System.err.println("Warning: bad deprecated tag '" + text + "'");
223:            //##                return "<dd><em>Note</em>. " + text + "</dd>";
224:            //##            } else {
225:            //##                if ("This API is ICU internal only.".equals(text)) {
226:            //##                    return null;
227:            //##                }
228:            //##                return "<dd><em>Note, " + text.substring(first, next) + "</em>. " + text.substring(next) + "</dd>";
229:            //##            }
230:            //##        }
231:            //##    }
232:            //#endif
233:
234:            public static class ICUProvisionalTaglet extends ICUTaglet {
235:                private static final String NAME = "provisional";
236:
237:                public static void register(Map taglets) {
238:                    taglets.remove(NAME); // override standard deprecated taglet
239:                    taglets.put(NAME, new ICUProvisionalTaglet());
240:                }
241:
242:                private ICUProvisionalTaglet() {
243:                    super (NAME, MASK_DEFAULT);
244:                }
245:
246:                public String toString(Tag tag) {
247:                    return null;
248:                }
249:            }
250:
251:            public static class ICUObsoleteTaglet extends ICUTaglet {
252:                private static final String NAME = "obsolete";
253:
254:                public static void register(Map taglets) {
255:                    taglets.put(NAME, new ICUObsoleteTaglet());
256:                }
257:
258:                private ICUObsoleteTaglet() {
259:                    super (NAME, MASK_DEFAULT);
260:                }
261:
262:                public String toString(Tag tag) {
263:                    BreakIterator bi = BreakIterator
264:                            .getSentenceInstance(Locale.US);
265:                    String text = tag.text();
266:                    bi.setText(text);
267:                    int first = bi.first();
268:                    int next = bi.next();
269:                    if (text.length() == 0) {
270:                        first = next = 0;
271:                    }
272:                    return STATUS
273:                            + "<dd><em>Obsolete.</em> <font color='red'>Will be removed in "
274:                            + text.substring(first, next) + "</font>. "
275:                            + text.substring(next) + "</dd>";
276:
277:                }
278:            }
279:
280:            public static class ICUIgnoreTaglet extends ICUTaglet {
281:                private static ICUTaglet singleton;
282:
283:                public static void register(Map taglets) {
284:                    if (singleton == null) {
285:                        singleton = new ICUIgnoreTaglet();
286:                    }
287:                    taglets.put("bug", singleton);
288:                    taglets.put("test", singleton);
289:                    taglets.put("summary", singleton);
290:                }
291:
292:                private ICUIgnoreTaglet() {
293:                    super (".ignore", MASK_DEFAULT);
294:                }
295:
296:                public String toString(Tag tag) {
297:                    return null;
298:                }
299:            }
300:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.