Search in sources :

Example 11 with IStandaloneElementTag

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

the class StandaloneElementTagTest method testXmlStandaloneElementPropertyManagement.

@Test
public void testXmlStandaloneElementPropertyManagement() {
    IStandaloneElementTag tag;
    final ElementDefinitions elementDefinitions = TEMPLATE_ENGINE_CONFIGURATION.getElementDefinitions();
    tag = computeXmlTag("<input/>");
    Assert.assertSame(elementDefinitions.forXMLName("input"), tag.getElementDefinition());
    try {
        // XML standalone elements cannot be un-minimized
        tag.setMinimized(false);
        Assert.assertTrue(false);
    } catch (final IllegalArgumentException e) {
        Assert.assertTrue(true);
    }
}
Also used : IStandaloneElementTag(org.thymeleaf.model.IStandaloneElementTag) Test(org.junit.Test)

Example 12 with IStandaloneElementTag

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

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

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

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

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