target.add(intAttrNames.getField());
}
});
final FieldPanel extAttrName;
if (schemaNames.isEmpty()) {
extAttrName = new AjaxTextFieldPanel("extAttrName", new ResourceModel("extAttrNames",
"extAttrNames").getObject(), new PropertyModel<String>(mappingTO, "extAttrName"));
} else {
extAttrName = new AjaxDropDownChoicePanel<String>("extAttrName", new ResourceModel("extAttrNames",
"extAttrNames").getObject(), new PropertyModel(mappingTO, "extAttrName"));
((AjaxDropDownChoicePanel) extAttrName).setChoices(schemaNames);
}
boolean required = false;
if (mappingTO != null && !mappingTO.isAccountid() && !mappingTO.isPassword()) {
required = true;
}
extAttrName.setRequired(required);
extAttrName.setEnabled(required);
extAttrName.setStyleShet(fieldStyle);
item.add(extAttrName);
final AjaxTextFieldPanel mandatory = new AjaxTextFieldPanel("mandatoryCondition", new ResourceModel(
"mandatoryCondition", "mandatoryCondition").getObject(), new PropertyModel(mappingTO,
"mandatoryCondition"));
mandatory.setChoices(Arrays.asList(new String[]{"true", "false"}));
mandatory.setStyleShet(shortFieldStyle);
item.add(mandatory);
final AjaxCheckBoxPanel accountId = new AjaxCheckBoxPanel("accountId", new ResourceModel("accountId",
"accountId").getObject(), new PropertyModel(mappingTO, "accountid"));
accountId.getField().add(new AjaxFormComponentUpdatingBehavior(onchange) {
private static final long serialVersionUID = -1107858522700306810L;
@Override
protected void onUpdate(final AjaxRequestTarget target) {
extAttrName.setEnabled(!accountId.getModelObject() && !mappingTO.isPassword());
extAttrName.setModelObject(null);
extAttrName.setRequired(!accountId.getModelObject());
target.add(extAttrName);
}
});
item.add(accountId);
final AjaxCheckBoxPanel password = new AjaxCheckBoxPanel("password", new ResourceModel("password",
"password").getObject(), new PropertyModel(mappingTO, "password"));
password.getField().add(new AjaxFormComponentUpdatingBehavior(onchange) {
private static final long serialVersionUID = -1107858522700306810L;
@Override
protected void onUpdate(final AjaxRequestTarget target) {
extAttrName.setEnabled(!mappingTO.isAccountid() && !password.getModelObject());
extAttrName.setModelObject(null);
extAttrName.setRequired(!password.getModelObject());
target.add(extAttrName);
setAccountId((IntMappingType) typesPanel.getModelObject(), accountId, password);
target.add(accountId);
}