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:


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 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 (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.
 

Method Detail

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 line number of the text.
Returns:
a line number.

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 depricated 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 depricated to be used, because it will probably be re-designed in the future.
Parameters:
i - the specified extra char index.
val - the specified extra char value.


Copyright © Zaval Creative Engineering Group, 2000-2005.
http://www.zaval.org