| java.lang.Object javax.swing.text.AbstractDocument org.netbeans.editor.BaseDocument
All known Subclasses: org.netbeans.editor.GuardedDocument,
Inner Class :class LineRootElement implements Element | |
Inner Class :class LineElement implements Element | |
Inner Class :public interface PropertyEvaluator | |
Constructor Summary | |
public | BaseDocument(Class kitClass, boolean addToRegistry) Create base document with a specified syntax. |
Method Summary | |
public boolean | addLayer(DrawLayer layer, int visibility) | final public synchronized void | atomicLock() | final public synchronized void | atomicUnlock() | final public void | breakAtomicLock() Break the atomic lock so that doc is no longer in atomic mode. | protected BaseDocumentEvent | createDocumentEvent(int pos, int length, DocumentEvent.EventType type) | public Position | createPosition(int offset, Position.Bias bias) | final public synchronized void | extWriteLock() Extended write locking of the document allowing reentrant write lock
acquiring. | final public synchronized void | extWriteUnlock() Extended write unlocking. | public int | find(Finder finder, int startPos, int limitPos) Find something in document using a finder. | public DrawLayer | findLayer(String layerName) | protected void | fireChangedUpdate(DocumentEvent e) | protected void | fireInsertUpdate(DocumentEvent e) | protected void | fireRemoveUpdate(DocumentEvent e) | public synchronized Annotations | getAnnotations() Returns object which represent list of annotations which are attached to
this document. | final protected int | getAtomicDepth() | public synchronized Bookmarks | getBookmarks() Returns object which represent list of annotations which are attached to
this document. | public char[] | getChars(int pos, int len) | public char[] | getChars(int[] block) | public void | getChars(int pos, char ret, int offset, int len) | public Element | getDefaultRootElement() | final DrawLayerList | getDrawLayerList() | public Formatter | getFormatter() Get the formatter for this document. | Syntax | getFreeSyntax() | final public Class | getKitClass() | final public int | getLength() Length of document. | public int | getNextBookmark(int pos, boolean wrap) Get the position of the next bookmark. | public Element | getParagraphElement(int pos) | public Element[] | getRootElements() | public int | getShiftWidth() Get the width of one indentation level. | int | getStoredPosition(int posID) | public SyntaxSupport | getSyntaxSupport() | public int | getTabSize() Get the number of spaces the TAB character ('\t') visually represents. | public String | getText(int[] block) | public void | insertString(int offset, String text, AttributeSet a) | public void | invalidateSyntaxMarks() Invalidate the state-infos in all the syntax-marks in the whole document.
The Syntax can call this method if it changes its internal state in the
way that affects the future returned tokens. | final public boolean | isAtomicLock() Is the document currently atomically locked? It's not synced as this
method must be called only from writer thread. | public boolean | isIdentifierPart(char ch) | public boolean | isModified() | public boolean | isWhitespace(char ch) | protected void | preInsertCheck(int offset, String text, AttributeSet a) This method is called automatically before the document insertion occurs
and can be used to revoke the insertion before it occurs by throwing the
BadLocationException. | protected void | preRemoveCheck(int offset, int len) This method is called automatically before the document removal occurs
and can be used to revoke the removal before it occurs by throwing the
BadLocationException. | public void | print(PrintContainer container) | public int | processText(TextBatchProcessor tbp, int startPos, int endPos) Perform any generic text processing. | public void | read(Reader reader, int pos) Insert contents of reader at specified position into document. | void | releaseSyntax(Syntax syntax) | public void | remove(int offset, int len) | void | removeStoredPosition(int posID) | public void | render(Runnable r) Runs the runnable under read lock. | public void | repaintBlock(int startOffset, int endOffset) Fire the change event to repaint the given block of text. | public void | resetUndoMerge() This method prohibits merging of the next document modification with the
previous one even if it would be normally possible. | public void | runAtomic(Runnable r) Runs the runnable under write lock. | public void | runAtomicAsUser(Runnable r) Runs the runnable under write lock. | public void | settingsChange(SettingsChangeEvent evt) Called when settings were changed. | int | storePosition(int pos) Create the mark for the given position and store it in the list. | public String | toString() | public String | toStringDetail() | public boolean | toggleBookmark(int pos) | public void | write(Writer writer, int pos, int len) Write part of the document into specified writer. |
BLOCKS_FINDER_PROP | final public static String BLOCKS_FINDER_PROP(Code) | | Highlight search finder property.
|
FILE_NAME_PROP | final public static String FILE_NAME_PROP(Code) | | File name property
|
ID_PROP | final public static String ID_PROP(Code) | | Registry identification property
|
KIT_CLASS_PROP | final public static String KIT_CLASS_PROP(Code) | | Kit class property. This can become useful for getting the settings that
logicaly belonging to the document.
|
LINE_BATCH_SIZE | final public static String LINE_BATCH_SIZE(Code) | | Size of the line batch. Line batch can be used at various places
especially when processing lines by syntax scanner.
|
LINE_LIMIT_PROP | final public static String LINE_LIMIT_PROP(Code) | | Maximum line width encountered during the initial read operation. This is
filled by Analyzer and used by UI to set the correct initial width of the
component. Values: java.lang.Integer
|
LS_CR | final public static String LS_CR(Code) | | Line separator is marked by CR (Macintosh)
|
LS_CRLF | final public static String LS_CRLF(Code) | | Line separator is marked by CR and LF (Windows)
|
LS_LF | final public static String LS_LF(Code) | | Line separator is marked by LF (Unix)
|
READ_LINE_SEPARATOR_PROP | final public static String READ_LINE_SEPARATOR_PROP(Code) | | Line separator property for reading files in
|
STRING_BWD_FINDER_PROP | final public static String STRING_BWD_FINDER_PROP(Code) | | String backward finder property
|
STRING_FINDER_PROP | final public static String STRING_FINDER_PROP(Code) | | String forward finder property
|
UNDO_MANAGER_PROP | final public static String UNDO_MANAGER_PROP(Code) | | Undo manager property. This can be used to implement undo in a simple
way. Default undo and redo actions try to get this property and perform
undo and redo through it.
|
WRAP_SEARCH_MARK_PROP | final public static String WRAP_SEARCH_MARK_PROP(Code) | | Wrap search mark property
|
WRITE_LINE_SEPARATOR_PROP | final public static String WRITE_LINE_SEPARATOR_PROP(Code) | | Line separator property for writing content into files. If not set the
writing defaults to the READ_LINE_SEPARATOR_PROP.
|
defaultRootElem | protected BaseElement defaultRootElem(Code) | | Default element - lazily inited
|
inited | protected boolean inited(Code) | | |
lastModifyUndoEdit | UndoableEdit lastModifyUndoEdit(Code) | | Last document event to be undone. The field is filled by the lastly done
modification undoable edit. BaseDocumentEvent.canUndo() checks this flag.
|
lineRootElement | protected LineRootElement lineRootElement(Code) | | Root element of line elements representation
|
modified | protected boolean modified(Code) | | |
op | DocOp op(Code) | | Document operations support class for this document. It presents the base
synchronization level for most of the operations. Some of the operations
are available through Utilities class.
|
undoMergeReset | boolean undoMergeReset(Code) | | Reset merging next created undoable edit to the last one.
|
BaseDocument | public BaseDocument(Class kitClass, boolean addToRegistry)(Code) | | Create base document with a specified syntax.
Parameters: kitClass - class used to initialize this document with proper settingscategory based on the editor kit for which this document iscreated Parameters: syntax - syntax scanner to use with this document |
atomicLock | final public synchronized void atomicLock()(Code) | | |
atomicUnlock | final public synchronized void atomicUnlock()(Code) | | |
breakAtomicLock | final public void breakAtomicLock()(Code) | | Break the atomic lock so that doc is no longer in atomic mode. All the
performed changes are rolled back automatically. Even after calling this
method, the atomicUnlock() must still be called. This method is not
synced as it must be called only from writer thread.
|
extWriteLock | final public synchronized void extWriteLock()(Code) | | Extended write locking of the document allowing reentrant write lock
acquiring.
|
extWriteUnlock | final public synchronized void extWriteUnlock()(Code) | | Extended write unlocking.
See Also: extWriteLock() |
find | public int find(Finder finder, int startPos, int limitPos) throws BadLocationException(Code) | | Find something in document using a finder.
Parameters: finder - finder to be used for the search Parameters: startPos - position in the document where the search will start Parameters: limitPos - position where the search will be end with reporting thatnothing was found. |
getAnnotations | public synchronized Annotations getAnnotations()(Code) | | Returns object which represent list of annotations which are attached to
this document.
object which represent attached annotations |
getAtomicDepth | final protected int getAtomicDepth()(Code) | | |
getBookmarks | public synchronized Bookmarks getBookmarks()(Code) | | Returns object which represent list of annotations which are attached to
this document.
object which represent attached annotations |
getDefaultRootElement | public Element getDefaultRootElement()(Code) | | Return default root element
|
getFormatter | public Formatter getFormatter()(Code) | | Get the formatter for this document.
|
getLength | final public int getLength()(Code) | | Length of document.
number of characters >= 0 |
getNextBookmark | public int getNextBookmark(int pos, boolean wrap) throws BadLocationException(Code) | | Get the position of the next bookmark.
position of the next bookmark or -1 if there is no mark |
getParagraphElement | public Element getParagraphElement(int pos)(Code) | | |
getRootElements | public Element[] getRootElements()(Code) | | Return array of root elements - usually only one
|
getShiftWidth | public int getShiftWidth()(Code) | | Get the width of one indentation level. The algorithm first checks
whether there's a value for the INDENT_SHIFT_WIDTH setting. If so it uses
it, otherwise it uses formatter.getSpacesPerTab() .
See Also: getTabSize() See Also: Formatter.getSpacesPerTab() |
getStoredPosition | int getStoredPosition(int posID)(Code) | | |
getTabSize | public int getTabSize()(Code) | | Get the number of spaces the TAB character ('\t') visually represents.
This is related to SettingsNames.TAB_SIZE setting.
|
invalidateSyntaxMarks | public void invalidateSyntaxMarks()(Code) | | Invalidate the state-infos in all the syntax-marks in the whole document.
The Syntax can call this method if it changes its internal state in the
way that affects the future returned tokens. The syntax-state-info in all
the marks is reset and it will be lazily restored when necessary.
|
isAtomicLock | final public boolean isAtomicLock()(Code) | | Is the document currently atomically locked? It's not synced as this
method must be called only from writer thread.
|
isIdentifierPart | public boolean isIdentifierPart(char ch)(Code) | | |
isModified | public boolean isModified()(Code) | | Was the document modified by either insert/remove but not the initial
read)?
|
isWhitespace | public boolean isWhitespace(char ch)(Code) | | |
preInsertCheck | protected void preInsertCheck(int offset, String text, AttributeSet a) throws BadLocationException(Code) | | This method is called automatically before the document insertion occurs
and can be used to revoke the insertion before it occurs by throwing the
BadLocationException.
Parameters: offset - position where the insertion will be done Parameters: text - string to be inserted Parameters: a - attributes of the inserted text |
preRemoveCheck | protected void preRemoveCheck(int offset, int len) throws BadLocationException(Code) | | This method is called automatically before the document removal occurs
and can be used to revoke the removal before it occurs by throwing the
BadLocationException.
Parameters: offset - position where the insertion will be done Parameters: len - length of the removal |
processText | public int processText(TextBatchProcessor tbp, int startPos, int endPos) throws BadLocationException(Code) | | Perform any generic text processing. The advantage of this method is that
it allows the text to processed in line batches. The initial size of the
batch is given by the SettingsNames.LINE_BATCH_SIZE. The
TextBatchProcessor.processTextBatch() method is called for every text
batch. If the method returns true, it means the processing should
continue with the next batch of text which will have double line count
compared to the previous one. This guarantees there will be not too many
batches so the processing should be more efficient.
Parameters: tbp - text batch processor to be used to process the text batches Parameters: startPos - starting position of the processing. Parameters: endPos - ending position of the processing. This can be -1 to signalthe end of document. If the endPos is lower than startPos thenthe batches are created in the backward direction. the returned value from the last tpb.processTextBatch() call. The-1 will be returned for (startPos == endPos). |
read | public void read(Reader reader, int pos) throws IOException, BadLocationException(Code) | | Insert contents of reader at specified position into document.
Parameters: reader - reader from which data will be read Parameters: pos - on which position that data will be inserted |
removeStoredPosition | void removeStoredPosition(int posID)(Code) | | |
render | public void render(Runnable r)(Code) | | Runs the runnable under read lock.
|
repaintBlock | public void repaintBlock(int startOffset, int endOffset)(Code) | | Fire the change event to repaint the given block of text.
|
resetUndoMerge | public void resetUndoMerge()(Code) | | This method prohibits merging of the next document modification with the
previous one even if it would be normally possible.
|
runAtomic | public void runAtomic(Runnable r)(Code) | | Runs the runnable under write lock. This is a stronger version of the
runAtomicAsUser() method, because if there any locked sections in the
documents this methods breaks the modification locks and modifies the
document. If there are any excpeptions thrown during the processing of
the runnable, all the document modifications are rolled back
automatically.
|
runAtomicAsUser | public void runAtomicAsUser(Runnable r)(Code) | | Runs the runnable under write lock. If there are any excpeptions thrown
during the processing of the runnable, all the document modifications are
rolled back automatically.
|
settingsChange | public void settingsChange(SettingsChangeEvent evt)(Code) | | Called when settings were changed. The method is called also in
constructor, so the code must count with the evt being null.
|
storePosition | int storePosition(int pos) throws BadLocationException(Code) | | Create the mark for the given position and store it in the list. The
position can be later retrieved through its ID.
|
toStringDetail | public String toStringDetail()(Code) | | Detailed debug info about the document
|
write | public void write(Writer writer, int pos, int len) throws IOException, BadLocationException(Code) | | Write part of the document into specified writer.
Parameters: writer - writer into which data will be written. Parameters: pos - from which position get the data Parameters: len - how many characters write |
Methods inherited from javax.swing.text.AbstractDocument | public void addDocumentListener(DocumentListener listener)(Code)(Java Doc) public void addUndoableEditListener(UndoableEditListener listener)(Code)(Java Doc) protected Element createBranchElement(Element parent, AttributeSet a)(Code)(Java Doc) protected Element createLeafElement(Element parent, AttributeSet a, int p0, int p1)(Code)(Java Doc) public synchronized Position createPosition(int offs) throws BadLocationException(Code)(Java Doc) public void dump(PrintStream out)(Code)(Java Doc) protected void fireChangedUpdate(DocumentEvent e)(Code)(Java Doc) protected void fireInsertUpdate(DocumentEvent e)(Code)(Java Doc) protected void fireRemoveUpdate(DocumentEvent e)(Code)(Java Doc) protected void fireUndoableEditUpdate(UndoableEditEvent e)(Code)(Java Doc) public int getAsynchronousLoadPriority()(Code)(Java Doc) final protected AttributeContext getAttributeContext()(Code)(Java Doc) public Element getBidiRootElement()(Code)(Java Doc) final protected Content getContent()(Code)(Java Doc) final protected synchronized Thread getCurrentWriter()(Code)(Java Doc) abstract public Element getDefaultRootElement()(Code)(Java Doc) public DocumentFilter getDocumentFilter()(Code)(Java Doc) public DocumentListener[] getDocumentListeners()(Code)(Java Doc) public Dictionary<Object, Object> getDocumentProperties()(Code)(Java Doc) final public Position getEndPosition()(Code)(Java Doc) public int getLength()(Code)(Java Doc) public T[] getListeners(Class<T> listenerType)(Code)(Java Doc) abstract public Element getParagraphElement(int pos)(Code)(Java Doc) final public Object getProperty(Object key)(Code)(Java Doc) public Element[] getRootElements()(Code)(Java Doc) final public Position getStartPosition()(Code)(Java Doc) public String getText(int offset, int length) throws BadLocationException(Code)(Java Doc) public void getText(int offset, int length, Segment txt) throws BadLocationException(Code)(Java Doc) public UndoableEditListener[] getUndoableEditListeners()(Code)(Java Doc) public void insertString(int offs, String str, AttributeSet a) throws BadLocationException(Code)(Java Doc) protected void insertUpdate(DefaultDocumentEvent chng, AttributeSet attr)(Code)(Java Doc) protected void postRemoveUpdate(DefaultDocumentEvent chng)(Code)(Java Doc) final public void putProperty(Object key, Object value)(Code)(Java Doc) final public synchronized void readLock()(Code)(Java Doc) final public synchronized void readUnlock()(Code)(Java Doc) public void remove(int offs, int len) throws BadLocationException(Code)(Java Doc) public void removeDocumentListener(DocumentListener listener)(Code)(Java Doc) public void removeUndoableEditListener(UndoableEditListener listener)(Code)(Java Doc) protected void removeUpdate(DefaultDocumentEvent chng)(Code)(Java Doc) public void render(Runnable r)(Code)(Java Doc) public void replace(int offset, int length, String text, AttributeSet attrs) throws BadLocationException(Code)(Java Doc) public void setAsynchronousLoadPriority(int p)(Code)(Java Doc) public void setDocumentFilter(DocumentFilter filter)(Code)(Java Doc) public void setDocumentProperties(Dictionary<Object, Object> x)(Code)(Java Doc) final protected synchronized void writeLock()(Code)(Java Doc) final protected synchronized void writeUnlock()(Code)(Java Doc)
|
|
|