Class CustomComponentsRegistry

java.lang.Object
io.jmix.ui.sys.registration.CustomComponentsRegistry

@Component("ui_CustomComponentsRegistry") public class CustomComponentsRegistry extends Object
Registers external UI components that should be used by the framework.

For instance, in the spring Configuration class create ComponentRegistration bean.

 @Configuration
 public class ComponentConfiguration {

     @Bean
     public ComponentRegistration extButton() {
         return ComponentRegistrationBuilder.create(ExtButton.NAME)
                 .withComponentClass(ExtWebButton.class)
                 .withComponentLoaderClass(ExtButtonLoader.class)
                 .build();
     }
 }
 


Note, the order of providing ComponentRegistration beans is very important because components with the same name will be filtered if they have lower priority. For instance, the configuration provides two ComponentRegistration with the same name:

 @Bean
 @Order(100)
 public ComponentRegistration extButton() {
     return ComponentRegistrationBuilder.create(ExtButton.NAME)
             .withComponentClass(ExtWebButton.class)
             .build();
 }
 @Bean
 @Order(200)
 public ComponentRegistration extButton1() {
     return ComponentRegistrationBuilder.create(ExtButton.NAME)
             .withComponentClass(ExtWebButton.class)
             .withComponentLoaderClass(ExtButtonLoader.class)
             .build();
 }
 
Component with loader will be filtered as it has a lower priority. Another example, the configuration provides ComponentRegistration that overrides registration from some add-on. In this case, if the component from the add-on has lower priority it will not be registered at all. It means that our component registration must provide full information: name, tag (if it not the same as name), component class, and loader class.
See Also:
  • Field Details

  • Constructor Details

    • CustomComponentsRegistry

      public CustomComponentsRegistry()
  • Method Details

    • init

      @EventListener @Order(200) public void init(org.springframework.context.event.ContextRefreshedEvent event)
    • registerComponents

      protected void registerComponents()
    • registerComponent

      protected void registerComponent(ComponentRegistration registration)