Class RouteCreator

java.lang.Object
com.vaadin.copilot.RouteCreator

public class RouteCreator extends Object
Handles creation of views for new routes.
  • Constructor Details

    • RouteCreator

      public RouteCreator(com.vaadin.flow.server.VaadinSession vaadinSession)
  • Method Details

    • createFlowView

      public void createFlowView(String title, String route, Path qualifiedClassNamePath, AccessRequirement accessRequirement, Class<?> layoutClass, String templateFileName, String templateData, Boolean addToMenu) throws IOException, RouteDuplicatedException
      Creates a Flow view for the given route using the given access requirement.
      Parameters:
      title - the title of the view
      route - the path to create a view for
      qualifiedClassNamePath - qualified class name path that is used to create the file e.g. com.vaadin.org.MainView.java
      accessRequirement - the access requirement for the view
      layoutClass - the layout class to use, or null to not use a layout
      templateFileName - the file name to select the template of view
      templateData - data for the selected template, or null
      Throws:
      IOException - if the view file could not be created
      RouteDuplicatedException
    • createHillaView

      public void createHillaView(String title, String route, Path filePath, AccessRequirement accessRequirement, String templateFileName, String templateData, boolean addToMenu) throws RouteDuplicatedException, IOException
      Creates a Hilla view for the given route using the given access requirement.
      Parameters:
      title - the title of the view
      route - the path to create a view for
      filePath - the folder to add view
      accessRequirement - the access requirement for the view
      templateFileName - the selected template for the view
      templateData - data for the selected template, or null
      addToMenu -
      Throws:
      RouteDuplicatedException
      IOException
    • getNewClassPackageNameRelative

      public static String getNewClassPackageNameRelative(String framework, com.vaadin.flow.server.VaadinSession session)
    • getNewFilePath

      public static Path getNewFilePath(String framework, String qualifiedClassNameOrViewFile)