Search in sources :

Example 26 with MarkupWriter

use of org.apache.tapestry5.MarkupWriter in project tapestry-5 by apache.

the class OverrideMixin method afterRender.

void afterRender(MarkupWriter writer) {
    final Element element = writer.getDocument().getElementById(clientElement.getClientId());
    element.element("span", "id", "overrideMixin").text(" [Override mixin]");
}
Also used : ClientElement(org.apache.tapestry5.ClientElement) Element(org.apache.tapestry5.dom.Element)

Example 27 with MarkupWriter

use of org.apache.tapestry5.MarkupWriter in project tapestry-5 by apache.

the class ConfigureHTMLElementFilter method renderMarkup.

public void renderMarkup(MarkupWriter writer, MarkupRenderer renderer) {
    renderer.renderMarkup(writer);
    // After that's done (i.e., pretty much all rendering), touch it up a little.
    Element html = writer.getDocument().find("html");
    // to describe locale, and if debug is enabled.
    if (html != null) {
        html.attributes("data-locale", threadLocale.getLocale().toString());
        if (debugEnabled) {
            html.attributes("data-debug-enabled", "true");
        }
    }
}
Also used : Element(org.apache.tapestry5.dom.Element)

Example 28 with MarkupWriter

use of org.apache.tapestry5.MarkupWriter in project tapestry-5 by apache.

the class AjaxFormUpdateControllerImpl method setupBeforePartialZoneRender.

public void setupBeforePartialZoneRender(MarkupWriter writer) {
    if (formComponentId == null)
        return;
    hiddenFieldPositioner = new HiddenFieldPositioner(writer, rules);
    actionSink = new ComponentActionSink(logger, clientDataEncoder);
    formSupport = createInternalFormSupport(formClientId, formComponentId, actionSink);
    environment.push(FormSupport.class, formSupport);
    environment.push(ValidationTracker.class, new ValidationTrackerImpl());
    heartbeat.begin();
}
Also used : ComponentActionSink(org.apache.tapestry5.corelib.internal.ComponentActionSink) HiddenFieldPositioner(org.apache.tapestry5.corelib.internal.HiddenFieldPositioner) ValidationTrackerImpl(org.apache.tapestry5.ValidationTrackerImpl)

Example 29 with MarkupWriter

use of org.apache.tapestry5.MarkupWriter in project tapestry-5 by apache.

the class BlockImplTest method body_pushed_to_queue_backwards.

@Test
public void body_pushed_to_queue_backwards() {
    BlockImpl block = new BlockImpl(null, null);
    RenderQueue queue = mockRenderQueue();
    MarkupWriter writer = mockMarkupWriter();
    RenderCommand element1 = mockRenderCommand();
    RenderCommand element2 = mockRenderCommand();
    getMocksControl().checkOrder(true);
    queue.push(element2);
    queue.push(element1);
    replay();
    block.addToBody(element1);
    block.addToBody(element2);
    block.render(writer, queue);
    verify();
}
Also used : RenderCommand(org.apache.tapestry5.runtime.RenderCommand) RenderQueue(org.apache.tapestry5.runtime.RenderQueue) MarkupWriter(org.apache.tapestry5.MarkupWriter) Test(org.testng.annotations.Test)

Example 30 with MarkupWriter

use of org.apache.tapestry5.MarkupWriter in project tapestry-5 by apache.

the class ExpansionPageElementImplTest method invariant_binding_is_cached.

@Test
public void invariant_binding_is_cached() {
    Binding binding = mockBinding();
    TypeCoercer coercer = mockTypeCoercer();
    MarkupWriter writer = mockMarkupWriter();
    RenderQueue queue = mockRenderQueue();
    Object value = new Object();
    train_isInvariant(binding, true);
    replay();
    RenderCommand element = new ExpansionPageElement(binding, coercer);
    verify();
    train_get(binding, value);
    train_coerce(coercer, value, String.class, "STRING-VALUE");
    writer.write("STRING-VALUE");
    replay();
    element.render(writer, queue);
    verify();
    // It is now cached ...
    writer.write("STRING-VALUE");
    replay();
    element.render(writer, queue);
    verify();
}
Also used : Binding(org.apache.tapestry5.Binding) RenderCommand(org.apache.tapestry5.runtime.RenderCommand) TypeCoercer(org.apache.tapestry5.commons.services.TypeCoercer) RenderQueue(org.apache.tapestry5.runtime.RenderQueue) MarkupWriter(org.apache.tapestry5.MarkupWriter) Test(org.testng.annotations.Test)

Aggregations

MarkupWriter (org.apache.tapestry5.MarkupWriter)72 Test (org.testng.annotations.Test)69 Element (org.apache.tapestry5.dom.Element)21 XMLMarkupModel (org.apache.tapestry5.dom.XMLMarkupModel)19 MarkupWriterImpl (org.apache.tapestry5.internal.services.MarkupWriterImpl)16 RenderCommand (org.apache.tapestry5.runtime.RenderCommand)14 RenderQueue (org.apache.tapestry5.runtime.RenderQueue)14 ComponentResources (org.apache.tapestry5.ComponentResources)13 Link (org.apache.tapestry5.http.Link)11 SelectModelImpl (org.apache.tapestry5.internal.SelectModelImpl)9 StringValueEncoder (org.apache.tapestry5.internal.services.StringValueEncoder)9 FormSupport (org.apache.tapestry5.services.FormSupport)9 JSONObject (org.apache.tapestry5.json.JSONObject)7 PartialMarkupRenderer (org.apache.tapestry5.services.PartialMarkupRenderer)6 PartialMarkupRendererFilter (org.apache.tapestry5.services.PartialMarkupRendererFilter)6 Map (java.util.Map)5 FieldTranslator (org.apache.tapestry5.FieldTranslator)5 Translator (org.apache.tapestry5.Translator)5 MessageFormatter (org.apache.tapestry5.commons.MessageFormatter)5 Messages (org.apache.tapestry5.commons.Messages)5