Source Code Cross Referenced for TagInfo.java in  » Sevlet-Container » apache-tomcat-6.0.14 » javax » servlet » jsp » tagext » 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 » Sevlet Container » apache tomcat 6.0.14 » javax.servlet.jsp.tagext 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         *
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:
018:        package javax.servlet.jsp.tagext;
019:
020:        /**
021:         * Tag information for a tag in a Tag Library;
022:         * This class is instantiated from the Tag Library Descriptor file (TLD)
023:         * and is available only at translation time.
024:         *
025:         * 
026:         */
027:
028:        public class TagInfo {
029:
030:            /**
031:             * Static constant for getBodyContent() when it is JSP.
032:             */
033:
034:            public static final String BODY_CONTENT_JSP = "JSP";
035:
036:            /**
037:             * Static constant for getBodyContent() when it is Tag dependent.
038:             */
039:
040:            public static final String BODY_CONTENT_TAG_DEPENDENT = "tagdependent";
041:
042:            /**
043:             * Static constant for getBodyContent() when it is empty.
044:             */
045:
046:            public static final String BODY_CONTENT_EMPTY = "empty";
047:
048:            /**
049:             * Static constant for getBodyContent() when it is scriptless.
050:             * 
051:             * @since 2.0
052:             */
053:            public static final String BODY_CONTENT_SCRIPTLESS = "scriptless";
054:
055:            /**
056:             * Constructor for TagInfo from data in the JSP 1.1 format for TLD.
057:             * This class is to be instantiated only from the TagLibrary code
058:             * under request from some JSP code that is parsing a
059:             * TLD (Tag Library Descriptor).
060:             *
061:             * Note that, since TagLibibraryInfo reflects both TLD information
062:             * and taglib directive information, a TagInfo instance is
063:             * dependent on a taglib directive.  This is probably a
064:             * design error, which may be fixed in the future.
065:             *
066:             * @param tagName The name of this tag
067:             * @param tagClassName The name of the tag handler class
068:             * @param bodycontent Information on the body content of these tags
069:             * @param infoString The (optional) string information for this tag
070:             * @param taglib The instance of the tag library that contains us.
071:             * @param tagExtraInfo The instance providing extra Tag info.  May be null
072:             * @param attributeInfo An array of AttributeInfo data from descriptor.
073:             * May be null;
074:             *
075:             */
076:            public TagInfo(String tagName, String tagClassName,
077:                    String bodycontent, String infoString,
078:                    TagLibraryInfo taglib, TagExtraInfo tagExtraInfo,
079:                    TagAttributeInfo[] attributeInfo) {
080:                this .tagName = tagName;
081:                this .tagClassName = tagClassName;
082:                this .bodyContent = bodycontent;
083:                this .infoString = infoString;
084:                this .tagLibrary = taglib;
085:                this .tagExtraInfo = tagExtraInfo;
086:                this .attributeInfo = attributeInfo;
087:
088:                if (tagExtraInfo != null)
089:                    tagExtraInfo.setTagInfo(this );
090:            }
091:
092:            /**
093:             * Constructor for TagInfo from data in the JSP 1.2 format for TLD.
094:             * This class is to be instantiated only from the TagLibrary code
095:             * under request from some JSP code that is parsing a
096:             * TLD (Tag Library Descriptor).
097:             *
098:             * Note that, since TagLibibraryInfo reflects both TLD information
099:             * and taglib directive information, a TagInfo instance is
100:             * dependent on a taglib directive.  This is probably a
101:             * design error, which may be fixed in the future.
102:             *
103:             * @param tagName The name of this tag
104:             * @param tagClassName The name of the tag handler class
105:             * @param bodycontent Information on the body content of these tags
106:             * @param infoString The (optional) string information for this tag
107:             * @param taglib The instance of the tag library that contains us.
108:             * @param tagExtraInfo The instance providing extra Tag info.  May be null
109:             * @param attributeInfo An array of AttributeInfo data from descriptor.
110:             * May be null;
111:             * @param displayName A short name to be displayed by tools
112:             * @param smallIcon Path to a small icon to be displayed by tools
113:             * @param largeIcon Path to a large icon to be displayed by tools
114:             * @param tvi An array of a TagVariableInfo (or null)
115:             */
116:            public TagInfo(String tagName, String tagClassName,
117:                    String bodycontent, String infoString,
118:                    TagLibraryInfo taglib, TagExtraInfo tagExtraInfo,
119:                    TagAttributeInfo[] attributeInfo, String displayName,
120:                    String smallIcon, String largeIcon, TagVariableInfo[] tvi) {
121:                this .tagName = tagName;
122:                this .tagClassName = tagClassName;
123:                this .bodyContent = bodycontent;
124:                this .infoString = infoString;
125:                this .tagLibrary = taglib;
126:                this .tagExtraInfo = tagExtraInfo;
127:                this .attributeInfo = attributeInfo;
128:                this .displayName = displayName;
129:                this .smallIcon = smallIcon;
130:                this .largeIcon = largeIcon;
131:                this .tagVariableInfo = tvi;
132:
133:                if (tagExtraInfo != null)
134:                    tagExtraInfo.setTagInfo(this );
135:            }
136:
137:            /**
138:             * Constructor for TagInfo from data in the JSP 2.0 format for TLD.
139:             * This class is to be instantiated only from the TagLibrary code
140:             * under request from some JSP code that is parsing a
141:             * TLD (Tag Library Descriptor).
142:             *
143:             * Note that, since TagLibibraryInfo reflects both TLD information
144:             * and taglib directive information, a TagInfo instance is
145:             * dependent on a taglib directive.  This is probably a
146:             * design error, which may be fixed in the future.
147:             *
148:             * @param tagName The name of this tag
149:             * @param tagClassName The name of the tag handler class
150:             * @param bodycontent Information on the body content of these tags
151:             * @param infoString The (optional) string information for this tag
152:             * @param taglib The instance of the tag library that contains us.
153:             * @param tagExtraInfo The instance providing extra Tag info.  May be null
154:             * @param attributeInfo An array of AttributeInfo data from descriptor.
155:             * May be null;
156:             * @param displayName A short name to be displayed by tools
157:             * @param smallIcon Path to a small icon to be displayed by tools
158:             * @param largeIcon Path to a large icon to be displayed by tools
159:             * @param tvi An array of a TagVariableInfo (or null)
160:             * @param dynamicAttributes True if supports dynamic attributes
161:             *
162:             * @since 2.0
163:             */
164:            public TagInfo(String tagName, String tagClassName,
165:                    String bodycontent, String infoString,
166:                    TagLibraryInfo taglib, TagExtraInfo tagExtraInfo,
167:                    TagAttributeInfo[] attributeInfo, String displayName,
168:                    String smallIcon, String largeIcon, TagVariableInfo[] tvi,
169:                    boolean dynamicAttributes) {
170:                this .tagName = tagName;
171:                this .tagClassName = tagClassName;
172:                this .bodyContent = bodycontent;
173:                this .infoString = infoString;
174:                this .tagLibrary = taglib;
175:                this .tagExtraInfo = tagExtraInfo;
176:                this .attributeInfo = attributeInfo;
177:                this .displayName = displayName;
178:                this .smallIcon = smallIcon;
179:                this .largeIcon = largeIcon;
180:                this .tagVariableInfo = tvi;
181:                this .dynamicAttributes = dynamicAttributes;
182:
183:                if (tagExtraInfo != null)
184:                    tagExtraInfo.setTagInfo(this );
185:            }
186:
187:            /**
188:             * The name of the Tag.
189:             *
190:             * @return The (short) name of the tag.
191:             */
192:
193:            public String getTagName() {
194:                return tagName;
195:            }
196:
197:            /**
198:             * Attribute information (in the TLD) on this tag.
199:             * The return is an array describing the attributes of this tag, as
200:             * indicated in the TLD.
201:             *
202:             * @return The array of TagAttributeInfo for this tag, or a
203:             *         zero-length array if the tag has no attributes.
204:             */
205:
206:            public TagAttributeInfo[] getAttributes() {
207:                return attributeInfo;
208:            }
209:
210:            /**
211:             * Information on the scripting objects created by this tag at runtime.
212:             * This is a convenience method on the associated TagExtraInfo class.
213:             *
214:             * @param data TagData describing this action.
215:             * @return if a TagExtraInfo object is associated with this TagInfo, the
216:             *     result of getTagExtraInfo().getVariableInfo( data ), otherwise
217:             *     null.
218:             */
219:            public VariableInfo[] getVariableInfo(TagData data) {
220:                VariableInfo[] result = null;
221:                TagExtraInfo tei = getTagExtraInfo();
222:                if (tei != null) {
223:                    result = tei.getVariableInfo(data);
224:                }
225:                return result;
226:            }
227:
228:            /**
229:             * Translation-time validation of the attributes. 
230:             * This is a convenience method on the associated TagExtraInfo class.
231:             *
232:             * @param data The translation-time TagData instance.
233:             * @return Whether the data is valid.
234:             */
235:            public boolean isValid(TagData data) {
236:                TagExtraInfo tei = getTagExtraInfo();
237:                if (tei == null) {
238:                    return true;
239:                }
240:                return tei.isValid(data);
241:            }
242:
243:            /**
244:             * Translation-time validation of the attributes.
245:             * This is a convenience method on the associated TagExtraInfo class.
246:             *
247:             * @param data The translation-time TagData instance.
248:             * @return A null object, or zero length array if no errors, an
249:             *     array of ValidationMessages otherwise.
250:             * @since 2.0
251:             */
252:            public ValidationMessage[] validate(TagData data) {
253:                TagExtraInfo tei = getTagExtraInfo();
254:                if (tei == null) {
255:                    return null;
256:                }
257:                return tei.validate(data);
258:            }
259:
260:            /**
261:             * Set the instance for extra tag information.
262:             * 
263:             * @param tei the TagExtraInfo instance
264:             */
265:            public void setTagExtraInfo(TagExtraInfo tei) {
266:                tagExtraInfo = tei;
267:            }
268:
269:            /**
270:             * The instance (if any) for extra tag information.
271:             * 
272:             * @return The TagExtraInfo instance, if any.
273:             */
274:            public TagExtraInfo getTagExtraInfo() {
275:                return tagExtraInfo;
276:            }
277:
278:            /**
279:             * Name of the class that provides the handler for this tag.
280:             *
281:             * @return The name of the tag handler class.
282:             */
283:
284:            public String getTagClassName() {
285:                return tagClassName;
286:            }
287:
288:            /**
289:             * The bodycontent information for this tag.
290:             * If the bodycontent is not defined for this
291:             * tag, the default of JSP will be returned.
292:             *
293:             * @return the body content string.
294:             */
295:
296:            public String getBodyContent() {
297:                return bodyContent;
298:            }
299:
300:            /**
301:             * The information string for the tag.
302:             *
303:             * @return the info string, or null if 
304:             *         not defined
305:             */
306:
307:            public String getInfoString() {
308:                return infoString;
309:            }
310:
311:            /**
312:             * Set the TagLibraryInfo property.
313:             *
314:             * Note that a TagLibraryInfo element is dependent
315:             * not just on the TLD information but also on the
316:             * specific taglib instance used.  This means that
317:             * a fair amount of work needs to be done to construct
318:             * and initialize TagLib objects.
319:             *
320:             * If used carefully, this setter can be used to avoid having to
321:             * create new TagInfo elements for each taglib directive.
322:             *
323:             * @param tl the TagLibraryInfo to assign
324:             */
325:
326:            public void setTagLibrary(TagLibraryInfo tl) {
327:                tagLibrary = tl;
328:            }
329:
330:            /**
331:             * The instance of TabLibraryInfo we belong to.
332:             *
333:             * @return the tag library instance we belong to
334:             */
335:
336:            public TagLibraryInfo getTagLibrary() {
337:                return tagLibrary;
338:            }
339:
340:            // ============== JSP 2.0 TLD Information ========
341:
342:            /**
343:             * Get the displayName.
344:             *
345:             * @return A short name to be displayed by tools,
346:             *         or null if not defined
347:             */
348:
349:            public String getDisplayName() {
350:                return displayName;
351:            }
352:
353:            /**
354:             * Get the path to the small icon.
355:             *
356:             * @return Path to a small icon to be displayed by tools,
357:             *         or null if not defined
358:             */
359:
360:            public String getSmallIcon() {
361:                return smallIcon;
362:            }
363:
364:            /**
365:             * Get the path to the large icon.
366:             *
367:             * @return Path to a large icon to be displayed by tools,
368:             *         or null if not defined
369:             */
370:
371:            public String getLargeIcon() {
372:                return largeIcon;
373:            }
374:
375:            /**
376:             * Get TagVariableInfo objects associated with this TagInfo.
377:             *
378:             * @return Array of TagVariableInfo objects corresponding to
379:             *         variables declared by this tag, or a zero length
380:             *         array if no variables have been declared
381:             */
382:
383:            public TagVariableInfo[] getTagVariableInfos() {
384:                return tagVariableInfo;
385:            }
386:
387:            // ============== JSP 2.0 TLD Information ========
388:
389:            /**
390:             * Get dynamicAttributes associated with this TagInfo.
391:             *
392:             * @return True if tag handler supports dynamic attributes
393:             * @since 2.0
394:             */
395:            public boolean hasDynamicAttributes() {
396:                return dynamicAttributes;
397:            }
398:
399:            /*
400:             * private fields for 1.1 info
401:             */
402:            private String tagName; // the name of the tag
403:            private String tagClassName;
404:            private String bodyContent;
405:            private String infoString;
406:            private TagLibraryInfo tagLibrary;
407:            private TagExtraInfo tagExtraInfo; // instance of TagExtraInfo
408:            private TagAttributeInfo[] attributeInfo;
409:
410:            /*
411:             * private fields for 1.2 info
412:             */
413:            private String displayName;
414:            private String smallIcon;
415:            private String largeIcon;
416:            private TagVariableInfo[] tagVariableInfo;
417:
418:            /*
419:             * Additional private fields for 2.0 info
420:             */
421:            private boolean dynamicAttributes;
422:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.