View Javadoc

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