1 19 20 package org.netbeans.modules.xml.text.syntax.dom; 21 22 import org.w3c.dom.*; 23 import org.netbeans.modules.xml.text.syntax.*; 24 import org.netbeans.modules.xml.spi.dom.*; 25 import org.netbeans.editor.*; 26 27 36 public class TextImpl extends SyntaxNode implements Text { 37 38 private AttrImpl parent; 40 41 44 public TextImpl(XMLSyntaxSupport support, TokenItem from, int to) { 45 super( support, from, to ); 46 } 47 48 51 TextImpl(XMLSyntaxSupport syntax, TokenItem from, AttrImpl parent) { 52 super( syntax, from, 0); 53 if (parent == null) throw new IllegalArgumentException (); 54 this.parent = parent; 55 } 56 57 60 public Node getParentNode() { 61 if (parent != null) { 62 return parent; 63 } else { 64 return super.getParentNode(); 65 } 66 } 67 68 public Node getPreviousSibling() { 69 if (parent == null) return super.getPreviousSibling(); 70 return parent.getPreviousSibling(this); 71 } 72 73 public Node getNextSibling() { 74 if (parent == null) return super.getNextSibling(); 75 return parent.getNextSibling(this); 76 } 77 78 public short getNodeType() { 79 return Node.TEXT_NODE; 80 } 81 82 public String getNodeValue() { 83 return getData(); 84 } 85 86 public Text splitText(int offset) { 87 throw new ROException(); 88 } 89 90 public String getData() { 91 return first.getImage(); 92 } 93 94 public void setData(String data) { 95 throw new ROException(); 96 } 97 98 public int getLength() { 99 return getData().length(); 100 } 101 102 public String substringData(int offset, int count) { 103 return getData().substring(offset, offset + count + 1); 104 } 105 106 public void appendData(String arg) { 107 throw new ROException(); 108 } 109 110 public void insertData(int offset, String arg) { 111 throw new ROException(); 112 } 113 114 115 public void deleteData(int offset, int count) { 116 throw new ROException(); 117 } 118 119 public void replaceData(int offset, int count, String arg) { 120 throw new ROException(); 121 } 122 123 124 127 public String toString() { 128 return "Text" + super.toString() + " value: '" + getNodeValue() + "'"; 129 } 130 131 132 } 133 134 | Popular Tags |