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 Summary
FieldsModifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContextprotected ClassManagerprotected List<ViewControllersConfiguration>static final Stringstatic final Patternprotected ExtendedEntitiesprotected booleanstatic final Stringprotected ReadWriteLockstatic final Stringprotected Metadataprotected AnnotationScanMetadataReaderFactoryprotected FlowuiPropertiesprotected Resourcesprotected com.vaadin.flow.router.RouteConfigurationprotected ViewControllersConfigurationSorter -
Constructor Summary
Constructors -
Method Summary
Modifier 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(FlowuiProperties 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
-
applicationContext
protected org.springframework.context.ApplicationContext applicationContext -
metadataReaderFactory
-
views
-
-
primaryListViews
-
primaryLookupViews
-
configurations
-
initialized
protected volatile boolean initialized -
routeConfiguration
protected com.vaadin.flow.router.RouteConfiguration routeConfiguration -
viewControllersConfigurationSorter
-
lock
-
-
Constructor Details
-
ViewRegistry
public 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) -
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
postConstruct
@PostConstruct protected void postConstruct() -
reset
public void reset()Make the registry to reload views on next request. -
checkInitialized
protected void checkInitialized() -
init
protected void init() -
loadViewConfigurations
protected void loadViewConfigurations() -
registerView
-
registerPrimaryDetailView
protected void registerPrimaryDetailView(ViewInfo viewInfo, org.springframework.core.type.AnnotationMetadata annotationMetadata) -
registerPrimaryListView
protected void registerPrimaryListView(ViewInfo viewInfo, org.springframework.core.type.AnnotationMetadata annotationMetadata) -
registerPrimaryLookupView
protected void registerPrimaryLookupView(ViewInfo viewInfo, org.springframework.core.type.AnnotationMetadata annotationMetadata) -
getAnnotationValue
-
loadClassMetadata
protected org.springframework.core.type.classreading.MetadataReader loadClassMetadata(String className) -
loadDefinedViewClass
-
findViewInfo
Returns view information by id.- Parameters:
id- view id as set in theViewControllerannotation- Returns:
- view's registration information
-
getViewInfo
Returns view information by id.- Parameters:
id- view id as set in theViewControllerannotation- 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
-
getListViewId
Returns standard id of the list view for an entity, for exampleCustomer.list.- Parameters:
metaClass- entity metaclass
-
getLookupViewId
Returns standard id of the lookup view for an entity, for exampleCustomer.lookup.- Parameters:
metaClass- entity metaclass
-
getDetailViewId
Returns standard id of the detail view for an entity, for exampleCustomer.detail.- Parameters:
metaClass- entity metaclass
-
getDetailViewInfo
Returns 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
-
getDetailViewInfo
Returns 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
-
getDetailViewInfo
Returns 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
-
getListViewInfo
Returns 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
-
getListViewInfo
Returns 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
-
getListViewInfo
Returns 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
-
getLookupViewInfo
Returns 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
-
getLookupViewInfo
Returns 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
-
getLookupViewInfo
Returns 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
-
getAvailableListViewId
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 used
- Parameters:
metaClass- entity metaclass- Returns:
- view's id
- If a view annotated with @
-
getAvailableLookupViewId
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 used
- Parameters:
metaClass- entity metaclass- Returns:
- view's id
- If a view annotated with @
-
getListViewIdInternal
-
getLookupViewIdInternal
-
loadViewClass
Reloads a view class for hot-deploy.- Parameters:
className- view class name
-
registerViewRoutes
public void registerViewRoutes()Iterates over all registered views and registers their routes. -
registerRoute
Registers route for the passed viewInfo instance.- Parameters:
viewInfo- a viewInfo instance to register route
-
registerRoute
Registers route for the passed view class.- Parameters:
viewClass- a view class to register route
-
getParentChain
-
getDefaultParentChain
-
getRouteConfiguration
public com.vaadin.flow.router.RouteConfiguration getRouteConfiguration() -
setRouteConfiguration
public void setRouteConfiguration(com.vaadin.flow.router.RouteConfiguration routeConfiguration)
-