01: /*
02: * Copyright (c) 2002-2003 by OpenSymphony
03: * All rights reserved.
04: */
05: package com.opensymphony.webwork.views.xslt;
06:
07: import org.w3c.dom.DOMException;
08: import org.w3c.dom.Node;
09: import org.w3c.dom.Text;
10: import com.opensymphony.webwork.WebWorkException;
11:
12: /**
13: * @author <a href="mailto:meier@meisterbohne.de">Philipp Meier</a>
14: * @author Pat Niemeyer (pat@pat.net)
15: */
16: public class SimpleTextNode extends AbstractAdapterNode implements
17: Node, Text {
18: //~ Constructors ///////////////////////////////////////////////////////////
19:
20: public SimpleTextNode(AdapterFactory rootAdapterFactory,
21: AdapterNode parent, String propertyName, Object value) {
22: setContext(rootAdapterFactory, parent, propertyName, value);
23: }
24:
25: //~ Methods ////////////////////////////////////////////////////////////////
26:
27: protected String getStringValue() {
28: return getPropertyValue().toString();
29: }
30:
31: public void setData(String string) throws DOMException {
32: throw new WebWorkException("Operation not supported");
33: }
34:
35: public String getData() throws DOMException {
36: return getStringValue();
37: }
38:
39: public int getLength() {
40: return getStringValue().length();
41: }
42:
43: public String getNodeName() {
44: return "#text";
45: }
46:
47: public short getNodeType() {
48: return Node.TEXT_NODE;
49: }
50:
51: public String getNodeValue() throws DOMException {
52: return getStringValue();
53: }
54:
55: public void appendData(String string) throws DOMException {
56: throw new WebWorkException("Operation not supported");
57: }
58:
59: public void deleteData(int i, int i1) throws DOMException {
60: throw new WebWorkException("Operation not supported");
61: }
62:
63: public void insertData(int i, String string) throws DOMException {
64: throw new WebWorkException("Operation not supported");
65: }
66:
67: public void replaceData(int i, int i1, String string)
68: throws DOMException {
69: throw new WebWorkException("Operation not supported");
70: }
71:
72: public Text splitText(int i) throws DOMException {
73: throw new WebWorkException("Operation not supported");
74: }
75:
76: public String substringData(int beginIndex, int endIndex)
77: throws DOMException {
78: return getStringValue().substring(beginIndex, endIndex);
79: }
80:
81: // DOM level 3
82:
83: public boolean isElementContentWhitespace() {
84: throw operationNotSupported();
85: }
86:
87: public String getWholeText() {
88: throw operationNotSupported();
89: }
90:
91: public Text replaceWholeText(String string) throws DOMException {
92: throw operationNotSupported();
93: }
94: // end DOM level 3
95:
96: }
|