public void handle(ComponentEventRequestParameters parameters) throws IOException {
Page activePage = cache.get(parameters.getActivePageName());
ComponentResultProcessorWrapper callback = new ComponentResultProcessorWrapper(resultProcessor);
// If activating the page returns a "navigational result", then don't trigger the action
// on the component.
activePage.getRootElement().triggerContextEvent(EventConstants.ACTIVATE,
parameters.getPageActivationContext(), callback);
if (callback.isAborted()) return;
Page containerPage = cache.get(parameters.getContainingPageName());
ComponentPageElement element = containerPage.getComponentElementByNestedId(parameters.getNestedComponentId());
environment.push(ComponentEventResultProcessor.class, resultProcessor);
boolean handled = element.triggerContextEvent(parameters.getEventType(), parameters.getEventContext(),
callback);
if (!handled)
throw new TapestryException(ServicesMessages.eventNotHandled(element, parameters.getEventType()), element,
null);
environment.pop(ComponentEventResultProcessor.class);
if (callback.isAborted()) return;
if (!response.isCommitted()) generator.generateResponse(activePage);
}
|