Class ComponentXmlFactory

java.lang.Object
io.jmix.flowui.view.template.impl.ComponentXmlFactory

@Component("flowui_ComponentXmlFactory") public class ComponentXmlFactory extends Object
Factory for creating XML representations of UI components based on entity metadata properties.
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • createComponentXml

      public String createComponentXml(MetaProperty metaProperty, @Nullable String dataContainerId)
      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 @LookupField configuration is resolved and used to choose between an entityComboBox and an entityPicker, with actions added accordingly. An eager entityComboBox is bound to a data container via itemsContainer (see createItemsContainerXml(MetaProperty)); a lazy one carries an itemsQuery.

      Parameters:
      metaProperty - the entity property for which to create a component
      dataContainerId - 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

      protected boolean isDropdown(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. Otherwise it degrades to a view lookup.
    • isEagerDropdown

      protected boolean isEagerDropdown(EffectiveLookupConfig config, MetaClass referencedEntity)
    • itemsContainerId

      protected String itemsContainerId(MetaProperty metaProperty)
    • createItemsContainerXml

      public String createItemsContainerXml(MetaProperty metaProperty)
      Creates the top-level collection data container XML that backs an eager entityComboBox generated 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

      protected String buildItemsQuery(MetaClass referencedEntity)
    • addItemsQuery

      protected void addItemsQuery(org.dom4j.Element element, EffectiveLookupConfig config, MetaClass referencedEntity)
    • addResolvedActions

      protected void addResolvedActions(org.dom4j.Element element, List<String> actionIds)
    • addDefaultPickerActions

      protected void addDefaultPickerActions(org.dom4j.Element element, MetaProperty metaProperty)
    • createElement

      protected org.dom4j.Element createElement(MetaProperty metaProperty)
    • getDatatypeComponentName

      protected String getDatatypeComponentName(MetaProperty metaProperty)
    • initDataBinding

      protected void initDataBinding(org.dom4j.Element element, MetaProperty metaProperty, @Nullable String dataContainerId)
    • addAction

      protected void addAction(org.dom4j.Element actions, String id, String type)