org.apache.struts2.views.xslt
Class SimpleAdapterDocument

java.lang.Object
  extended by org.apache.struts2.views.xslt.AbstractAdapterNode
      extended by org.apache.struts2.views.xslt.SimpleAdapterDocument
All Implemented Interfaces:
AdapterNode, Document, Node

public class SimpleAdapterDocument
extends AbstractAdapterNode
implements Document

SimpleAdapterDocument adapted a Java object and presents it as a Document. This class represents the Document container and uses the AdapterFactory to produce a child adapter for the wrapped object. The adapter produced must be of an Element type or an exception is thrown. Note: in theory we could base this on AbstractAdapterElement and then allow the wrapped object to be a more general Node type. We would just use ourselves as the root element. However I don't think this is an issue as people expect Documents to wrap Elements.


Field Summary
private  Element rootElement
           
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Constructor Summary
SimpleAdapterDocument(AdapterFactory adapterFactory, AdapterNode parent, String propertyName, Object value)
           
 
Method Summary
 Node adoptNode(Node node)
           
 Attr createAttribute(String string)
           
 Attr createAttributeNS(String string, String string1)
           
 CDATASection createCDATASection(String string)
           
 Comment createComment(String string)
           
 DocumentFragment createDocumentFragment()
           
 Element createElement(String string)
           
 Element createElementNS(String string, String string1)
           
 EntityReference createEntityReference(String string)
           
 ProcessingInstruction createProcessingInstruction(String string, String string1)
           
 Text createTextNode(String string)
           
protected  List<Node> getChildAdapters()
          Lazily initialize child childAdapters
 Node getChildAfter(Node child)
          The child node after the specified sibling
 Node getChildBefore(Node child)
          The child node before the specified sibling
 NodeList getChildNodes()
           
 DocumentType getDoctype()
           
 Element getDocumentElement()
           
 String getDocumentURI()
           
 DOMConfiguration getDomConfig()
           
 Element getElementById(String string)
           
 NodeList getElementsByTagName(String string)
           
 NodeList getElementsByTagNameNS(String string, String string1)
           
 Node getFirstChild()
           
 DOMImplementation getImplementation()
           
 String getInputEncoding()
           
 Node getLastChild()
           
 String getNodeName()
           
 short getNodeType()
           
private  Element getRootElement()
          Lazily construct the root element adapter from the value object.
 boolean getStrictErrorChecking()
           
 String getXmlEncoding()
           
 boolean getXmlStandalone()
           
 String getXmlVersion()
           
 boolean hasChildNodes()
           
 Node importNode(Node node, boolean b)
           
 void normalizeDocument()
           
 Node renameNode(Node node, String string, String string1)
           
 void setDocumentURI(String string)
           
 void setPropertyValue(Object prop)
          The Java object (property) that we are adapting
 void setStrictErrorChecking(boolean b)
           
 void setXmlStandalone(boolean b)
           
 void setXmlVersion(String string)
           
 
Methods inherited from class org.apache.struts2.views.xslt.AbstractAdapterNode
appendChild, buildChildAdapters, cloneNode, compareDocumentPosition, getAdapterFactory, getAttributes, getBaseURI, getChildBeforeOrAfter, getFeature, getLocalName, getNamespaceURI, getNextSibling, getNodeValue, getOwnerDocument, getParent, getParentNode, getPrefix, getPreviousSibling, getPropertyName, getPropertyValue, getTextContent, getUserData, hasAttributes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, operationNotSupported, removeChild, replaceChild, setAdapterFactory, setContext, setNodeValue, setParent, setPrefix, setPropertyName, setTextContent, setUserData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getFeature, getLocalName, getNamespaceURI, getNextSibling, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData
 

Field Detail

rootElement

private Element rootElement
Constructor Detail

SimpleAdapterDocument

public SimpleAdapterDocument(AdapterFactory adapterFactory,
                             AdapterNode parent,
                             String propertyName,
                             Object value)
Method Detail

setPropertyValue

public void setPropertyValue(Object prop)
Description copied from interface: AdapterNode
The Java object (property) that we are adapting

Specified by:
setPropertyValue in interface AdapterNode
Overrides:
setPropertyValue in class AbstractAdapterNode

getRootElement

private Element getRootElement()
Lazily construct the root element adapter from the value object.


getChildAdapters

protected List<Node> getChildAdapters()
Description copied from class: AbstractAdapterNode
Lazily initialize child childAdapters

Overrides:
getChildAdapters in class AbstractAdapterNode

getChildNodes

public NodeList getChildNodes()
Specified by:
getChildNodes in interface Node
Overrides:
getChildNodes in class AbstractAdapterNode

getDoctype

public DocumentType getDoctype()
Specified by:
getDoctype in interface Document

getDocumentElement

public Element getDocumentElement()
Specified by:
getDocumentElement in interface Document

getElementById

public Element getElementById(String string)
Specified by:
getElementById in interface Document

getElementsByTagName

public NodeList getElementsByTagName(String string)
Specified by:
getElementsByTagName in interface Document
Overrides:
getElementsByTagName in class AbstractAdapterNode

getElementsByTagNameNS

public NodeList getElementsByTagNameNS(String string,
                                       String string1)
Specified by:
getElementsByTagNameNS in interface Document
Overrides:
getElementsByTagNameNS in class AbstractAdapterNode

getFirstChild

public Node getFirstChild()
Specified by:
getFirstChild in interface Node
Overrides:
getFirstChild in class AbstractAdapterNode

getImplementation

public DOMImplementation getImplementation()
Specified by:
getImplementation in interface Document

getLastChild

public Node getLastChild()
Specified by:
getLastChild in interface Node
Overrides:
getLastChild in class AbstractAdapterNode

getNodeName

public String getNodeName()
Specified by:
getNodeName in interface Node
Overrides:
getNodeName in class AbstractAdapterNode

getNodeType

public short getNodeType()
Specified by:
getNodeType in interface Node
Overrides:
getNodeType in class AbstractAdapterNode

createAttribute

public Attr createAttribute(String string)
                     throws DOMException
Specified by:
createAttribute in interface Document
Throws:
DOMException

createAttributeNS

public Attr createAttributeNS(String string,
                              String string1)
                       throws DOMException
Specified by:
createAttributeNS in interface Document
Throws:
DOMException

createCDATASection

public CDATASection createCDATASection(String string)
                                throws DOMException
Specified by:
createCDATASection in interface Document
Throws:
DOMException

createComment

public Comment createComment(String string)
Specified by:
createComment in interface Document

createDocumentFragment

public DocumentFragment createDocumentFragment()
Specified by:
createDocumentFragment in interface Document

createElement

public Element createElement(String string)
                      throws DOMException
Specified by:
createElement in interface Document
Throws:
DOMException

createElementNS

public Element createElementNS(String string,
                               String string1)
                        throws DOMException
Specified by:
createElementNS in interface Document
Throws:
DOMException

createEntityReference

public EntityReference createEntityReference(String string)
                                      throws DOMException
Specified by:
createEntityReference in interface Document
Throws:
DOMException

createProcessingInstruction

public ProcessingInstruction createProcessingInstruction(String string,
                                                         String string1)
                                                  throws DOMException
Specified by:
createProcessingInstruction in interface Document
Throws:
DOMException

createTextNode

public Text createTextNode(String string)
Specified by:
createTextNode in interface Document

hasChildNodes

public boolean hasChildNodes()
Specified by:
hasChildNodes in interface Node
Overrides:
hasChildNodes in class AbstractAdapterNode

importNode

public Node importNode(Node node,
                       boolean b)
                throws DOMException
Specified by:
importNode in interface Document
Throws:
DOMException

getChildAfter

public Node getChildAfter(Node child)
Description copied from interface: AdapterNode
The child node after the specified sibling

Specified by:
getChildAfter in interface AdapterNode
Overrides:
getChildAfter in class AbstractAdapterNode

getChildBefore

public Node getChildBefore(Node child)
Description copied from interface: AdapterNode
The child node before the specified sibling

Specified by:
getChildBefore in interface AdapterNode
Overrides:
getChildBefore in class AbstractAdapterNode

getInputEncoding

public String getInputEncoding()
Specified by:
getInputEncoding in interface Document

getXmlEncoding

public String getXmlEncoding()
Specified by:
getXmlEncoding in interface Document

getXmlStandalone

public boolean getXmlStandalone()
Specified by:
getXmlStandalone in interface Document

setXmlStandalone

public void setXmlStandalone(boolean b)
                      throws DOMException
Specified by:
setXmlStandalone in interface Document
Throws:
DOMException

getXmlVersion

public String getXmlVersion()
Specified by:
getXmlVersion in interface Document

setXmlVersion

public void setXmlVersion(String string)
                   throws DOMException
Specified by:
setXmlVersion in interface Document
Throws:
DOMException

getStrictErrorChecking

public boolean getStrictErrorChecking()
Specified by:
getStrictErrorChecking in interface Document

setStrictErrorChecking

public void setStrictErrorChecking(boolean b)
Specified by:
setStrictErrorChecking in interface Document

getDocumentURI

public String getDocumentURI()
Specified by:
getDocumentURI in interface Document

setDocumentURI

public void setDocumentURI(String string)
Specified by:
setDocumentURI in interface Document

adoptNode

public Node adoptNode(Node node)
               throws DOMException
Specified by:
adoptNode in interface Document
Throws:
DOMException

getDomConfig

public DOMConfiguration getDomConfig()
Specified by:
getDomConfig in interface Document

normalizeDocument

public void normalizeDocument()
Specified by:
normalizeDocument in interface Document

renameNode

public Node renameNode(Node node,
                       String string,
                       String string1)
                throws DOMException
Specified by:
renameNode in interface Document
Throws:
DOMException


Copyright © 2000-2009 Apache Software Foundation. All Rights Reserved.