
org.asmatron.messengine.ControlEngine Maven / Gradle / Ivy
package org.asmatron.messengine;
import org.asmatron.messengine.action.ActionHandler;
import org.asmatron.messengine.action.ActionObject;
import org.asmatron.messengine.action.ActionId;
import org.asmatron.messengine.event.EmptyEvent;
import org.asmatron.messengine.event.EventObject;
import org.asmatron.messengine.event.EventId;
import org.asmatron.messengine.event.ValueEvent;
import org.asmatron.messengine.model.ModelId;
/**
* Engine for controllers and service objects.
* This engine allows service tier objects to communicate with the view.
*
*/
public interface ControlEngine extends EngineController {
/**
* Fires an event and allows all event listeners to handle it.
* This is a convenience method that fires an emptyEvent so eventListeners
* does not need the event argument.
*
* @param eventId
* The id of the event (must be an EmptyEvent)
*/
void fireEvent(EventId eventId);
/**
* Fires the event with an argument passed to listeners.
*
* @param
* The type of the argument, it must extend the EventObject class.
* @param eventId
* The id of the event
* @param argument
* The argument of matching T type that will be passed to event
* listeners
*/
void fireEvent(EventId eventId, T argument);
/**
* Convenience method that fires a value event (a wrapper of a simple class
* into an eventObject).
*
* @param
* Anything that we want to send to eventListeners.
* @param eventId
* The id of the event (must be a ValueEvent)
* @param argument
* the argument that will be wrapped on a valueEvent
*/
void fireValueEvent(EventId> eventId, T argument);
/**
* Gets a value from the engine model repository.
*
* @param
* The type of the value stored
* @param modelId
* the id of the model variable stored in the engine
* @return the model variable value or null if none is found
*/
T get(ModelId modelId);
void set(ModelId modelId, T value, EventId> event);
void addActionHandler(ActionId actionId, ActionHandler actionHandler);
void removeActionHandler(ActionId actionId);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy