org.zaval.data.event
Class TextEvent

java.lang.Object
  |
  +--java.util.EventObject
        |
        +--org.zaval.util.event.EvObject
              |
              +--org.zaval.data.event.TextEvent
All Implemented Interfaces:
java.io.Serializable

public class TextEvent
extends EvObject

This class describes event that is performed by TextModel interface implementation. Using the event class the text implementation notifies listeners about the text content changes.

See Also:
Serialized Form

Field Summary
static int INSERTED
          The text inserted event type.
static int REMOVED
          The text removed event type.
static int UPDATED
          The text updated event type.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
TextEvent(java.lang.Object target, int id, int offset, int size)
          Constructs a new text event class with the given source, event id, text offset and text size.
 
Method Summary
protected  boolean checkID(int id)
          Tests if the event type is possible.
 int getFirstUpdatedLine()
          Gets the start updated line number from that the text has been modified.
 int getOffset()
          Returns the offset that defines where the removing or inserting opertaion has been performed.
 int getSize()
          Returns the size that defines size of removed or inserted text part.
 int getUpdatedLines()
          Gets the number of updated lines that has been modified for the text.
 void setUpdatedLines(int first, int lines)
          Sets the set of lines that has been updated.
 
Methods inherited from class org.zaval.util.event.EvObject
getID
 
Methods inherited from class java.util.EventObject
getSource, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INSERTED

public static final int INSERTED
The text inserted event type.

REMOVED

public static final int REMOVED
The text removed event type.

UPDATED

public static final int UPDATED
The text updated event type.
Constructor Detail

TextEvent

public TextEvent(java.lang.Object target,
                 int id,
                 int offset,
                 int size)
Constructs a new text event class with the given source, event id, text offset and text size. The offset defines where removing or inserting operation has been performed and size defines size of removed or inserted part.
Parameters:
target - the source of the event.
id - the type of the event.
offset - the text offset.
size - the text size.
Method Detail

setUpdatedLines

public void setUpdatedLines(int first,
                            int lines)
Sets the set of lines that has been updated.
Parameters:
first - the specified start updated line number.
lines - the specified number of updated lines.

getFirstUpdatedLine

public int getFirstUpdatedLine()
Gets the start updated line number from that the text has been modified.
Returns:
a line number.

getUpdatedLines

public int getUpdatedLines()
Gets the number of updated lines that has been modified for the text.
Returns:
a number of lines.

getOffset

public int getOffset()
Returns the offset that defines where the removing or inserting opertaion has been performed.
Returns:
a text offset.

getSize

public int getSize()
Returns the size that defines size of removed or inserted text part.
Returns:
a text size.

checkID

protected boolean checkID(int id)
Tests if the event type is possible. If the event type is unknown than IllegalArgumentException exception will be thrown.
Overrides:
checkID in class EvObject
Parameters:
id - the type of the event.


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