QOOMdOO Beginner's Guide Develop Rich Internet Applications (RIA) with qooxdoo Rajesh Kumar Bachu Mohamed Raffi [ PUBLISHING 1 open source I community experience distilled BIRMINGHAM MUMBAI
Table of Contents Preface 1 Chapter 1: What is qooxdoo? 7 A feel of an RIA developed in qooxdoo 8 play with the feed reader application 8 Architecture of qooxdoo SDK 12 Core layer 12 Browser Abstraction layer 12 LowLevel layer 13 GUI Toolkit layer 13 Data Binding 13 Internationalization qooxdoo framework features Language 14 Objectorientation 14 Programming 15 Internationalization 15 API reference 15 Testing 16 Deployment 16 Migration 16 Alternative programming models Eventbased rich Ul programming 17 GUI widget library 18 checking the demo browser and the playground applications 18 13 14 17
creating Table of Contents Application to be developed in this book Team Twitter 20 checking the Team Twitter application 20 What you should know and what you don't need to know 23 Summary 24 Chapter 2: Say Hello to the qooxdoo World! 25 Installing qooxdoo tools 26 installing qooxdoo tools 26 Installing ActivePython 26 Installing Cygwin 29 Installing qooxdoo SDK 35 installing qooxdoo SDK 35 Creating a simple qooxdoo application 39 a simple qooxdoo application 39 Passing data to the server 42 JSON standard format 43 Communicating with the server 46 Setting up an RPC connection 46 Making a call 46 Request 48 Response 48 Aborting a call 48 Error handling 49 Crossdomain calls 50 Parameter and result conversion 51 RPC servers 52 Integrating with the Java server 52 integrating with the Java server 53 Working with Eclipse IDE 60 Summary 64 Chapter 3: Core Programming Concepts 65 Code comments and API documentation 66 generating API documentation for Team Twitter 68 Objectoriented programming 69 Object and class 69 Encapsulation 69 Inheritance 70 Overriding 70 Abstraction 70 Polymorphism 70
writing Table of Contents Interface Members Statics Class Properties 71 Events Constructor and destructor 74 Members Class members Instance members 75 Types 77 Static class 77 Singleton class 77 Abstract class 77 Inheritance in qooxdoo 78 Overriding in qooxdoo 78 Mixin 81 Defining a mixin 82 Using a mixin in a class 82 classes for Team Twitter 84 qooxdoo properties 91 Property initialization 92 Predefined methods 93 Property configurations 93 Apply 93 Check 94 Validate 96 Group 97 Event property level 98 Property features 99 Value checks 99 Validation 99 Convenience 99 Notification 99 Advanced value handling 100 Performance 100 Memory management 100 Events class level 102 Declaring events for a class 102 Adding listeners 102 Firing an event 102 enhancing Team Twitter classes with properties 103 Summary 106 71 71 71 72 73 74 74
Table of Contents Chapter 4: Working with Layouts and Menus 109 Base classes for widgets 110 qx.core.object 111 Object management 111 Event handling 111 Logging 112 qx.core.layoutltem 112 qx.core.widget 112 Widget properties 113 qx.application 115 Containers 117 Scroll 117 Stack 118 Resizer 119 Composite 119 Window 120 Tabview 121 Groupbox 122 Layout managers 123 Size hint of the widget and its parent widget 123 Layout properties 123 Auto sizing 124 Growing or shrinking 124 Overflow 124 Basic 125 Canvas 126 Dock 127 HBox 128 VBox 129 Flow 130 Grid 131 designing layout managers for Team Twitter 132 Menu, MenuBar, and ToolBar 138 Menu 139 Menu creation 139 MenuBar 141 ToolBar 142 Summary 147 Chapter 5: Working with Widgets 149 Basic widgets 150 Label 150 Atom 151 Image 153
enhancing adding Table of Contents the server application 154 Form widgets 158 Interface hierarchy 160 IBooleanForm, INumberForm, IDateForm, IColorForm, and IStringForm 161 IForm 162 I Executable 162 IRange 162 IModel IModelSelection 163 Class hierarchy 164 qx.ui.form.textfield 164 qx.ui.form.textarea 165 qx.ui.form.passwordfield 165 qx.ui.form.checkbox 165 qx.ui.form.radiobutton 165 qx.ui.form.radiobuttongroup 166 qx.ui.form.selectbox 167 qx.ui.form.combobox 167 qx.ui.form.spinner 167 qx.ui.form.list 168 qx.ui.form.listltem 168 qx.ui.form.datefield 169 qx.ui.form.button 170 qx.ui.form.togglebutton 170 qx.ui.form.menubutton 170 qx.ui.form.splitbutton 171 qx.ui.form.hoverbutton 172 qx.ui.form.repeatbutton 173 qx.ui.form.slider 174 adding widgets into Team Twitter 174 Special widgets 179 The popup widgets 180 qx.ui.popup 180 The tooltip widgets 180 qx.ui.tooltip 180 The control widgets 182 qx.ui.control.colorpopup 182 qx.ui.control.colorselector 182 qx.ui.control.datechooser 183 Custom widgets 184 a custom widget to Team Twitter 186 Inline widgets 189 The table widget 192 Class hierarchy 192 Table construction 193 Remote table model 194 163 [vl
enhancing performing Table ofcontents The tree widget 195 Class hierarchy 195 Tree construction 196 The treevirtual widget 197 Class hierarchy 197 TreeVirtual construction 198 Summary 202 Chapter 6: Working with Forms and Data Form handling 204 Validation 204 Synchronous 206 Asynchronous 208 Resetting 209 Rendering 210 Single column 211 Double column 211 Single column with placeholder 212 Serialization 212 2Q3 the UserSignUpForm 213 Object pooling 216 Data binding 216 Single value binding 218 Property binding 219 Event binding 219 Hierarchical data binding 219 Array binding 220 Options map 220 Data controller 221 Object controller 221 List controller 222 Form controller 223 Tree controller 224 Data stores 225 enhancing the UserSignUpForm again 226 Summary 230 Chapter 7: Testing and Debugging 231 Unit testing 232 unit test 234 Integration testing 241 Integration test setup 241 Writing test cases 242 Simulator API documentation 242 luil
Table of Contents Simulator class hierarchy 243 Selenium Java Client Driver API documentation 244 Locating strategy 244 Time for action performing integration test 246 Debugging 255 Logging statements in qooxdoo code 256 Console object 256 Trace qx.dev.debug 257 Variant qx.debug 258 Miscellaneous 258 Introduction to Firebug 259 Installing the Firebug addon 259 IE developer tools 259 Tracing through AOP 260 debugging 260 Summary 267 Chapter 8: Internationalization 269 Internationalization 269 Writing code to use internationalization 270 qx.locale.manager 271 qx. locale. MTranslation 271 qx.locale.string, qx.locale.number, qx.locale.date, and qx.locale.key 271 Writing PO files for various languages 275 generating PO files for Team Twitter 276 Summary 284 Chapter 9: Working with Themes 285 Theme 286 Meta theme 287 Theme 288 Font 288 Color 288 Decoration 288 Appearance 289 Modern theme 289 Classic theme 290 Simple theme 291 Icon theme 292 Color theme 292 Font theme 293 Decoration theme 293 Aliases 294 257
Table of Contents Decorations 294 Decorator 295 Style 297 Writing new decorators 297 Appearance theme 297 Appearance selector (key) 299 Appearance entry (value) 299 Alias 300 Appearance map 301 Style entry in the appearance map 302 The include entry in the appearance map 303 The alias entry in the appearance map 303 Base calls 305 Performance 306 Appearance queue 306 Selector caching 306 Alias caching 307 Result caching 308 customizing themes for Team Twitter 309 Summary 321 Chapter 10: Performance 323 Memory management 323 Object pooling 327 Profiling 328 Limitations 330 Compiletime tuning 331 Class optimizations 331 Strings 331 Variables 331 Private 331 Base calls 332 Identifying unused classes 332 Lint check 334 Improvements 335 Partitioning and lazy loading 335 Configuration 336 Coding to load parts on demand 337 Verification 337 Recent improvements 338 Part collapsing or merging 338 Remove dependencies from the part loader 338 Load packages in parallel 338 Error handling 339
partitioning migration Table of Contents Advantages 339 339 Good practices for performance 343 Restrict the data in certain widgets 343 Use filters 343 Pagination 344.gz compression 344 Summary 346 Chapter 11: Miscellaneous 349 Configuration 349 config.json 350 Listing of keys in context 352 Job resolution 354 The extend key 355 The run key 358 Job shadowing and partial overriding 360 Migration 362 362 Back button support 367 Identify application states 367 Update history upon state change 367 Add the event listener to the history manager 368 Retrieve initial state 369 qooxdoo license 370 Summary 372 Appendix: Pop Quiz Answers 373 References. 3?7 Index 379