| Recent Entries |
|
02. Jul 2009
|
|||
|
01. Jul 2009
|
|||
|
29. Jun 2009
|
|||
|
24. Jun 2009
|
|||
|
23. Jun 2009
|
|||
|
12. Jun 2009
|
|||
|
11. Jun 2009
|
|||
|
09. Jun 2009
|
|||
|
08. Jun 2009
|
|||
|
05. Jun 2009
|
|||
|
04. Jun 2009
|
|||
|
01. Jun 2009
|
|||
|
31. May 2009
|
| Seam | (88) |
| Seam News | (78) |
| Web Beans | (47) |
| JBoss Tools | (41) |
| Eclipse | (32) |
| JBoss Tools Eclipse | (31) |
| RichFaces | (30) |
| Contexts and Dependency Injection | (12) |
| Bean Validation | (11) |
| JavaServer Faces | (11) |
| Seam Wiki | (8) |
| Interoperability | (7) |
| Hibernate Search | (5) |
| JPA | (5) |
| Web Beans Sneak Peek | (5) |
In Seam 1.1.1 a PDF view is just like any other page in the application: a facelets template containing EL expressions that bind values from the underlying Seam components onto the page. So if you already know Seam, producing PDF just involves learning the new iText-specific tags.
Here's a simple Hello example in Seam PDF:
<p:document [=>xmlns:p=]"=>http://jboss.com/products/seam/pdf"
title="Hello">
<p:paragraph>Hello #{user.name}!</p:paragraph>
</p:document>
Just throw this document in your docroot directory of a Seam project, and access the page like you would any other facelets page. What could be easier?
For larger documents, we'll probably want to break our document up into chapters:
<p:document [=>xmlns:p=]"=>http://jboss.com/products/seam/pdf"
title="Hello">
<p:chapter number="1">
<p:title><p:paragraph>Hello</p:paragraph></p:title>
<p:paragraph>Hello #{user.name}!</p:paragraph>
</p:chapter>
<p:chapter number="2">
<p:title><p:paragraph>Goodbye</p:paragraph></p:title>
<p:paragraph>Goodbye #{user.name}.</p:paragraph>
</p:chapter>
</p:document>
Of course, the real usefulness of this feature is for reporting, so I bet you want to know how to render dynamic lists and tables. Well, here's a list:
<p:document [=>xmlns:p=]"=>http://jboss.com/products/seam/pdf"
[=>xmlns:ui=]"=>http://java.sun.com/jsf/facelets"
title="Hello">
<p:list style="numbered">
<[=>ui:repeat] value="#{documents}" var="doc">
<p:listItem>#{doc.name}</p:listItem>
</[=>ui:repeat]>
</p:list>
</p:document>
And here's a table:
<p:document [=>xmlns:p=]"=>http://jboss.com/products/seam/pdf"
[=>xmlns:ui=]"=>http://java.sun.com/jsf/facelets"
title="Hello">
<p:table columns="3" headerRows="1">
<p:cell>name</p:cell>
<p:cell>owner</p:cell>
<p:cell>size</p:cell>
<[=>ui:repeat] value="#{documents}" var="doc">
<p:cell>#{doc.name}</p:cell>
<p:cell>#{doc.user.name}</p:cell>
<p:cell>#{doc.size}</p:cell>
</[=>ui:repeat]>
</p:table>
</p:document>
Of course, there's much more functionality available: sections, anchors, fonts, etc, but that should be enough to give you the flavor of this new stuff. Check out the examples in Seam 1.1.1 for more information.
Seam 1.1.1 is now available for download.
https://sourceforge.net/project/showfiles.php?group_id=22866&package_id=163777&release_id=479605
This release fixes several minor bugs, introduces a number of improvements to seam-gen, and adds the following new features:
- Facelets PDF templates (a JSF tag library for iText)
- definition of navigation rules via pages.xml
- Seam Text, a built-in text formatting language for use in blogs, forums and wikis
-
transaction success
events
- several improvements to pages.xml
The most exciting feature is the PDF generation (developed by Norman Richards). It's now super easy to generate PDF from Seam, by writing a simple facelets template. Check out the samples in the examples/pdf directory.
For people building collaboration-oriented websites, Seam Text is a wikitext parser built using an ANTLR grammar. It's totally trivial to display wikitext in your Seam application using <s:formattedText/>. The language itself is nice and flexible - much, much better than the awful wikitext language used by the software that runs this blog. I guess its well past time for blog.hibernate.org to be running on Seam.