public abstract class EventDispatcher extends Object
Constructor and Description |
---|
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.
|
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.
|
public 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.
protected 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.