public abstract class EventDispatcher extends Object
Modifier | Constructor and Description |
---|---|
protected |
EventDispatcher(Desktop desktop)
Creates an event dispatcher.
|
Modifier and Type | Method and Description |
---|---|
abstract boolean |
dispatchEvent(int event)
Dispatches an event.
|
void |
dispose()
Disposes this event dispatcher.
|
Desktop |
getDesktop()
Returns the desktop managed by this dispatcher.
|
void |
initialize()
Initializes this event dispatcher.
|
boolean |
isInitialized()
Gets whether this event dispatcher has been initialized.
|
protected boolean |
sendEventToWidget(Widget widget,
int event)
Sends the given event to the given widget.
|
protected Widget |
sendEventToWidgetHierarchy(Widget hierarchyLeaf,
int event)
Sends the given event to the given widget and to each of its ancestors.
|
protected EventDispatcher(Desktop desktop)
desktop
- the desktop to dispatch in.public abstract boolean dispatchEvent(int event)
event
- the event to dispatch.true
if the event dispatcher has dealt with the event, false
otherwise.public void dispose()
After this call, all that has been allocated or started in the initialize()
method must be disposed or
stopped.
public Desktop getDesktop()
public void initialize()
For example, this method can be used to create an event generator.
public boolean isInitialized()
It is set as not initialized when disposed.
true
if this event dispatcher has been initialized, false
otherwiseprotected boolean sendEventToWidget(Widget widget, int event)
widget
- the widget to which the event should be sent.event
- the event to send.true
if the widget has consumed the event, false
otherwise.@Nullable protected Widget sendEventToWidgetHierarchy(Widget hierarchyLeaf, int event)
If the event is consumed by one of the widgets, it is not sent to its ancestors.
hierarchyLeaf
- the leaf of the hierarchy to which the event should be sent.event
- the event to send.null
if the event has not been consumed.