InvocationTarget target = invocation.getTarget();
// TODO: Not too happy about needing this cast; can the method be moved up to
// InvocationTarget or ComponentInvocation?
ActionLinkTarget actionLinkTarget = Defense.cast(target, ActionLinkTarget.class, "target");
Page page = _cache.get(actionLinkTarget.getPageName());
// This is the active page, until we know better.
String nestedId = actionLinkTarget.getComponentNestedId();
ComponentPageElement element = page.getComponentElementByNestedId(nestedId);
final Holder<ActionResponseGenerator> holder = new Holder<ActionResponseGenerator>();
ComponentEventHandler handler = new ComponentEventHandler()
{
@SuppressWarnings("unchecked")
public boolean handleResult(Object result, Component component, String methodDescription)
{
ActionResponseGenerator generator = _resultProcessor.processComponentEvent(
result,
component,
methodDescription);
holder.put(generator);
return true;
}
};
// If activating the page returns a "navigational result", then don't trigger the action
// on the component.
page.getRootElement().triggerEvent(
TapestryConstants.ACTIVATE_EVENT,
invocation.getActivationContext(),
handler);
if (holder.hasValue())