use of org.apache.tapestry5.MarkupWriter in project tapestry-5 by apache.
the class MarkupWriterFactoryImpl method constructMarkupWriter.
private MarkupWriter constructMarkupWriter(ContentType contentType, boolean partial, boolean HTML5) {
final String mimeType = contentType.getMimeType();
boolean isHTML = mimeType.equalsIgnoreCase("text/html");
MarkupModel model;
if (isHTML)
model = HTML5 ? (partial ? html5PartialModel : html5Model) : (partial ? htmlPartialModel : htmlModel);
else
model = partial ? xmlPartialModel : xmlModel;
return new MarkupWriterImpl(model, contentType.getCharset(), mimeType);
}
use of org.apache.tapestry5.MarkupWriter in project tapestry-5 by apache.
the class MarkupWriterFactoryImpl method newMarkupWriter.
public MarkupWriter newMarkupWriter(Page page) {
boolean isHTML5 = hasHTML5Doctype(page);
ContentType contentType = pageContentTypeAnalyzer.findContentType(page);
return constructMarkupWriter(contentType, false, isHTML5);
}
use of org.apache.tapestry5.MarkupWriter in project tapestry-5 by apache.
the class MarkupWriterFactoryImpl method newPartialMarkupWriter.
public MarkupWriter newPartialMarkupWriter(Page page) {
boolean isHTML5 = hasHTML5Doctype(page);
ContentType contentType = pageContentTypeAnalyzer.findContentType(page);
return constructMarkupWriter(contentType, true, isHTML5);
}
use of org.apache.tapestry5.MarkupWriter in project tapestry-5 by apache.
the class RenderCommandComponentEventResultProcessor method renderMarkup.
/**
* As a filter, this class does three things:
* <ul>
* <li>It creates an outer element to capture the partial page content that will be rendered</li>
* <li>It does setup and cleanup with the {@link AjaxFormUpdateController}</li>
* <li>It extracts the child markup and stuffs it into the reply's "content" property.</li>
* </ul>
*/
public void renderMarkup(MarkupWriter writer, JSONObject reply, PartialMarkupRenderer renderer) {
// The partial will quite often contain multiple elements (or just a block of plain text),
// so those must be enclosed in a root element.
Element root = writer.element("ajax-partial");
ajaxFormUpdateController.setupBeforePartialZoneRender(writer);
renderer.renderMarkup(writer, reply);
ajaxFormUpdateController.cleanupAfterPartialZoneRender();
writer.end();
String content = root.getChildMarkup().trim();
reply.put("content", content);
}
use of org.apache.tapestry5.MarkupWriter in project tapestry-5 by apache.
the class CompositeRenderCommandTest method render_queue_commands_nyi.
@Test(dataProvider = "nyi_data")
public void render_queue_commands_nyi(RenderCommand rc) {
MarkupWriter writer = mockMarkupWriter();
RenderQueue queue = mockRenderQueue();
try {
new CompositeRenderCommand(new RenderCommand[] { rc }).render(writer, queue);
unreachable();
} catch (IllegalStateException ex) {
// Don't care about the message.
}
}
Aggregations