use of com.codename1.rad.events.EventContext in project CodeRAD by shannah.
the class ActionNode method fireEvent.
/**
* Fires an event with the given event context.
* @param context The event context.
* @return
*/
public ActionEvent fireEvent(EventContext context) {
EventFactoryNode eventFactory = this.getEventFactory();
EventContext contextCopy = context.copyWithNewAction(this);
ActionEvent actionEvent = eventFactory.getValue().createEvent(contextCopy);
fireActionListeners(actionEvent);
if (actionEvent.isConsumed()) {
fireAfterActionCallback(actionEvent);
return actionEvent;
}
ActionSupport.dispatchEvent(actionEvent);
fireAfterActionCallback(actionEvent);
return actionEvent;
}
use of com.codename1.rad.events.EventContext in project CodeRAD by shannah.
the class ActionNode method fireEvent.
/**
* Fires an event with the given entity, source, and extra data as the context.
* @param entity
* @param source
* @param extraData
* @return
*/
public ActionEvent fireEvent(Entity entity, Component source, Map extraData) {
EventFactoryNode eventFactory = this.getEventFactory();
if (eventFactory == null) {
eventFactory = new EventFactoryNode(UI.getDefaultEventFactory());
}
EventContext eventContext = new EventContext();
eventContext.setEntity(entity);
eventContext.setAction(this);
eventContext.setEventSource(source);
if (extraData != null) {
for (Object k : extraData.keySet()) {
eventContext.putExtra(k, extraData.get(k));
}
}
ActionEvent actionEvent = eventFactory.getValue().createEvent(eventContext);
fireActionListeners(actionEvent);
if (actionEvent.isConsumed()) {
fireAfterActionCallback(actionEvent);
return actionEvent;
}
ActionSupport.dispatchEvent(actionEvent);
fireAfterActionCallback(actionEvent);
return actionEvent;
}
Aggregations