jcckit.data
Class DataEvent

java.lang.Object
  extended byjcckit.data.DataEvent

public class DataEvent
extends java.lang.Object

Event to be sent to a DataListener.

Author:
Franz-Josef Elmer

Method Summary
static DataEvent createAddEvent(DataContainer container)
          Creates an event of type DataEventType.ELEMENT_ADDED for the specified container.
static DataEvent createInsertEvent(DataContainer container, int index)
          Creates an event of type DataEventType.ELEMENT_INSERTED for the specified container.
static DataEvent createRemoveEvent(DataContainer container, int index, DataElement removedElement)
          Creates an event of type DataEventType.ELEMENT_REMOVED for the specified container.
static DataEvent createReplaceEvent(DataContainer container, int index, DataElement replacedElement)
          Creates an event of type DataEventType.ELEMENT_REPLACED for the specified container.
 DataContainer getContainer()
          Returns the container.
 DataElement getDeletedElement()
          Returns the deleted element.
 int getIndex()
          Returns the index.
 DataEventType getType()
          Returns the event type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createAddEvent

public static final DataEvent createAddEvent(DataContainer container)
Creates an event of type DataEventType.ELEMENT_ADDED for the specified container.

Parameters:
container - Container where an element has been added.
Returns:
ELEMENT_ADDED event.

createInsertEvent

public static final DataEvent createInsertEvent(DataContainer container,
                                                int index)
Creates an event of type DataEventType.ELEMENT_INSERTED for the specified container.

Parameters:
container - Container where an element has been inserted.
index - Index at which an element has been inserted.
Returns:
ELEMENT_INSERTED event.

createReplaceEvent

public static final DataEvent createReplaceEvent(DataContainer container,
                                                 int index,
                                                 DataElement replacedElement)
Creates an event of type DataEventType.ELEMENT_REPLACED for the specified container.

Parameters:
container - Container where an element has been replaced.
index - Index of the replaced element.
replacedElement - The previous element at index.
Returns:
ELEMENT_REPLACED event.

createRemoveEvent

public static final DataEvent createRemoveEvent(DataContainer container,
                                                int index,
                                                DataElement removedElement)
Creates an event of type DataEventType.ELEMENT_REMOVED for the specified container.

Parameters:
container - Container where an element has been removed.
index - Index of the removed element.
removedElement - The previous element at index.
Returns:
ELEMENT_REMOVED event.

getContainer

public DataContainer getContainer()
Returns the container.


getType

public DataEventType getType()
Returns the event type. Will be one of the constants DataEventType.ELEMENT_ADDED, DataEventType.ELEMENT_INSERTED, DataEventType.ELEMENT_REMOVED, or DataEventType.ELEMENT_REPLACED.


getIndex

public int getIndex()
Returns the index.


getDeletedElement

public DataElement getDeletedElement()
Returns the deleted element.

Returns:
null if either an element has been added or inserted.