Class ViewTemplateDefinitions
java.lang.Object
io.jmix.flowui.view.template.impl.ViewTemplateDefinitions
Loads and caches template-generated view definitions discovered in entity metadata.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ComponentXmlFactoryprotected ViewTemplateControllerClassFactoryprotected List<ViewTemplateDefinition> protected ViewTemplateDescriptorRegistryprotected static final Stringprotected freemarker.template.Configurationprotected com.google.gson.Gsonprotected static final Stringprotected Metadataprotected Resourcesprotected static final Typeprotected ViewTemplateHelper -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddDefinition(List<ViewTemplateDefinition> definitions, Set<String> viewIds, ViewTemplateDefinition definition) protected ViewTemplateDefinitioncreateDefinition(String viewId, ViewTemplateType type, MetaClass metaClass, Map<String, Object> attributes, String title) protected ViewTemplateDefinitioncreateDetailDefinition(MetaClass metaClass, Map<String, Object> attributes) protected ViewTemplateDefinitioncreateListDefinition(MetaClass metaClass, Map<String, Object> attributes) Returns cached template view definitions, loading them lazily on the first call.protected StringgetStringAttribute(Map<String, Object> attributes, String name) getTemplateAttributes(MetaClass metaClass, Class<?> annotationClass) protected voidinit()protected List<ViewTemplateDefinition> parseTemplateParams(String templateParams) voidrefresh()Re-renders all template view descriptors from current metadata and updates the descriptor registry.protected StringrenderTemplate(MetaClass metaClass, String templatePath, String title, Map<String, Object> templateParams) protected StringresolveControllerIdAttribute(Map<String, Object> attributes, String attributeName, String defaultValue) protected StringresolveEditedEntityContainerId(Map<String, Object> attributes) protected StringresolveLookupComponentId(Map<String, Object> attributes) protected StringresolveRoutePath(String viewId, ViewTemplateType type, Map<String, Object> attributes) protected StringresolveTitleMessageReference(MetaClass metaClass, String title) Normalizes aviewTitledefined as a message reference so that it is resolved through theMessagesbean by the framework.
-
Field Details
-
TEMPLATE_PARAMS_TYPE
-
LOOKUP_COMPONENT_ID
- See Also:
-
EDITED_ENTITY_CONTAINER_ID
- See Also:
-
metadata
-
resources
-
componentXmlFactory
-
templateHelper
-
descriptorRegistry
-
controllerClassFactory
-
gson
protected com.google.gson.Gson gson -
freemarkerConfiguration
protected freemarker.template.Configuration freemarkerConfiguration -
definitions
-
-
Constructor Details
-
ViewTemplateDefinitions
public ViewTemplateDefinitions()
-
-
Method Details
-
init
@PostConstruct protected void init() -
getDefinitions
Returns cached template view definitions, loading them lazily on the first call.- Returns:
- immutable list of template view definitions
-
refresh
public void refresh()Re-renders all template view descriptors from current metadata and updates the descriptor registry. Used when runtime metadata changes after startup so that template-generated views reflect the current entity properties. -
loadDefinitions
-
getTemplateAttributes
-
addDefinition
protected void addDefinition(List<ViewTemplateDefinition> definitions, Set<String> viewIds, ViewTemplateDefinition definition) -
createListDefinition
protected ViewTemplateDefinition createListDefinition(MetaClass metaClass, Map<String, Object> attributes) -
createDetailDefinition
protected ViewTemplateDefinition createDetailDefinition(MetaClass metaClass, Map<String, Object> attributes) -
createDefinition
protected ViewTemplateDefinition createDefinition(String viewId, ViewTemplateType type, MetaClass metaClass, Map<String, Object> attributes, String title) -
resolveRoutePath
-
renderTemplate
-
parseTemplateParams
-
resolveLookupComponentId
-
resolveEditedEntityContainerId
-
resolveControllerIdAttribute
-
resolveTitleMessageReference
Normalizes aviewTitledefined as a message reference so that it is resolved through theMessagesbean by the framework. A brief referencemsg://message_idis expanded to the full formmsg://group/message_idusing the entity package as the message group. The reference itself is kept intact so the title is resolved per locale later. -
getStringAttribute
-