This example was built using seam-gen. To add in Trinidad, the trinidad-api jar was added to the ear (and referenced from `application.xml`) and the trinidad-impl jar, `jboss-seam-trinidad.jar` (Seam-Trinidad integration) & `a4j-trinidad.jar` (RichFaces Ajax-Trinidad integration) were added to `WEB-INF/lib`.

A few alterations were needed in `web.xml` and `faces-config.xml`.

The `trinidad-config.xml` file was used to disable client-side validation for a more consistent user experience.

Of course Trinidad and RichFaces offer some complementary components (e.g. tables, trees) - it's up to you which you choose!

The example also shows how you can use Trinidad components to achieve "in-place" editing - the same views are used to display and edit informtation. A casual visitor to the site navigates around, and see's the components in read only mode; once logged in, these components are editable, and button's are rendered to submit information.

    <tr:inputText label="Artist"
                 value="#{artist.name}"
                 readOnly="#{not identity.loggedIn}"
                 required="true"
                 autoSubmit="true"/>

Trinidad makes it easy by providing a `readOnly` attribute for components - but you could easily achieve the same using Seam's `<s:decorate />` tag.

The example uses the Seam Application Framework. Where possible XML is used, using extension only where extra functionality is needed.

An `EntityHome` and is used for each CRUD, and an `EntityQuery` for clickable lists.

If you extend `EntityHome` you can make the component an EJB3 stateful session bean by adding `@Stateful` and a local interface. You'll need to declare methods like `persist()` and `isManaged()` from `EntityHome` on the interface. The `ArtistHome` is a stateful session bean in this example.

Each item in the list can be clicked - an `<s:link />` and an `<f:param />` is used to link to the detail view. It's wired using `pages.xml`.

The CRUD page uses the `EntityHome` object to create, update or delete the entity as necessary. `pages.xml` is used to direct the user back to the list view.

It's been said that the quality of a tree component is an indication of the quality of a component set. Trinidad has a really robust tree component, - but it's `TreeModel` can be a bit confusing. Luckily it provides a good default implementation - the `ChildPropertyTreeModel`.

The `ChildPropertyTreeModel` takes two parameters - the `Collection` to use for the tree's nodes, and a `String` property which specifies the field or get/set pair to use for accessing each elements child. If the property returns `null`, then the node is a leaf-node.

The example uses a slightly modified `ChildPropertyTreeModel` - one that says discs are the leaves of the tree. Different labels are rendered depending on the type of node.

Both Trinidad and RichFaces have powerful and mature skinning/theming APIs - so you all you need to do is write some CSS! For seamdiscs, we took a RichFaces skin, and adjusted the trinidad skin to fit with it. To do this, we added the skin to `trinidad-skins.xml`, and told Trinidad to use it in `trinidad-config.xml`. You can find more information about Trinidad skinning on the Trinidad wiki.

You'll notice that Trinidad and RichFaces components don't provide a consistent look-and-feel out of the box - there are plans afoot to improve this!

JSF component sets like Trinidad, Tomahawk and IceFaces give you an enhanced `h:dataTable` which has built-in sorting, paging and other goodies. However, there is one big flaw - the entire data set is loaded and sorted/paged in memory, when really you want to get your persistence layer (be it an ORM or just a database) to do this for - a sort translates naturally to an `ORDER BY`, and paging translates naturally to a `LIMIT` clauses.

Seam on the other hand provides tight integration to your persistence layer, and supports paging and sorting of queries through the `Query` object in the Seam Application Framework - but you have to write a load more JSF to get it integrated. We can get the best of both worlds by using the enhanced `DataModel` in Trinidad, which supports paging and sorting backed by a `Query`.

The `jboss-seam-trinidad.jar` (built using the build file in the `trinidad` directory in Seam CVS) provides a `DataModel` which, when backed by a `Query`, provides lazy loading of data for paging, sorting in the persistence context and strong row keys. You can use it by adding the `jboss-seam-trinidad.jar` to your `WEB-INF/lib` - no need to alter your facelet. One caveat is that you must ensure the rows property on the `Query` is the same as the `maxResults` property on the `Query`. Take a look at the seamdiscs example in the `trinidad/examples` directory to see it in action.

    <tr:table value="#{discs.dataModel}" rows="#{discs.maxResults}">
       <tr:column>
       ...
       </tr:column
    </tr:table>