001: /*
002: * Copyright 2007 Google Inc.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
005: * use this file except in compliance with the License. You may obtain a copy of
006: * the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
012: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
013: * License for the specific language governing permissions and limitations under
014: * the License.
015: */
016: package com.google.gwt.xml.client.impl;
017:
018: import com.google.gwt.core.client.JavaScriptException;
019: import com.google.gwt.core.client.JavaScriptObject;
020: import com.google.gwt.xml.client.CharacterData;
021: import com.google.gwt.xml.client.DOMException;
022:
023: /**
024: * This class implements the CharacterData interface.
025: */
026: abstract class CharacterDataImpl extends NodeImpl implements
027: CharacterData {
028:
029: protected CharacterDataImpl(JavaScriptObject o) {
030: super (o);
031: }
032:
033: /**
034: * This function delegates to the native method <code>appendData</code> in
035: * XMLParserImpl.
036: */
037: public void appendData(String arg) {
038: try {
039: XMLParserImpl.appendData(this .getJsObject(), arg);
040: } catch (JavaScriptException e) {
041: throw new DOMNodeException(
042: DOMException.INVALID_MODIFICATION_ERR, e, this );
043: }
044: }
045:
046: /**
047: * This function delegates to the native method <code>deleteData</code> in
048: * XMLParserImpl.
049: */
050: public void deleteData(int offset, int count) {
051: try {
052: XMLParserImpl.deleteData(this .getJsObject(), offset, count);
053: } catch (JavaScriptException e) {
054: throw new DOMNodeException(
055: DOMException.INVALID_MODIFICATION_ERR, e, this );
056: }
057: }
058:
059: /**
060: * This function delegates to the native method <code>getData</code> in
061: * XMLParserImpl.
062: */
063: public String getData() {
064: return XMLParserImpl.getData(this .getJsObject());
065: }
066:
067: /**
068: * This function delegates to the native method <code>getLength</code> in
069: * XMLParserImpl.
070: */
071: public int getLength() {
072: return XMLParserImpl.getLength(this .getJsObject());
073: }
074:
075: /**
076: * This function delegates to the native method <code>insertData</code> in
077: * XMLParserImpl.
078: */
079: public void insertData(int offset, String arg) {
080: try {
081: XMLParserImpl.insertData(this .getJsObject(), offset, arg);
082: } catch (JavaScriptException e) {
083: throw new DOMNodeException(
084: DOMException.INVALID_MODIFICATION_ERR, e, this );
085: }
086: }
087:
088: /**
089: * This function delegates to the native method <code>replaceData</code> in
090: * XMLParserImpl.
091: */
092: public void replaceData(int offset, int count, String arg) {
093: try {
094: XMLParserImpl.replaceData(this .getJsObject(), offset,
095: count, arg);
096: } catch (JavaScriptException e) {
097: throw new DOMNodeException(
098: DOMException.INVALID_MODIFICATION_ERR, e, this );
099: }
100: }
101:
102: /**
103: * This function delegates to the native method <code>setData</code> in
104: * XMLParserImpl.
105: */
106: public void setData(String data) {
107: try {
108: XMLParserImpl.setData(this .getJsObject(), data);
109: } catch (JavaScriptException e) {
110: throw new DOMNodeException(
111: DOMException.INVALID_MODIFICATION_ERR, e, this );
112: }
113: }
114:
115: /**
116: * This function delegates to the native method <code>substringData</code>
117: * in XMLParserImpl.
118: */
119: public String substringData(final int offset, final int count) {
120: try {
121: return XMLParserImpl.substringData(this .getJsObject(),
122: offset, count);
123: } catch (JavaScriptException e) {
124: throw new DOMNodeException(DOMException.INVALID_ACCESS_ERR,
125: e, this );
126: }
127: }
128:
129: @Override
130: public abstract String toString();
131: }
|