if (property.getSchema().isConfidential()
|| GUARDED_STRING.equalsIgnoreCase(property.getSchema().getType())
|| GUARDED_BYTE_ARRAY.equalsIgnoreCase(property.getSchema().getType())) {
field = new AjaxPasswordFieldPanel("panel", label.getDefaultModelObjectAsString(), new Model());
((PasswordTextField) field.getField()).setResetPassword(false);
required = property.getSchema().isRequired();
} else {
Class propertySchemaClass;
try {
propertySchemaClass =
ClassUtils.forName(property.getSchema().getType(), ClassUtils.getDefaultClassLoader());
} catch (Exception e) {
LOG.error("Error parsing attribute type", e);
propertySchemaClass = String.class;
}
if (NUMBER.contains(propertySchemaClass)) {
field = new AjaxNumberFieldPanel("panel", label.getDefaultModelObjectAsString(), new Model(),
ClassUtils.resolvePrimitiveIfNecessary(propertySchemaClass));
required = property.getSchema().isRequired();
} else if (Boolean.class.equals(propertySchemaClass) || boolean.class.equals(propertySchemaClass)) {
field = new AjaxCheckBoxPanel("panel", label.getDefaultModelObjectAsString(), new Model());
} else {
field = new AjaxTextFieldPanel("panel", label.getDefaultModelObjectAsString(), new Model());
required = property.getSchema().isRequired();
}
if (String[].class.equals(propertySchemaClass)) {
isArray = true;
}
}
field.setTitle(property.getSchema().getHelpMessage());
if (isArray) {
field.removeRequiredLabel();
if (property.getValues().isEmpty()) {
property.getValues().add(null);
}
item.add(new MultiValueSelectorPanel<String>(
"panel", new PropertyModel<List<String>>(property, "values"), field));
} else {
if (required) {
field.addRequiredLabel();
}
field.setNewModel(property.getValues());
item.add(field);
}
final AjaxCheckBoxPanel overridable = new AjaxCheckBoxPanel("connPropAttrOverridable",
"connPropAttrOverridable", new PropertyModel(property, "overridable"));
item.add(overridable);
connectorTO.addConfiguration(property);
}
};
final Form connectorForm = new Form("form");
connectorForm.setModel(new CompoundPropertyModel(connectorTO));
final Form connectorPropForm = new Form("connectorPropForm");
connectorPropForm.setModel(new CompoundPropertyModel(connectorTO));
connectorPropForm.setOutputMarkupId(true);
propertiesContainer = new WebMarkupContainer("container");
propertiesContainer.setOutputMarkupId(true);
propertiesContainer.add(connectorPropForm);
connectorForm.add(propertiesContainer);
connectorPropForm.add(view);
final AjaxLink check = new IndicatingAjaxLink("check", new ResourceModel("check")) {
private static final long serialVersionUID = -7978723352517770644L;
@Override
public void onClick(final AjaxRequestTarget target) {
connectorTO.setBundleName(bundleTO.getBundleName());
connectorTO.setVersion(bundleTO.getVersion());
if (restClient.check(connectorTO).booleanValue()) {
info(getString("success_connection"));
} else {
error(getString("error_connection"));
}
target.add(feedbackPanel);
}
};
connectorPropForm.add(check);
final AjaxButton submit = new IndicatingAjaxButton("apply", new Model(getString("submit"))) {
private static final long serialVersionUID = -958724007591692537L;
@Override
protected void onSubmit(final AjaxRequestTarget target, final Form form) {