Search in sources :

Example 11 with IModel

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

the class MarkupReplaceBodyElementModelProcessor 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);
    for (int i = model.size() - 2; i > 0; i--) {
        model.remove(i);
    }
    model.insertModel(1, replacementMarkup);
}
Also used : IModel(org.thymeleaf.model.IModel)

Example 12 with IModel

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

the class ReplaceWithNonProcessableCDATASectionProcessor method doProcess.

@Override
protected void doProcess(final ITemplateContext context, final ICDATASection cdataSection, final ICDATASectionStructureHandler 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 13 with IModel

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

the class ReplaceWithNonProcessableCommentProcessor method doProcess.

@Override
protected void doProcess(final ITemplateContext context, final IComment comment, final ICommentStructureHandler 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 14 with IModel

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

the class ReplaceWithProcessableCDATASectionProcessor method doProcess.

@Override
protected void doProcess(final ITemplateContext context, final ICDATASection cdataSection, final ICDATASectionStructureHandler 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)

Example 15 with IModel

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

the class ReplaceWithProcessableCommentProcessor method doProcess.

@Override
protected void doProcess(final ITemplateContext context, final IComment comment, final ICommentStructureHandler 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

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