01: /*
02: * Copyright (c) 2002-2006 by OpenSymphony
03: * All rights reserved.
04: */
05: package com.opensymphony.webwork.views.xslt;
06:
07: import org.apache.commons.logging.Log;
08: import org.apache.commons.logging.LogFactory;
09: import org.w3c.dom.*;
10:
11: /**
12: * ProxyAttrAdapter is a pass-through adapter for objects which already
13: * implement the Attr interface. All methods are proxied to the underlying
14: * Node except node traversal (e.g. getParent()) related methods which
15: * are implemented by the abstract adapter node to work with the parent adapter.
16: *
17: * @author Pat Niemeyer (pat@pat.net)
18: *
19: */
20: public class ProxyAttrAdapter extends ProxyNodeAdapter implements Attr {
21: private Log log = LogFactory.getLog(this .getClass());
22:
23: public ProxyAttrAdapter(AdapterFactory factory, AdapterNode parent,
24: Attr value) {
25: super (factory, parent, value);
26: }
27:
28: // convenience
29: protected Attr attr() {
30: return (Attr) getPropertyValue();
31: }
32:
33: // Proxied Attr methods
34:
35: public String getName() {
36: return attr().getName();
37: }
38:
39: public boolean getSpecified() {
40: return attr().getSpecified();
41: }
42:
43: public String getValue() {
44: return attr().getValue();
45: }
46:
47: public void setValue(String string) throws DOMException {
48: throw new UnsupportedOperationException();
49: }
50:
51: public Element getOwnerElement() {
52: return (Element) getParent();
53: }
54:
55: // DOM level 3
56:
57: public TypeInfo getSchemaTypeInfo() {
58: throw operationNotSupported();
59: }
60:
61: public boolean isId() {
62: throw operationNotSupported();
63: }
64:
65: // end DOM level 3
66:
67: // End Proxied Attr methods
68:
69: public String toString() {
70: return "ProxyAttribute for: " + attr();
71: }
72: }
|