recipientAttrName.setChoices(getSchemaNames(notificationTO.getRecipientAttrType()));
recipientAttrName.setRequired(true);
form.add(recipientAttrName);
recipientAttrType.getField().add(new AjaxFormComponentUpdatingBehavior(onchange) {
@Override
protected void onUpdate(final AjaxRequestTarget target) {
recipientAttrName.setChoices(getSchemaNames(notificationTO.getRecipientAttrType()));
target.add(recipientAttrName);
}
});
final AjaxPalettePanel events = new AjaxPalettePanel("events", new PropertyModel(notificationTO, "events"),
new ListModel<String>(restClient.getEvents()));
form.add(events);
final WebMarkupContainer recipientsContainer = new WebMarkupContainer("recipientsContainer");
recipientsContainer.setOutputMarkupId(true);
form.add(recipientsContainer);
final AjaxCheckBoxPanel selfAsRecipient = new AjaxCheckBoxPanel("selfAsRecipient",
getString("selfAsRecipient"), new PropertyModel(notificationTO, "selfAsRecipient"));
form.add(selfAsRecipient);
if (createFlag) {
selfAsRecipient.getField().setDefaultModelObject(Boolean.TRUE);
}
final AjaxCheckBoxPanel checkRecipients =
new AjaxCheckBoxPanel("checkRecipients", "checkRecipients",
new Model<Boolean>(notificationTO.getRecipients() == null ? false : true));
recipientsContainer.add(checkRecipients);
final UserSearchPanel recipients =
new UserSearchPanel("recipients",
notificationTO.getRecipients() == null ? null : notificationTO.getRecipients());
recipientsContainer.add(recipients);
recipients.setEnabled(checkRecipients.getModelObject());
selfAsRecipient.getField().add(new AjaxFormComponentUpdatingBehavior(onchange) {
private static final long serialVersionUID = -1107858522700306810L;
@Override
protected void onUpdate(final AjaxRequestTarget target) {
if (!Boolean.valueOf(selfAsRecipient.getField().getValue())) {
checkRecipients.getField().setDefaultModelObject(Boolean.TRUE);
target.add(checkRecipients);
recipients.setEnabled(checkRecipients.getModelObject());
target.add(recipients);
target.add(recipientsContainer);
}
}
});
checkRecipients.getField().add(new AjaxFormComponentUpdatingBehavior(onchange) {
private static final long serialVersionUID = -1107858522700306810L;
@Override
protected void onUpdate(final AjaxRequestTarget target) {