statusPanel, RENDER, xmlRolesReader.getAllAllowedRoles("Resources", "getConnectorObject"));
form.add(statusPanel);
final AjaxButton disable;
if (attributable instanceof UserTO) {
disable = new IndicatingAjaxButton("disable", new ResourceModel("disable", "Disable")) {
private static final long serialVersionUID = -958724007591692537L;
@Override
protected void onSubmit(final AjaxRequestTarget target, final Form form) {
try {
userRestClient.suspend(attributable.getId(), statuses);
if (pageRef.getPage() instanceof BasePage) {
((BasePage) pageRef.getPage()).setModalResult(true);
}
window.close(target);
} catch (Exception e) {
LOG.error("Error disabling resources", e);
error(getString("error") + ":" + e.getMessage());
target.add(feedbackPanel);
}
}
@Override
protected void onError(final AjaxRequestTarget target, final Form<?> form) {
target.add(feedbackPanel);
}
};
} else {
disable = new AjaxButton("disable") {
private static final long serialVersionUID = 5538299138211283825L;
};
disable.setVisible(false);
}
form.add(disable);
final AjaxButton enable;
if (attributable instanceof UserTO) {
enable = new IndicatingAjaxButton("enable", new ResourceModel("enable", "Enable")) {
private static final long serialVersionUID = -958724007591692537L;
@Override
protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
try {
userRestClient.reactivate(attributable.getId(), statuses);
((BasePage) pageRef.getPage()).setModalResult(true);
window.close(target);
} catch (Exception e) {
LOG.error("Error enabling resources", e);
error(getString("error") + ":" + e.getMessage());
target.add(feedbackPanel);
}
}
@Override
protected void onError(final AjaxRequestTarget target, final Form<?> form) {
target.add(feedbackPanel);
}
};
} else {
enable = new AjaxButton("enable") {
private static final long serialVersionUID = 5538299138211283825L;
};
enable.setVisible(false);
}
form.add(enable);
final AjaxButton cancel = new IndicatingAjaxButton("cancel", new ResourceModel("cancel")) {
private static final long serialVersionUID = -958724007591692537L;
@Override
protected void onSubmit(final AjaxRequestTarget target, final Form form) {
window.close(target);
}
};
cancel.setDefaultFormProcessing(false);
form.add(cancel);
}