Search in sources :

Example 1 with LocalComponents

use of com.axellience.vuegwt.processors.component.template.parser.context.localcomponents.LocalComponents in project vue-gwt by Axellience.

the class ComponentTemplateProcessor method processComponentTemplate.

public void processComponentTemplate(TypeElement componentTypeElement, Builder componentJsTypeBuilder) {
    ClassName componentTypeName = ClassName.get(componentTypeElement);
    Optional<String> optionalTemplateContent = getTemplateContent(componentTypeName, componentTypeElement);
    if (!optionalTemplateContent.isPresent())
        return;
    LocalComponents localComponents = new LocalComponents();
    findLocalComponentsForComponent(localComponents, componentTypeElement);
    // Initialize the template parser context based on the VueComponent type element
    TemplateParserContext templateParserContext = new TemplateParserContext(componentTypeElement, localComponents);
    registerFieldsAndMethodsInContext(templateParserContext, componentTypeElement, new HashSet<>(), new HashSet<>());
    // Parse the template
    TemplateParserResult templateParserResult = new TemplateParser().parseHtmlTemplate(optionalTemplateContent.get(), templateParserContext, messager);
    // Add expressions from the template to JsType and compile template
    TemplateMethodsBuilder templateMethodsBuilder = new TemplateMethodsBuilder();
    templateMethodsBuilder.addTemplateMethodsToComponentJsType(componentJsTypeBuilder, templateParserResult);
}
Also used : TemplateParserContext(com.axellience.vuegwt.processors.component.template.parser.context.TemplateParserContext) TemplateMethodsBuilder(com.axellience.vuegwt.processors.component.template.builder.TemplateMethodsBuilder) ClassName(com.squareup.javapoet.ClassName) TemplateParser(com.axellience.vuegwt.processors.component.template.parser.TemplateParser) TemplateParserResult(com.axellience.vuegwt.processors.component.template.parser.result.TemplateParserResult) ComponentGeneratorsUtil.getComponentLocalComponents(com.axellience.vuegwt.processors.utils.ComponentGeneratorsUtil.getComponentLocalComponents) LocalComponents(com.axellience.vuegwt.processors.component.template.parser.context.localcomponents.LocalComponents)

Aggregations

TemplateMethodsBuilder (com.axellience.vuegwt.processors.component.template.builder.TemplateMethodsBuilder)1 TemplateParser (com.axellience.vuegwt.processors.component.template.parser.TemplateParser)1 TemplateParserContext (com.axellience.vuegwt.processors.component.template.parser.context.TemplateParserContext)1 LocalComponents (com.axellience.vuegwt.processors.component.template.parser.context.localcomponents.LocalComponents)1 TemplateParserResult (com.axellience.vuegwt.processors.component.template.parser.result.TemplateParserResult)1 ComponentGeneratorsUtil.getComponentLocalComponents (com.axellience.vuegwt.processors.utils.ComponentGeneratorsUtil.getComponentLocalComponents)1 ClassName (com.squareup.javapoet.ClassName)1