PickerField.LookupAction lookupAction = (PickerField.LookupAction) pickerField.getAction(PickerField.LookupAction.NAME); if (!Strings.isNullOrEmpty(categoryAttribute.getJoinClause()) || !Strings.isNullOrEmpty(categoryAttribute.getWhereClause())) { lookupAction = createLookupAction(pickerField, categoryAttribute.getJoinClause(), categoryAttribute.getWhereClause()); pickerField.addAction(lookupAction);
/** * Creates ListEditor component. * * @param valueSource value source * @param categoryAttribute category attribute * @return list editor component or null */ @Nullable public Component generateComponent(ValueSource valueSource, CategoryAttribute categoryAttribute) { ListEditor listEditor = uiComponents.create(ListEditor.NAME); listEditor.setEntityJoinClause(categoryAttribute.getJoinClause()); listEditor.setEntityWhereClause(categoryAttribute.getWhereClause()); ListEditor.ItemType itemType = getListEditorItemType(categoryAttribute.getDataType()); listEditor.setItemType(itemType); if (!Strings.isNullOrEmpty(categoryAttribute.getEntityClass())) { Class<?> clazz = scripting.loadClass(categoryAttribute.getEntityClass()); if (clazz == null) { log.error("Unable to find class of entity {} for dynamic attribute {}", categoryAttribute.getEntityClass(), categoryAttribute.getCode()); return null; } MetaClass metaClass = metadata.getClassNN(clazz); listEditor.setEntityName(metaClass.getName()); listEditor.setUseLookupField(BooleanUtils.isTrue(categoryAttribute.getLookup())); } //noinspection unchecked listEditor.setValueSource(valueSource); return listEditor; }
CollectionDatasource optionsDatasource = dynamicAttributesGuiTools .createOptionsDatasourceForLookup(metaProperty.getRange().asClass(), attribute.getJoinClause(), attribute.getWhereClause()); options = new DatasourceOptions<>(optionsDatasource);
CollectionDatasource optionsDatasource = dynamicAttributesGuiTools .createOptionsDatasourceForLookup(metaProperty.getRange().asClass(), attribute.getJoinClause(), attribute.getWhereClause()); options = new DatasourceOptions(optionsDatasource);