org.apache.commons.events.observable
Class ModificationEvent

java.lang.Object
  extended by java.util.EventObject
      extended by org.apache.commons.events.observable.ModificationEvent
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
StandardModificationEvent

public class ModificationEvent
extends EventObject

Base event class extended by each class that encapsulates event information.

This class can be used as is, but generally it is subclassed.

Since:
Commons Events 1.0
Version:
$Revision: 155443 $ $Date: 2005-02-26 13:19:51 +0000 (Sat, 26 Feb 2005) $
Author:
Stephen Colebourne
See Also:
Serialized Form

Field Summary
protected  ObservableCollection collection
          The source collection
protected  ModificationHandler handler
          The handler
protected  int type
          The event code
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
ModificationEvent(ObservableCollection obsCollection, ModificationHandler handler, int type)
          Constructor.
 
Method Summary
 Collection getBaseCollection()
          Gets the base collection underlying the observable collection.
 ModificationHandler getHandler()
          Gets the handler of the events.
 ObservableCollection getObservedCollection()
          Gets the collection the event is reporting on.
 int getType()
          Gets the event type constant.
 String toString()
          Gets a debugging string version of the event.
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

collection

protected final ObservableCollection collection
The source collection


handler

protected final ModificationHandler handler
The handler


type

protected final int type
The event code

Constructor Detail

ModificationEvent

public ModificationEvent(ObservableCollection obsCollection,
                         ModificationHandler handler,
                         int type)
Constructor.

Parameters:
obsCollection - the event source
handler - the handler
type - the event type
Method Detail

getObservedCollection

public ObservableCollection getObservedCollection()
Gets the collection the event is reporting on.

Using this collection will bypass any decorators that have been added to the ObservableCollection. For example, if a synchronized decorator was added it will not be called by changes to this collection.

For the synchronization case, you are normally OK however. If you process the event in the same thread as the original change then your code will be protected by the original synchronized decorator and this collection may be used freely.

Returns:
the collection

getBaseCollection

public Collection getBaseCollection()
Gets the base collection underlying the observable collection.

Using this collection will bypass the event sending mechanism. It will also bypass any other decorators, such as synchronization. Use with care.

Returns:
the collection

getHandler

public ModificationHandler getHandler()
Gets the handler of the events.

Returns:
the handler

getType

public int getType()
Gets the event type constant.

This is one of the method constants from ModificationEventType.

Returns:
the method event type constant

toString

public String toString()
Gets a debugging string version of the event.

Overrides:
toString in class EventObject
Returns:
a debugging string


Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.