Class ComponentXmlFactory
java.lang.Object
io.jmix.flowui.view.template.impl.ComponentXmlFactory
Factory for creating XML representations of UI components based on entity metadata properties.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ItemsFetchCallbackSupportprotected final LookupFieldSupportprotected final MetadataTools -
Constructor Summary
ConstructorsConstructorDescriptionComponentXmlFactory(LookupFieldSupport lookupFieldSupport, ItemsFetchCallbackSupport itemsFetchCallbackSupport, MetadataTools metadataTools) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidaddDefaultPickerActions(org.dom4j.Element element, MetaProperty metaProperty) protected voidaddItemsQuery(org.dom4j.Element element, EffectiveLookupConfig config, MetaClass referencedEntity) protected voidaddResolvedActions(org.dom4j.Element element, List<String> actionIds) protected StringbuildItemsQuery(MetaClass referencedEntity) createComponentXml(MetaProperty metaProperty, @Nullable String dataContainerId) Creates an XML representation of a UI component for the given entity property.protected org.dom4j.ElementcreateElement(MetaProperty metaProperty) createItemsContainerXml(MetaProperty metaProperty) Creates the top-levelcollectiondata container XML that backs an eagerentityComboBoxgenerated for the given reference property, or an empty string if the property is not an eager dropdown.protected StringcreateReferenceComponentXml(MetaProperty metaProperty, MetaClass referencedEntity, @Nullable String dataContainerId) protected StringgetDatatypeComponentName(MetaProperty metaProperty) protected voidinitDataBinding(org.dom4j.Element element, MetaProperty metaProperty, @Nullable String dataContainerId) protected booleanisDropdown(EffectiveLookupConfig config, MetaClass referencedEntity) A DROPDOWN renders as a combobox only when it can source items in XML: the entity must have a usable store and, for the byInstanceName mode, string instance-name properties.protected booleanisEagerDropdown(EffectiveLookupConfig config, MetaClass referencedEntity) protected StringitemsContainerId(MetaProperty metaProperty)
-
Field Details
-
lookupFieldSupport
-
itemsFetchCallbackSupport
-
metadataTools
-
-
Constructor Details
-
ComponentXmlFactory
public ComponentXmlFactory(LookupFieldSupport lookupFieldSupport, ItemsFetchCallbackSupport itemsFetchCallbackSupport, MetadataTools metadataTools)
-
-
Method Details
-
createComponentXml
Creates an XML representation of a UI component for the given entity property.The component type is determined based on the property's range and type. For entity properties, the effective
@LookupFieldconfiguration is resolved and used to choose between anentityComboBoxand anentityPicker, with actions added accordingly. An eagerentityComboBoxis bound to a data container viaitemsContainer(seecreateItemsContainerXml(MetaProperty)); a lazy one carries anitemsQuery.- Parameters:
metaProperty- the entity property for which to create a componentdataContainerId- optional data container identifier for data binding, may be null- Returns:
- XML string representation of the component
- Throws:
UnsupportedOperationException- if the property is collection-valued
-
createReferenceComponentXml
protected String createReferenceComponentXml(MetaProperty metaProperty, MetaClass referencedEntity, @Nullable String dataContainerId) -
isDropdown
A DROPDOWN renders as a combobox only when it can source items in XML: the entity must have a usable store and, for the byInstanceName mode, string instance-name properties. Otherwise it degrades to a view lookup. -
isEagerDropdown
-
itemsContainerId
-
createItemsContainerXml
Creates the top-levelcollectiondata container XML that backs an eagerentityComboBoxgenerated for the given reference property, or an empty string if the property is not an eager dropdown. For JPA entities the loader carries a JPQL query ordered by the instance name; for non-JPA entities the query is omitted and the store loads all instances.- Parameters:
metaProperty- a single-value entity reference property- Returns:
- the
<collection>XML, or""if not an eager dropdown
-
buildItemsQuery
-
addItemsQuery
protected void addItemsQuery(org.dom4j.Element element, EffectiveLookupConfig config, MetaClass referencedEntity) -
addResolvedActions
-
addDefaultPickerActions
-
createElement
-
getDatatypeComponentName
-
initDataBinding
protected void initDataBinding(org.dom4j.Element element, MetaProperty metaProperty, @Nullable String dataContainerId) -
addAction
-