Class DynamicViewComponentIdProvider
The components are read from up to three sources, unioned: the literal descriptor.source,
the extended base view (for static entity extensions), and the rendered template (for dynamic
entities). A template can only be rendered for an entity that exists in current metadata, so a
dynamic entity that has never been applied contributes nothing — the editor combo accepts a typed
value anyway.
Every id attribute in a source document is collected, except those in the parts of the view
that hold no components: the data and facets sections and the actions
declarations. A handler is attached by looking the id up in the view's component tree, so an id
declared there could never be a target for any event.
This class does not consider trigger kinds. Narrowing the result to what a particular trigger can
attach to is the editor's job, using ViewComponentTagCapabilities and the reported tag.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA component offered by the handler editor: itsidand the XMLtagit was declared with, such asbuttonortextField. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BaseViewXmlProviderprotected DynamicViewDeployerprotected Metadataprotected DynamicModelDefinitionModelConverterView XML elements whose subtrees declare no components.protected DynamicModelStaticExtensionResolver -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcollectComponents(org.dom4j.Element element, Map<String, String> tagsById) Collects each element that carries anidintotagsById, keyed by the id and valued by the element's XML tag.protected voidcollectFromBaseView(DynamicViewModel view, @Nullable DynamicEntityModel entity, boolean staticExtension, Map<String, String> tagsById) protected voidcollectFromSource(DynamicViewModel view, Map<String, String> tagsById) protected voidcollectFromTemplate(DynamicViewModel view, @Nullable DynamicEntityModel entity, boolean staticExtension, Map<String, String> tagsById) Renders the template behind a dynamic entity view and collects its ids.protected @Nullable StringgetComponentInfos(DynamicViewModel view, @Nullable DynamicEntityModel entity) Returns the components of the given view declaration, distinct by id and sorted by id case-insensitively.protected booleanisStaticExtension(@Nullable DynamicEntityModel entity) Resolves once whether the given entity is a static-entity extension, so bothcollectFromBaseView(io.jmix.dynmodelflowui.model.DynamicViewModel, io.jmix.dynmodelflowui.model.DynamicEntityModel, boolean, java.util.Map<java.lang.String, java.lang.String>)andcollectFromTemplate(io.jmix.dynmodelflowui.model.DynamicViewModel, io.jmix.dynmodelflowui.model.DynamicEntityModel, boolean, java.util.Map<java.lang.String, java.lang.String>)branch on the same answer.
-
Field Details
-
NON_COMPONENT_ELEMENTS
View XML elements whose subtrees declare no components. A handler target is resolved against the view's component tree, so an id declared inside one of these could never be found. The set is deliberately limited to fixed parts of the view schema, so it can never exclude a component. -
metadata
-
baseViewXmlProvider
-
dynamicViewDeployer
-
staticExtensionResolver
-
modelConverter
-
-
Constructor Details
-
DynamicViewComponentIdProvider
public DynamicViewComponentIdProvider()
-
-
Method Details
-
getComponentInfos
public List<DynamicViewComponentIdProvider.ComponentInfo> getComponentInfos(DynamicViewModel view, @Nullable DynamicEntityModel entity) Returns the components of the given view declaration, distinct by id and sorted by id case-insensitively. Never throws: a source that cannot be read contributes nothing, so the worst case is an empty list.When the same id appears in more than one source, the first occurrence keeps its tag. The sources are visited in declaration order, so the literal
descriptor.sourcewins over the extended base view.- Parameters:
view- the view declaration being editedentity- the entity that owns the view,nullwhen unknown
-
isStaticExtension
Resolves once whether the given entity is a static-entity extension, so bothcollectFromBaseView(io.jmix.dynmodelflowui.model.DynamicViewModel, io.jmix.dynmodelflowui.model.DynamicEntityModel, boolean, java.util.Map<java.lang.String, java.lang.String>)andcollectFromTemplate(io.jmix.dynmodelflowui.model.DynamicViewModel, io.jmix.dynmodelflowui.model.DynamicEntityModel, boolean, java.util.Map<java.lang.String, java.lang.String>)branch on the same answer. A failing resolver contributes nothing rather than aborting the whole lookup: the entity is then treated as not a static extension, which only skips the base-view source. -
collectFromSource
-
collectFromBaseView
protected void collectFromBaseView(DynamicViewModel view, @Nullable DynamicEntityModel entity, boolean staticExtension, Map<String, String> tagsById) -
collectFromTemplate
protected void collectFromTemplate(DynamicViewModel view, @Nullable DynamicEntityModel entity, boolean staticExtension, Map<String, String> tagsById) Renders the template behind a dynamic entity view and collects its ids. Skipped for static extensions, for a declaration that already carries literal source, when the view type is not set, and when the entity has no metaclass yet. -
descriptorSource
-
collectComponents
Collects each element that carries anidintotagsById, keyed by the id and valued by the element's XML tag. An id already present keeps the tag it was first seen with. Subtrees listed inNON_COMPONENT_ELEMENTSare skipped whole.
-