FileDocCategorySizeDatePackage
SimpleAdapterDocument.javaAPI DocExample7246Mon Jul 23 13:26:44 BST 2007org.apache.struts2.views.xslt

SimpleAdapterDocument

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.

Fields Summary
private Element
rootElement
Constructors Summary
public SimpleAdapterDocument(AdapterFactory adapterFactory, AdapterNode parent, String propertyName, Object value)

        setContext(adapterFactory, parent, propertyName, value);

    
Methods Summary
public org.w3c.dom.NodeadoptNode(org.w3c.dom.Node node)

        throw operationNotSupported();
    
public org.w3c.dom.AttrcreateAttribute(java.lang.String string)

        return null;
    
public org.w3c.dom.AttrcreateAttributeNS(java.lang.String string, java.lang.String string1)

        return null;
    
public org.w3c.dom.CDATASectioncreateCDATASection(java.lang.String string)

        return null;
    
public org.w3c.dom.CommentcreateComment(java.lang.String string)

        return null;
    
public org.w3c.dom.DocumentFragmentcreateDocumentFragment()

        return null;
    
public org.w3c.dom.ElementcreateElement(java.lang.String string)

        return null;
    
public org.w3c.dom.ElementcreateElementNS(java.lang.String string, java.lang.String string1)

        return null;
    
public org.w3c.dom.EntityReferencecreateEntityReference(java.lang.String string)

        return null;
    
public org.w3c.dom.ProcessingInstructioncreateProcessingInstruction(java.lang.String string, java.lang.String string1)

        return null;
    
public org.w3c.dom.TextcreateTextNode(java.lang.String string)

        return null;
    
protected java.util.ListgetChildAdapters()

        return Arrays.asList(new Node[]{getRootElement()});
    
public org.w3c.dom.NodegetChildAfter(org.w3c.dom.Node child)

        return null;
    
public org.w3c.dom.NodegetChildBefore(org.w3c.dom.Node child)

        return null;
    
public org.w3c.dom.NodeListgetChildNodes()

        return new NodeList() {
            public Node item(int i) {
                return getRootElement();
            }

            public int getLength() {
                return 1;
            }
        };
    
public org.w3c.dom.DocumentTypegetDoctype()

        return null;
    
public org.w3c.dom.ElementgetDocumentElement()

        return getRootElement();
    
public java.lang.StringgetDocumentURI()

        throw operationNotSupported();
    
public org.w3c.dom.DOMConfigurationgetDomConfig()

        throw operationNotSupported();
    
public org.w3c.dom.ElementgetElementById(java.lang.String string)

        return null;
    
public org.w3c.dom.NodeListgetElementsByTagName(java.lang.String string)

        return null;
    
public org.w3c.dom.NodeListgetElementsByTagNameNS(java.lang.String string, java.lang.String string1)

        return null;
    
public org.w3c.dom.NodegetFirstChild()

        return getRootElement();
    
public org.w3c.dom.DOMImplementationgetImplementation()

        return null;
    
public java.lang.StringgetInputEncoding()

        throw operationNotSupported();
    
public org.w3c.dom.NodegetLastChild()

        return getRootElement();
    
public java.lang.StringgetNodeName()

        return "#document";
    
public shortgetNodeType()

        return Node.DOCUMENT_NODE;
    
private org.w3c.dom.ElementgetRootElement()
Lazily construct the root element adapter from the value object.

        if (rootElement != null)
            return rootElement;

        Node node = getAdapterFactory().adaptNode(
                this, getPropertyName(), getPropertyValue());
        if (node instanceof Element)
            rootElement = (Element) node;
        else
            throw new StrutsException(
                    "Document adapter expected to wrap an Element type.  Node is not an element:" + node);

        return rootElement;
    
public booleangetStrictErrorChecking()

        throw operationNotSupported();
    
public java.lang.StringgetXmlEncoding()

        throw operationNotSupported();
    
public booleangetXmlStandalone()

        throw operationNotSupported();
    
public java.lang.StringgetXmlVersion()

        throw operationNotSupported();
    
public booleanhasChildNodes()

        return true;
    
public org.w3c.dom.NodeimportNode(org.w3c.dom.Node node, boolean b)

        return null;
    
public voidnormalizeDocument()

        throw operationNotSupported();
    
public org.w3c.dom.NoderenameNode(org.w3c.dom.Node node, java.lang.String string, java.lang.String string1)

        return null;
    
public voidsetDocumentURI(java.lang.String string)

        throw operationNotSupported();
    
public voidsetPropertyValue(java.lang.Object prop)

        super.setPropertyValue(prop);
        rootElement = null; // recreate the root element
    
public voidsetStrictErrorChecking(boolean b)

        throw operationNotSupported();
    
public voidsetXmlStandalone(boolean b)

        throw operationNotSupported();
    
public voidsetXmlVersion(java.lang.String string)

        throw operationNotSupported();