1 19 20 package org.netbeans.tax.dom; 21 22 import org.w3c.dom.*; 23 import org.netbeans.tax.*; 24 25 29 class TextImpl extends NodeImpl implements Text { 30 31 private final TreeText peer; 32 33 34 public TextImpl(TreeText peer) { 35 this.peer = peer; 36 } 37 38 46 public void appendData(String arg) throws DOMException { 47 throw new ROException(); 48 } 49 50 65 public void deleteData(int offset, int count) throws DOMException { 66 throw new ROException(); 67 } 68 69 84 public String getData() throws DOMException { 85 return peer.getData(); 86 } 87 88 93 public int getLength() { 94 return peer.getLength(); 95 } 96 97 100 public String getNodeName() { 101 return "#text"; 102 } 103 104 107 public short getNodeType() { 108 return Node.TEXT_NODE; 109 } 110 111 121 public String getNodeValue() throws DOMException { 122 return getData(); 123 } 124 125 133 public Node getParentNode() { 134 135 TreeParentNode parent = peer.getParentNode(); 136 if (parent instanceof TreeElement) { 137 return Wrapper.wrap((TreeElement) parent); 138 } else if (parent instanceof TreeDocumentRoot) { 139 return Wrapper.wrap((TreeDocumentRoot) parent); 140 } 141 return null; 142 } 143 144 154 public void insertData(int offset, String arg) throws DOMException { 155 throw new ROException(); 156 } 157 158 177 public void replaceData(int offset, int count, String arg) throws DOMException { 178 throw new ROException(); 179 } 180 181 196 public void setData(String data) throws DOMException { 197 throw new ROException(); 198 } 199 200 217 public Text splitText(int offset) throws DOMException { 218 throw new ROException(); 219 } 220 221 236 public String substringData(int offset, int count) throws DOMException { 237 try { 238 return peer.substringData(offset, count); 239 } catch (InvalidArgumentException ex) { 240 throw new UOException(); 241 } 242 } 243 244 248 public Node getPreviousSibling() { 249 return Children.getPreviousSibling(peer); 250 } 251 252 256 public Node getNextSibling() { 257 return Children.getNextSibling(peer); 258 } 259 260 } 261 | Popular Tags |