}
if (field == null) {
return;
}
BeanWrapper wrapper = PropertyAccessorFactory
.forBeanPropertyAccess(ReportletConfModalPage.this.reportletConf);
Panel panel;
if (NodeCond.class.equals(field.getType())) {
panel = new UserSearchPanel("value", (NodeCond) wrapper.getPropertyValue(fieldName), false);
// This is needed in order to manually update this.reportletConf with search panel selections
panel.setDefaultModel(new Model<String>(fieldName));
} else if (List.class.equals(field.getType())) {
if (wrapper.getPropertyValue(fieldName) == null) {
wrapper.setPropertyValue(fieldName, new ArrayList());
}
Class<?> listItemType = String.class;
if (field.getGenericType() instanceof ParameterizedType) {
listItemType =
(Class<?>) ((ParameterizedType) field.getGenericType()).getActualTypeArguments()[0];
}
FormAttributeField annotation = field.getAnnotation(FormAttributeField.class);
if (listItemType.equals(String.class) && annotation != null) {
List<String> choices;
switch (annotation.schema()) {
case UserSchema:
choices = schemaRestClient.getSchemaNames(AttributableType.USER);
break;
case UserDerivedSchema:
choices = schemaRestClient.getDerivedSchemaNames(AttributableType.USER);
break;
case UserVirtualSchema:
choices = schemaRestClient.getVirtualSchemaNames(AttributableType.USER);
break;
case RoleSchema:
choices = schemaRestClient.getSchemaNames(AttributableType.ROLE);
break;
case RoleDerivedSchema:
choices = schemaRestClient.getDerivedSchemaNames(AttributableType.ROLE);
break;
case RoleVirtualSchema:
choices = schemaRestClient.getVirtualSchemaNames(AttributableType.ROLE);
break;
case MembershipSchema:
choices = schemaRestClient.getSchemaNames(AttributableType.MEMBERSHIP);
break;
case MembershipDerivedSchema:
choices = schemaRestClient.getDerivedSchemaNames(AttributableType.MEMBERSHIP);
break;
case MembershipVirtualSchema:
choices = schemaRestClient.getVirtualSchemaNames(AttributableType.MEMBERSHIP);
break;
default:
choices = Collections.emptyList();
}
panel = new AjaxPalettePanel("value", new PropertyModel<List<String>>(
ReportletConfModalPage.this.reportletConf, fieldName), new ListModel<String>(choices),
true);
} else if (listItemType.isEnum()) {
panel = new CheckBoxMultipleChoiceFieldPanel("value", new PropertyModel(
ReportletConfModalPage.this.reportletConf, fieldName), new ListModel(Arrays
.asList(listItemType.getEnumConstants())));
} else {
if (((List) wrapper.getPropertyValue(fieldName)).isEmpty()) {
((List) wrapper.getPropertyValue(fieldName)).add(null);
}
panel = new MultiValueSelectorPanel("value", new PropertyModel<List>(
ReportletConfModalPage.this.reportletConf, fieldName), buildSinglePanel(
field.getType(), fieldName, "panel"));