Class AllComponentsViewTemplateGenerator

java.lang.Object
com.vaadin.copilot.allcomponents.AllComponentsViewTemplateGenerator

public class AllComponentsViewTemplateGenerator extends Object
Generates the Java source for a runtime All Components view.

The generator creates a routed view containing grouped component showcase cards. It selects component-specific generators where available and falls back to the default generator for all other component types.

  • Constructor Details

    • AllComponentsViewTemplateGenerator

      public AllComponentsViewTemplateGenerator()
      Creates a generator with the built-in component-specific generators.
  • Method Details

    • generateTemplate

      public String generateTemplate(String viewClassName, String route, List<UserApplicationComponentFinder.ClassNameInfo> classNameInfos)
      Generates source code for an All Components view.

      Components that cannot be resolved or instantiated with a default constructor are omitted from the generated view.

      Parameters:
      viewClassName - simple name for the generated view class
      route - route assigned to the generated view
      classNameInfos - components to include in the generated view
      Returns:
      Java source code for the generated All Components view
    • generateTemplate

      public String generateTemplate(String viewClassName, String route, List<UserApplicationComponentFinder.ClassNameInfo> classNameInfos, String applicationMainRoute)
      Generates source code for an All Components view and adds a return control when the application has a root route.
      Parameters:
      viewClassName - View class name aligns with the corresponding file name
      route - Path to navigate
      applicationMainRoute - application's root route, if one is registered
      Returns:
      Generated class code that can be written to a file without a package definition.
    • generateEmptyTemplate

      public String generateEmptyTemplate(String viewClassName, String route)
      Generates an empty All Components view with information about the tool.
      Parameters:
      viewClassName - simple name for the generated view class
      route - route assigned to the generated view
      Returns:
      Java source code for the empty All Components view
    • generateEmptyTemplate

      public String generateEmptyTemplate(String viewClassName, String route, String applicationMainRoute)
      Generates an empty All Components view and adds a return control when the application has a root route.
      Parameters:
      applicationMainRoute - application's root route, if one is registered