1 19 package org.openide.text; 20 21 import javax.swing.event.DocumentListener ; 22 import javax.swing.event.UndoableEditListener ; 23 import javax.swing.text.*; 24 25 26 28 34 public class FilterDocument extends Object implements StyledDocument { 35 36 private static Element leaf; 37 38 39 protected Document original; 40 41 44 public FilterDocument(Document original) { 45 this.original = original; 46 } 47 48 51 public int getLength() { 52 return original.getLength(); 53 } 54 55 56 public void addDocumentListener(DocumentListener l) { 57 original.addDocumentListener(l); 58 } 59 60 61 public void removeDocumentListener(DocumentListener l) { 62 original.removeDocumentListener(l); 63 } 64 65 66 public void addUndoableEditListener(UndoableEditListener listener) { 67 original.addUndoableEditListener(listener); 68 } 69 70 71 public void removeUndoableEditListener(UndoableEditListener listener) { 72 original.removeUndoableEditListener(listener); 73 } 74 75 76 public Object getProperty(Object key) { 77 return original.getProperty(key); 78 } 79 80 81 public void putProperty(Object key, Object value) { 82 original.putProperty(key, value); 83 } 84 85 86 public void remove(int offset, int len) throws BadLocationException { 87 original.remove(offset, len); 88 } 89 90 91 public void insertString(int offset, String str, AttributeSet a) 92 throws BadLocationException { 93 original.insertString(offset, str, a); 94 } 95 96 97 public String getText(int offset, int len) throws BadLocationException { 98 return original.getText(offset, len); 99 } 100 101 102 public void getText(int offset, int len, Segment txt) 103 throws BadLocationException { 104 original.getText(offset, len, txt); 105 } 106 107 108 public Position getStartPosition() { 109 return original.getStartPosition(); 110 } 111 112 113 public Position getEndPosition() { 114 return original.getEndPosition(); 115 } 116 117 118 public Position createPosition(int offset) throws BadLocationException { 119 return original.createPosition(offset); 120 } 121 122 123 public Element[] getRootElements() { 124 return original.getRootElements(); 125 } 126 127 128 public Element getDefaultRootElement() { 129 return original.getDefaultRootElement(); 130 } 131 132 135 public void render(Runnable r) { 136 original.render(r); 137 } 138 139 143 159 public Style addStyle(String nm, Style parent) { 160 return null; 161 } 162 163 168 public void removeStyle(String nm) { 169 } 170 171 177 public Style getStyle(String nm) { 178 return null; 179 } 180 181 200 public void setCharacterAttributes(int offset, int length, AttributeSet s, boolean replace) { 201 } 202 203 216 public void setParagraphAttributes(int offset, int length, AttributeSet s, boolean replace) { 217 } 218 219 230 public void setLogicalStyle(int pos, Style s) { 231 } 232 233 239 public Style getLogicalStyle(int p) { 240 return null; 241 } 242 243 250 public Element getParagraphElement(int pos) { 251 return getLeafElement(); 252 } 253 254 261 public Element getCharacterElement(int pos) { 262 return getLeafElement(); 263 } 264 265 273 public java.awt.Color getForeground(AttributeSet attr) { 274 return java.awt.Color.black; 275 } 276 277 285 public java.awt.Color getBackground(AttributeSet attr) { 286 return java.awt.Color.white; 287 } 288 289 298 public java.awt.Font getFont(AttributeSet attr) { 299 return null; 300 } 301 302 304 private static Element getLeafElement() { 305 if (leaf != null) { 306 return leaf; 307 } 308 309 AbstractDocument doc = new javax.swing.text.html.HTMLDocument (); 310 311 return leaf = doc.new LeafElement(null, null, 0, 0); 312 } 313 } 314 | Popular Tags |