protected AbstractLink newLink(
final String linkId,
final ObjectAdapter objectAdapter, final ObjectAction action,
final ActionPromptProvider actionPromptProvider) {
final ActionPrompt actionPrompt = actionPromptProvider.getActionPrompt();
if(actionPrompt != null) {
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 {
ActionPromptHeaderPanel titlePanel = new ActionPromptHeaderPanel(actionPrompt.getTitleId(), actionModel);
final ActionPanel actionPanel =
(ActionPanel) getComponentFactoryRegistry().createComponent(
ComponentType.ACTION_PROMPT, actionPrompt.getContentId(), actionModel);
actionPanel.setShowHeader(false);
actionPrompt.setTitle(titlePanel, target);
actionPrompt.setPanel(actionPanel, target);
actionPanel.setActionPrompt(actionPrompt);
actionPrompt.showPrompt(target);
focusOnFirstParameter(target, actionPanel);
}
}