文件名称:Apache MyFaces Trinidad 1.2_ A Practical Guide.pdf
文件大小:5.78MB
文件格式:PDF
更新时间:2022-09-05 04:14:28
Apache MyFaces Trinidad Practical Guide
Table of Contents Preface 1 Chapter 1: Introducing Trinidad 7 Background 7 Overview of Trinidad 9 Characteristics of Trinidad 9 General key criteria for the choosing of Trinidad 10 Seamidad! Ease JSF development with Seam 13 Introduction and overview of Seam 13 Application of Seam with Trinidad 14 Seam conversations and other context management 16 Seam navigation 17 Seam authorization 18 Configuring Trinidad 24 Summary 28 Chapter 2: Structuring and Building Pages with Facelets 29 Facelet page composition—templating with Facelets 30 Using the template 34 Facelet composition components 36 Creating the composition component 37 The model attribute 38 The visible attribute 39 The msgLabel attribute 39 The labelStyle attribute 40 The required attribute 40 The readOnly attribute 41 The width attribute 41 The margin attribute 41 Declaring the composition component 42 Applying the composition component 43 This material is copyright and is licensed for the sole use by Jillian Fraser on 20th November 2009 111 Sutter Street, Suite 1800, San Francisco, , 94104 Download at WoweBook.Com Table of Contents [ ii ] Using JSTL for further refinement 45 Typical JSTL structures 45 Things to be aware of when using JSTL and Facelets 47 Other tags to be aware of 48 Experiencing Facelets in real life projects 48 Summary 49 Chapter 3: Most Wanted Tags and Tag Attributes 51 Component library structure 51 Trinidad’s XHTML tag library namespace (trh) 53 Trinidad’s core tag library namespace (tr) 54 Standard tag attributes 57 Standard tag attributes in tag groups 58 Attributes that occur in form and display tags 58 Attributes that occur in command and navigation components 60 Attributes that occur in large input and output components 60 The tag attributes for table, treeTable, and tree 61 The tag attributes for table and treeTable 61 The tag attributes for tree and treeTable 62 The tag attributes for treeTable 63 The tag attributes for tree 63 Summary 63 Chapter 4: Rendering Pages Partially 65 Tag-based PPR 66 Finding the trigger 67 Aspect 1: Ensure that the ID of the PPR trigger is correct 68 Aspect 2: Ensure that the Trinidad configuration is correct 68 Aspect 3: Ensure that the refreshed fields are reset 69 Aspect 4: Ensure proper MVC setup 69 Aspect 5: Ensure that the tag's partialTriggers work 70 Aspect 6: Beware of using PPR with the rendered attribute 70 PPR with server-side caching by means of the Trinidad pageFlowScope 70 PPR with a tr:selectOneChoice to refresh itself inside a component 71 PPR with a tr:selectOneChoice component and a valueChangeListener 73 PPR with a tr:selectOneChoice component and an actionListener 76 PPR and the rendered attribute 79 Applying PPR naively 79 The right way—a parent component with partial trigger 81 Java-side PPR using Trinidad's RequestContext 82 Application of PPR from the Java-side 83 Step I: Define the PPR source 84 Step II: Add the partial target 84 Summary 85 This material is copyright and is licensed for the sole use by Jillian Fraser on 20th November 2009 111 Sutter Street, Suite 1800, San Francisco, , 94104 Download at WoweBook.Com Table of Contents [ iii ] Chapter 5: Web Application Groundwork 87 Navigation 87 Trinidad's Dialog Framework 90 Programmatically creating a dialog 91 Providing the data flow from dialog to dialog 91 Returning from a dialog 92 Authorization 93 Equipping each XHTML with authorization 93 User authorization 94 Internationalization (I18n) 95 I18n on single labels 95 I18n on internal Facelet composition components 95 Polling 96 Setting up the application with Seam-gen 97 Setting up an Eclipse project using Seam-gen 99 Deployment 101 Trinidad-specific and Facelet-related changes to the project files 102 Trinidad-specific changes to the Ant build script 105 Deployment from Eclipse 106 Browser client setup 109 Summary 111 Chapter 6: Building a Panel-based Content 113 Where the Trinidad panel components live and what they support 113 The accordion and showDetailItem components 115 How to play the panelAccordion 115 The showDetailItem component—press to play an accordion key 116 The combination of accordion and showDetailItem 120 An alternative to pure Facelets 122 The content panel—same soul, different incarnation 123 ControllerPanel keeps the panels under the same roof 124 The toolbar facet 125 Skinning the panels 128 Skinning the accordion and its children 128 Skinning specific properties of the accordion's children 130 Switching the skins on configuration level 130 Summary 132 Chapter 7: Building a Form 133 Building a form 134 Step I: Building the composition components 135 The fieldText component 135 This material is copyright and is licensed for the sole use by Jillian Fraser on 20th November 2009 111 Sutter Street, Suite 1800, San Francisco, , 94104 Download at WoweBook.Com Table of Contents [ iv ] The fieldDate component 137 The fieldNumber component 139 The fieldSelect component 142 Step II: Building the form 143 Building a form with several panelFormLayout instances 145 The approach 146 Step III: Decorating the form with Trinidad's form submission controls 148 Processing of a part of a form by means of Trinidad subforms 149 Step IV: Adding a general message area 152 Summary 152 Chapter 8: Growing a Tree 153 Trinidad's tree components 153 ChildPropertyTreeModel—Trinidad's out of the box model 155 Creating a TreeNode Model 155 Building up a tree model 157 Extending the ChildPropertyTreeModel to a Seam component 158 Preparing the panels for navigation 159 Applying the navigation component for basic navigation control 160 Creating the XHTML 161 Using the nodeStamp facet to generate the tree 161 Using a commandLink to create the clickable tree node 162 Passing the node parameters to the navigation control 162 Extending the model-view tree couple 163 Preparations for the new tree model 164 The properties of the AbstractTreeNode 164 The AbstractTreeNode constructors 164 New and modified helper methods 165 The abstracted getters and setters 166 The new TreeNode implementation is now short and easy 166 The new tree node implementation for the new tree model 167 The new tree model—based on Trinidad's abstract TreeModel 168 Test out the row disclosure by adding a RowDisclosureEvent listener 169 Another tree content to better try tree traversal 169 The getters to access the new state 170 Tree traversal with Trinidad's container methods 171 The controller-enhanced tree models 175 Testing internal navigation 176 Summary 177 Chapter 9: The table and treeTable Components 179 The table component 179 The table component in its most minimal usage 180 Adding a selection listener 182 This material is copyright and is licensed for the sole use by Jillian Fraser on 20th November 2009 111 Sutter Street, Suite 1800, San Francisco, , 94104 Download at WoweBook.Com Table of Contents [ v ] Adding sorting 184 Adding a button bar 185 Adding detail data sub views and using a POJO data model 186 Adding a search form and paging 188 Adding banding and grids for better visibility 191 Making use of JSF binding and Facelets for further encapsulation 191 Creating the XHTML: the reduction to a single line 194 The treeTable component 195 The treeTable component in its most minimal usage 195 Adding major table capabilities 196 Summary 200 Chapter 10: The Chart Component 201 Where the chart component is and what it supports 201 Bar charts 202 Stacking the bar chart 205 Pie charts 207 Area charts 209 Line charts 211 ScatterPlot charts 214 Radar charts 215 Funnel charts 219 Gauge charts 219 Summary 221 Chapter 11: Building a Wizard 223 Defining an abstract wizard model 223 The properties of the abstract wizard model 223 Constructors of the abstract wizard 224 Providing the current step, action, and actionListener methods 225 Providing control for the number of wizard steps 226 Providing control for the current step index 226 Providing step incrementation and decrementation 227 Abstract class design aspects 227 Defining the concrete wizard 228 Implementing the wizard's action listeners 228 Implementing the wizard's navigation 229 Implementing a step object 230 Initializing a wizard instance 230 The wizard's application inside the preparation controller 231 Wizard implementation design aspects 232 This material is copyright and is licensed for the sole use by Jillian Fraser on 20th November 2009 111 Sutter Street, Suite 1800, San Francisco, , 94104 Download at WoweBook.Com Table of Contents [ vi ] Defining the XHTML side—the wizard's face 234 Summary 237 Chapter 12: Dialogs—Pop-Up Your Web Application! 239 Using the right scope: Seam or only Trinidad 240 How the conversation is kept during a Trinidad dialog 242 Defining a dialog-enabled navigation control 243 Creating Trinidad dialogs in the navigation control 244 Ensuring correct partial page rendering 245 Standard context retrieval methods 247 Calling the proper preparation method 248 The resulting navigation point 249 Making a dialog-enabled tree control 251 Creating concrete tree contents 252 Standard tree methods 253 Providing navigational attributes 254 The tree's navigation method 254 Revisiting the wizard—few additions make it pop-up 256 Summary 258 Appendix: References 259 Links to the Apache MyFaces Trinidad web site 259 References 260 Chapter 1 260 Chapter 2 260 Chapter 3 261 Chapter 4 261 Chapter 5 261 Chapter 6 261 Chapter 7 262 Chapter 8 262 Chapter 9 262 Chapter 10 262 Chapter 11 263 Chapter 12 263 Index 265