Search in sources :

Example 1 with IStandaloneElementTag

use of org.thymeleaf.model.IStandaloneElementTag in project thymeleaf-tests by thymeleaf.

the class ReplaceWithNonProcessableDocTypeProcessor method doProcess.

@Override
protected void doProcess(final ITemplateContext context, final IDocType docType, final IDocTypeStructureHandler structureHandler) {
    final IModelFactory modelFactory = context.getModelFactory();
    final IStandaloneElementTag tag = modelFactory.createStandaloneElementTag("replaced", "th:text", "one", false, true);
    final IModel model = modelFactory.createModel(tag);
    structureHandler.replaceWith(model, false);
}
Also used : IModel(org.thymeleaf.model.IModel) IModelFactory(org.thymeleaf.model.IModelFactory) IStandaloneElementTag(org.thymeleaf.model.IStandaloneElementTag)

Example 2 with IStandaloneElementTag

use of org.thymeleaf.model.IStandaloneElementTag in project thymeleaf-tests by thymeleaf.

the class ReplaceWithNonProcessableProcessingInstructionProcessor method doProcess.

@Override
protected void doProcess(final ITemplateContext context, final IProcessingInstruction processingInstruction, final IProcessingInstructionStructureHandler structureHandler) {
    final IModelFactory modelFactory = context.getModelFactory();
    final IStandaloneElementTag tag = modelFactory.createStandaloneElementTag("replaced", "th:text", "one", false, true);
    final IModel model = modelFactory.createModel(tag);
    structureHandler.replaceWith(model, false);
}
Also used : IModel(org.thymeleaf.model.IModel) IModelFactory(org.thymeleaf.model.IModelFactory) IStandaloneElementTag(org.thymeleaf.model.IStandaloneElementTag)

Example 3 with IStandaloneElementTag

use of org.thymeleaf.model.IStandaloneElementTag in project thymeleaf-tests by thymeleaf.

the class ReplaceWithNonProcessableTextProcessor method doProcess.

@Override
protected void doProcess(final ITemplateContext context, final IText text, final ITextStructureHandler structureHandler) {
    if (EngineEventUtils.isWhitespace(text) || text.getText().equals("one")) {
        return;
    }
    final IModelFactory modelFactory = context.getModelFactory();
    final IStandaloneElementTag tag = modelFactory.createStandaloneElementTag("replaced", "th:text", "one", false, true);
    final IModel model = modelFactory.createModel(tag);
    structureHandler.replaceWith(model, false);
}
Also used : IModel(org.thymeleaf.model.IModel) IModelFactory(org.thymeleaf.model.IModelFactory) IStandaloneElementTag(org.thymeleaf.model.IStandaloneElementTag)

Example 4 with IStandaloneElementTag

use of org.thymeleaf.model.IStandaloneElementTag in project thymeleaf-tests by thymeleaf.

the class ReplaceWithNonProcessableXMLDeclarationProcessor method doProcess.

@Override
protected void doProcess(final ITemplateContext context, final IXMLDeclaration xmlDeclaration, final IXMLDeclarationStructureHandler structureHandler) {
    final IModelFactory modelFactory = context.getModelFactory();
    final IStandaloneElementTag tag = modelFactory.createStandaloneElementTag("replaced", "th:text", "one", false, true);
    final IModel model = modelFactory.createModel(tag);
    structureHandler.replaceWith(model, false);
}
Also used : IModel(org.thymeleaf.model.IModel) IModelFactory(org.thymeleaf.model.IModelFactory) IStandaloneElementTag(org.thymeleaf.model.IStandaloneElementTag)

Example 5 with IStandaloneElementTag

use of org.thymeleaf.model.IStandaloneElementTag in project thymeleaf-tests by thymeleaf.

the class ReplaceWithProcessableDocTypeProcessor method doProcess.

@Override
protected void doProcess(final ITemplateContext context, final IDocType docType, final IDocTypeStructureHandler structureHandler) {
    final IModelFactory modelFactory = context.getModelFactory();
    final IStandaloneElementTag tag = modelFactory.createStandaloneElementTag("replaced", "th:text", "one", false, true);
    final IModel model = modelFactory.createModel(tag);
    structureHandler.replaceWith(model, true);
}
Also used : IModel(org.thymeleaf.model.IModel) IModelFactory(org.thymeleaf.model.IModelFactory) IStandaloneElementTag(org.thymeleaf.model.IStandaloneElementTag)

Aggregations

IStandaloneElementTag (org.thymeleaf.model.IStandaloneElementTag)19 IModelFactory (org.thymeleaf.model.IModelFactory)13 IModel (org.thymeleaf.model.IModel)12 Test (org.junit.Test)4 TemplateProcessingException (org.thymeleaf.exceptions.TemplateProcessingException)1 IAttribute (org.thymeleaf.model.IAttribute)1 ICloseElementTag (org.thymeleaf.model.ICloseElementTag)1 IOpenElementTag (org.thymeleaf.model.IOpenElementTag)1 IProcessableElementTag (org.thymeleaf.model.IProcessableElementTag)1 ITemplateEvent (org.thymeleaf.model.ITemplateEvent)1 IText (org.thymeleaf.model.IText)1 IElementModelProcessor (org.thymeleaf.processor.element.IElementModelProcessor)1 IElementProcessor (org.thymeleaf.processor.element.IElementProcessor)1 IElementTagProcessor (org.thymeleaf.processor.element.IElementTagProcessor)1