Class GenerateMainImports

java.lang.Object
io.jmix.flowui.devserver.frontend.GenerateMainImports
All Implemented Interfaces:
Runnable

public class GenerateMainImports extends Object
Collect generated-flow-imports content for project to use to determine if dev-bundle contains all required imports.

Only used when checking if dev bundle need to be rebuild in dev mode without a dev server.

  • Constructor Details

    • GenerateMainImports

      public GenerateMainImports(com.vaadin.flow.server.frontend.scanner.ClassFinder classFinder, com.vaadin.flow.server.frontend.scanner.FrontendDependenciesScanner frontendDepScanner, Options options, com.vaadin.flow.theme.ThemeDefinition themeDefinition, elemental.json.JsonObject statsJson)
  • Method Details

    • getLines

      public List<String> getLines()
    • addCssLines

      protected boolean addCssLines(Collection<String> lines, com.vaadin.flow.server.frontend.scanner.CssData cssData, int i)
      Adds CSS imports to the generated flow imports file based on the given CssImport data.
      Parameters:
      lines - collection of generated file lines to add imports to
      cssData - CssImport data
      i - imported CSS counter
      Returns:
      true if the imported CSS files does exist, false otherwise
    • writeImportLines

      protected void writeImportLines(List<String> lines)
    • getModules

      protected List<String> getModules()
      Get all ES6 modules needed for run the application. Modules that are theme dependencies are guaranteed to precede other modules in the result.
      Returns:
      list of JS modules
    • getScripts

      protected Set<String> getScripts()
      Get all the JS files used by the application.
      Returns:
      the set of JS files
    • getResource

      protected URL getResource(String name)
      Get a resource from the classpath.
      Parameters:
      name - class literal
      Returns:
      the resource
    • getGeneratedModules

      protected Collection<String> getGeneratedModules()
      Get generated modules to import.
      Returns:
      generated modules
    • getThemeDefinition

      protected com.vaadin.flow.theme.ThemeDefinition getThemeDefinition()
      Get the ThemeDefinition of the application.
      Returns:
      the theme definition
    • getTheme

      protected com.vaadin.flow.theme.AbstractTheme getTheme()
      Get the AbstractTheme instance used in the application.
      Returns:
      the theme instance
    • getCss

      protected Set<com.vaadin.flow.server.frontend.scanner.CssData> getCss()
      Get all the CSS files used by the application.
      Returns:
      the set of CSS files
    • getThemeLines

      protected Collection<String> getThemeLines()
      Get theme lines for the generated imports file content.
      Returns:
      theme related generated JS lines
    • getLogger

      protected org.slf4j.Logger getLogger()
      Get logger for this instance.
      Returns:
      a logger
    • inMemoryCollection

      protected boolean inMemoryCollection()
      If in memory collection we are collecting for devBundle check.
      Returns:
      true if devBundle in memory collecting
    • getImportsNotFoundMessage

      protected String getImportsNotFoundMessage()
    • importedFileExists

      protected boolean importedFileExists(String importName)
      Validate that the file importName can be found.
      Parameters:
      importName - name of the file
      Returns:
      true if file is found
    • run

      public void run()
      Specified by:
      run in interface Runnable
    • getExportLines

      protected Collection<String> getExportLines()
      Get exported modules.
      Returns:
      exported lines.
    • getCssLines

      protected Collection<String> getCssLines()
    • updateImportsFile

      protected void updateImportsFile(File importsFile, List<String> newContent) throws IOException
      Throws:
      IOException
    • resolveResource

      protected String resolveResource(String importPath)
    • addLines

      protected void addLines(Collection<String> lines, String content)
    • getThemeIdPrefix

      protected String getThemeIdPrefix()