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: * ProxyTextNodeAdapter is a pass-through adapter for objects which already
13: * implement the Text interface. All methods are proxied to the underlying
14: * Node except getParent(), getNextSibling() and getPreviousSibling(), 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: public class ProxyTextNodeAdapter extends ProxyNodeAdapter implements
20: Text {
21: private Log log = LogFactory.getLog(this .getClass());
22:
23: public ProxyTextNodeAdapter(AdapterFactory factory,
24: AdapterNode parent, Text value) {
25: super (factory, parent, value);
26: }
27:
28: // convenience
29: Text text() {
30: return (Text) getPropertyValue();
31: }
32:
33: public String toString() {
34: return "ProxyTextNode for: " + text();
35: }
36:
37: public Text splitText(int offset) throws DOMException {
38: throw new UnsupportedOperationException();
39: }
40:
41: public int getLength() {
42: return text().getLength();
43: }
44:
45: public void deleteData(int offset, int count) throws DOMException {
46: throw new UnsupportedOperationException();
47: }
48:
49: public String getData() throws DOMException {
50: return text().getData();
51: }
52:
53: public String substringData(int offset, int count)
54: throws DOMException {
55: return text().substringData(offset, count);
56: }
57:
58: public void replaceData(int offset, int count, String arg)
59: throws DOMException {
60: throw new UnsupportedOperationException();
61: }
62:
63: public void insertData(int offset, String arg) throws DOMException {
64: throw new UnsupportedOperationException();
65: }
66:
67: public void appendData(String arg) throws DOMException {
68: throw new UnsupportedOperationException();
69: }
70:
71: public void setData(String data) throws DOMException {
72: throw new UnsupportedOperationException();
73: }
74:
75: // DOM level 3
76:
77: public boolean isElementContentWhitespace() {
78: throw operationNotSupported();
79: }
80:
81: public String getWholeText() {
82: throw operationNotSupported();
83: }
84:
85: public Text replaceWholeText(String string) throws DOMException {
86: throw operationNotSupported();
87: }
88: }
|