KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > webwork > views > xslt > SimpleTextNode


1 /*
2  * Copyright (c) 2002-2003 by OpenSymphony
3  * All rights reserved.
4  */

5 package com.opensymphony.webwork.views.xslt;
6
7 import org.w3c.dom.DOMException JavaDoc;
8 import org.w3c.dom.Node JavaDoc;
9 import org.w3c.dom.Text JavaDoc;
10
11
12 /**
13  * @author <a HREF="mailto:meier@meisterbohne.de">Philipp Meier</a>
14  * Date: 10.10.2003
15  * Time: 19:45:12
16  */

17 public class SimpleTextNode extends DefaultAdapterNode implements Text JavaDoc, AdapterNode {
18     //~ Constructors ///////////////////////////////////////////////////////////
19

20     public SimpleTextNode(DOMAdapter rootAdapter, AdapterNode parent, String JavaDoc propertyName, Object JavaDoc value) {
21         super(rootAdapter, parent, propertyName, value);
22     }
23
24     //~ Methods ////////////////////////////////////////////////////////////////
25

26     public void setData(String JavaDoc string) throws DOMException JavaDoc {
27         throw new RuntimeException JavaDoc("Operation not supported");
28     }
29
30     public String JavaDoc getData() throws DOMException JavaDoc {
31         return getStringValue();
32     }
33
34     public int getLength() {
35         return getStringValue().length();
36     }
37
38     public String JavaDoc getNodeName() {
39         return "#text";
40     }
41
42     public short getNodeType() {
43         return Node.TEXT_NODE;
44     }
45
46     public String JavaDoc getNodeValue() throws DOMException JavaDoc {
47         return getStringValue();
48     }
49
50     public void appendData(String JavaDoc string) throws DOMException JavaDoc {
51         throw new RuntimeException JavaDoc("Operation not supported");
52     }
53
54     public void deleteData(int i, int i1) throws DOMException JavaDoc {
55         throw new RuntimeException JavaDoc("Operation not supported");
56     }
57
58     public void insertData(int i, String JavaDoc string) throws DOMException JavaDoc {
59         throw new RuntimeException JavaDoc("Operation not supported");
60     }
61
62     public void replaceData(int i, int i1, String JavaDoc string) throws DOMException JavaDoc {
63         throw new RuntimeException JavaDoc("Operation not supported");
64     }
65
66     public Text JavaDoc splitText(int i) throws DOMException JavaDoc {
67         throw new RuntimeException JavaDoc("Operation not supported");
68     }
69
70     public String JavaDoc substringData(int beginIndex, int endIndex) throws DOMException JavaDoc {
71         return getStringValue().substring(beginIndex, endIndex);
72     }
73
74     private String JavaDoc getStringValue() {
75         return getValue().toString();
76     }
77 }
78
Popular Tags