001: /*
002: * $Id: ProxyTextNodeAdapter.java 471756 2006-11-06 15:01:43Z husted $
003: *
004: * Licensed to the Apache Software Foundation (ASF) under one
005: * or more contributor license agreements. See the NOTICE file
006: * distributed with this work for additional information
007: * regarding copyright ownership. The ASF licenses this file
008: * to you under the Apache License, Version 2.0 (the
009: * "License"); you may not use this file except in compliance
010: * with the License. You may obtain a copy of the License at
011: *
012: * http://www.apache.org/licenses/LICENSE-2.0
013: *
014: * Unless required by applicable law or agreed to in writing,
015: * software distributed under the License is distributed on an
016: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017: * KIND, either express or implied. See the License for the
018: * specific language governing permissions and limitations
019: * under the License.
020: */
021: package org.apache.struts2.views.xslt;
022:
023: import org.w3c.dom.DOMException;
024: import org.w3c.dom.Text;
025:
026: /**
027: * ProxyTextNodeAdapter is a pass-through adapter for objects which already
028: * implement the Text interface. All methods are proxied to the underlying
029: * Node except getParent(), getNextSibling() and getPreviousSibling(), which
030: * are implemented by the abstract adapter node to work with the parent adapter.
031: */
032: public class ProxyTextNodeAdapter extends ProxyNodeAdapter implements
033: Text {
034:
035: public ProxyTextNodeAdapter(AdapterFactory factory,
036: AdapterNode parent, Text value) {
037: super (factory, parent, value);
038: }
039:
040: // convenience
041: Text text() {
042: return (Text) getPropertyValue();
043: }
044:
045: public String toString() {
046: return "ProxyTextNode for: " + text();
047: }
048:
049: public Text splitText(int offset) throws DOMException {
050: throw new UnsupportedOperationException();
051: }
052:
053: public int getLength() {
054: return text().getLength();
055: }
056:
057: public void deleteData(int offset, int count) throws DOMException {
058: throw new UnsupportedOperationException();
059: }
060:
061: public String getData() throws DOMException {
062: return text().getData();
063: }
064:
065: public String substringData(int offset, int count)
066: throws DOMException {
067: return text().substringData(offset, count);
068: }
069:
070: public void replaceData(int offset, int count, String arg)
071: throws DOMException {
072: throw new UnsupportedOperationException();
073: }
074:
075: public void insertData(int offset, String arg) throws DOMException {
076: throw new UnsupportedOperationException();
077: }
078:
079: public void appendData(String arg) throws DOMException {
080: throw new UnsupportedOperationException();
081: }
082:
083: public void setData(String data) throws DOMException {
084: throw new UnsupportedOperationException();
085: }
086:
087: // DOM level 3
088:
089: public boolean isElementContentWhitespace() {
090: throw operationNotSupported();
091: }
092:
093: public String getWholeText() {
094: throw operationNotSupported();
095: }
096:
097: public Text replaceWholeText(String string) throws DOMException {
098: throw operationNotSupported();
099: }
100: }
|