Package com.vaadin.copilot
Class NewRouteTemplateHandler
java.lang.Object
com.vaadin.copilot.NewRouteTemplateHandler
Handles listing, supplying templates of new views that will be created by New
Route Panel.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordContains information to generate new Flow viewstatic final recordContains information to generate new Flow view -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetFlowTemplate(NewRouteTemplateHandler.FlowTemplateRequest flowTemplateRequest) Creates a view template string that will have view configuration based on given parameters and invoke the template handler with it.getHillaTemplate(NewRouteTemplateHandler.HillaTemplateRequest hillaTemplateRequest) Creates a view template string that will have view configuration based on given parameters and invoke the template handler with it.getTemplateNames(String framework) It returns the template list for the given framework.getTemplateNames(String framework, SourceLanguage language) Lists the templates that can be generated for the given framework and language.
-
Constructor Details
-
NewRouteTemplateHandler
public NewRouteTemplateHandler()
-
-
Method Details
-
getFlowTemplate
public CompletableFuture<String> getFlowTemplate(NewRouteTemplateHandler.FlowTemplateRequest flowTemplateRequest) Creates a view template string that will have view configuration based on given parameters and invoke the template handler with it. It returns the empty template when template name is blank or equals toEMPTYor null.- Parameters:
flowTemplateRequest- Required parameters to create flow template- Returns:
- a CompletableFuture with the template string
-
getHillaTemplate
public CompletableFuture<String> getHillaTemplate(NewRouteTemplateHandler.HillaTemplateRequest hillaTemplateRequest) Creates a view template string that will have view configuration based on given parameters and invoke the template handler with it. It returns the empty template when template name is blank or equals toEMPTYor null.- Parameters:
hillaTemplateRequest- Required parameters to create hilla template
-
getTemplateNames
It returns the template list for the given framework. Label is the base file name, value is the file name.- Parameters:
framework- Either "hilla" or "flow"- Returns:
- list of summary templates, which model has label and value properties
-
getTemplateNames
Lists the templates that can be generated for the given framework and language.Only the templates ported to Kotlin are offered for a Kotlin project, since offering one that cannot be generated would fail only after the user had picked it and named the view.
- Parameters:
framework- either "hilla" or "flow"language- the language the view will be written in- Returns:
- the template labels
-