try {
final IEntity entity = (IEntity) item.getModelObject();
final App app = viewContext.getApp();
final IEntities entities = modelContext.getEntities();
final ConceptConfig conceptConfig = entity.getConceptConfig();
final Integer currentPageBlock = new Integer(getCurrentPage());
final ModelContext entityModelContext = new ModelContext(
modelContext);
entityModelContext.setEntity(entity);
Link copyLink = new Link("copy") {
static final long serialVersionUID = 200741L;
public void onClick() {
getAppSession().getClipboard().setEntity(entity);
ViewContext entityCopyPageContext = new ViewContext(
viewContext);
entityCopyPageContext.setPageBlock(currentPageBlock);
setResponsePage(app.getViewMeta().getPage(
"EntityUpdateTablePage", entityModelContext,
entityCopyPageContext));
}
};
item.add(copyLink);
final ViewContext entityUpdatePageContext = new ViewContext(
viewContext);
entityUpdatePageContext.setPageBlock(currentPageBlock);
Link editLink = new PageLink("edit", new IPageLink() {
static final long serialVersionUID = 200742L;
public Page getPage() {
return app.getViewMeta().getPage("EntityEditFormPage",
entityModelContext, entityUpdatePageContext);
}
public Class getPageIdentity() {
return app.getViewMeta().getPageClass("EntityEditFormPage",
entityModelContext, entityUpdatePageContext);
}
});
item.add(editLink);
final ViewContext entityRemovePageContext = new ViewContext(
viewContext);
entityRemovePageContext.setPageBlock(currentPageBlock);
item.add(new Link("remove") {
static final long serialVersionUID = 200743L;
public void onClick() {
try {
if (app.isConceptUpdateAllowed(
getAppSession(), conceptConfig, entity, "remove")) {
entities.getErrors().empty();
if (app.getModelConfig().isConfirmRemove()) {
setResponsePage(app.getViewMeta().getPage(
"EntityConfirmRemovePage",
entityModelContext,
entityRemovePageContext));
} else if (entities.remove(entity)) {
setResponsePage(app.getViewMeta().getPage(
"EntityUpdateTablePage",
entityModelContext,
entityRemovePageContext));
} else {