private void setupExecutions() {
final WebMarkupContainer executions = new WebMarkupContainer("executions");
executions.setOutputMarkupId(true);
form.add(executions);
final ModalWindow reportExecMessageWin = new ModalWindow("reportExecMessageWin");
reportExecMessageWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
reportExecMessageWin.setCookieName("report-exec-message-win-modal");
add(reportExecMessageWin);
final ModalWindow reportExecExportWin = new ModalWindow("reportExecExportWin");
reportExecExportWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
reportExecExportWin.setCookieName("report-exec-export-win-modal");
reportExecExportWin.setInitialHeight(EXEC_EXPORT_WIN_HEIGHT);
reportExecExportWin.setInitialWidth(EXEC_EXPORT_WIN_WIDTH);
reportExecExportWin.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
private static final long serialVersionUID = 8804221891699487139L;
@Override
public void onClose(final AjaxRequestTarget target) {
AjaxExportDownloadBehavior behavior = new AjaxExportDownloadBehavior(ReportModalPage.this.exportFormat,
ReportModalPage.this.exportExecId);
executions.add(behavior);
behavior.initiate(target);
}
});
add(reportExecExportWin);
final List<IColumn> columns = new ArrayList<IColumn>();
columns.add(new PropertyColumn(new ResourceModel("id"), "id", "id"));
columns.add(new DatePropertyColumn(new ResourceModel("startDate"), "startDate", "startDate"));
columns.add(new DatePropertyColumn(new ResourceModel("endDate"), "endDate", "endDate"));
columns.add(new PropertyColumn(new ResourceModel("status"), "status", "status"));
columns.add(new AbstractColumn<ReportExecTO>(new ResourceModel("actions", "")) {
private static final long serialVersionUID = 2054811145491901166L;
@Override
public String getCssClass() {
return "action";
}
@Override
public void populateItem(final Item<ICellPopulator<ReportExecTO>> cellItem, final String componentId,
final IModel<ReportExecTO> model) {
final ReportExecTO taskExecutionTO = model.getObject();
final ActionLinksPanel panel = new ActionLinksPanel(componentId, model);
panel.add(new ActionLink() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target) {
reportExecMessageWin.setPageCreator(new ModalWindow.PageCreator() {
private static final long serialVersionUID = -7834632442532690940L;
@Override
public Page createPage() {
return new ExecMessageModalPage(model.getObject().getMessage());
}
});
reportExecMessageWin.show(target);
}
}, ActionLink.ActionType.EDIT, "Reports", "read", StringUtils.hasText(model.getObject().getMessage()));
panel.add(new ActionLink() {
private static final long serialVersionUID = -3722207913631435501L;
@Override
public void onClick(final AjaxRequestTarget target) {
reportExecExportWin.setPageCreator(new ModalWindow.PageCreator() {
private static final long serialVersionUID = -7834632442532690940L;
@Override
public Page createPage() {
ReportModalPage.this.exportExecId = model.getObject().getId();
return new ReportExecResultDownloadModalPage(reportExecExportWin, ReportModalPage.this.
getPageReference());
}
});
reportExecExportWin.show(target);
}
}, ActionLink.ActionType.EXPORT, "Reports", "read", ReportExecStatus.SUCCESS.name().equals(
model.getObject().getStatus()));
panel.add(new ActionLink() {