View Javadoc

1   /*
2    * $Id: ProxyTextNodeAdapter.java 440597 2006-09-06 03:34:39Z wsmoak $
3    *
4    * Copyright 2006 The Apache Software Foundation.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    *
10   *      http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  package org.apache.struts2.views.xslt;
19  
20  import org.w3c.dom.DOMException;
21  import org.w3c.dom.Text;
22  
23  /***
24   * ProxyTextNodeAdapter is a pass-through adapter for objects which already
25   * implement the Text interface.  All methods are proxied to the underlying
26   * Node except getParent(), getNextSibling() and getPreviousSibling(), which
27   * are implemented by the abstract adapter node to work with the parent adapter.
28   */
29  public class ProxyTextNodeAdapter extends ProxyNodeAdapter implements Text {
30  
31      public ProxyTextNodeAdapter(AdapterFactory factory, AdapterNode parent, Text value) {
32          super(factory, parent, value);
33      }
34  
35      // convenience
36      Text text() {
37          return (Text) getPropertyValue();
38      }
39  
40      public String toString() {
41          return "ProxyTextNode for: " + text();
42      }
43  
44      public Text splitText(int offset) throws DOMException {
45          throw new UnsupportedOperationException();
46      }
47  
48      public int getLength() {
49          return text().getLength();
50      }
51  
52      public void deleteData(int offset, int count) throws DOMException {
53          throw new UnsupportedOperationException();
54      }
55  
56      public String getData() throws DOMException {
57          return text().getData();
58      }
59  
60      public String substringData(int offset, int count) throws DOMException {
61          return text().substringData(offset, count);
62      }
63  
64      public void replaceData(int offset, int count, String arg) throws DOMException {
65          throw new UnsupportedOperationException();
66      }
67  
68      public void insertData(int offset, String arg) throws DOMException {
69          throw new UnsupportedOperationException();
70      }
71  
72      public void appendData(String arg) throws DOMException {
73          throw new UnsupportedOperationException();
74      }
75  
76      public void setData(String data) throws DOMException {
77          throw new UnsupportedOperationException();
78      }
79  
80      // DOM level 3
81  
82      public boolean isElementContentWhitespace() {
83          throw operationNotSupported();
84      }
85  
86      public String getWholeText() {
87          throw operationNotSupported();
88      }
89  
90      public Text replaceWholeText(String string) throws DOMException {
91          throw operationNotSupported();
92      }
93  }
94