Search in sources :

Example 1 with Mvp4gModule

use of com.mvp4g.client.Mvp4gModule in project mvp4g by mvp4g.

the class PlaceService method forwardToChildModuleIfNeeded.

/**
 * Check if this event is a child's module event. If it's the case, forward the token to the
 * child module and return true.
 *
 * @param eventName
 *   name of the event that was stored in the token
 * @param param
 *   parameters stored in the token
 *
 * @return true if this child module's event.
 */
protected boolean forwardToChildModuleIfNeeded(final String eventName, final String param) {
    boolean forAChild = eventName.contains(MODULE_SEPARATOR);
    if (forAChild) {
        Mvp4gEventPasser passer = new Mvp4gEventPasser(true) {

            @Override
            public void pass(Mvp4gModule module) {
                if ((Boolean) eventObjects[0]) {
                    dispatchEvent(eventName, param, module);
                } else {
                    sendNotFoundEvent(module);
                }
            }
        };
        module.dispatchHistoryEvent(eventName, passer);
    }
    return forAChild;
}
Also used : Mvp4gModule(com.mvp4g.client.Mvp4gModule) Mvp4gEventPasser(com.mvp4g.client.Mvp4gEventPasser)

Aggregations

Mvp4gEventPasser (com.mvp4g.client.Mvp4gEventPasser)1 Mvp4gModule (com.mvp4g.client.Mvp4gModule)1