Search in sources :

Example 1 with ParserData

use of com.vaadin.flow.component.template.internal.ParserData in project flow by vaadin.

the class LitTemplateDataAnalyzer method parseTemplate.

/**
 * Gets the template data for the template initializer.
 *
 * @return the template data
 */
ParserData parseTemplate() {
    TemplateData templateData = parser.getTemplateContent(templateClass, tag, service);
    if (templateData == null) {
        getLogger().info("Couldn't parse template for {} class. " + "Only specific Lit template format is supported. Please check that your template definition" + " directly contains 'render' method which returns html`_template_content_`.", templateClass);
    }
    Element templateRoot = templateData == null ? null : templateData.getTemplateElement();
    String modulePath = templateData == null ? null : templateData.getModulePath();
    IdCollector idExtractor = new IdCollector(templateClass, modulePath, templateRoot);
    idExtractor.collectInjectedIds(Collections.emptySet());
    return new ParserData(idExtractor.getIdByField(), idExtractor.getTagById(), idExtractor.getAttributes());
}
Also used : TemplateData(com.vaadin.flow.component.littemplate.LitTemplateParser.TemplateData) Element(org.jsoup.nodes.Element) ParserData(com.vaadin.flow.component.template.internal.ParserData) IdCollector(com.vaadin.flow.component.template.internal.IdCollector)

Aggregations

TemplateData (com.vaadin.flow.component.littemplate.LitTemplateParser.TemplateData)1 IdCollector (com.vaadin.flow.component.template.internal.IdCollector)1 ParserData (com.vaadin.flow.component.template.internal.ParserData)1 Element (org.jsoup.nodes.Element)1