@Override
public void populateItem(final Item<ICellPopulator<AbstractPolicyTO>> cellItem, final String componentId,
final IModel<AbstractPolicyTO> model) {
final AbstractPolicyTO policyTO = model.getObject();
final ActionLinksPanel panel = new ActionLinksPanel(componentId, model, pageRef);
panel.add(new ActionLink() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target) {
mwindow.setPageCreator(new ModalWindow.PageCreator() {
private static final long serialVersionUID = -7834632442532690940L;
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public Page createPage() {
return new PolicyModalPage(pageRef, mwindow, policyTO);
}
});
mwindow.show(target);
}
}, ActionLink.ActionType.EDIT, "Policies");
panel.add(new ActionLink() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target) {
try {
policyRestClient.delete(policyTO.getId(), policyTO.getClass());
info(getString(Constants.OPERATION_SUCCEEDED));
} catch (SyncopeClientException e) {
error(getString(Constants.OPERATION_ERROR));
LOG.error("While deleting policy {}({})",
policyTO.getId(), policyTO.getDescription(), e);
}
target.add(container);
((NotificationPanel) getPage().get(Constants.FEEDBACK)).refresh(target);
}