public class Event
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
EVENT_EVERYTHING
A constant that denotes all types.
|
static int |
EVENT_NOTHING
A constant that denotes no type.
|
Constructor and Description |
---|
Event(int type,
java.lang.Object source,
java.lang.Object data,
boolean undoable)
Creates a new event with the specified type, source and user data.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getData()
Returns the user data object contained in the event.
|
java.lang.Object |
getSource()
Returns the source object that created the event.
|
int |
getType()
Returns the type of the event as an integer constant.
|
boolean |
isType(int t)
Determines whether the event is also of the specified type, i.e.
|
boolean |
isUndo()
Determines whether this is an undo event.
|
boolean |
isUndoable()
Determines whether the specified event is undoable.
|
java.lang.String |
toString()
Returns a human readable string representation of this event.
|
void |
undo()
Cancels the event.
|
public static int EVENT_NOTHING
public static int EVENT_EVERYTHING
public Event(int type, java.lang.Object source, java.lang.Object data, boolean undoable)
type
- The type of the event. It is convention that an event
type should only contain one active bit.source
- The source of the event.data
- The data of the event.undoable
- A flag that indicates whether the
event can be aborted.public int getType()
public boolean isType(int t)
t
- The type to test for.public java.lang.Object getSource()
public java.lang.Object getData()
public boolean isUndoable()
public boolean isUndo()
public void undo()
java.lang.RuntimeException
- Thrown if the event is not undoable or if
the event is an undo event.public java.lang.String toString()
toString
in class java.lang.Object