Source Code Cross Referenced for SimpleAdapterDocument.java in  » Web-Framework » struts-2.0.11 » org » apache » struts2 » views » xslt » 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 » Web Framework » struts 2.0.11 » org.apache.struts2.views.xslt 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: SimpleAdapterDocument.java 471756 2006-11-06 15:01:43Z husted $
003:         *
004:         * Licensed to the Apache Software Foundation (ASF) under one
005:         * or more contributor license agreements.  See the NOTICE file
006:         * distributed with this work for additional information
007:         * regarding copyright ownership.  The ASF licenses this file
008:         * to you under the Apache License, Version 2.0 (the
009:         * "License"); you may not use this file except in compliance
010:         * with the License.  You may obtain a copy of the License at
011:         *
012:         *  http://www.apache.org/licenses/LICENSE-2.0
013:         *
014:         * Unless required by applicable law or agreed to in writing,
015:         * software distributed under the License is distributed on an
016:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017:         * KIND, either express or implied.  See the License for the
018:         * specific language governing permissions and limitations
019:         * under the License.
020:         */
021:        package org.apache.struts2.views.xslt;
022:
023:        import java.util.Arrays;
024:        import java.util.List;
025:
026:        import org.apache.struts2.StrutsException;
027:        import org.w3c.dom.Attr;
028:        import org.w3c.dom.CDATASection;
029:        import org.w3c.dom.Comment;
030:        import org.w3c.dom.DOMConfiguration;
031:        import org.w3c.dom.DOMException;
032:        import org.w3c.dom.DOMImplementation;
033:        import org.w3c.dom.Document;
034:        import org.w3c.dom.DocumentFragment;
035:        import org.w3c.dom.DocumentType;
036:        import org.w3c.dom.Element;
037:        import org.w3c.dom.EntityReference;
038:        import org.w3c.dom.Node;
039:        import org.w3c.dom.NodeList;
040:        import org.w3c.dom.ProcessingInstruction;
041:        import org.w3c.dom.Text;
042:
043:        /**
044:         * SimpleAdapterDocument adapted a Java object and presents it as
045:         * a Document.  This class represents the Document container and uses
046:         * the AdapterFactory to produce a child adapter for the wrapped object.
047:         * The adapter produced must be of an Element type or an exception is thrown.
048:         *
049:         * Note: in theory we could base this on AbstractAdapterElement and then allow
050:         * the wrapped object to be a more general Node type.  We would just use
051:         * ourselves as the root element.  However I don't think this is an issue as
052:         * people expect Documents to wrap Elements.
053:         */
054:        public class SimpleAdapterDocument extends AbstractAdapterNode
055:                implements  Document {
056:
057:            private Element rootElement;
058:
059:            public SimpleAdapterDocument(AdapterFactory adapterFactory,
060:                    AdapterNode parent, String propertyName, Object value) {
061:                setContext(adapterFactory, parent, propertyName, value);
062:
063:            }
064:
065:            public void setPropertyValue(Object prop) {
066:                super .setPropertyValue(prop);
067:                rootElement = null; // recreate the root element
068:            }
069:
070:            /**
071:             * Lazily construct the root element adapter from the value object.
072:             */
073:            private Element getRootElement() {
074:                if (rootElement != null)
075:                    return rootElement;
076:
077:                Node node = getAdapterFactory().adaptNode(this ,
078:                        getPropertyName(), getPropertyValue());
079:                if (node instanceof  Element)
080:                    rootElement = (Element) node;
081:                else
082:                    throw new StrutsException(
083:                            "Document adapter expected to wrap an Element type.  Node is not an element:"
084:                                    + node);
085:
086:                return rootElement;
087:            }
088:
089:            protected List<Node> getChildAdapters() {
090:                return Arrays.asList(new Node[] { getRootElement() });
091:            }
092:
093:            public NodeList getChildNodes() {
094:                return new NodeList() {
095:                    public Node item(int i) {
096:                        return getRootElement();
097:                    }
098:
099:                    public int getLength() {
100:                        return 1;
101:                    }
102:                };
103:            }
104:
105:            public DocumentType getDoctype() {
106:                return null;
107:            }
108:
109:            public Element getDocumentElement() {
110:                return getRootElement();
111:            }
112:
113:            public Element getElementById(String string) {
114:                return null;
115:            }
116:
117:            public NodeList getElementsByTagName(String string) {
118:                return null;
119:            }
120:
121:            public NodeList getElementsByTagNameNS(String string, String string1) {
122:                return null;
123:            }
124:
125:            public Node getFirstChild() {
126:                return getRootElement();
127:            }
128:
129:            public DOMImplementation getImplementation() {
130:                return null;
131:            }
132:
133:            public Node getLastChild() {
134:                return getRootElement();
135:            }
136:
137:            public String getNodeName() {
138:                return "#document";
139:            }
140:
141:            public short getNodeType() {
142:                return Node.DOCUMENT_NODE;
143:            }
144:
145:            public Attr createAttribute(String string) throws DOMException {
146:                return null;
147:            }
148:
149:            public Attr createAttributeNS(String string, String string1)
150:                    throws DOMException {
151:                return null;
152:            }
153:
154:            public CDATASection createCDATASection(String string)
155:                    throws DOMException {
156:                return null;
157:            }
158:
159:            public Comment createComment(String string) {
160:                return null;
161:            }
162:
163:            public DocumentFragment createDocumentFragment() {
164:                return null;
165:            }
166:
167:            public Element createElement(String string) throws DOMException {
168:                return null;
169:            }
170:
171:            public Element createElementNS(String string, String string1)
172:                    throws DOMException {
173:                return null;
174:            }
175:
176:            public EntityReference createEntityReference(String string)
177:                    throws DOMException {
178:                return null;
179:            }
180:
181:            public ProcessingInstruction createProcessingInstruction(
182:                    String string, String string1) throws DOMException {
183:                return null;
184:            }
185:
186:            public Text createTextNode(String string) {
187:                return null;
188:            }
189:
190:            public boolean hasChildNodes() {
191:                return true;
192:            }
193:
194:            public Node importNode(Node node, boolean b) throws DOMException {
195:                return null;
196:            }
197:
198:            public Node getChildAfter(Node child) {
199:                return null;
200:            }
201:
202:            public Node getChildBefore(Node child) {
203:                return null;
204:            }
205:
206:            // DOM level 3
207:
208:            public String getInputEncoding() {
209:                throw operationNotSupported();
210:            }
211:
212:            public String getXmlEncoding() {
213:                throw operationNotSupported();
214:            }
215:
216:            public boolean getXmlStandalone() {
217:                throw operationNotSupported();
218:            }
219:
220:            public void setXmlStandalone(boolean b) throws DOMException {
221:                throw operationNotSupported();
222:            }
223:
224:            public String getXmlVersion() {
225:                throw operationNotSupported();
226:            }
227:
228:            public void setXmlVersion(String string) throws DOMException {
229:                throw operationNotSupported();
230:            }
231:
232:            public boolean getStrictErrorChecking() {
233:                throw operationNotSupported();
234:            }
235:
236:            public void setStrictErrorChecking(boolean b) {
237:                throw operationNotSupported();
238:            }
239:
240:            public String getDocumentURI() {
241:                throw operationNotSupported();
242:            }
243:
244:            public void setDocumentURI(String string) {
245:                throw operationNotSupported();
246:            }
247:
248:            public Node adoptNode(Node node) throws DOMException {
249:                throw operationNotSupported();
250:            }
251:
252:            public DOMConfiguration getDomConfig() {
253:                throw operationNotSupported();
254:            }
255:
256:            public void normalizeDocument() {
257:                throw operationNotSupported();
258:            }
259:
260:            public Node renameNode(Node node, String string, String string1)
261:                    throws DOMException {
262:                return null;
263:            }
264:            // end DOM level 3
265:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.