Search in sources :

Example 1 with EntityComboBox

use of io.jmix.ui.component.EntityComboBox in project jmix by jmix-framework.

the class EntityFieldCreationSupport method createFieldComponent.

protected EntityPicker createFieldComponent(MetaClass metaClass, @Nullable Options options) {
    String componentName = componentProperties.getEntityFieldType().get(metaClass.getName());
    EntityPicker field;
    if (options != null || EntityComboBox.NAME.equals(componentName)) {
        EntityComboBox entityComboBox = uiComponents.create(EntityComboBox.class);
        entityComboBox.setOptions(options != null ? options : new ContainerOptions(createCollectionContainer(metaClass)));
        field = entityComboBox;
    } else {
        if (componentName == null || EntityPicker.NAME.equals(componentName)) {
            field = uiComponents.create(EntityPicker.class);
            field.setMetaClass(metaClass);
        } else {
            EntityPicker component = uiComponents.create(componentName);
            if (component instanceof OptionsField) {
                ((OptionsField) component).setOptions(new ContainerOptions(createCollectionContainer(metaClass)));
            }
            field = component;
        }
    }
    return field;
}
Also used : ContainerOptions(io.jmix.ui.component.data.options.ContainerOptions) EntityPicker(io.jmix.ui.component.EntityPicker) EntityComboBox(io.jmix.ui.component.EntityComboBox) OptionsField(io.jmix.ui.component.OptionsField)

Aggregations

EntityComboBox (io.jmix.ui.component.EntityComboBox)1 EntityPicker (io.jmix.ui.component.EntityPicker)1 OptionsField (io.jmix.ui.component.OptionsField)1 ContainerOptions (io.jmix.ui.component.data.options.ContainerOptions)1