Source Code Cross Referenced for TagAdapter.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:        import javax.servlet.jsp.*;
021:
022:        /**
023:         * Wraps any SimpleTag and exposes it using a Tag interface.  This is used
024:         * to allow collaboration between classic Tag handlers and SimpleTag
025:         * handlers.
026:         * <p>
027:         * Because SimpleTag does not extend Tag, and because Tag.setParent()
028:         * only accepts a Tag instance, a classic tag handler (one
029:         * that implements Tag) cannot have a SimpleTag as its parent.  To remedy
030:         * this, a TagAdapter is created to wrap the SimpleTag parent, and the
031:         * adapter is passed to setParent() instead.  A classic Tag Handler can
032:         * call getAdaptee() to retrieve the encapsulated SimpleTag instance.
033:         *
034:         * @since 2.0
035:         */
036:        public class TagAdapter implements  Tag {
037:            /** The simple tag that's being adapted. */
038:            private SimpleTag simpleTagAdaptee;
039:
040:            /** The parent, of this tag, converted (if necessary) to be of type Tag. */
041:            private Tag parent;
042:
043:            // Flag indicating whether we have already determined the parent
044:            private boolean parentDetermined;
045:
046:            /**
047:             * Creates a new TagAdapter that wraps the given SimpleTag and 
048:             * returns the parent tag when getParent() is called.
049:             *
050:             * @param adaptee The SimpleTag being adapted as a Tag.
051:             */
052:            public TagAdapter(SimpleTag adaptee) {
053:                if (adaptee == null) {
054:                    // Cannot wrap a null adaptee.
055:                    throw new IllegalArgumentException();
056:                }
057:                this .simpleTagAdaptee = adaptee;
058:            }
059:
060:            /**
061:             * Must not be called.
062:             *
063:             * @param pc ignored.
064:             * @throws UnsupportedOperationException Must not be called
065:             */
066:            public void setPageContext(PageContext pc) {
067:                throw new UnsupportedOperationException(
068:                        "Illegal to invoke setPageContext() on TagAdapter wrapper");
069:            }
070:
071:            /**
072:             * Must not be called.  The parent of this tag is always 
073:             * getAdaptee().getParent().
074:             *
075:             * @param parentTag ignored.
076:             * @throws UnsupportedOperationException Must not be called.
077:             */
078:            public void setParent(Tag parentTag) {
079:                throw new UnsupportedOperationException(
080:                        "Illegal to invoke setParent() on TagAdapter wrapper");
081:            }
082:
083:            /**
084:             * Returns the parent of this tag, which is always
085:             * getAdaptee().getParent().  
086:             *
087:             * This will either be the enclosing Tag (if getAdaptee().getParent()
088:             * implements Tag), or an adapter to the enclosing Tag (if 
089:             * getAdaptee().getParent() does not implement Tag).
090:             *
091:             * @return The parent of the tag being adapted.
092:             */
093:            public Tag getParent() {
094:                if (!parentDetermined) {
095:                    JspTag adapteeParent = simpleTagAdaptee.getParent();
096:                    if (adapteeParent != null) {
097:                        if (adapteeParent instanceof  Tag) {
098:                            this .parent = (Tag) adapteeParent;
099:                        } else {
100:                            // Must be SimpleTag - no other types defined.
101:                            this .parent = new TagAdapter(
102:                                    (SimpleTag) adapteeParent);
103:                        }
104:                    }
105:                    parentDetermined = true;
106:                }
107:
108:                return this .parent;
109:            }
110:
111:            /**
112:             * Gets the tag that is being adapted to the Tag interface.
113:             * This should be an instance of SimpleTag in JSP 2.0, but room
114:             * is left for other kinds of tags in future spec versions.
115:             *
116:             * @return the tag that is being adapted
117:             */
118:            public JspTag getAdaptee() {
119:                return this .simpleTagAdaptee;
120:            }
121:
122:            /**
123:             * Must not be called.
124:             *
125:             * @return always throws UnsupportedOperationException
126:             * @throws UnsupportedOperationException Must not be called
127:             * @throws JspException never thrown
128:             */
129:            public int doStartTag() throws JspException {
130:                throw new UnsupportedOperationException(
131:                        "Illegal to invoke doStartTag() on TagAdapter wrapper");
132:            }
133:
134:            /**
135:             * Must not be called.
136:             *
137:             * @return always throws UnsupportedOperationException
138:             * @throws UnsupportedOperationException Must not be called
139:             * @throws JspException never thrown
140:             */
141:            public int doEndTag() throws JspException {
142:                throw new UnsupportedOperationException(
143:                        "Illegal to invoke doEndTag() on TagAdapter wrapper");
144:            }
145:
146:            /**
147:             * Must not be called.
148:             *
149:             * @throws UnsupportedOperationException Must not be called
150:             */
151:            public void release() {
152:                throw new UnsupportedOperationException(
153:                        "Illegal to invoke release() on TagAdapter wrapper");
154:            }
155:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.