Package io.jmix.flowui.view
Class ViewRegistry
java.lang.Object
io.jmix.flowui.view.ViewRegistry
- All Implemented Interfaces:
- org.springframework.beans.factory.Aware,- org.springframework.context.ApplicationContextAware
@Component("flowui_ViewRegistry")
public class ViewRegistry
extends Object
implements org.springframework.context.ApplicationContextAware
Provides information about all registered views.
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContextprotected ClassManagerprotected List<ViewControllersConfiguration>static final Stringstatic final Patternprotected ExtendedEntitiesprotected booleanstatic final Stringprotected ReadWriteLockstatic final Stringprotected Metadataprotected AnnotationScanMetadataReaderFactoryprotected UiPropertiesprotected Resourcesprotected com.vaadin.flow.router.RouteConfigurationprotected ViewControllersConfigurationSorter
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidfindViewInfo(String id) Returns view information by id.getAnnotationValue(org.springframework.core.type.AnnotationMetadata annotationMetadata, Class<?> annotationClass) getAvailableListViewId(MetaClass metaClass) Returns list view id by entity metaclass determined by the following procedure: If a view annotated with @PrimaryListViewexists, its id is used Otherwise, a view with<entity_name>.listid is usedgetAvailableLookupViewId(MetaClass metaClass) Returns lookup view id by entity metaclass determined by the following procedure: If a view annotated with @PrimaryLookupViewexists, its id is used Otherwise, if a view with<entity_name>.lookupid exists, its id is used Otherwise, if a view annotated with @PrimaryListViewexists, its id is used Otherwise, a view with<entity_name>.listid is usedgetDetailViewId(MetaClass metaClass) Returns standard id of the detail view for an entity, for exampleCustomer.detail.getDetailViewInfo(MetaClass metaClass) Returns detail view information by entity metaclass.getDetailViewInfo(Class<?> entityClass) Returns detail view information by entity class.getDetailViewInfo(Object entity) Returns detail view information by entity instance.getListViewId(MetaClass metaClass) Returns standard id of the list view for an entity, for exampleCustomer.list.protected StringgetListViewIdInternal(MetaClass metaClass) getListViewInfo(MetaClass metaClass) Returns list or lookup view information by entity metaclass.getListViewInfo(Class<?> entityClass) Returns list or lookup view information by entity class.getListViewInfo(Object entity) Returns list or lookup view information by entity instance.getLookupViewId(MetaClass metaClass) Returns standard id of the lookup view for an entity, for exampleCustomer.lookup.protected StringgetLookupViewIdInternal(MetaClass metaClass) getLookupViewInfo(MetaClass metaClass) Returns lookup or list view information by entity metaclass.getLookupViewInfo(Class<?> entityClass) Returns lookup or list view information by entity class.getLookupViewInfo(Object entity) Returns lookup or list view information by entity instance.protected StringgetMetaClassViewId(MetaClass metaClass, String suffix) getParentChain(com.vaadin.flow.router.Route route, List<Class<? extends com.vaadin.flow.router.RouterLayout>> defaultChain) com.vaadin.flow.router.RouteConfigurationgetViewInfo(String id) Returns view information by id.booleanprotected voidinit()protected org.springframework.core.type.classreading.MetadataReaderloadClassMetadata(String className) loadDefinedViewClass(String className) voidloadViewClass(String className) Reloads a view class for hot-deploy.protected voidprotected voidprotected voidregisterPrimaryDetailView(ViewInfo viewInfo, org.springframework.core.type.AnnotationMetadata annotationMetadata) protected voidregisterPrimaryListView(ViewInfo viewInfo, org.springframework.core.type.AnnotationMetadata annotationMetadata) protected voidregisterPrimaryLookupView(ViewInfo viewInfo, org.springframework.core.type.AnnotationMetadata annotationMetadata) voidregisterRoute(ViewInfo viewInfo) Registers route for the passed viewInfo instance.voidregisterRoute(Class<? extends View<?>> viewClass) Registers route for the passed view class.protected voidregisterView(String id, ViewInfo viewInfo) voidIterates over all registered views and registers their routes.voidreset()Make the registry to reload views on next request.voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetClassManager(ClassManager classManager) voidsetConfigurations(List<ViewControllersConfiguration> configurations) voidsetExtendedEntities(ExtendedEntities extendedEntities) voidsetMetadata(Metadata metadata) voidsetMetadataReaderFactory(AnnotationScanMetadataReaderFactory metadataReaderFactory) voidsetProperties(UiProperties properties) voidsetResources(Resources resources) voidsetRouteConfiguration(com.vaadin.flow.router.RouteConfiguration routeConfiguration) voidsetViewControllersConfigurationSorter(ViewControllersConfigurationSorter viewControllersConfigurationSorter) 
- 
Field Details- 
ENTITY_VIEW_PATTERN
- 
DETAIL_VIEW_SUFFIX- See Also:
 
- 
LIST_VIEW_SUFFIX- See Also:
 
- 
LOOKUP_VIEW_SUFFIX- See Also:
 
- 
metadata
- 
resources
- 
classManager
- 
properties
- 
extendedEntities
- 
applicationContextprotected org.springframework.context.ApplicationContext applicationContext
- 
metadataReaderFactory
- 
views
- 
- 
primaryListViews
- 
primaryLookupViews
- 
configurations
- 
initializedprotected volatile boolean initialized
- 
routeConfigurationprotected com.vaadin.flow.router.RouteConfiguration routeConfiguration
- 
viewControllersConfigurationSorter
- 
lock
 
- 
- 
Constructor Details- 
ViewRegistrypublic ViewRegistry()
 
- 
- 
Method Details- 
setMetadata
- 
setResources
- 
setClassManager
- 
setProperties
- 
setExtendedEntities
- 
setMetadataReaderFactory@Autowired public void setMetadataReaderFactory(AnnotationScanMetadataReaderFactory metadataReaderFactory) 
- 
setViewControllersConfigurationSorter@Autowired public void setViewControllersConfigurationSorter(ViewControllersConfigurationSorter viewControllersConfigurationSorter) 
- 
setConfigurations@Autowired(required=false) public void setConfigurations(List<ViewControllersConfiguration> configurations) 
- 
setApplicationContextpublic void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
- setApplicationContextin interface- org.springframework.context.ApplicationContextAware
- Throws:
- org.springframework.beans.BeansException
 
- 
postConstruct@PostConstruct protected void postConstruct()
- 
resetpublic void reset()Make the registry to reload views on next request.
- 
checkInitializedprotected void checkInitialized()
- 
initprotected void init()
- 
loadViewConfigurationsprotected void loadViewConfigurations()
- 
registerView
- 
registerPrimaryDetailViewprotected void registerPrimaryDetailView(ViewInfo viewInfo, org.springframework.core.type.AnnotationMetadata annotationMetadata) 
- 
registerPrimaryListViewprotected void registerPrimaryListView(ViewInfo viewInfo, org.springframework.core.type.AnnotationMetadata annotationMetadata) 
- 
registerPrimaryLookupViewprotected void registerPrimaryLookupView(ViewInfo viewInfo, org.springframework.core.type.AnnotationMetadata annotationMetadata) 
- 
getAnnotationValue
- 
loadClassMetadataprotected org.springframework.core.type.classreading.MetadataReader loadClassMetadata(String className) 
- 
loadDefinedViewClass
- 
findViewInfoReturns view information by id.- Parameters:
- id- view id as set in the- ViewControllerannotation
- Returns:
- view's registration information
 
- 
getViewInfoReturns view information by id.- Parameters:
- id- view id as set in the- ViewControllerannotation
- Returns:
- view's registration information
- Throws:
- NoSuchViewException- if the view with specified id is not registered
 
- 
hasView- Returns:
- trueif the registry contains a view with provided id
 
- 
getViewInfos- Returns:
- registration info of all known views
 
- 
getMetaClassViewId
- 
getListViewIdReturns standard id of the list view for an entity, for exampleCustomer.list.- Parameters:
- metaClass- entity metaclass
 
- 
getLookupViewIdReturns standard id of the lookup view for an entity, for exampleCustomer.lookup.- Parameters:
- metaClass- entity metaclass
 
- 
getDetailViewIdReturns standard id of the detail view for an entity, for exampleCustomer.detail.- Parameters:
- metaClass- entity metaclass
 
- 
getDetailViewInfoReturns detail view information by entity metaclass.- Parameters:
- metaClass- entity metaclass
- Returns:
- view's registration information
- Throws:
- NoSuchViewException- if the detail view with the standard id is not registered for the entity
 
- 
getDetailViewInfoReturns detail view information by entity class.- Parameters:
- entityClass- entity class
- Returns:
- view's registration information
- Throws:
- NoSuchViewException- if the detail view with the standard id is not registered for the entity
 
- 
getDetailViewInfoReturns detail view information by entity instance.- Parameters:
- entity- entity instance
- Returns:
- view's registration information
- Throws:
- NoSuchViewException- if the detail view with the standard id is not registered for the entity
 
- 
getListViewInfoReturns list or lookup view information by entity metaclass.- Parameters:
- metaClass- entity metaclass
- Returns:
- view's registration information
- Throws:
- NoSuchViewException- if the list or lookup view with the standard id is not registered for the entity
 
- 
getListViewInfoReturns list or lookup view information by entity class.- Parameters:
- entityClass- entity class
- Returns:
- view's registration information
- Throws:
- NoSuchViewException- if the list or lookup view with the standard id is not registered for the entity
 
- 
getListViewInfoReturns list or lookup view information by entity instance.- Parameters:
- entity- entity instance
- Returns:
- view's registration information
- Throws:
- NoSuchViewException- if the list or lookup view with the standard id is not registered for the entity
 
- 
getLookupViewInfoReturns lookup or list view information by entity metaclass.- Parameters:
- metaClass- entity metaclass
- Returns:
- view's registration information
- Throws:
- NoSuchViewException- if the lookup or list view with the standard id is not registered for the entity
 
- 
getLookupViewInfoReturns lookup or list view information by entity class.- Parameters:
- entityClass- entity class
- Returns:
- view's registration information
- Throws:
- NoSuchViewException- if the lookup or list view with the standard id is not registered for the entity
 
- 
getLookupViewInfoReturns lookup or list view information by entity instance.- Parameters:
- entity- entity instance
- Returns:
- view's registration information
- Throws:
- NoSuchViewException- if the lookup or list view with the standard id is not registered for the entity
 
- 
getAvailableListViewIdReturns list view id by entity metaclass determined by the following procedure:- If a view annotated with @PrimaryListViewexists, its id is used
- Otherwise, a view with <entity_name>.listid is used
 - Parameters:
- metaClass- entity metaclass
- Returns:
- view's id
 
- If a view annotated with @
- 
getAvailableLookupViewIdReturns lookup view id by entity metaclass determined by the following procedure:- If a view annotated with @PrimaryLookupViewexists, its id is used
- Otherwise, if a view with <entity_name>.lookupid exists, its id is used
- Otherwise, if a view annotated with @PrimaryListViewexists, its id is used
- Otherwise, a view with <entity_name>.listid is used
 - Parameters:
- metaClass- entity metaclass
- Returns:
- view's id
 
- If a view annotated with @
- 
getListViewIdInternal
- 
getLookupViewIdInternal
- 
loadViewClassReloads a view class for hot-deploy.- Parameters:
- className- view class name
 
- 
registerViewRoutespublic void registerViewRoutes()Iterates over all registered views and registers their routes.
- 
registerRouteRegisters route for the passed viewInfo instance.- Parameters:
- viewInfo- a viewInfo instance to register route
 
- 
registerRouteRegisters route for the passed view class.- Parameters:
- viewClass- a view class to register route
 
- 
getParentChain
- 
getDefaultParentChain
- 
getRouteConfigurationpublic com.vaadin.flow.router.RouteConfiguration getRouteConfiguration()
- 
setRouteConfigurationpublic void setRouteConfiguration(com.vaadin.flow.router.RouteConfiguration routeConfiguration) 
 
-