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: import org.apache.commons.logging.Log;
009: import org.apache.commons.logging.LogFactory;
010:
011: import java.util.Map;
012: import java.util.HashMap;
013:
014: /**
015: * AbstractAdapterElement extends the abstract Node type and implements
016: * the DOM Element interface.
017: *
018: * @author <a href="mailto:meier@meisterbohne.de">Philipp Meier</a>
019: * @author Pat Niemeyer (pat@pat.net)
020: */
021: public abstract class AbstractAdapterElement extends
022: AbstractAdapterNode implements Element {
023: //~ Instance fields ////////////////////////////////////////////////////////
024: private Log log = LogFactory.getLog(this .getClass());
025: private Map attributeAdapters;
026:
027: //~ Constructors ///////////////////////////////////////////////////////////
028:
029: public AbstractAdapterElement() {
030: }
031:
032: //~ Methods ////////////////////////////////////////////////////////////////
033:
034: public void setAttribute(String string, String string1)
035: throws DOMException {
036: throw operationNotSupported();
037: }
038:
039: protected Map getAttributeAdapters() {
040: if (attributeAdapters == null)
041: attributeAdapters = buildAttributeAdapters();
042: return attributeAdapters;
043: }
044:
045: protected Map buildAttributeAdapters() {
046: return new HashMap();
047: }
048:
049: /**
050: * No attributes, return empty attributes if asked.
051: */
052: public String getAttribute(String string) {
053: return "";
054: }
055:
056: public void setAttributeNS(String string, String string1,
057: String string2) throws DOMException {
058: throw operationNotSupported();
059: }
060:
061: public String getAttributeNS(String string, String string1) {
062: return null;
063: }
064:
065: public Attr setAttributeNode(Attr attr) throws DOMException {
066: throw operationNotSupported();
067: }
068:
069: public Attr getAttributeNode(String name) {
070: return (Attr) getAttributes().getNamedItem(name);
071: }
072:
073: public Attr setAttributeNodeNS(Attr attr) throws DOMException {
074: throw operationNotSupported();
075: }
076:
077: public Attr getAttributeNodeNS(String string, String string1) {
078: throw operationNotSupported();
079: }
080:
081: public String getNodeName() {
082: return getTagName();
083: }
084:
085: public short getNodeType() {
086: return Node.ELEMENT_NODE;
087: }
088:
089: public String getTagName() {
090: return getPropertyName();
091: }
092:
093: public boolean hasAttribute(String string) {
094: return false;
095: }
096:
097: public boolean hasAttributeNS(String string, String string1) {
098: return false;
099: }
100:
101: public boolean hasChildNodes() {
102: return getElementsByTagName("*").getLength() > 0;
103: }
104:
105: public void removeAttribute(String string) throws DOMException {
106: throw operationNotSupported();
107: }
108:
109: public void removeAttributeNS(String string, String string1)
110: throws DOMException {
111: throw operationNotSupported();
112: }
113:
114: public Attr removeAttributeNode(Attr attr) throws DOMException {
115: throw operationNotSupported();
116: }
117:
118: public void setIdAttributeNode(Attr attr, boolean b)
119: throws DOMException {
120: throw operationNotSupported();
121: }
122:
123: public TypeInfo getSchemaTypeInfo() {
124: throw operationNotSupported();
125: }
126:
127: public void setIdAttribute(String string, boolean b)
128: throws DOMException {
129: throw operationNotSupported();
130: }
131:
132: public void setIdAttributeNS(String string, String string1,
133: boolean b) throws DOMException {
134: throw operationNotSupported();
135: }
136:
137: }
|