org.zaval.data
Interface TextModel
- All Known Implementing Classes:
- Text, SingleLineTxt, MaskedText
- public interface TextModel
The interface is used to represent text data. Actually the interface
determines following three abilities to work with a text:
-
Get the text properties. It is possible to get text lines, text size and so on
using appropriate methods of the interface.
-
Modify text data. It is possible to write and remove text data using appropriate
methods of the interface.
-
Listen text events. The interface provides the
addTextListener and
removeTextListener methods to listen the text events.
|
Method Summary |
void |
addTextListener(TextListener l)
Adds the specified text listener to receive text events. |
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 number of lines for the text model. |
java.lang.String |
getText()
Returns the original text data that have been set with setText method. |
int |
getTextLength()
Returns the text length (number of the text characters). |
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 val)
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. |
getLine
public java.lang.String getLine(int line)
- Returns the line at the specified line number.
- Parameters:
line - the specified line number.- Returns:
- a line at the specified line number.
setText
public void setText(java.lang.String text)
- Sets the specified text data. As rule the method should perform parsing process.
The process decides how the text data have to be divided into lines.
- Parameters:
text - the specified text data.
getText
public java.lang.String getText()
- Returns the original text data that have been set with
setText method.
- Returns:
- an original text data.
getSize
public int getSize()
- Returns the number of lines for the text model.
- Returns:
- a number of lines.
write
public void write(java.lang.String s,
int offset)
- Inserts the specified text at the given offset. The offset has to be less than the text
length. Actually the method performs re-parsing of the text.
- Parameters:
s - the text to be inserted.offset - the offset where the text will be inserted.
write
public void write(char ch,
int offset)
- Inserts the specified character at the given offset. The offset has to be less than the text
length. Actually the method performs re-parsing of the text.
- Parameters:
ch - the character to be inserted.offset - the offset where the character will be inserted.
remove
public void remove(int offset,
int size)
- Removes a text at the specified offset with the size. The offset and the offset plus the
size have to be less than the text length.
- Parameters:
offset - the offset where the text will be removed.size - the size of the part that is going to be removed.
getTextLength
public int getTextLength()
- Returns the text length (number of the text characters).
- Returns:
- a text length.
addTextListener
public void addTextListener(TextListener l)
- Adds the specified text listener to receive text events.
- Parameters:
l - the text listener.- See Also:
TextListener,
TextEvent
removeTextListener
public void removeTextListener(TextListener l)
- Removes the specified text listener.
- Parameters:
l - the text listener.- See Also:
TextListener,
TextEvent
getExtraChar
public int getExtraChar(int i)
- Gets special extra char that is used to store extra information by the specified index.
The method is deprecated to be used, because it will be probably re-designed in the future.
- Parameters:
i - the specified extra char index.- Returns:
- an extra char value.
setExtraChar
public void setExtraChar(int i,
int val)
- Sets special extra char that is used to store extra information by the specified index.
The method is deprecated, since probably it will be re-designed in the future.
- Parameters:
i - the specified extra char index.val - the specified extra char value.
|