public class SwingBuffer extends Buffer
Modifier and Type | Field and Description |
---|---|
BufferContent |
content |
javax.swing.text.Caret |
curPosition |
static javax.swing.text.Style |
defaultStyle |
javax.swing.text.DefaultStyledDocument |
doc |
javax.swing.text.Style |
inputStyle |
javax.swing.text.StyledDocument |
modelineDocument |
static javax.swing.text.Style |
redStyle |
static javax.swing.text.StyleContext |
styles |
activeKeymaps, buffers, fileBuffers, markMarker, pointMarker
noInts
ATTRIBUTE_VALUE, BOOLEAN_VALUE, CDATA_VALUE, CHAR_VALUE, COMMENT_VALUE, DOCUMENT_VALUE, DOUBLE_VALUE, ELEMENT_VALUE, EOF_VALUE, eofValue, FLOAT_VALUE, INT_S16_VALUE, INT_S32_VALUE, INT_S64_VALUE, INT_S8_VALUE, INT_U16_VALUE, INT_U32_VALUE, INT_U64_VALUE, INT_U8_VALUE, OBJECT_VALUE, PRIM_VALUE, PROCESSING_INSTRUCTION_VALUE, TEXT_BYTE_VALUE
Constructor and Description |
---|
SwingBuffer(java.lang.String name) |
SwingBuffer(java.lang.String name,
BufferContent content) |
Modifier and Type | Method and Description |
---|---|
int |
createPos(int index,
boolean isAfter)
Generate a position at a given index.
|
Char |
get(int index)
See java.util.List.
|
int |
getDot() |
int |
getLength() |
CharSeq |
getStringContent() |
void |
insert(int index,
java.lang.String string,
java.lang.Object style) |
void |
insert(java.lang.String string,
java.lang.Object style) |
void |
insert(java.lang.String string,
java.lang.Object style,
int ipos)
Insert string with given style at position pair.
|
void |
insertChar(int ch,
int count)
Insert count copies of ch at point.
|
void |
insertFile(java.io.Reader in) |
void |
invoke(java.lang.Runnable doRun)
This is intended for Runnable's that may affect the state of the buffer.
|
int |
lineStartOffset(int offset) |
int |
maxDot() |
int |
nextIndex(int ipos)
Get the offset from the beginning corresponding to a position cookie.
|
gnu.kawa.io.InPort |
openReader(int start,
int count) |
void |
redrawModeline() |
void |
removeChar(int count) |
void |
removePos(int ipos,
int count)
Remove one or more elements.
|
void |
removeRegion(int start,
int end) |
void |
restorePointMark(long pointMark) |
void |
save(java.io.Writer out) |
long |
savePointMark() |
long |
scan(char target,
int start,
int end,
int count,
boolean allowQuit)
Search in BUF for COUNT instances of the character TARGET between START and END.
|
void |
setDot(int i)
Set the current position (point) (0-origin).
|
int |
size()
See java.util.List.
|
backwardChar, charAt, charWidth, checkMark, coerceBuffer, countColumns, currentColumn, currentColumn, display, findFile, forwardChar, forwardLine, forwardLine, generateNewBufferName, getBuffer, getChars, getCurrent, getFileName, getLocalKeymap, getMarkMarker, getName, getPath, getPoint, getPointMarker, getReadOnly, insert, insert, insertAll, insertChar, insertFile, length, lineStartOffset, makeBufferLocal, minDot, moveToColumn, positionToOffset, removeAll, save, setCharacterAt, setCharAt, setCurrent, setFileName, setLocalKeymap, setPath, setPoint, setReadOnly, subSequence, toString, writeTo, writeTo
add, add, addAll, addAll, addPos, asImmutable, badRank, boundedHash, checkCanWrite, checkRank, clear, compare, compare, compare, consume, consume, consumeNext, consumePosRange, contains, containsAll, copyPos, createRelativePos, effectiveIndex, effectiveIndex, effectiveIndex, effectiveIndex, effectiveIndex, elements, endPos, equals, equals, fill, fill, fillPosRange, firstAttributePos, firstChildPos, firstChildPos, fromEndIndex, get, get, get, get, getAttribute, getAttributeLength, getBooleanRaw, getByteRaw, getCharRaw, getContainingSequenceSize, getDoubleRaw, getElementKind, getFloatRaw, getIndexDifference, getInt, getInt, getInt, getInt, getInt, getIntRaw, getIterator, getIterator, getIteratorAtPos, getLongRaw, getLowBound, getNextKind, getNextTypeName, getNextTypeObject, getPosNext, getPosPrevious, getRaw, getRowMajor, getShortRaw, getSize, getSize, gotoAttributesStart, gotoChildrenStart, gotoParent, hashCode, hasNext, hasPrevious, indexOf, isAfterPos, isEmpty, iterator, lastIndexOf, listIterator, listIterator, nextIndex, nextMatching, nextPos, parentPos, previousPos, rank, releasePos, remove, remove, removeAll, removePosRange, retainAll, set, set, setAt, setBuffer, setPosNext, setPosPrevious, setRaw, stableCompare, startPos, subList, subSequence, subSequencePos, toArray, toArray, toString, unsupported, unsupportedException
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
add, add, addAll, addAll, clear, contains, containsAll, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, sort, spliterator, subList, toArray, toArray
consume
boundedHash
public javax.swing.text.DefaultStyledDocument doc
public javax.swing.text.Caret curPosition
public BufferContent content
public javax.swing.text.StyledDocument modelineDocument
public static javax.swing.text.StyleContext styles
public static javax.swing.text.Style defaultStyle
public javax.swing.text.Style inputStyle
public static javax.swing.text.Style redStyle
public SwingBuffer(java.lang.String name)
public SwingBuffer(java.lang.String name, BufferContent content)
public void removeRegion(int start, int end)
removeRegion
in class Buffer
public void removeChar(int count)
removeChar
in class Buffer
public void removePos(int ipos, int count)
AbstractSequence
removePos
in class AbstractSequence<Char>
ipos
- position where elements should be removedcount
- if non-negative, remove that number of elements
following (poses, posNumber); if negative the negative of the number
of elements to remove before (poses, posNumber).public void save(java.io.Writer out) throws java.lang.Exception
public void insertChar(int ch, int count)
Buffer
insertChar
in class Buffer
public void insert(int index, java.lang.String string, java.lang.Object style)
public void insert(java.lang.String string, java.lang.Object style)
public void insert(java.lang.String string, java.lang.Object style, int ipos)
Buffer
public void insertFile(java.io.Reader in) throws java.lang.Exception
insertFile
in class Buffer
java.lang.Exception
public void redrawModeline()
redrawModeline
in class Buffer
public long scan(char target, int start, int end, int count, boolean allowQuit)
Buffer
END >= START
is required.
If COUNT is negative, search backwards for the -COUNTth instance;
inn this case END <= START
is required.
If COUNT is zero, do anything you please; run rogue, for all I care.
If END is zero, use beginning or end of (FIXME: accessible part of)
the buffer, as appropriate for the direction indicated by COUNT.
If we find COUNT instances, SHORTAGE is zero, and return the
position after the COUNTth match. Note that for reverse motion
this is not the same as the usual convention for Emacs motion commands.
If we don't find COUNT instances before reaching END, set SHORTAGE
to the number of TARGETs left unfound,
and return (shortage<<32|END)
.public int lineStartOffset(int offset)
lineStartOffset
in class Buffer
public void setDot(int i)
Buffer
public CharSeq getStringContent()
getStringContent
in class Buffer
public int createPos(int index, boolean isAfter)
AbstractSequence
createPos
in class AbstractSequence<Char>
index
- offset from beginning of desired positionisAfter
- should the position have the isAfter propertypublic int size()
Sequence
public int nextIndex(int ipos)
AbstractSequence
nextIndex
in class AbstractSequence<Char>
public long savePointMark()
savePointMark
in class Buffer
public void restorePointMark(long pointMark)
restorePointMark
in class Buffer
public gnu.kawa.io.InPort openReader(int start, int count)
openReader
in class Buffer
public void invoke(java.lang.Runnable doRun)
Buffer
invoke
in class Buffer
Buffer.invoke(java.lang.Runnable)