protected void onUpdate(AjaxRequestTarget target) {
target.add(reportlets);
}
});
profile.add(new AjaxLink(ADD_BUTTON_ID) {
private static final long serialVersionUID = -7978723352517770644L;
@Override
public void onClick(final AjaxRequestTarget target) {
reportletConfWin.setPageCreator(new ModalWindow.PageCreator() {
private static final long serialVersionUID = -7834632442532690940L;
@Override
public Page createPage() {
modalReportletConfOldName = null;
modalReportletConf = null;
return new ReportletConfModalPage(null, reportletConfWin,
ReportModalPage.this.getPageReference());
}
});
reportletConfWin.show(target);
}
});
profile.add(new AjaxLink(EDIT_BUTTON_ID) {
private static final long serialVersionUID = -7978723352517770644L;
@Override
public void onClick(final AjaxRequestTarget target) {
if (reportlets.getModelObject() != null) {
reportletConfWin.setPageCreator(new ModalWindow.PageCreator() {
private static final long serialVersionUID = -7834632442532690940L;
@Override
public Page createPage() {
modalReportletConfOldName = reportlets.getModelObject().getName();
modalReportletConf = null;
return new ReportletConfModalPage(reportlets.getModelObject(), reportletConfWin,
ReportModalPage.this.getPageReference());
}
});
reportletConfWin.show(target);
} else {
target.appendJavaScript("alert('" + getString("selectItem") + "')");
}
}
});
profile.add(new AjaxLink(REMOVE_BUTTON_ID) {
private static final long serialVersionUID = -7978723352517770644L;
@Override
public void onClick(final AjaxRequestTarget target) {
reportTO.removeReportletConf(reportlets.getModelObject());
reportlets.setModelObject(null);
target.add(reportlets);
}
@Override
protected void updateAjaxAttributes(final AjaxRequestAttributes attributes) {
if (reportlets.getModelObject() != null) {
super.updateAjaxAttributes(attributes);
final AjaxCallListener ajaxCallListener = new AjaxCallListener() {
private static final long serialVersionUID = 7160235486520935153L;
@Override
public CharSequence getPrecondition(final Component component) {
return "if (!confirm('" + getString("confirmDelete") + "')) {return false;}";
}
};
attributes.getAjaxCallListeners().add(ajaxCallListener);
}
}
});
profile.add(new AjaxLink(UP_BUTTON_ID) {
private static final long serialVersionUID = -7978723352517770644L;
@Override
public void onClick(final AjaxRequestTarget target) {
if (reportlets.getModelObject() != null) {
moveUp(reportlets.getModelObject());
target.add(reportlets);
}
}
});
profile.add(new AjaxLink(DOWN_BUTTON_ID) {
private static final long serialVersionUID = -7978723352517770644L;
@Override
public void onClick(final AjaxRequestTarget target) {