Source Code Cross Referenced for SimpleAdapterDocument.java in  » J2EE » webwork-2.2.6 » com » opensymphony » webwork » 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 » J2EE » webwork 2.2.6 » com.opensymphony.webwork.views.xslt 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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