Class marimba.text.Text
All Packages Class Hierarchy This Package Previous Next Index
Class marimba.text.Text
java.lang.Object
|
+----marimba.text.Text
- public class Text
- extends Object
This class implements a text object. This stores information about
the actual bytes/chars in the text as well as any style information.
TextView provides a view onto this text, and, of course, there can
be multiple views onto a single text widget.
- Version:
- 1.20, 12/15/96
- Author:
- Jonathan Payne
-
count
- Number of characters in this buffer.
-
data
- The actual characters.
-
styles
- The style references in this document.
-
Text()
-
-
Text(int)
-
-
addView(TextView)
- Adds a new text view to views.
-
applyStyleChange(StyleChange, int, int)
-
-
applyStyleChangeCheck(StyleChange, int, int)
- Applies a style change to the range from POS0 to POS1.
-
byteAt(int)
- Returns the byte at POS.
-
clear()
- Deletes all the text in the buffer.
-
delete(int, int)
- Deletes N bytes starting at POS0.
-
deleteStyles(int, int)
- Deletes all styles in the range from POS0 to POS1.
-
deleteWhiteSpace(int)
- Deletes all the white space around POS.
-
getBeginningOfLine(int)
- Returns the position that is the beginning of the line
containing pos.
-
getBytes()
- Returns the byte array.
-
getColumnFor(int)
- Returns the indent of a line, in character positions, for the
specified POS.
-
getEndOfLine(int)
- Returns the position that is the end of the line containing pos.
-
getIndent(int)
- Moves to the indent (first non white space character) in line
containing POS.
-
getLinePos(int)
- Return the position of the Nth line in the buffer.
-
getLinePos(int, int)
- Returns the position of the beginning of the nth line from the
specified pos.
-
getNextLine(int)
- Returns the position of the beginning of the next line.
-
getNextWord(int, int)
- Moves forward or backward a word (Emacs style).
-
getNextWordStart(int)
-
-
getPosFor(int, int)
- Returns the buffer position that hits the specified column on
the line containing POS.
-
getRichText()
- Returns a "rich text" representation of the text.
-
getStyles()
-
-
getWordEnd(int, int)
- Returns the position that is the end (or beginning if direction
< 0) of the word that POS is part of.
-
indentTo(int, int)
- Indent to the specified destination column, starting at the
specified position, using the smallest combination of Tabs and
Spaces as possible.
-
insert(byte[], int, int, int)
- Inserts LENGTH bytes from BYTES at offset OFF into this text
buffer at POS.
-
insert(InputStream, int)
- Inserts stream IN at POS, until EOF is reached.
-
insert(int, int)
- Inserts character C at POS into this text.
-
insert(String, int)
- Inserts string S at POS.
-
insert(String, int, int)
- Inserts LENGTH characters of string S at POS.
-
isDigit(int)
-
-
isLetter(int)
-
-
isWordChar(int)
-
-
length()
- Returns the length of the text.
-
notifyDelete(int, int)
- Notifies views of a deletion just before it occurs.
-
notifyDeleteAfter(int, int)
- Notifies views of a deletion after the fact.
-
notifyDirtyRegion(int, int)
- Notifies views that a region of characters have changed (due to
a style change, most likely).
-
notifyInsert(int, int)
- Notifies views of an insertion.
-
removeView(TextView)
- Removes a text view from views.
-
scan(int, int, int)
- Searches for the first instance of the specified character C,
starting from POS, in the specified direction.
-
search(String, int, int)
- Searches for string S starting at POS moving forward if
DIRECTION is > 0, backwards otherwise.
-
setRichText(String)
- Sets the value of the text from a "rich text" representation.
-
skipWhiteSpace(int, int)
- Skips over white space.
-
substring(int)
- Returns contents of the text from POS0 to the end as a string.
-
substring(int, int)
- Returns contents of the text from POS0 to POS1 as a string.
-
toString()
- Returns the entire text object as a String.
data
protected byte data[]
- The actual characters.
count
protected int count
- Number of characters in this buffer.
styles
protected StylePool styles
- The style references in this document.
Text
public Text(int size)
Text
public Text()
isLetter
public static boolean isLetter(int c)
isDigit
public static boolean isDigit(int c)
isWordChar
public static boolean isWordChar(int c)
getStyles
public StylePool getStyles()
addView
protected void addView(TextView view)
- Adds a new text view to views.
removeView
protected void removeView(TextView view)
- Removes a text view from views.
notifyInsert
protected void notifyInsert(int pos,
int count)
- Notifies views of an insertion.
notifyDelete
protected void notifyDelete(int pos,
int count)
- Notifies views of a deletion just before it occurs.
notifyDeleteAfter
protected void notifyDeleteAfter(int pos,
int count)
- Notifies views of a deletion after the fact.
notifyDirtyRegion
protected void notifyDirtyRegion(int pos0,
int pos1)
- Notifies views that a region of characters have changed (due to
a style change, most likely).
insert
public synchronized void insert(String s,
int pos)
- Inserts string S at POS.
insert
public synchronized void insert(String s,
int pos,
int length)
- Inserts LENGTH characters of string S at POS.
insert
public synchronized void insert(byte bytes[],
int off,
int length,
int pos)
- Inserts LENGTH bytes from BYTES at offset OFF into this text
buffer at POS.
insert
public synchronized void insert(int c,
int pos)
- Inserts character C at POS into this text.
insert
public synchronized void insert(InputStream in,
int pos) throws IOException
- Inserts stream IN at POS, until EOF is reached.
delete
public synchronized void delete(int pos0,
int n)
- Deletes N bytes starting at POS0.
clear
public void clear()
- Deletes all the text in the buffer.
substring
public synchronized String substring(int pos0,
int pos1)
- Returns contents of the text from POS0 to POS1 as a string.
substring
public synchronized String substring(int pos0)
- Returns contents of the text from POS0 to the end as a string.
toString
public synchronized String toString()
- Returns the entire text object as a String.
- Overrides:
- toString in class Object
getBytes
public final byte[] getBytes()
- Returns the byte array.
scan
public final synchronized int scan(int c,
int pos,
int direction)
- Searches for the first instance of the specified character C,
starting from POS, in the specified direction. If DIRECTION is
> 0 , the search is forward; otherwise it's backward.
Returns -1 if there's no such character. When the direction is
backward, the scan starts at the character before POS. When
the direction is forward, the scan starts at POS.
search
public final synchronized int search(String s,
int pos,
int direction)
- Searches for string S starting at POS moving forward if
DIRECTION is > 0, backwards otherwise. Returns -1 if no such
string is found.
length
public final int length()
- Returns the length of the text.
byteAt
public final synchronized int byteAt(int pos)
- Returns the byte at POS.
applyStyleChange
public synchronized void applyStyleChange(StyleChange sc,
int pos0,
int pos1)
applyStyleChangeCheck
public synchronized boolean applyStyleChangeCheck(StyleChange sc,
int pos0,
int pos1)
- Applies a style change to the range from POS0 to POS1.
deleteStyles
public synchronized void deleteStyles(int pos0,
int pos1)
- Deletes all styles in the range from POS0 to POS1.
getRichText
public synchronized String getRichText()
- Returns a "rich text" representation of the text.
setRichText
public synchronized void setRichText(String s)
- Sets the value of the text from a "rich text" representation.
getBeginningOfLine
public synchronized int getBeginningOfLine(int pos)
- Returns the position that is the beginning of the line
containing pos.
getEndOfLine
public synchronized int getEndOfLine(int pos)
- Returns the position that is the end of the line containing pos.
getNextLine
public synchronized int getNextLine(int pos)
- Returns the position of the beginning of the next line.
If pos is on the last line, returns -1.
getLinePos
public synchronized int getLinePos(int pos,
int n)
- Returns the position of the beginning of the nth line from the
specified pos.
getLinePos
public int getLinePos(int n)
- Return the position of the Nth line in the buffer.
getWordEnd
public synchronized int getWordEnd(int pos,
int direction)
- Returns the position that is the end (or beginning if direction
< 0) of the word that POS is part of. If POS is not part of a
word, the position is unchanged.
getNextWord
public synchronized int getNextWord(int pos,
int direction)
- Moves forward or backward a word (Emacs style). Returns the
new position.
getNextWordStart
public synchronized int getNextWordStart(int pos)
getColumnFor
public synchronized int getColumnFor(int pos)
- Returns the indent of a line, in character positions, for the
specified POS.
getPosFor
public synchronized int getPosFor(int column,
int pos)
- Returns the buffer position that hits the specified column on
the line containing POS.
skipWhiteSpace
public synchronized int skipWhiteSpace(int pos,
int direction)
- Skips over white space.
getIndent
public synchronized int getIndent(int pos)
- Moves to the indent (first non white space character) in line
containing POS.
deleteWhiteSpace
public synchronized int deleteWhiteSpace(int pos)
- Deletes all the white space around POS. Returns the resulting
buffer position.
indentTo
public synchronized int indentTo(int pos,
int destcol)
- Indent to the specified destination column, starting at the
specified position, using the smallest combination of Tabs and
Spaces as possible.
All Packages Class Hierarchy This Package Previous Next Index