public abstract class PluginEvent<T>
- Object
- ActionEvent
- PluginEvent
Known subtypesIsGalleryTypeSupportedEvent, OpenGalleryEvent
Parent class for all plugin events. Plugin events are fired by the Codename One runtime to give plugins an opportunity to override the implementation of certain core methods.
For example, the OpenGalleryEvent is fired when the Display#openGallery() method
is called. This event will be passed to registered plugins, which can choose to “consume” the event
and override the behaviour.
If a plugin wishes to handle the event, it should call #consume() on the event to prevent
Codename One from proceeding to handle the request itself.
Events that require a synchronous return value should call the #setPluginEventResponse(Object) method
with the return value. #setPluginEventResponse(Object) calls #consume(), so you do not need
to call both of these methods.
Constructors
public PluginEvent(Object source, ActionEvent.Type type) | Creates a new plugin event with the given source and type. |
Methods
public T getPluginEventResponse() | Gets the response to the event. |
public void setPluginEventResponse(T response) | Sets the return value of processing the event. |
Inherited nested types
Inherited methods
Constructor details
PluginEvent
public PluginEvent(Object source, ActionEvent.Type type)Parameters
sourceObject- The source of the event. May be null.
typeActionEvent.Type- The type of the event. All PluginEvent classes should have a corresponding enum type in the
Typeenum.
Method details
getPluginEventResponse
public T getPluginEventResponse()Returns
setPluginEventResponse
public void setPluginEventResponse(T response)#consume(), so you don’t need to
call both to consume the event and set the response.