use of org.thymeleaf.model.IModelFactory in project thymeleaf by thymeleaf.
the class EngineConfiguration method getModelFactory.
public IModelFactory getModelFactory(final TemplateMode templateMode) {
if (this.modelFactories.containsKey(templateMode)) {
return this.modelFactories.get(templateMode);
}
// TODO The classes to be instanced for creating model factories should be configurable
final IModelFactory modelFactory = new StandardModelFactory(this, templateMode);
this.modelFactories.putIfAbsent(templateMode, modelFactory);
return this.modelFactories.get(templateMode);
}
use of org.thymeleaf.model.IModelFactory in project thymeleaf-tests by thymeleaf.
the class MarkupPrintAfterElementModelProcessor method doProcess.
@Override
protected void doProcess(final ITemplateContext context, final IModel model, final AttributeName attributeName, final String attributeValue, final IElementModelStructureHandler structureHandler) {
final String markupStr = HtmlEscape.escapeHtml4Xml(model.toString().replaceAll("\\r\\n|\\r|\\n", "\\\\n"));
final IModelFactory modelFactory = context.getModelFactory();
final IProcessableElementTag newTag = modelFactory.setAttribute((IProcessableElementTag) model.get(0), "aggafter", markupStr);
model.replace(0, newTag);
}
use of org.thymeleaf.model.IModelFactory in project thymeleaf-tests by thymeleaf.
the class MarkupPrintBeforeElementModelProcessor method doProcess.
@Override
protected void doProcess(final ITemplateContext context, final IModel model, final AttributeName attributeName, final String attributeValue, final IElementModelStructureHandler structureHandler) {
final String markupStr = HtmlEscape.escapeHtml4Xml(model.toString().replaceAll("\\r\\n|\\r|\\n", "\\\\n"));
final IModelFactory modelFactory = context.getModelFactory();
final IProcessableElementTag newTag = modelFactory.setAttribute((IProcessableElementTag) model.get(0), "aggbefore", markupStr);
model.replace(0, newTag);
}
use of org.thymeleaf.model.IModelFactory 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);
}
use of org.thymeleaf.model.IModelFactory 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);
}
Aggregations