Apache MyFaces Trinidad 1.2 - Thomas David - E-Book

Apache MyFaces Trinidad 1.2 E-Book

David Thomas

0,0
26,26 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.
Mehr erfahren.
Beschreibung

In Detail

In today's world, JSF is one of the pivotal technologies for implementing middle- to large-scale web applications. With Trinidad, JSF developers have a powerful open source component framework at their fingertips.

This book introduces Apache MyFaces Trinidad, a powerful JSF component framework and combines it with Seam, the next-generation Web Application Framework to achieve the most comprehensive and effective technology for the development of powerful rich-client web applications.

In this book, you start out by learning where Trinidad comes from and what its aims are. You will learn how Facelets and Seam are used to get the most out of JSF. In addition, you will also learn the often occurring tag attributes, and, in particular, Trinidad's AJAX technology. You will implement login, authorization, navigation, internationalization, polling, and support for browser issues with the help of these technologies. You will then use Seam-gen for deployment.

Next, you will develop a web application example where a series of selected Trinidad components are applied and their capabilities explored. Finally, you will master the Trinidad dialog framework, a key Trinidad technology that allows the application of dialogs.

A step-by-step, practical guide to creating and developing web applications with Trinidad and Seam

Approach

The book is a hands-on practical guide that stresses the discussion of code and builds up a sample application that illustrates all the standard UI types covered by Trinidad.

Who this book is for

This book is written for Java developers who are beginners at JSF and experienced web developers who are looking for an introduction into the world of open source JSF technology.

Sie lesen das E-Book in den Legimi-Apps auf:

Android
iOS
von Legimi
zertifizierten E-Readern

Seitenzahl: 267

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Table of Contents

Apache MyFaces Trinidad 1.2
Credits
About the Author
About the Reviewers
Preface
What this book covers
Conventions
Reader feedback
Customer support
Errata
Piracy
Questions
1. Introducing Trinidad
Background
Overview of Trinidad
Characteristics of Trinidad
General key criteria for the choosing of Trinidad
Seamidad! Ease JSF development with Seam
Introduction and overview of Seam
Application of Seam with Trinidad
Seam conversations and other context management
Seam navigation
Seam authorization
Configuring Trinidad
Important Trinidad configuration parameters in the web.xml
Important Trinidad configuration parameters in the trinidad-config.xml
Other configuration parameters
Special parameters in the trinidad-config.xml
Special parameters in the web.xml for further optimization
Summary
2. Structuring and Building Pages with Facelets
Facelet page composition—templating with Facelets
Using the template
Facelet composition components
Creating the composition component
The model attribute
The visible attribute
The msgLabel attribute
The labelStyle attribute
The required attribute
The readOnly attribute
The width attribute
The margin attribute
Declaring the composition component
Applying the composition component
Using JSTL for further refinement
Typical JSTL structures
Things to be aware of when using JSTL and Facelets
Other tags to be aware of
Experiencing Facelets in real life projects
Summary
3. Most Wanted Tags and Tag Attributes
Component library structure
Trinidad’s XHTML tag library namespace (trh)
Trinidad’s core tag library namespace (tr)
Standard tag attributes
Standard tag attributes in tag groups
Attributes that occur in form and display tags
Attributes that occur in command and navigation components
Attributes that occur in large input and output components
The tag attributes for table, treeTable, and tree
The tag attributes for table and treeTable
The tag attributes for tree and treeTable
The tag attributes for treeTable
The tag attributes for tree
Summary
4. Rendering Pages Partially
Tag-based PPR
Finding the trigger
Aspect 1: Ensure that the ID of the PPR trigger is correct
Aspect 2: Ensure that the Trinidad configuration is correct
Aspect 3: Ensure that the refreshed fields are reset
Aspect 4: Ensure proper MVC setup
Aspect 5: Ensure that the tag's partialTriggers work
Aspect 6: Beware of using PPR with the rendered attribute
PPR with server-side caching by means of the Trinidad pageFlowScope
PPR with a tr:selectOneChoice to refresh itself inside a component
PPR with a tr:selectOneChoice component and a valueChangeListener
PPR with a tr:selectOneChoice component and an actionListener
PPR and the rendered attribute
Applying PPR naively
The right way—a parent component with partial trigger
Java-side PPR using Trinidad's RequestContext
Application of PPR from the Java-side
Step I: Define the PPR source
Step II: Add the partial target
Summary
5. Web Application Groundwork
Navigation
Trinidad's Dialog Framework
Programmatically creating a dialog
Providing the data flow from dialog to dialog
Returning from a dialog
Authorization
Equipping each XHTML with authorization
User authorization
Internationalization (I18n)
I18n on single labels
I18n on internal Facelet composition components
Polling
Setting up the application with Seam-gen
Setting up an Eclipse project using Seam-gen
Deployment
Trinidad-specific and Facelet-related changes to the project files
Trinidad-specific changes to the Ant build script
Deployment from Eclipse
Browser client setup
Summary
6. Building a Panel-based Content
Where the Trinidad panel components live and what they support
The accordion and showDetailItem components
How to play the panelAccordion
The showDetailItem component—press to play an accordion key
The combination of Accordion and showDetailItem
An alternative to pure Facelets
The content panel—same soul, different incarnation
ControllerPanel keeps the panels under the same roof
The toolbar facet
Skinning the panels
Skinning the Accordion and its children
Skinning specific properties of the Accordion's children
Switching the skins on configuration level
Summary
7. Building a Form
Building a form
Step I: Building the composition components
The fieldText component
The fieldDate component
The fieldNumber component
The fieldSelect component
Step II: Building the form
Building a form with several panelFormLayout instances
The approach
Step III: Decorating the form with Trinidad's form submission controls
Processing of a part of a form by means of Trinidad subforms
Step IV: Adding a general message area
Summary
8. Growing a Tree
Trinidad's tree components
ChildPropertyTreeModel—Trinidad's out of the box model
Creating a TreeNode Model
Building up a tree model
Extending the ChildPropertyTreeModel to a Seam component
Preparing the panels for navigation
Applying the navigation component for basic navigation control
Creating the XHTML
Using the nodeStamp facet to generate the tree
Using a commandLink to create the clickable tree node
Passing the node parameters to the navigation control
Extending the model-view tree couple
Preparations for the new tree model
The properties of the AbstractTreeNode
The AbstractTreeNode constructors
New and modified helper methods
The abstracted getters and setters
The new TreeNode implementation is now short and easy
The new tree node implementation for the new tree model
The new tree model—based on Trinidad's abstract TreeModel
Test out the row disclosure by adding a RowDisclosureEvent listener
Another tree content to better try tree traversal
The getters to access the new state
Tree traversal with Trinidad's container methods
The row key methods
The row index methods
The general row methods
The table-related methods are implemented as empty methods
The controller-enhanced tree models
Testing internal navigation
Summary
9. The table and treeTable Components
The table component
The table component in its most minimal usage
Adding a selection listener
Adding sorting
Adding a button bar
Adding detail data sub views and using a POJO data model
Adding a search form and paging
Adding banding and grids for better visibility
Making use of JSF binding and Facelets for further encapsulation
Creating the XHTML: the reduction to a single line
The treeTable component
The treeTable component in its most minimal usage
Adding major table capabilities
Summary
10. The Chart Component
Where the chart component is and what it supports
Bar charts
Stacking the bar chart
Pie charts
Area charts
Line charts
ScatterPlot charts
Radar charts
Funnel charts
Gauge charts
Summary
11. Building a Wizard
Defining an abstract wizard model
The properties of the abstract wizard model
Constructors of the abstract wizard
Providing the current step, action, and actionListener methods
Providing control for the number of wizard steps
Providing control for the current step index
Providing step incrementation and decrementation
Abstract class design aspects
Defining the concrete wizard
Implementing the wizard's action listeners
Implementing the wizard's navigation
Implementing a step object
Initializing a wizard instance
The wizard's application inside the preparation controller
Wizard implementation design aspects
Defining the XHTML side—the wizard's face
Summary
12. Dialogs: Pop-Up Your Web Application!
Using the right scope: Seam or only Trinidad
How the conversation is kept during a Trinidad dialog
Defining a dialog-enabled navigation control
Creating Trinidad dialogs in the navigation control
Ensuring correct partial page rendering
Standard context retrieval methods
Calling the proper preparation method
The resulting navigation point
Making a dialog-enabled tree control
Creating concrete tree contents
Standard tree methods
Providing navigational attributes
The tree's navigation method
Revisiting the wizard—few additions make it pop-up
Summary
A. References
Links to the Apache MyFaces Trinidad web site
References
Chapter 1
Chapter 2
Chapter 3
Chapter 4
Chapter 5
Chapter 6
Chapter 7
Chapter 8
Chapter 9
Chapter 10
Chapter 11
Chapter 12
Index

Apache MyFaces Trinidad 1.2

A Practical Guide

David Thomas

Apache MyFaces Trinidad 1.2

A Practical Guide

Copyright © 2009 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

First published: November 2009

Production Reference: 1031109

Published by Packt Publishing Ltd. 32 Lincoln Road Olton Birmingham, B27 6PA, UK.

ISBN 978-1-847196-08-8

www.packtpub.com

Cover Image by Vinayak Chittar ( <[email protected]> )

Credits

Author

David Thomas

Reviewers

Cagatay Civici

Simon Lessard

Acquisition Editor

Rashmi Phadnis

Development Editors

Rakesh Shejwal

Siddharth Mangarole

Technical Editor

Mehul Shetty

Indexer

Monica Ajmera

Editorial Team Leader

Akshara Aware

Project Team Leader

Lata Basantani

Project Coordinator

Rajashree Hamine

Proofreader

Jeff Orloff

Graphics

Nilesh Mohile

Production Coordinator

Shantanu Zagade

Cover Work

Shantanu Zagade

About the Author

David Thomas is a developer and technical project manager of Java-based web applications, and has well over 10 years of experience in various web technologies.

He began writing applications based on the Common Gateway Interface (CGI), HTML and Javascript, with a short Java Applets interlude.

The main occupation with Java began when Java took charge of the server. A series of Java Servlet applications were developed using an early, self-built Model-2 controller architecture.

Java Server Pages (JSP) took hold for a rather long time and a couple of major, increasingly complex, web applications were developed in combination with Struts. This also included the development of major portal applications in the finance and banking sector.

Shortly after Java Server Faces 1.2 (JSF) emerged, began the development of a major JSF web application including the development of a high-level framework based on Apache My Faces Trinidad, Facelets and JBOSS Seam in the area of controlling. This project spawned a couple of sub projects, so development continues up to the present day.

This is the author's first book which is highly influenced by the accumulated years of his experience in web technology.

Apart from his work and the writing of this book, David Thomas likes to write music, sing his own songs, and accompany them on piano and guitar. Other hobbies of his are going on holidays, reading books, walking, swimming, making tea, and taking trains.

Furthermore, he is a firm believer in vegetarianism and the responsibility of each human being for her or his well-being and surroundings—in short, of acting locally while thinking globally.

Regarding this book he hopes it will be of great value to many people to enjoy an effective and efficient use of Trinidad.

I would like to thank my wife for her patience during the writing of this book.

About the Reviewers

Cagatay Civici is the PMC member of open source JSF implementation Apache MyFaces and the project lead of popular PrimeFaces framework. In addition to being a recognized speaker in international conferences such as JSFSummit, JSFDays, and local events, he's an author and technical reviewer of books regarding web application development with Java and JSF. Cagatay is currently working as a consultant and instructor in the UK.

Simon Lessard has been using Java since 2000 with a focus first on game server development, and since 2005 on Web development, when he joined Fujitsu Canada team. Since then, he joined the Apache community working mainly on Apache Trinidad and Apache MyFaces 2.0, and also represents Fujitsu Limited on the JSF 2.0 Expert Group.

Preface

In this book, you will learn how Facelets and Seam are used to get the most out of JSF. You start out by learning where Trinidad comes from and what its aims are. Additionally, you will also learn the often occurring tag attributes and, in particular, Trinidad's Ajax technology. You will implement login, authorization, navigation, internationalization, polling and browser issues with the help of these technologies. You will then use Seam-gen for deployment.

As you move through the book, you will develop a web application example where a series of selected Trinidad components are applied and their capabilities explored.

Finally, you will master the Trinidad dialog framework, a Trinidad key technology that allows the application of dialogs.

What this book covers

Chapter 1,Introducing Trinidad, introduces you to the Trinidad component library. We give a general idea of this component library, the areas covered by its components, and compare it to other libraries. Finally, the integration of Trinidad and Seam is discussed.

Chapter 2,Structuring and Building Pages with Facelets , explains Facelets as a basic means to structure and build pages using Facelet page composition, Facelet composition components, and JSTL.

Chapter 3,Most Wanted Tags and Tag Attributes , discusses the Trinidad tags and their attributes in a structured approach. You will gain an insight into the design of Trinidad allowing you to draw an efficient mental map of the library and make an effective selection and application of tags.

Chapter 4,Rendering Pages Partially , introduces you to the Trinidad's Ajax technology called PPR (Partial Page Rendering). PPR is inspected from two points of view the pure tag-based partial rendering and the pure Java-side partial rendering techniques.

Chapter 5,Web Application Groundwork , teaches you how to develop the basic parts of the web application that serves as our Trinidad example. We present using Seam-gen to rapidly deploy after each change of any file.

Chapter 6,Building a Panel-based Content , deals with Trinidad's panelAccordion and showDetailItem components to show how they can be combined to build panel-based, panel-wise collapsible content.

Chapter 7,Building a Form , discusses the combinination of Trinidad's tags to Facelet composition components to build highly flexible and well-formatted forms, including messaging support.

Chapter 8,Growing a Tree , deals with Trinidad's tree components and models and exemplify their application. We present an effective shortcut that makes Trinidad's tree support an easy, and yet powerful, technology.

Chapter 9,The table and treeTable Components , gives an insight to Trinidad's table and treeTable components and exemplifies their application. We apply the components in an increasingly refined way, revealing most of their features one at a time.

Chapter 10,The Chart Component, deals with Trinidad's chart component and shows its application. You will learn to competently set up representation parameters, effectively achieving the intended representation focus and thus graphically materializing hidden information in an appropriate way.

Chapter 11,Building a Wizard, deals with Trinidad's components to implement a wizard and show their application. We present a solution to avoid an existing Facelet problem.

Chapter 12,Dialog—Pop Up Your Web Application, discusses Trinidad's pop-up window techniques. We revisit Seam conversations to address the specific necessities for pop-up dialogs in Trinidad and Seam. We enhance the web application with a couple of pop-up windows including wizard pop-up support.

Appendix, References, provides us with useful references and links related to Apache MyFaces Trinidad.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "Add a general message area using tr:messages, Trinidad's standard component for this task."

A block of code will be set as follows:

<tr:panelFormLayout inlineStyle="width:#{inlineWidth}px;" labelWidth="#{labelWidth}" fieldWidth="#{fieldWidth}" rows="1" maxColumns="#{maxColumns}"> input11 input12 </tr:panelFormLayout>

When we wish to draw your attention to a particular part of a code block, the relevant lines or items will be shown in bold:

<tr:panelFormLayout maxColumns="3" rows="1"> <input1><input2><input3><input4><input5><input6><input7><input8> <input9> </tr:panelFormLayout>

Any command-line input or output is written as follows:

seam setup

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in our text like this: "the check method has returned what it could find under the keyword Green, that is, Green Tea".

Note

Warnings or important notes appear in a box like this.

Note

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply drop an email to <[email protected]>, and mention the book title in the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or email <[email protected]>.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Note

Downloading the example code for the book

Visithttp://www.packtpub.com/files/code/6088_Code.zip to directly download the example code.

The downloadable files contain instructions on how to use them.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in text or code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration, and help us to improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the let us know link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata added to any list of existing errata. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at <[email protected]> with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at <[email protected]> if you are having a problem with any aspect of the book, and we will do our best to address it.

Chapter 1. Introducing Trinidad

This chapter introduces the user to Apache MyFaces Trinidad—or, in short, Trinidad. Trinidad is a skinnable, Ajax-enabled, JavaServer Faces (JSF) component library that is highly adaptable to various requirements of today's modern web applications. It is most comprehensive in its functionality and consistent in its API interface and design. Trinidad's large component set arguably satisfies many, if not most, of the requirements that even large web applications nowadays have. Its Ajax framework makes sure pages are rendered in an efficient way. Their look and feel is easily switchable thanks to the underlying skin framework. Trinidad's consistent API interface and design makes JSF development become an effective experience.

This chapter will give a general idea of Trinidad. We will cover the following topics:

Areas covered by Trinidad componentsAn overview of its focus and advantagesCriterias to value the quality and the level of the offered componentsEased JSF development by combining Trinidad with the Seam web frameworkSeam used for navigation, context management, and authorizationTrinidad's configuration parameters

Background

Trinidad dates back to code development from the beginning of the 21st century. Oracle aimed at the development of a component-based web framework named UIX which would evolve into a core component library for JSF applications and further JSF frameworks themselves. Oracle's early decision to invest in JSF at a time when its future was not at all clear has turned out to be a gamble that paid off. Nowadays, JSF is one of the pivotal technologies when it comes to implementing middle-to-large-scale web applications.

Oracle's next decision, based on its commitment to the open source Java community, was to donate this framework, originally known as Oracle ADF Faces, to the Apache Software Foundation—which happened in 2006. A part of the development team remains at Oracle, thus ensuring design consistency. The Apache and Oracle team then concentrated on clearing the source from source dependencies to ensure the framework source only consisted of open source code. As an aside, Oracle ADF Faces development still continues, but it is now based on Trinidad.

On May 5, 2007, Trinidad left Apache's incubator and joined MyFaces as a subproject. Apache MyFaces is a project of the Apache Software Foundation that is responsible for the open source JSF implementation of the same name that includes a number of sub projects such as Trinidad.

By the end of June, Trinidad saw its first release 1.0.1 supporting JSF 1.1. On July 5, Trinidad 1.2.1, the version for JSF 1.2, was released. By the end of 2007 Trinidad started to become a component library with a frequent release cycle, about every two months on average. For more details, refer to the detailed release table in the Appendix,References. The Apache MyFaces mailing list with around 10 to 20 daily entries on Trinidad is another indication of an active user and developer community.

Milestone

Version

New Features

2006

Trinidad Incubator

Initial version with closed source bounds

05/05/2007

Release as a MyFaces subproject 1.0.1

JSF 1.1 open source component library

07/05/2007

1.2.1 release (in parallel)

JSF 1.2 open source component library

09/06/2007

1.2.2/1.0.2 release

Addition of aclient-side number converter and skinning performance improvement

10/28/2007

1.2.3/1.0.3 release

Panel improvements, DOM method refinement, configuration improvement, icons and skinning improvements, Ajax improvements

12/10/2007

1.2.4/1.0.4 release

EL improvement, skinning/CSS improvement, internationalization improvements

01/14/2008

1.2.5/1.0.5 release

Sorting improvement, EL improvement, further conversion support

02/11/2008

1.2.6/1.0.6 release

Improvements for skinning and rendering, application scope support,

03/16/2008

1.2.7/1.0.7 release

Skinning improvement

05/21/2008

1.2.8/1.0.8 release

Skinning improvement, file upload improvement, pop-up dialog improvement, browser support, tree table improvement

08/07/2008

1.2.9/1.0.9 release

Change Management improvements, panel improvement, demo and documentation updates, converter and input field improvements , browser support

Overview of Trinidad

Trinidad is not just a JSF component library. It provides the developer with a modern web framework that focuses on comprehensiveness and a closed-world software design philosophy. This has two general advantages:

The user does not need to combine several component libraries. This avoids integration problems is mostly because of the exceptionally large number of components that Trinidad includes.A high degree of consistency is encouraged. As a consequence, similar things are done in a similar way, similar attributes have consistent naming, side effects of other code sources are minimal, error growth is minimal, and so on.

Characteristics of Trinidad

Concretely speaking, the following Trinidad features illustrate this approach's focus on comprehensiveness and closed-world software design:

Partial page rendering (PPR)—the built-in JSF-Ajax technology is part of practically all Trinidad tagsConsistent attribute naming, including sets of recurring attributes throughout Trinidad's tag universe (with different frequency levels of occurrence)A large number of JSF tags is available as a Trinidad version with refinements focused on Trinidad-specific technologies and support, for example, PPR, error or info messaging support, tooltips, labels, layout, and so onSkinning framework—each component is skinnable as well as its parts and attributesDialog framework—Trinidad's dialogs allow a web application to work with modal and nestable pop-up windows with no restriction as to its contentTrinidad also comes with its own scopes, for example, pageFlowScope to support dialog and page data flow

So now that we have an idea of Trinidad's character, the next obvious question is whether or not it would fit into one of the other JSF project. After all, many component libraries are available, then why should we make Trinidad our next project? It is not easy to make a choice if both variation and complexity are high.

Note

If a component is missing, it is usually a better approach to rely on the addition of a JavaScript library, a self-written Facelet or JSF component than trying to integrate another component library that has such a component.

General key criteria for the choosing of Trinidad

No library can be the perfect choice for everyone, as software development projects are simply too different in their requirements. However, if we take a look at general criteria for the choice of a component library where Trinidad is strikingly strong, it will provide a clear and more detailed picture of Trinidad's strengths and help in making your choice.

So, in this section we will just give an idea which are the key criterias to the choice of Trinidad and why Trinidad is, if judged from these criteria, a very commendable choice. Further criteria for the choice of a JSF component library can be found in http://www.jsfmatrix.net.

Following are the criteria:

Maturity: Trinidad is a rather mature component library because it has been developed since the beginning of 2000 and has already passed a number of test cycles; moreover, its continuous development and commercial background all point towards a higher degree of maturity.Component range: With these criterias, we typically use the number of components as basic indicator. With well over 100 components Trinidad has a very comprehensive component collection. This collection extends from pure HTML support tags to really substantial components, such as a table viewer, that is, tr:table); a chart component, that is, tr:chart; refined select components such as tr:selectManyShuttle and tr:inputListOfValues; navigation orientation for example, tr:train, nested forms, for instance tr:form/subform; and so on.Interoperability: Trinidad works well with SUN's reference implementation (RI) of JSF and is well combinable with Seam, as we will see throughout this book. However, as is the case with all the other JSF component libraries, it is not well combinable with other JSF component libraries, which is expected to improve in JSF 2.0 with the introduction of standardized Ajax. However, the combination with JavaScript libraries, particularly in combination with Facelets, works very well with Trinidad and represents a worthwhile alternative.Framework character: This is an interesting criterion because it involves aspects like consistency of design and comprehensiveness which are much more the case when dealing with a framework. In comparison, a rather framework-less component library is Tomahawk where each component is much more on its own and can be used rather independently, which is why Tomahawk has a higher interoperability.Support: Support happens mainly through the mailing list, which is quite good considering that it is all free; alternatively, a commercial support by Oracle is surely possible if this is an option you wish to pursue.Facelet support: As already mentioned Trinidad works well with Facelets and is, in fact, the recommendation.Activity example (based on last build): Currently, several developers work on Trinidad, some of them at Oracle, also taking care of design consistency. The community is very much alive as indicated by Trinidad's high release frequency and mailing list traffic.Functional range (functional requirements fulfillment): Of course, this is extremely project-specific, yet the most important criterion as specific, often very singular requirements and their fulfillment, make the biggest difference. Simply speaking, the question to answer is to what degree the library's capability is to fulfill project-specific requirements out of the box? For instance, if a specific requirement is accessibility, refer to the last section of this chapter on configuration. Trinidad has built-in support that is practically unknown to other component libraries.Adequacy: This is a criterion that is closely related to functional range, but more general in terms of the general design philosophy and the user interface guidelines that have materialized in the library. A good example is if the library is capable of supporting a purely keyboard-based navigation, which is the case for Trinidad, or if it is a library that is geared towards mouse-centered direct manipulation, such as JBOSS's RichFaces or SUN's Woodstock. Another example is mobile support, where Trinidad is compatible with a number of major mobile browsers such as Apple IPhone or Microsoft Windows Mobile (refer http://myfaces.apache.org/trinidad/devguide/mobile.html).Skinnability: A web application is skinnable if there is a mechanism whereby one is able to easily and consistently change a specific look and feel, that is the skin, by configuration. In Trinidad this is efficiently supported as part of css-based, component-wise definitions such as the messages component, which can be skinned individually, and the aspect-wise definitions. For example, global selectors, such as AFDarkForeground:alias to set the primary foreground color of the foreground color ramp, so that a couple of well-defined css files, one per skin, is enough to setup and interchange such a skin by configuration.Design quality: This can be measured by the usage flexibility of each component, which is actually very high as one can easily see by looking at the refined and consistently recurring control attributes that many tags have.Documentation: This is provided on the web site and, apart from a couple of broken links on the web site, fairly good. Refer to the Appendix for a list of working links.Browser and platform support: A couple of browsers and platforms are supported, the foremost ones currently are Firefox and Internet Explorer. For current information on browser compatibility, please visit http://myfaces.apache.org/trinidad/browsers.html. Trinidad is compatible with both JSF 1.2 and 1.1 and provides releases for both specifications.

Tip

A warning to everybody to avoid IE because of security leaks and the many bugs!

We have seen that Trinidad's framework character helps in various aspects when developing a JSF application. However, there are a couple of issues where Trinidad relies on JSF, and JSF itself is not refined enough to cope with them in an easy way.

Seamidad! Ease JSF development with Seam

To be able to better concentrate on the Trinidad component library without having to deal with JSF intricacies and shortcomings, the Seam web framework was introduced. The areas are discussed where Seam comes very favorably into play, that is, scopes such as conversation context, navigation and authorization. Moreover, integration issues are also mentioned. Further details are discussed in the web application chapters.

Introduction and overview of Seam

Trinidad focuses on the viewer side of development, providing concrete JSF components. Seam is a next-generation web framework that has its focus much more on the internal middle tier layer whose domain and controller objects can be managed by Seam to live as Seam objects. This makes it much easier to manage them inside the context of a web application. So the middle-tier covered by Seam involves the management and support for the following types of objects:

All kinds of controller objects, for example, a navigation controller that encapsulates Trinidad's dialog framework, which is covered throughout this bookModel objects which possibly include controller logic to some degree, for instance tree model controllers or a panel model, both to be covered in this bookDomain objects that represent the pure object-oriented mapping of database entities as Seam-managed entity beans which reach into the backend, something that is out of focus of this book

Therefore, Seam's emphasis is on providing an overall glue framework for all tiers, with a notable emphasis on the middle-tier. At the same time, this is the main reason why it comes into consideration to fill all the gaps and incongruities left by other frameworks including JSF and Trinidad.

The following image shows the application tiers and the framework responsibilities:

Therefore, to allow one to enjoy the advantages of both frameworks, the approach of combining both frameworks is well worth considering. Thus, for the middle-tier layer, where Trinidad rather leaves us to the mercies of JSF, we could take advantage of Seam. Note that, in the past, such a combination also meant some tedious integration work.

In the mean time, integration has been resolved up to a point where, arguably, no serious issues remain. Note that we will still find some integration issues, but we will also resolve them over the course of our Trinidad development sample.