public abstract class BasicEvent extends EventObject
BasicEventis the superclass of all events to be processed through
EventManagers. It subclases
java.util.EventObjectand thus inherits an event
The source is usually the object that caused the event to be dispatched, see the Timeline's setPosition for an example of the source usage. This allows objects which both dispatch and receive events to recognize if the event was fired by themselves, in which case they might optimize graphical updates or simply ignore the event, or by other objects.
Furthermore, a time tag (
getWhen()) can be
read to find out when the event was generated.
If events are dispatched at a heavy frequency, the
incorporate method can help to shrink the
queue by fusing events of the same type.
|Constructor and Description|
Constructs a new
|Modifier and Type||Method and Description|
Requests an identifier specifying the exact type of action that was performed.
State whens the event has been generated, a timestamp specifying system time millisecs as returned by
Asks the event to incorporate the action described by another (older) event.
public BasicEvent(Object source, int id, long when)
BasicEventis a subclass of
java.util.EventObject, the given 'source' is directly passed to the superclass and can be queried with
sourcedescribes the object that originated an action.
id- type of action depending on the concrete subclass. Generally the
idis used to distinguish between different method calls on the registered listeners, hence will be usually ignored by the listeners themselves.
when- When the event was generated. See
public int getID()
public long getWhen()
public abstract boolean incorporate(BasicEvent oldEvent)
replaceEdit()method of the
javax.swing.undo.UndoableEditinterface; a pendant of a symmetric
addEdit()like method is not provided because it seems to be unnecessary.
Implementation notes : the
generally only be incorporated if it refers to
the same source object (
getSource()) and has
the same ID (
timestamp of the current event should not be modified.
oldEvent- the most recent event in the queue which might be incorporated by this new event.
trueif this object was able to incorporate the older event. in this case the
oldEventis removed from the event queue.
falsestates that the
oldEventwas incompatible and should remain in the queue.
Copyright © 2015–2017 UW-Madison LOCI. All rights reserved.