final ActionModel actionModel = ActionModel.create(objectAdapter, action);
actionModel.setActionPrompt(actionPrompt);
final AjaxDeferredBehaviour ajaxDeferredBehaviour = determineDeferredBehaviour(action, actionModel);
final AbstractLink link = new AjaxLink<Object>(linkId) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
if(ajaxDeferredBehaviour != null) {
ajaxDeferredBehaviour.initiate(target);
} else {
final ActionPanel actionPromptPanel =
(ActionPanel) getComponentFactoryRegistry().createComponent(
ComponentType.ACTION_PROMPT, actionPrompt.getContentId(), actionModel);
actionPrompt.setPanel(actionPromptPanel, target);
actionPromptPanel.setActionPrompt(actionPrompt);
actionPrompt.show(target);
target.focusComponent(actionPromptPanel);
}
}
};
if(ajaxDeferredBehaviour != null) {
link.add(ajaxDeferredBehaviour);
}
link.add(new CssClassAppender("noVeil"));
return link;
} else {
// use the action semantics to determine whether invoking this action will require a concurrency check or not
// if it's "safe", then we'll just continue without any checking.
final ConcurrencyChecking concurrencyChecking = ConcurrencyChecking.concurrencyCheckingFor(action.getSemantics());
final PageParameters pageParameters = ActionModel.createPageParameters(objectAdapter, action, concurrencyChecking);
final Class<? extends Page> pageClass = getPageClassRegistry().getPageClass(PageType.ACTION_PROMPT);
AbstractLink link = Links.newBookmarkablePageLink(linkId, pageParameters, pageClass);
// special case handling if this a no-arg action is returning a URL
if(action.getParameterCount()==0) {
addTargetBlankIfActionReturnsUrl(link, action);
}