com.pcauto.gui.table
Class EntityListEvent

java.lang.Object
  extended byjava.util.EventObject
      extended bycom.pcauto.gui.table.EntityListEvent
All Implemented Interfaces:
java.io.Serializable

public class EntityListEvent
extends java.util.EventObject

EntityListEvent is used to notify listeners that an EntityList has changed. The entity list event can be used to specify an INSERTED, DELETED, or MODIFIED event. The accessor methods can be used to retrieve information about the event such as the first and last entity that the event applies to. Moving an entity requires two events. It must be both DELETED and then INSERTED. Depending on the parameters used in the constructors, the EntityListEvent can be used to specify the following types of changes:

 EntityListEvent(source)    //all data has changed
 EntityListEvent(source, 5) //the entity at position 5 has changed. This is actually entity 6.
 EntityListEvent(source,1,EntityListEvent.INSERTED)   //the entity at postion 1 has just been inserted.
 EntityListEvent(source, 3, EntityListEvent.DELETED)  //entity 3 was deleted
 EntityListEvent(source,0,2,EntityListEvent.MODIFIED) //the first 3 entities have changed.

See Also:
Serialized Form

Field Summary
static int DELETED
          Identifies the removal of data from the table.
static int INSERTED
          Identifies the addition of new data to the table.
static int MODIFIED
          Identifies the modification of table data.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
EntityListEvent(java.lang.Object source)
          Constructs a new EntityListEvent that initially occurred on the specified object.
EntityListEvent(java.lang.Object source, int index)
          Constructs a new EntityListEvent where the entity at the specified index has changed.
EntityListEvent(java.lang.Object source, int index, int event)
          Constructs a new EntityListEvent where the entity at the specified index had the specified event performed on it.
EntityListEvent(java.lang.Object source, int startIndex, int endIndex, int event)
          Constructs a new EntityListEvent where the entities between the specified indices(inclusive) had the specified event performed on them.
 
Method Summary
 int getFirstEntity()
          Returns the first entity that changed.
 int getLastEntity()
          Returns the last entity that changed.
 int getType()
          Returns the type of event - one of: DELETED, INSERTED, and MODIFIED.
 
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
Identifies the addition of new data to the table. This is used to specify the actual event that has occurred and is set in some of the constructors. It can also be retrieved using the getType function.

See Also:
Constant Field Values

DELETED

public static final int DELETED
Identifies the removal of data from the table. This is used to specify the actual event that has occurred and is set in some of the constructors. It can also be retrieved using the getType function.

See Also:
Constant Field Values

MODIFIED

public static final int MODIFIED
Identifies the modification of table data. This is used to specify the actual event that has occurred and is set in some of the constructors. It can also be retrieved using the getType function.

See Also:
Constant Field Values
Constructor Detail

EntityListEvent

public EntityListEvent(java.lang.Object source)
Constructs a new EntityListEvent that initially occurred on the specified object. Source is the EntityList upon which the event occurred.

Parameters:
source - the object on which the event initially occurred

EntityListEvent

public EntityListEvent(java.lang.Object source,
                       int index)
Constructs a new EntityListEvent where the entity at the specified index has changed. The first index is at 0. Source is the EntityList upon which the event occurred.

Parameters:
source - the object on which the event initially occurred
index - the index of the entity that has changed

EntityListEvent

public EntityListEvent(java.lang.Object source,
                       int index,
                       int event)
Constructs a new EntityListEvent where the entity at the specified index had the specified event performed on it. The first index is at 0. The event is one of: DELETED, INSERTED, or MODIFIED. Source is the EntityList upon which the event occurred.

Parameters:
source - the object on which the event initially occurred
index - the index of the entity that changed
event - the event that occurred

EntityListEvent

public EntityListEvent(java.lang.Object source,
                       int startIndex,
                       int endIndex,
                       int event)
Constructs a new EntityListEvent where the entities between the specified indices(inclusive) had the specified event performed on them. The first index is at 0. The event is one of: DELETED, INSERTED, or MODIFIED. Source is the EntityList upon which the event occurred.

Parameters:
source - the object on which the event initially occurred
startIndex - the index of the first entity for which the event applies
endIndex - the index of the last entity for which the event applies
event - the event that occurred
Method Detail

getFirstEntity

public int getFirstEntity()
Returns the first entity that changed. This is the first entity affected by the event specified. If only one entity has changed, then both getFirstEntity and getLastEntity functions will return the same index.

Returns:
the index of the first entity. The smalles index is 0.

getLastEntity

public int getLastEntity()
Returns the last entity that changed. This is the last entity that was affected by the event specified. If only one entity has changed, then both getFirstEntity and getLastEntity functions will return the same index.

Returns:
the index of the last entity. The smalles index is 0.

getType

public int getType()
Returns the type of event - one of: DELETED, INSERTED, and MODIFIED.

Returns:
the event type - one of: DELETED, INSERTED, and MODIFIED