11.3.2. Creating a SeamPDF Report Template

The code snippets presented in this section show how to build a Report Template for Klaros-Testmanagement. For detailed information please refer to SeamPDF manual. More information on the Klaros-Testmanagement object model can be found in de.verit.klaros.core.model .

The following snippet shows how to build the frame for the Report Template. Inside this frame all other Report details can be described and grouped in chapters and sections.

  <p:document xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core"
   xmlns:p="http://jboss.com/products/seam/pdf" title="Klaros-Testmanagement Test Suite Report"
   marginMirroring="true" author="#{user.name}" creator="#{user.name}" pageSize="A4">
  ...
  </p:document>
	          
	          

Note the usage of the de.verit.klaros.core.model.KlarosUser parameter from the context, #{user.name} .

The next code snippet shows how to define headers and footers for all pages in the Report. This snippet makes use of the date and the de.verit.klaros.core.model.KlarosUser object in the context.

  <f:facet name="header">
    <p:font size="8">
      <p:header borderWidthBottom="0.1" borderColorBottom="black" borderWidthTop="0" alignment="center">
        <p:text value="Example report - generated #{date} by #{user.name}"/>
      </p:header>
      <p:footer borderWidthTop="0.1" borderColorTop="black" borderWidthBottom="0" alignment="center">
        <p:text value="Page " />
        <p:pageNumber />
      </p:footer>
    </p:font>
  </f:facet>
	

Next the front page for the Report should be defined to provide a short summary of the Report. To keep this example short only a fragment is presented. For the complete script please see Section D.3, “Example report template” .

  <p:font style="bold" size="16">
    <p:paragraph alignment="center" spacingAfter="5">
      <p:text value="#{user.name} (#{user.email})"/>
    </p:paragraph>
  </p:font>
	

The snippet shows how to insert the user's email address which opens the email client when clicked.