@Override
public void populateItem(final Item<ICellPopulator<ConfigurationTO>> cellItem, final String componentId,
final IModel<ConfigurationTO> model) {
final ConfigurationTO configurationTO = model.getObject();
final ActionLinksPanel panel = new ActionLinksPanel(componentId, model, getPageReference());
panel.add(new ActionLink() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target) {
editConfigWin.setPageCreator(new ModalWindow.PageCreator() {
private static final long serialVersionUID = -7834632442532690940L;
@Override
public Page createPage() {
return new ConfigurationModalPage(Configuration.this.getPageReference(), editConfigWin,
configurationTO, false);
}
});
editConfigWin.show(target);
}
}, ActionLink.ActionType.EDIT, "Configuration", "read");
panel.add(new ActionLink() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target) {
try {
confRestClient.deleteConfiguration(configurationTO.getKey());
} catch (SyncopeClientCompositeErrorException e) {
LOG.error("While deleting a conf key", e);
error(e.getMessage());
return;
}
info(getString("operation_succeded"));
target.add(feedbackPanel);
target.add(confContainer);
}
}, ActionLink.ActionType.DELETE, "Configuration", "delete");
cellItem.add(panel);
}
});
final AjaxFallbackDefaultDataTable confTable = new AjaxFallbackDefaultDataTable("syncopeconf", confColumns,
new SyncopeConfProvider(), confPaginatorRows);
confContainer = new WebMarkupContainer("confContainer");
confContainer.add(confTable);
confContainer.setOutputMarkupId(true);
add(confContainer);
createConfigWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
createConfigWin.setInitialHeight(CONFIG_WIN_HEIGHT);
createConfigWin.setInitialWidth(CONFIG_WIN_WIDTH);
createConfigWin.setCookieName("create-configuration-modal");
editConfigWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
editConfigWin.setInitialHeight(CONFIG_WIN_HEIGHT);
editConfigWin.setInitialWidth(CONFIG_WIN_WIDTH);
editConfigWin.setCookieName("edit-configuration-modal");
setWindowClosedCallback(createConfigWin, confContainer);
setWindowClosedCallback(editConfigWin, confContainer);
AjaxLink createConfigurationLink = new AjaxLink("createConfigurationLink") {
private static final long serialVersionUID = -7978723352517770644L;
@Override
public void onClick(final AjaxRequestTarget target) {
createConfigWin.setPageCreator(new ModalWindow.PageCreator() {
private static final long serialVersionUID = -7834632442532690940L;
@Override
public Page createPage() {
return new ConfigurationModalPage(Configuration.this.getPageReference(), createConfigWin,
new ConfigurationTO(), true);
}
});
createConfigWin.show(target);
}