Search in sources :

Example 16 with IModelFactory

use of org.thymeleaf.model.IModelFactory 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 17 with IModelFactory

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

Example 18 with IModelFactory

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

the class ReplaceWithProcessableProcessingInstructionProcessor 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, true);
}
Also used : IModel(org.thymeleaf.model.IModel) IModelFactory(org.thymeleaf.model.IModelFactory) IStandaloneElementTag(org.thymeleaf.model.IStandaloneElementTag)

Example 19 with IModelFactory

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

the class ReplaceWithProcessableTextProcessor 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, true);
}
Also used : IModel(org.thymeleaf.model.IModel) IModelFactory(org.thymeleaf.model.IModelFactory) IStandaloneElementTag(org.thymeleaf.model.IStandaloneElementTag)

Example 20 with IModelFactory

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

the class Dialect01DivProcessor method doProcess.

@Override
protected void doProcess(final ITemplateContext processingContext, final IProcessableElementTag tag, final IElementTagStructureHandler structureHandler) {
    final IModelFactory modelFactory = processingContext.getModelFactory();
    final IModel markup = modelFactory.createModel();
    markup.add(modelFactory.createText("[From Dialect 01]"));
    structureHandler.insertImmediatelyAfter(markup, true);
}
Also used : IModel(org.thymeleaf.model.IModel) IModelFactory(org.thymeleaf.model.IModelFactory)

Aggregations

IModelFactory (org.thymeleaf.model.IModelFactory)22 IModel (org.thymeleaf.model.IModel)15 IStandaloneElementTag (org.thymeleaf.model.IStandaloneElementTag)13 IProcessableElementTag (org.thymeleaf.model.IProcessableElementTag)6 AttributeName (org.thymeleaf.engine.AttributeName)1 StandardModelFactory (org.thymeleaf.engine.StandardModelFactory)1 TemplateProcessingException (org.thymeleaf.exceptions.TemplateProcessingException)1 IAttribute (org.thymeleaf.model.IAttribute)1 ICloseElementTag (org.thymeleaf.model.ICloseElementTag)1 IOpenElementTag (org.thymeleaf.model.IOpenElementTag)1 ITemplateEvent (org.thymeleaf.model.ITemplateEvent)1