Enterprise Development with Flex

Enterprise Development with Flex

Enterprise Development with Flex Enterprise Development with Flex Yakov Fain, Victor Rasputnis, and Anatole Tartakovsky Beijing • Cambridge • Farnham • Köln • Sebastopol • Taipei • Tokyo Enterprise Development with Flex by Yakov Fain, Victor Rasputnis, and Anatole Tartakovsky Copyright © 2010 Yakov Fain, Victor Rasputnis, and Anatole Tartakovsky.. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/institutional sales department: (800) 998-9938 or [email protected]. Editor: Mary E. Treseler Indexer: Ellen Troutman Development Editor: Linda Laflamme Cover Designer: Karen Montgomery Production Editor: Adam Zaremba Interior Designer: David Futato Copyeditor: Nancy Kotary Illustrator: Robert Romano Proofreader: Sada Preisch Printing History: March 2010: First Edition. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. Enterprise Development with Flex, the image of red-crested wood-quails, and related trade dress are trademarks of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher and authors assume no responsibility for errors or omissions, or for damages resulting from the use of the information con- tained herein. TM This book uses RepKover™, a durable and flexible lay-flat binding. ISBN: 978-0-596-15416-5 [M] 1267723996 Table of Contents Preface .................................................................... xiii 1. Comparing Selected Flex Frameworks ...................................... 1 Frameworks Versus Component Libraries 1 Introducing Café Townsend 3 Employee List Without Frameworks 5 Cairngorm 7 Café Townsend with Cairngorm 7 To Use or Not to Use Cairngorm? 19 Report Card: Cairngorm 20 Mate 21 Report Card: Mate 27 PureMVC 29 Café Townsend with PureMVC 30 Report Card: PureMVC 42 Clear Toolkit 43 Café Townsend with Clear Toolkit 45 Report Card: Clear Toolkit 57 Final Framework Selection Considerations 59 References 61 2. Selected Design Patterns ................................................ 63 Singleton 64 Proxy 67 Mediator 74 Data Transfer Object 81 Asynchronous Token 91 Class Factory 93 A Class Factory from the Flex Framework 94 Creating UIStaticClassFactory 97 Creating UIClassFactory 103 v 3. Building an Enterprise Framework ....................................... 113 Upgrading Existing Flex Components 114 Introducing Component Library clear.swc 115 Creating a Value-Aware CheckBox 116 Creating a Centered CheckBox 118 Creating a Protected CheckBox 119 Upgrading ComboBox 121 Resources as Properties of UI Controls 127 Styles Versus Properties 130 The Base Class for Resources 131 DataGrid with Resources 134 Data Forms 138 The DataForm Component 139 The DataFormItem Component 143 Validation 151 Sample Application: DataFormValidation 153 The ValidationRule Class Explained 157 Embedding Validation Rules into a DataGrid 162 Minimizing the Number of Custom Events 169 Summary 174 4. Equipping Enterprise Flex Projects ....................................... 175 Staffing Considerations 176 GUI and Component Developers 176 Flex Architects 177 Designopers and Devigners 178 Flex Developer’s Workstation 180 IDE Choices 180 Preparing for Teamwork 181 Embedding .swf Files into HTML Pages 182 Adding a .swf to HTML with SWFObject 183 Interacting with HTML and JavaScript 185 The ExternalInterface Class 185 Flex AJAX Bridge 186 The flashVars Variable 186 Testing Flex RIA 188 Unit and Integration Testing 189 Functional Testing 191 Load Testing 194 Code Coverage 195 Application Modularization from 30,000 Feet 196 Build Scripts and Continuous Integration 197 Automation of Ant Script Creation 197 vi | Table of Contents Maven Support 198 Continuous Integration 199 Logging with Log4Fx 200 Remote Logging with Log4Fx 201 A Grab Bag of Component Libraries 203 Integrating with the Java Spring Framework 205 Integrating with the Hibernate Framework 206 Project Documentation 208 Program Documentation with ASDoc 209 UML Diagrams 211 Accessibility of Flex RIA 211 Summary 213 5. Customizing the Messaging Layer of LCDS or BlazeDS ....................... 215 Flex Messaging Unleashed 215 Server Messages: Shooting in the Dark 216 Sending the Client’s Heartbeats 217 Heartbeat Adapter 218 Testing the Client Heartbeat 220 Guaranteed Delivery of Server Messages 222 Building a Custom Acknowledging Channel 225 Resending Messages with QoSAdapter 228 Testing Guaranteed Delivery 233 When Message Order Matters 236 SerializingChannel 238 Guaranteed Delivery of Client Messages 244 The ReliableClientMessage Class 244 Acknowledging the Endpoint 246 Resending Channel Guarantees Delivery 247 Testing Guaranteed Delivery from the Client 251 Keeping Client Messages in Order 253 Testing Ordered Delivery of Client Messages 257 Summary 261 6. Open Source Networking Solutions ...................................... 263 BlazeDS Versus LCDS 264 Why Is AMF Important? 265 AMF Performance Comparison 266 AMF and Client-Side Serialization 268 HTTP Connection Management 269 The Hack to Increase a Web Browser’s Performance 270 Other Ways of Increasing a Web Browser’s Performance 271 What Is Comet? 273 Table of Contents | vii Putting Streaming to Work 274 The Networking Architecture of BlazeDS 277 Setting Up a BlazeDS Sample Application on Jetty 278 Setting BlazeDS Messaging to Use the Jetty NIO API 279 NIO Performance Test 279 The Theory 279 Data Access Automation 283 Data Transfer Objects 284 ChangeObject 288 Assembler and DAO Classes 290 DataCollection Class 295 Deep Data Synchronization with BlazeDS 302 Nested DataCollections 302 Batching Remote Calls 306 Using AMF Message Headers 307 Data Push in Data Access 311 A Server as a Command Center 313 Reverse RPC 314 Extending the Protocol 318 Custom Serialization and AMF 320 Security Appliances 323 Third-Party Networking Solutions 324 Summary 325 7. Modules, Libraries, Applications, and Portals .............................. 327 Flex Portals and Modularization 327 Basic Modularization: Image 327 Runtime Style Modules 329 Real Actors: Loader and URLLoader 333 Loading Modules with Module Loader 333 Preloading Modules with ModuleManager 334 Communicating with Modules 339 Introducing Application Domains 344 Paying Tribute to Libraries 349 RSLs: “Under”-Libraries 352 Bootstrapping Libraries as Applications 357 Sibling Domains and Multiversioning 361 Four Scenarios of Loading Portlets 362 Default Portlet Loading: Same Sandbox Child Domain 366 Loading Portlets for Multiversioning 372 Bootstrap Class Loading 375 Sample Flex Portal 379 Integrating Flex into Legacy JEE Portals 381 viii | Table of Contents Summary 384 8. Performance Improvement: Selected Topics ............................... 385 Planning for Modularization 386 It Takes Two to Perform 387 Application Startup and Preloaders 389 Dissecting LightweightPreloader.swf 390 The Main SWF Talks to LightweightPreloader.swf 398 Supporting Logout Functionality 404 Using Resource Shared Libraries 407 How to Link Flex Libraries 408 Flex Framework RSL 411 Optimizing RSL Loading 417 Creating Modules with Test Harness 417 Creating a Shell Application with a Custom RSL Loader 422 A Grab Bag of Useful Habits 433 Dealing with Memory Leaks 433 JIT Benefits and Implications 435 Using the Flash Builder Profiler 436 Performance Checklist 437 Summary 439 9. Working with Adobe AIR ............................................... 441 How AIR Is Different from Flex 443 HelloWorld in AIR 444 Native Windows 449 Working with Files 450 Commonly Used Directories 450 Reading and Writing to Files 452 Working with Local Databases 454 PharmaSales Application 461 Installing PharmaSales 462 The PharmaSales Application for Dispatchers 462 The PharmaSales Application for Salespeople 466 Detecting Network Availability 466 After the Salesman Logs On 470 OfflineDataCollection 478 Integrating with Google Maps 486 Summary 489 10. Developing Flex Applications for LiveCycle ES (Enterprise Suite) .............. 491 Business Process Example: Vacation Request 492 Meet LiveCycle Workspace ES 494 Table of Contents | ix Meet the Flexlet: Vacation Request 495 LiveCycle ES Architecture in a Nutshell 497 Endpoints 498 Custom Services 499 Tools 500 Creating Flex Applications Enabled for LiveCycle Workspace ES 501 Form Variable Declaration and Process Instantiation 502 Flexlet Mapping for User Activity 504 Controlling the View State of the Reusable Flexlet from the Process 504 Workspace: Flexlet Conversation Basics 504 Flexlet Code Walkthrough 509 Running Workspace from Adobe Sources 519 Business Example: Warehouse Processes 520 User Interface of the Retailer 521 User Interface of the Supplier 524 User Interface of the Manufacturer 525 Introducing Process Orchestration 526 The Warehouse Processes Under the Hood 528 Extending LiveCycle with Custom Services 529 Custom Providers for the User and Group Repository 529 Custom Solution Components 543 Orchestrating Processes with Asynchronous Events 550 Defining Events 551 Dispatching

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    678 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us