Search in sources :

Example 1 with IModel

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

the class MarkupReplaceElementModelProcessor method doProcess.

@Override
protected void doProcess(final ITemplateContext context, final IModel model, final AttributeName attributeName, final String attributeValue, final IElementModelStructureHandler structureHandler) {
    final IModel replacementMarkup = context.getModelFactory().parse(context.getTemplateData(), REPLACEMENT);
    model.reset();
    model.addModel(replacementMarkup);
}
Also used : IModel(org.thymeleaf.model.IModel)

Example 2 with IModel

use of org.thymeleaf.model.IModel 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 3 with IModel

use of org.thymeleaf.model.IModel 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 4 with IModel

use of org.thymeleaf.model.IModel 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 5 with IModel

use of org.thymeleaf.model.IModel 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)

Aggregations

IModel (org.thymeleaf.model.IModel)19 IModelFactory (org.thymeleaf.model.IModelFactory)15 IStandaloneElementTag (org.thymeleaf.model.IStandaloneElementTag)12 Writer (java.io.Writer)1 Map (java.util.Map)1 IEngineConfiguration (org.thymeleaf.IEngineConfiguration)1 IEngineContext (org.thymeleaf.context.IEngineContext)1 ITemplateContext (org.thymeleaf.context.ITemplateContext)1 TemplateData (org.thymeleaf.engine.TemplateData)1 TemplateModel (org.thymeleaf.engine.TemplateModel)1 TemplateInputException (org.thymeleaf.exceptions.TemplateInputException)1 TemplateProcessingException (org.thymeleaf.exceptions.TemplateProcessingException)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 Fragment (org.thymeleaf.standard.expression.Fragment)1 FragmentSignature (org.thymeleaf.standard.expression.FragmentSignature)1 FastStringWriter (org.thymeleaf.util.FastStringWriter)1