public ActionLink(String id, ItemAction action, ActionableItem actionableItem) { super(id, Model.of(action.getDisplayName(actionableItem))); this.action = action; this.actionableItem = actionableItem; // add css classes add(new CssClass("icon-link")); add(new CssClass(action.getCssClass())); // set href for link actions String actionURL = action.getActionLinkURL(actionableItem); if (StringUtils.isNotEmpty(actionURL)) { add(new AttributeModifier("onclick", "window.open(this.href); return false;")); add(new AttributeModifier("href", actionURL)); } }
@Override protected IAjaxCallDecorator getAjaxCallDecorator() { String message = action.getConfirmationMessage(actionableItem); return new AllowNewWindowDecorator(new ConfirmationAjaxCallDecorator(message)); }
@Override public void onClick(AjaxRequestTarget target) { action.actionPerformed(newEvent(target)); }
@Override public boolean isEnabled() { return action.isEnabled(); }