|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.zaval.data.Text
This class is an implementation of TextModel
interface. It uses simple text
representation - a line is considered to be terminated by a line feed ('\n').
Constructor Summary | |
Text(java.lang.String s)
Constructs a new text with the given text. |
Method Summary | |
void |
addTextListener(TextListener l)
Adds the specified text listener. |
int |
getExtraChar(int i)
Gets special extra char that is used to store extra information by the specified index. |
java.lang.String |
getLine(int line)
Returns the line at the specified line number. |
int |
getSize()
Returns the line number of the text. |
java.lang.String |
getText()
Returns the original text data that have been set with setText method. |
int |
getTextLength()
Returns the text length. |
protected java.util.Vector |
parse(char[] buffer)
Parses the specified text buffer and returns a vector of the text lines. |
void |
remove(int offset,
int size)
Removes a text at the specified offset with the size. |
void |
removeTextListener(TextListener l)
Removes the specified text listener. |
void |
setExtraChar(int i,
int ch)
Sets special extra char that is used to store extra information by the specified index. |
void |
setText(java.lang.String text)
Sets the specified text data. |
void |
write(char ch,
int offset)
Inserts the specified character at the given offset. |
void |
write(java.lang.String s,
int offset)
Inserts the specified text at the given offset. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Text(java.lang.String s)
s
- the initial value of the text.Method Detail |
public java.lang.String getLine(int line)
getLine
in interface TextModel
line
- the specified line number.public void setText(java.lang.String text)
setText
in interface TextModel
text
- the text data.public java.lang.String getText()
setText
method.getText
in interface TextModel
public int getSize()
getSize
in interface TextModel
public void write(java.lang.String s, int offset)
write
in interface TextModel
s
- the text to be inserted.offset
- the offset where the text will be inserted.public void write(char ch, int offset)
write
in interface TextModel
ch
- the character to be inserted.offset
- the offset where the character will be inserted.public void remove(int offset, int size)
remove
in interface TextModel
offset
- the offset where the text will be removed.size
- the size of the part that is going to be removed.protected java.util.Vector parse(char[] buffer)
buffer
- the specified text buffer.public void addTextListener(TextListener l)
addTextListener
in interface TextModel
l
- the text listener.public void removeTextListener(TextListener l)
removeTextListener
in interface TextModel
l
- the text listener.TextListener
,
TextEvent
public int getTextLength()
getTextLength
in interface TextModel
public int getExtraChar(int i)
TextModel
getExtraChar
in interface TextModel
org.zaval.data.TextModel
i
- the specified extra char index.public void setExtraChar(int i, int ch)
TextModel
setExtraChar
in interface TextModel
org.zaval.data.TextModel
i
- the specified extra char index.val
- the specified extra char value.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |