java.lang.Object
javafx.event.EventType<T>
- Type Parameters:
T
- the event class to which this type applies
- All Implemented Interfaces:
Serializable
public final class EventType<T extends Event> extends Object implements Serializable
This class represents a specific event type associated with an
Event
.
Event types form a hierarchy with the ROOT
(equals to
Event.ANY
) as its root. This is useful in event filter / handler
registration where a single event filter / handler can be registered to a
super event type and will be receiving its sub type events as well.
Note that you cannot construct two different EventType objects with the same
name and parent.
Note about deserialization: All EventTypes that are going to be deserialized
(e.g. as part of Event
deserialization), need to exist at the time of
deserialization. Deserialization of EventType will not create new EventType
objects.
- Since:
- JavaFX 2.0
- See Also:
- Serialized Form
-
Field Summary
-
Constructor Summary
Constructors Constructor Description EventType()
Deprecated.Do not use this constructor, as only one such EventType can existEventType(String name)
Constructs a newEventType
with the specified name and theEventType.ROOT
as its super type.EventType(EventType<? super T> superType)
Constructs a newEventType
with the specified super type and the name set tonull
.EventType(EventType<? super T> superType, String name)
Constructs a newEventType
with the specified super type and name. -
Method Summary
-
Field Details
-
ROOT
The root event type. All other event types are either direct or indirect sub types of it. It is also the only event type which has its super event type set tonull
.
-
-
Constructor Details
-
EventType
Deprecated.Do not use this constructor, as only one such EventType can existConstructs a newEventType
with theEventType.ROOT
as its super type and the name set tonull
. -
EventType
Constructs a newEventType
with the specified name and theEventType.ROOT
as its super type.- Parameters:
name
- the name- Throws:
IllegalArgumentException
- if an EventType with the same name andROOT
/Event.ANY
as parent
-
EventType
Constructs a newEventType
with the specified super type and the name set tonull
.- Parameters:
superType
- the event super type- Throws:
IllegalArgumentException
- if an EventType with "null" name and under this supertype exists
-
EventType
Constructs a newEventType
with the specified super type and name.- Parameters:
superType
- the event super typename
- the name- Throws:
IllegalArgumentException
- if an EventType with the same name and superType exists
-
-
Method Details
-
getSuperType
Gets the super type of this event type. The returned value isnull
only for theEventType.ROOT
.- Returns:
- the super type
-
getName
Gets the name of this event type.- Returns:
- the name
-
toString
Returns a string representation of thisEventType
object.
-