|
org.netbeans.modules.editor.lib/1 1.14.0 3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.text.AbstractDocument
org.netbeans.editor.BaseDocument
public class BaseDocument
Document implementation
Nested Class Summary | |
---|---|
protected static class |
BaseDocument.LazyPropertyMap
|
static interface |
BaseDocument.PropertyEvaluator
Property evaluator is useful for lazy evaluation of properties of the document when javax.swing.text.Document#getProperty(java.lang.String)
is called. |
Nested classes/interfaces inherited from class javax.swing.text.AbstractDocument |
---|
AbstractDocument.AbstractElement, AbstractDocument.AttributeContext, AbstractDocument.BranchElement, AbstractDocument.Content, AbstractDocument.DefaultDocumentEvent, AbstractDocument.ElementEdit, AbstractDocument.LeafElement |
Field Summary | |
---|---|
static String |
BLOCKS_FINDER_PROP
Highlight search finder property. |
protected Element |
defaultRootElem
Default element - lazily inited |
static String |
FILE_NAME_PROP
File name property |
static String |
ID_PROP
Registry identification property |
protected boolean |
inited
|
static String |
KIT_CLASS_PROP
Kit class property. |
static String |
LINE_BATCH_SIZE
Size of the line batch. |
static String |
LINE_LIMIT_PROP
Maximum line width encountered during the initial read operation. |
protected org.netbeans.editor.LineRootElement |
lineRootElement
Root element of line elements representation |
static String |
LS_CR
Line separator is marked by CR (Macintosh) |
static String |
LS_CRLF
Line separator is marked by CR and LF (Windows) |
static String |
LS_LF
Line separator is marked by LF (Unix) |
protected boolean |
modified
|
static String |
READ_LINE_SEPARATOR_PROP
Line separator property for reading files in |
static String |
STRING_BWD_FINDER_PROP
String backward finder property |
static String |
STRING_FINDER_PROP
String forward finder property |
static ThreadLocal |
THREAD_LOCAL_LOCK_DEPTH
|
static String |
UNDO_MANAGER_PROP
Undo manager property. |
static String |
WRAP_SEARCH_MARK_PROP
Wrap search mark property |
static String |
WRITE_LINE_SEPARATOR_PROP
Line separator property for writing content into files. |
Fields inherited from class javax.swing.text.AbstractDocument |
---|
BAD_LOCATION, BidiElementName, ContentElementName, ElementNameAttribute, listenerList, ParagraphElementName, SectionElementName |
Fields inherited from interface javax.swing.text.Document |
---|
StreamDescriptionProperty, TitleProperty |
Constructor Summary | |
---|---|
BaseDocument(Class kitClass,
boolean addToRegistry)
Create base document with a specified syntax. |
Method Summary | |
---|---|
void |
addAtomicLockListener(AtomicLockListener l)
|
void |
addDocumentListener(DocumentListener listener)
|
boolean |
addLayer(DrawLayer layer,
int visibility)
Deprecated. Please use Highlighting SPI instead, for details see Editor Library 2. |
void |
atomicLock()
|
void |
atomicUndo()
|
void |
atomicUnlock()
|
void |
breakAtomicLock()
Break the atomic lock so that doc is no longer in atomic mode. |
void |
checkTrailingSpaces(int offset)
|
protected BaseDocumentEvent |
createDocumentEvent(int pos,
int length,
DocumentEvent.EventType type)
|
protected Dictionary |
createDocumentProperties(Dictionary origDocumentProperties)
|
Position |
createPosition(int offset,
Position.Bias bias)
Create biased position in document |
void |
extWriteLock()
Extended write locking of the document allowing reentrant write lock acquiring. |
void |
extWriteUnlock()
Extended write unlocking. |
int |
find(Finder finder,
int startPos,
int limitPos)
Find something in document using a finder. |
DrawLayer |
findLayer(String layerName)
Deprecated. Please use Highlighting SPI instead, for details see Editor Library 2. |
protected void |
fireChangedUpdate(DocumentEvent e)
|
protected void |
fireInsertUpdate(DocumentEvent e)
|
protected void |
fireRemoveUpdate(DocumentEvent e)
|
protected void |
fireUndoableEditUpdate(UndoableEditEvent e)
|
Annotations |
getAnnotations()
Returns object which represent list of annotations which are attached to this document. |
protected int |
getAtomicDepth()
|
char[] |
getChars(int[] block)
|
void |
getChars(int pos,
char[] ret,
int offset,
int len)
|
char[] |
getChars(int pos,
int len)
|
Element |
getDefaultRootElement()
Return default root element |
Formatter |
getFormatter()
Get the formatter for this document. |
Class |
getKitClass()
|
Element |
getParagraphElement(int pos)
|
Element[] |
getRootElements()
Return array of root elements - usually only one |
int |
getShiftWidth()
Get the width of one indentation level. |
SyntaxSupport |
getSyntaxSupport()
|
int |
getTabSize()
Get the number of spaces the TAB character ('\t') visually represents. |
CharSeq |
getText()
|
String |
getText(int[] block)
|
void |
insertString(int offset,
String text,
AttributeSet a)
Inserts string into document |
protected void |
insertUpdate(AbstractDocument.DefaultDocumentEvent chng,
AttributeSet attr)
|
void |
invalidateSyntaxMarks()
Invalidate the state-infos in all the syntax-marks in the whole document. |
boolean |
isAtomicLock()
Is the document currently atomically locked? It's not synced as this method must be called only from writer thread. |
boolean |
isIdentifierPart(char ch)
|
boolean |
isModified()
Was the document modified by either insert/remove but not the initial read)? |
boolean |
isWhitespace(char ch)
|
protected void |
postRemoveUpdate(AbstractDocument.DefaultDocumentEvent chng)
|
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 |
preInsertUpdate(AbstractDocument.DefaultDocumentEvent chng,
AttributeSet attr)
|
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. |
void |
print(PrintContainer container)
|
void |
print(PrintContainer container,
boolean usePrintColoringMap,
boolean lineNumberEnabled,
int startOffset,
int endOffset)
Print into given container. |
void |
print(PrintContainer container,
boolean usePrintColoringMap,
Boolean lineNumberEnabled,
int startOffset,
int endOffset)
Print into given container. |
int |
processText(TextBatchProcessor tbp,
int startPos,
int endPos)
Perform any generic text processing. |
void |
read(Reader reader,
int pos)
Insert contents of reader at specified position into document. |
void |
remove(int offset,
int len)
Removes portion of a document |
void |
removeAtomicLockListener(AtomicLockListener l)
|
void |
removeDocumentListener(DocumentListener listener)
|
protected void |
removeUpdate(AbstractDocument.DefaultDocumentEvent chng)
|
void |
render(Runnable r)
Runs the runnable under read lock. |
void |
repaintBlock(int startOffset,
int endOffset)
Fire the change event to repaint the given block of text. |
void |
resetUndoMerge()
This method prohibits merging of the next document modification with the previous one even if it would be normally possible. |
void |
runAtomic(Runnable r)
Runs the runnable under write lock. |
void |
runAtomicAsUser(Runnable r)
Runs the runnable under write lock. |
void |
setPostModificationDocumentListener(DocumentListener listener)
Set or clear a special document listener that gets notified after the modification and that is allowed to do further mutations to the document. |
void |
settingsChange(SettingsChangeEvent evt)
Called when settings were changed. |
String |
toString()
|
String |
toStringDetail()
Detailed debug info about the document |
void |
write(Writer writer,
int pos,
int len)
Write part of the document into specified writer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface javax.swing.text.Document |
---|
addUndoableEditListener, createPosition, getEndPosition, getLength, getProperty, getStartPosition, getText, getText, putProperty, removeUndoableEditListener |
Field Detail |
---|
public static final String ID_PROP
public static final String READ_LINE_SEPARATOR_PROP
public static final String WRITE_LINE_SEPARATOR_PROP
public static final String FILE_NAME_PROP
public static final String WRAP_SEARCH_MARK_PROP
public static final String UNDO_MANAGER_PROP
public static final String KIT_CLASS_PROP
public static final String STRING_FINDER_PROP
public static final String STRING_BWD_FINDER_PROP
public static final String BLOCKS_FINDER_PROP
public static final String LINE_LIMIT_PROP
public static final String LINE_BATCH_SIZE
public static final String LS_CR
public static final String LS_LF
public static final String LS_CRLF
public static final ThreadLocal THREAD_LOCAL_LOCK_DEPTH
protected boolean inited
protected boolean modified
protected Element defaultRootElem
protected org.netbeans.editor.LineRootElement lineRootElement
Constructor Detail |
---|
public BaseDocument(Class kitClass, boolean addToRegistry)
kitClass
- class used to initialize this document with proper settings
category based on the editor kit for which this document is createdsyntax
- syntax scanner to use with this documentMethod Detail |
---|
public CharSeq getText()
public void settingsChange(SettingsChangeEvent evt)
settingsChange
in interface SettingsChangeListener
public Formatter getFormatter()
public SyntaxSupport getSyntaxSupport()
public int processText(TextBatchProcessor tbp, int startPos, int endPos) throws BadLocationException
tbp
- text batch processor to be used to process the text batchesstartPos
- starting position of the processing.endPos
- ending position of the processing. This can be -1 to signal
the end of document. If the endPos is lower than startPos then the batches
are created in the backward direction.
BadLocationException
public boolean isIdentifierPart(char ch)
public boolean isWhitespace(char ch)
public void insertString(int offset, String text, AttributeSet a) throws BadLocationException
insertString
in interface Document
insertString
in class AbstractDocument
BadLocationException
public void checkTrailingSpaces(int offset)
public void remove(int offset, int len) throws BadLocationException
remove
in interface Document
remove
in class AbstractDocument
BadLocationException
protected void preInsertCheck(int offset, String text, AttributeSet a) throws BadLocationException
offset
- position where the insertion will be donetext
- string to be inserteda
- attributes of the inserted text
BadLocationException
protected void preRemoveCheck(int offset, int len) throws BadLocationException
offset
- position where the insertion will be donelen
- length of the removal
BadLocationException
protected void insertUpdate(AbstractDocument.DefaultDocumentEvent chng, AttributeSet attr)
insertUpdate
in class AbstractDocument
protected void preInsertUpdate(AbstractDocument.DefaultDocumentEvent chng, AttributeSet attr)
protected void removeUpdate(AbstractDocument.DefaultDocumentEvent chng)
removeUpdate
in class AbstractDocument
protected void postRemoveUpdate(AbstractDocument.DefaultDocumentEvent chng)
postRemoveUpdate
in class AbstractDocument
public String getText(int[] block) throws BadLocationException
BadLocationException
public char[] getChars(int pos, int len) throws BadLocationException
pos
- position of the first character to get.len
- number of characters to obtain.
BadLocationException
public char[] getChars(int[] block) throws BadLocationException
block
- two-element array with starting and ending offset
BadLocationException
public void getChars(int pos, char[] ret, int offset, int len) throws BadLocationException
pos
- position of the first character to get.ret
- destination arrayoffset
- offset in the destination array.len
- number of characters to obtain.
BadLocationException
public int find(Finder finder, int startPos, int limitPos) throws BadLocationException
finder
- finder to be used for the searchstartPos
- position in the document where the search will startlimitPos
- position where the search will be end with reporting
that nothing was found.
BadLocationException
public void repaintBlock(int startOffset, int endOffset)
public void print(PrintContainer container)
public void print(PrintContainer container, boolean usePrintColoringMap, boolean lineNumberEnabled, int startOffset, int endOffset)
container
- printing container into which the printing will be done.usePrintColoringMap
- use printing coloring settings instead
of the regular ones.lineNumberEnabled
- if set to false the line numbers will not be printed.
If set to true the visibility of line numbers depends on the settings
for the line number visibility.startOffset
- start offset of text to printendOffset
- end offset of text to printpublic void print(PrintContainer container, boolean usePrintColoringMap, Boolean lineNumberEnabled, int startOffset, int endOffset)
container
- printing container into which the printing will be done.usePrintColoringMap
- use printing coloring settings instead
of the regular ones.lineNumberEnabled
- if null, the visibility of line numbers is the same as it is given by settings
for the line number visibility, otherwise the visibility equals the boolean value of the parameterstartOffset
- start offset of text to printendOffset
- end offset of text to printpublic Position createPosition(int offset, Position.Bias bias) throws BadLocationException
BadLocationException
public Element[] getRootElements()
getRootElements
in interface Document
getRootElements
in class AbstractDocument
public Element getDefaultRootElement()
getDefaultRootElement
in interface Document
getDefaultRootElement
in class AbstractDocument
public void render(Runnable r)
render
in interface Document
render
in class AbstractDocument
public void runAtomic(Runnable r)
public void runAtomicAsUser(Runnable r)
public void read(Reader reader, int pos) throws IOException, BadLocationException
reader
- reader from which data will be readpos
- on which position that data will be inserted
IOException
BadLocationException
public void write(Writer writer, int pos, int len) throws IOException, BadLocationException
writer
- writer into which data will be written.pos
- from which position get the datalen
- how many characters write
IOException
BadLocationException
public void invalidateSyntaxMarks()
public int getTabSize()
SettingsNames.TAB_SIZE
setting.
public int getShiftWidth()
formatter.getSpacesPerTab()
.
getTabSize()
,
Formatter.getSpacesPerTab()
public final Class getKitClass()
public void resetUndoMerge()
protected void fireChangedUpdate(DocumentEvent e)
fireChangedUpdate
in class AbstractDocument
protected void fireInsertUpdate(DocumentEvent e)
fireInsertUpdate
in class AbstractDocument
protected void fireRemoveUpdate(DocumentEvent e)
fireRemoveUpdate
in class AbstractDocument
protected void fireUndoableEditUpdate(UndoableEditEvent e)
fireUndoableEditUpdate
in class AbstractDocument
public final void extWriteLock()
public final void extWriteUnlock()
extWriteLock()
public final void atomicLock()
atomicLock
in interface AtomicLockDocument
public final void atomicUnlock()
atomicUnlock
in interface AtomicLockDocument
public final boolean isAtomicLock()
public final void breakAtomicLock()
public void atomicUndo()
atomicUndo
in interface AtomicLockDocument
public void addAtomicLockListener(AtomicLockListener l)
addAtomicLockListener
in interface AtomicLockDocument
public void removeAtomicLockListener(AtomicLockListener l)
removeAtomicLockListener
in interface AtomicLockDocument
protected final int getAtomicDepth()
public void addDocumentListener(DocumentListener listener)
addDocumentListener
in interface Document
addDocumentListener
in class AbstractDocument
public void removeDocumentListener(DocumentListener listener)
removeDocumentListener
in interface Document
removeDocumentListener
in class AbstractDocument
protected BaseDocumentEvent createDocumentEvent(int pos, int length, DocumentEvent.EventType type)
public void setPostModificationDocumentListener(DocumentListener listener)
public boolean isModified()
public DrawLayer findLayer(String layerName)
DrawLayer
s
has been deprecated.
public boolean addLayer(DrawLayer layer, int visibility)
DrawLayer
s has been deprecated.
public Element getParagraphElement(int pos)
getParagraphElement
in class AbstractDocument
public Annotations getAnnotations()
protected Dictionary createDocumentProperties(Dictionary origDocumentProperties)
public String toString()
public String toStringDetail()
|
org.netbeans.modules.editor.lib/1 1.14.0 3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |