|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.EventObject org.apache.commons.events.observable.ModificationEvent org.apache.commons.events.observable.standard.StandardModificationEvent
public class StandardModificationEvent
Event class that encapsulates the event information for a standard collection event. Two subclasses are provided, one for pre and one for post events.
The information stored in this event is all that is available as
parameters or return values.
In addition, the size
method is used on the collection.
All objects used are the real objects from the method calls, not clones.
Field Summary | |
---|---|
protected int |
index
The index of the change |
protected Object |
object
The object of the change |
protected int |
preSize
The size before the event |
protected Object |
previous
The result of the method call |
protected int |
repeat
The number of changes |
protected ObservableCollection |
view
The view that the event came from, null if none |
protected int |
viewOffset
The offset index within the main collection of the view, -1 if none |
Fields inherited from class org.apache.commons.events.observable.ModificationEvent |
---|
collection, handler, type |
Fields inherited from class java.util.EventObject |
---|
source |
Constructor Summary | |
---|---|
StandardModificationEvent(ObservableCollection obsCollection,
ModificationHandler handler,
int type,
int preSize,
int index,
Object object,
int repeat,
Object previous,
ObservableCollection view,
int viewOffset)
Constructor. |
Method Summary | |
---|---|
Collection |
getChangeCollection()
Gets the collection of changed objects. |
int |
getChangeIndex()
Gets the index of the change. |
Object |
getChangeObject()
Gets the object that was added/removed/set. |
int |
getChangeRepeat()
Gets the number of times the object was added/removed. |
int |
getPreSize()
Gets the size before the change. |
Object |
getPrevious()
Gets the previous value that is being replaced or removed. |
ObservableCollection |
getView()
Gets the view, null if none. |
int |
getViewOffset()
Gets the view offset, -1 if no view or unknown offset. |
boolean |
isType(int eventType)
Checks to see if the event is of the specified type. |
boolean |
isTypeAdd()
Checks to see if the event is an add event (add/addAll). |
boolean |
isTypeBulk()
Checks to see if the event is a bulk event (addAll/removeAll/retainAll/clear). |
boolean |
isTypeChange()
Checks to see if the event is a change event (set). |
boolean |
isTypeReduce()
Checks to see if the event is a remove event (remove/removeAll/retainAll/clear). |
boolean |
isView()
Checks whether the event originated from a view. |
String |
toString()
Gets a debugging string version of the event. |
Methods inherited from class org.apache.commons.events.observable.ModificationEvent |
---|
getBaseCollection, getHandler, getObservedCollection, getType |
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 |
---|
protected final int preSize
protected final int index
protected final Object object
protected final int repeat
protected final Object previous
protected final ObservableCollection view
protected final int viewOffset
Constructor Detail |
---|
public StandardModificationEvent(ObservableCollection obsCollection, ModificationHandler handler, int type, int preSize, int index, Object object, int repeat, Object previous, ObservableCollection view, int viewOffset)
obsCollection
- the event sourcehandler
- the handlertype
- the event typepreSize
- the size before the changeindex
- the index that changedobject
- the value that changedrepeat
- the number of repeatsprevious
- the previous value being removed/replacedview
- the view collection, null if event from main collectionviewOffset
- the offset within the main collection of the view, -1 if unknownMethod Detail |
---|
public int getChangeIndex()
This is -1
when not applicable. Typically only used
for List
events.
public Object getChangeObject()
This is null
when not applicable, such as for clear().
public Collection getChangeCollection()
For clear, it is an empty list. For bulk operations, it is the collection. For non-bulk operations, it is a size one list.
public int getChangeRepeat()
This is normally 1
, but will be used for
Bag
events.
public Object getPrevious()
This is only returned if the value definitely was previously in the collection. Bulk operatons will not return this.
public int getPreSize()
public ObservableCollection getView()
null
if none.
A view is a subSet, headSet, tailSet, subList and so on.
public boolean isView()
public int getViewOffset()
-1
if no view or unknown offset.
This refers to the index of the start of the view within the main collection.
public boolean isTypeAdd()
public boolean isTypeReduce()
public boolean isTypeChange()
public boolean isTypeBulk()
public boolean isType(int eventType)
This is any combination of constants from ModificationEventType
.
eventType
- an event type constant
public String toString()
toString
in class ModificationEvent
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |