use of org.apache.tapestry5.dom.Document in project tapestry-5 by apache.
the class OverrideMethodsTest method override_abstract_methods.
/**
* TAP5-901
*/
@Test
public void override_abstract_methods() {
PageTester tester = new PageTester(TestConstants.APP2_PACKAGE, TestConstants.APP2_NAME);
try {
Document doc = tester.renderPage("OverrideAbstractMethods");
assertEquals("6", doc.getElementById("length").getChildMarkup());
} finally {
tester.shutdown();
}
}
use of org.apache.tapestry5.dom.Document in project tapestry-5 by apache.
the class PageNameMetaInjector method renderMarkup.
public void renderMarkup(MarkupWriter writer, MarkupRenderer delegate) {
delegate.renderMarkup(writer);
String pageName = globals.getActivePageName();
Document document = writer.getDocument();
Element element = document.find("html/head");
if (element != null) {
element.element("meta", "name", "tapestry-page-name", "content", pageName);
}
}
use of org.apache.tapestry5.dom.Document in project tapestry-5 by apache.
the class PartialTemplateRendererImpl method renderAsDocument.
public Document renderAsDocument(Object object) {
RenderCommand renderCommand = toRenderCommand(object);
MarkupWriter markupWriter = new MarkupWriterImpl();
RenderQueueImpl renderQueue = new RenderQueueImpl(LOGGER);
renderQueue.push(renderCommand);
renderQueue.run(markupWriter);
return markupWriter.getDocument();
}
use of org.apache.tapestry5.dom.Document in project tapestry-5 by apache.
the class PageTester method renderPage.
/**
* Renders a page specified by its name.
*
* @param pageName
* The name of the page to be rendered.
* @return The DOM created. Typically you will assert against it.
*/
public Document renderPage(String pageName) {
renderPageAndReturnResponse(pageName);
Document result = response.getRenderedDocument();
if (result == null)
throw new RuntimeException(String.format("Render of page '%s' did not result in a Document.", pageName));
return result;
}
use of org.apache.tapestry5.dom.Document in project tapestry-5 by apache.
the class AddBrowserCompatibilityStyles method renderMarkup.
public void renderMarkup(MarkupWriter writer, MarkupRenderer renderer) {
renderer.renderMarkup(writer);
Element head = writer.getDocument().find("html/head");
// Only add the respective style documents if we've rendered an HTML document
if (head != null) {
head.raw(ie9);
head.raw(ie8);
}
}
Aggregations