@Override
public void populateItem(final Item<ICellPopulator<AbstractSchemaTO>> item, final String componentId,
final IModel<AbstractSchemaTO> model) {
final AbstractSchemaTO schemaTO = model.getObject();
final ActionLinksPanel panel = new ActionLinksPanel(componentId, model, getPageReference());
panel.addWithRoles(new ActionLink() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target) {
modalWindow.setPageCreator(new ModalWindow.PageCreator() {
private static final long serialVersionUID = -7834632442532690940L;
@Override
public Page createPage() {
AbstractSchemaModalPage page = SchemaModalPageFactory.getSchemaModalPage(
attributableType, schemaType);
page.setSchemaModalPage(Schema.this.getPageReference(), modalWindow, schemaTO, false);
return page;
}
});
modalWindow.show(target);
}
}, ActionType.EDIT, allowedReadRoles);
panel.addWithRoles(new ActionLink() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target) {
switch (schemaType) {
case DERIVED:
restClient.deleteDerivedSchema(attributableType, schemaTO.getName());
break;
case VIRTUAL:
restClient.deleteVirtualSchema(attributableType, schemaTO.getName());
break;
default:
restClient.deleteSchema(attributableType, schemaTO.getName());
break;
}
info(getString(Constants.OPERATION_SUCCEEDED));
target.add(feedbackPanel);