qooxdoo Beginner's Guide - Rajesh Kumar Bachu - E-Book

qooxdoo Beginner's Guide E-Book

Rajesh Kumar Bachu

0,0
39,59 €

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

Mehr erfahren.
Beschreibung

Over the past few years, all the major internet or enterprise applications are developed or migrated to Rich Internet Application to support all the features that are provided in the desktop applications. This helps organizations keep the end users happy and also improves application deployment and maintenance. qooxdoo is a stable, open source RIA framework. If you are waiting and watching for the right time to migrate your application to qooxdoo, this is the right time!This book explains in detail about the rich user interface development in qooxdoo. It explains various concepts of qooxdoo framework in an easy to grasp and organized way, making it simple even for a novice in qooxdoo and also increases the competency level of the developer who is already working in qooxdoo.This book helps developers understand the qooxdoo framework, setup the environment, and start the development of RIA using qooxdoo. You will learn the core programming techniques in qooxdoo, user interface development in qooxdoo, testing & debugging qooxdoo applications, internationalization of qooxdoo applications to multiple languages, customizing the look and feel of qooxdoo applications using Themes, Performance management, etc.In the course of the book, we develop a complete application which will help the developer to understand the concepts better and to put things together to see the step-by-step progress to complete an application. By the end, this book will get the developer accustomed to the widgets and API available in the qooxdoo framework, and will enable him to design, develop, debug, and test the RIA in qooxdoo.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 421

Veröffentlichungsjahr: 2011

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

qooxdoo
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Time for action - heading
What just happened?
Pop quiz
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. What is qooxdoo?
A feel of an RIA developed in qooxdoo
Time for action - play with the feed reader application
Adding a feed to the feed reader
Checking the feeds
What just happened?
User context
Desktop characteristics
GUI library
Architecture of qooxdoo SDK
Core layer
Browser Abstraction layer
Low-Level layer
GUI Toolkit layer
Data Binding
Internationalization
qooxdoo framework features
Language
Object-orientation
Programming
Internationalization
API reference
Testing
Deployment
Migration
Alternative programming models
Event-based rich UI programming
GUI widget library
Time for action - checking the demo browser and the playground applications
Demo browser
Playground
What just happened?
Application to be developed in this book—Team Twitter
Time for action - checking the Team Twitter application
Reading team tweets
Logging in to the Team Twitter application
Tweeting to the team
What just happened?
What you should know and what you don't need to know
Pop quiz
Summary
2. Say Hello to the qooxdoo World!
Installing qooxdoo tools
Time for action - installing qooxdoo tools
Installing ActivePython
Installing Cygwin
What just happened?
Installing qooxdoo SDK
Time for action - installing qooxdoo SDK
Application
Component
Documentation
Framework
Tool
What just happened?
Creating a simple qooxdoo application
Time for action - creating a simple qooxdoo application
What just happened?
Source
Build
Manifest.json
config.json
generate.py
Passing data to the server
JSON standard format
What just happened?
Communicating with the server
Setting up an RPC connection
Making a call
Request
Response
Aborting a call
Error handling
Cross-domain calls
Parameter and result conversion
What just happened?
RPC servers
Integrating with the Java server
Time for action - integrating with the Java server
Working with Eclipse IDE
What just happened?
Pop quiz
Summary
3. Core Programming Concepts
Code comments and API documentation
Time for action - generating API documentation for Team Twitter
What just happened?
Object-oriented programming
Object and class
Encapsulation
Inheritance
Overriding
Abstraction
Polymorphism
Interface
Members
Statics
Properties
Events
Class
Constructor and destructor
Members
Class members
Instance members
Types
Static class
Singleton class
Abstract class
Inheritance in qooxdoo
Overriding in qooxdoo
Mixin
Defining a mixin
Using a mixin in a class
Time for action - writing classes for Team Twitter
What just happened?
Pop quiz-I
qooxdoo properties
Property initialization
Predefined methods
Property configurations
Apply
Check
Validate
Group
Event—property level
Property features
Value checks
Validation
Convenience
Notification
Advanced value handling
Performance
Memory management
Events—class level
Declaring events for a class
Adding listeners
Firing an event
Time for action - enhancing Team Twitter classes with properties
What just happened?
Pop quiz-II
Summary
4. Working with Layouts and Menus
Base classes for widgets
qx.core.Object
Object management
Event handling
Logging
qx.core.LayoutItem
qx.core.Widget
Widget properties
qx.application
Containers
Scroll
Stack
Resizer
Composite
Window
Tabview
Groupbox
Layout managers
Size hint of the widget and its parent widget
Layout properties
Auto sizing
Growing or shrinking
Overflow
Basic
Canvas
Dock
HBox
VBox
Flow
Grid
Time for action - designing layout managers for Team Twitter
What just happened?
Menu, MenuBar, and ToolBar
Menu
Menu creation
MenuBar
ToolBar
Pop quiz
Summary
5. Working with Widgets
Basic widgets
Label
Atom
Image
Time for action - enhancing the server application
What just happened?
Form widgets
Interface hierarchy
IBooleanForm, INumberForm, IDateForm, IColorForm, and IStringForm
IForm
IExecutable
IRange
IModel
IModelSelection
Class hierarchy
qx.ui.form.TextField
qx.ui.form.TextArea
qx.ui.form.PasswordField
qx.ui.form.CheckBox
qx.ui.form.RadioButton
qx.ui.form.RadioButtonGroup
qx.ui.form.SelectBox
qx.ui.form.ComboBox
qx.ui.form.Spinner
qx.ui.form.List
qx.ui.form.ListItem
qx.ui.form.DateField
qx.ui.form.Button
qx.ui.form.ToggleButton
qx.ui.form.MenuButton
qx.ui.form.SplitButton
qx.ui.form.HoverButton
qx.ui.form.RepeatButton
qx.ui.form.Slider
Time for action - adding widgets into Team Twitter
What just happened?
Special widgets
The popup widgets
qx.ui.popup
The tooltip widgets
qx.ui.tooltip
The control widgets
qx.ui.control.ColorPopup
qx.ui.control.ColorSelector
qx.ui.control.DateChooser
Custom widgets
Time for action - adding a custom widget to Team Twitter
What just happened?
Inline widgets
The table widget
Class hierarchy
Table construction
Remote table model
The tree widget
Class hierarchy
Tree construction
The treevirtual widget
Class hierarchy
TreeVirtual construction
Pop quiz
Summary
6. Working with Forms and Data
Form handling
Validation
Synchronous
Asynchronous
Resetting
Rendering
Single column
Double column
Single column with placeholder
Serialization
Time for action - enhancing the UserSignUpForm
What just happened?
Object pooling
Data binding
Single value binding
Property binding
Event binding
Hierarchical data binding
Array binding
Options map
Data controller
Object controller
List controller
Form controller
Tree controller
Data stores
JSON store
JSONP store
YQL store
Time for action - enhancing the UserSignUpForm again
What just happened?
Pop quiz
Summary
7. Testing and Debugging
Unit testing
Time for action - performing unit test
What just happened?
Integration testing
Integration test setup
Writing test cases
Simulator API documentation
Simulator class hierarchy
Selenium Java Client Driver API documentation
Locating strategy
Selenium locators
qooxdoo locators
Time for action - performing integration test
What just happened?
Debugging
Logging statements in qooxdoo code
Console object
Trace
qx.dev.Debug
Variant qx.debug
Miscellaneous
Introduction to Firebug
Installing the Firebug add-on
IE developer tools
Tracing through AOP
Time for action - debugging
What just happened?
Pop quiz
Summary
8. Internationalization
Internationalization
Writing code to use internationalization
qx.locale.Manager
qx.locale.MTranslation
qx.locale.String, qx.locale.Number, qx.locale.Date, and qx.locale.Key
Writing PO files for various languages
Time for action - generating PO files for Team Twitter
What just happened?
Pop quiz
Summary
9. Working with Themes
Theme
Meta theme
Theme
Font
Color
Decoration
Appearance
Modern theme
Classic theme
Simple theme
Icon theme
Color theme
Font theme
Decoration theme
Aliases
Decorations
Decorator
Style
Writing new decorators
Appearance theme
Appearance selector (key)
Appearance entry (value)
Alias
Appearance map
Style entry in the appearance map
The include entry in the appearance map
The alias entry in the appearance map
Base calls
Performance
Appearance queue
Selector caching
Alias caching
Result caching
Time for action - customizing themes for Team Twitter
What just happened?
Pop quiz
Summary
10. Performance
Memory management
Object pooling
Profiling
Limitations
Compile-time tuning
Class optimizations
Strings
Variables
Private
Base calls
Identifying unused classes
Lint check
Improvements
Partitioning and lazy loading
Configuration
Coding to load parts on demand
Verification
Recent improvements
Part collapsing or merging
Remove dependencies from the part loader
Load packages in parallel
Error handling
Advantages
Time for action - partitioning
What just happened?
Good practices for performance
Restrict the data in certain widgets
Use filters
Pagination
.gz compression
Pop quiz
Summary
11. Miscellaneous
Configuration
config.json
Listing of keys in context
Job resolution
The extend key
The run key
The include key
Job shadowing and partial overriding
Migration
Time for action - migration
What just happened?
Back button support
Identify application states
Update history upon state change
Add the event listener to the history manager
Retrieve initial state
qooxdoo license
Pop quiz
Summary
A. Pop Quiz Answers
Chapter 1: What is qooxdoo?
Chapter 2: Say Hello to the qooxdoo World!
Chapter 3: Core Programming Concepts
Pop quiz-I
Pop quiz-II
Chapter 4: Working with Layouts and Menus
Chapter 5: Working with Widgets
Chapter 6: Working with Forms and Data
Chapter 7: Testing and Debugging
Chapter 8: Internationalization
Chapter 9: Working with Themes
Chapter 10: Performance
Chapter 11: Miscellaneous
B. References
Index

qooxdoo

qooxdoo

Copyright © 2011 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 authors, 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: December 2011

Production Reference: 1161211

Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK.

ISBN 978-1-84951-370-8

www.packtpub.com

Cover Image by Duraid Fatouhi (<[email protected]> )

Credits

Authors

Rajesh Kumar Bachu

Mohamed Raffi

Reviewers

Ehsun Behravesh

Liang Yuxian Eugene

Acquisition Editor

Dilip Venkatesh

Development Editor

Meeta Rajani

Technical Editors

Vrinda Amberkar

Kedar Bhat

Copy Editors

Brandt D'Mello

Leonard D'Silva

Project Coordinator

Michelle Quadros

Proofreaders

Mario Cecere

Aaron Nash

Indexer

Hemangini Bari

Graphics

Valentina D'Silva

Manu Joseph

Production Coordinators

Prachali Bhiwandar

Alwin Roy

Cover Work

Prachali Bhiwandar

About the Authors

Rajesh Kumar Bachu has over six years experience in the design and development of enterprise applications and mobile games. He is good at programming in Java and J2EE technologies. He has worked extensively in qooxdoo application development and has migrated an enterprise application to qooxdoo. You can find more about him at http://in.linkedin.com/in/rajbachu.

I am pleased to acknowledge my colleagues with whom I worked and learned qooxdoo, my co-author, Raffi, for bringing me on-board to write this book and qooxdoo team, who have actually given me the pleasure to write on qooxdoo. My special thanks to my parents. I would like to thank all my friends who directly or indirectly helped me to complete this book. My thanks to all those who have been involved with this book, especially to Mary Nadar, Dilip Venkatesh, Michelle Quadros, Meeta Rajani, Ehsun Behravesh, Liang Yuxian Eugene, Vrinda Amberkar, and Kedar Bhat.

Mohamed Raffi is an Enterprise Application Specialist. His area of work includes architecture, design, development, training, and mentoring. He has over thirteen years of product development experience in a variety of Java and JavaScript-based technologies and frameworks. You can find more about him at http://in.linkedin.com/in/raffimd and he writes his thoughts at http://thoughtstoblog.blogspot.com.

My sincere thanks to Packt Publishing for this opportunity. I would like to thank my co-author Rajesh for sharing the effort of writing this book. I am proud of the qooxdoo team for creating such a wonderful RIA framework. Also, I would like to thank all my colleagues for all the learning they have provided me with. I appreciate all the support provided by my parents and my wife in writing this book. My grandpa would be so proud (I wish he would have been here to see this). My thanks to all who were involved with this book, especially to Mary Nadar, Dilip Venkatesh, Michelle Quadros, Meeta Rajani, Ehsun Behravesh, Liang Yuxian Eugene, Vrinda Amberkar, and Kedar Bhat.

About the Reviewers

Ehsun Behravesh is a 28 year old post-graduate student at Universiti Putra, Malaysia (http://www.upm.edu.my/). He is majoring in Distributed and Parallel Computing. He is holds a bachelor's degree from the London Metropolitan University (http://www.londonmet.ac.uk/). He started programming when he was in high school and he has developed software systems for almost 10 years. He is a fan of open source software and one of his open source projects, MyPasswords (http://sourceforge.net/projects/mypasswords7/), won a comparison competition on LinuxFormat, January 2011 magazine. He loves computer programming, music, and animals.

I want to thank my wife who has always encouraged me to work and study. I also want to thank my parents who helped me to study abroad.

Liang Yuxian Eugene most recently completed an internship as a frontend engineer with Yahoo!, Taiwan after completing a double degree in Business Administration and Computer Science at National Cheng Chi University, Taipei, Taiwan.

He is also the author of JavaScript Testing Beginner's Guide, Packt Publishing.

Eugene enjoys solving difficult problems creatively in the form of building web applications using Python/Django/Tornado Web and JavaScript/jQuery. He is also passionate about social media, social network analysis, social computing, recommendation algorithms, link analysis, data visualization, data mining, information retrieval, business intelligence, and intelligent user interfaces.

Eugene seeks to solve business problems with Computer Science.

He can be reached at http://www.liangeugene.com.

Firstly, as a technical reviewer, I want to thank all the great folks at Packt Publishing for giving me the opportunity to work with such a great team of people. Secondly, I want to thank my family and friends for their kind understanding and putting up with my incredibly busy schedule. Lastly, I want to thank all the people I have met and have helped me out here-and-there along the way. It has been a great journey.

www.PacktPub.com

Support files, eBooks, discount offers, and more

You might want to visit www.PacktPub.com for support files and downloads related to your book.

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at<[email protected]> for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.

http://PacktLib.PacktPub.com

Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can access, read and search across Packt's entire library of books.

Why Subscribe?

Fully searchable across every book published by PacktCopy and paste, print and bookmark contentOn demand and accessible via web browser

Free Access for Packt account holders

If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.

Preface

Rich Internet Application (RIA) provides the capability to deliver feature-rich web applications, enables you to develop web applications with most of the desktop application's characteristics, and improves the usability of the web application. Over the last few years, many frameworks have arrived and are available to develop the Rich Internet Applications in different technologies.

qooxdoo is one of the comprehensive open source RIA frameworks. qooxdoo allows you to develop cross-browser RIAs in object-oriented JavaScript, which helps greatly to re-use application code, and hence reduces the application size. It provides a wide range of off-the-shelf UI widgets. qooxdoo comes with a rich feature set when compared to most of the other RIA frameworks. qooxdoo is completely based on JavaScript. It provides a variety of tools to build, optimize, generate documentation, and more. qooxdoo framework supports multiple browsers, multi-language deployment, custom look and feel, unit testing, automation testing, and much more.

In the past few years, all the major Internet applications or enterprise applications have been developed or migrated to RIA to support all the features that are provided in the desktop applications. This helps the organizations to keep the customers happy and also improves application deployment and maintenance.

qooxdoo is an open source framework. It has been there since 2005 and it is a quite stable framework now. If you are watching and waiting for the right time to migrate your application to qooxdoo, this is the right time, in my opinion.

What this book covers

Chapter 1, What is qooxdoo?, helps the developer to get an overview of the qooxdoo framework, to get to know what the framework provides, to know the architecture of the qooxdoo framework, and to get a feel of the RIA developed in qooxdoo.

Chapter 2, Say Hello to qooxdoo World!, guides the developer in setting up the development environment for the qooxdoo framework, to understand the communication with the server, and to set up one of the RPC servers that comes as a contribution project.

Chapter 3, Core Programming Concepts, explains the core programming concepts of qooxdoo. This chapter is a very important chapter as it explains the implementation syntax of basic object-oriented concepts such as class, interface, and so on. This chapter will help the developer to construct the application code in an object-oriented way.

Chapter 4, Working with Layouts and Menus, explains the layout design, toolbars, and menu bars.

Chapter 5, Working with Widgets, helps the developer to know about the various widgets available in the qooxdoo framework.

Chapter 6, Working with Forms and Data, explains form handling and data store support in the qooxdoo framework.

Chapter 7, Testing and Debugging, explains how to test and debug the qooxdoo application, as well as how to fix the identified issues.

Chapter 8, Internationalization, helps the developer to internationalize and localize the qooxdoo application to multiple languages.

Chapter 9, Working with Themes, aids the developer in understanding the theme support in qooxdoo and in designing a custom theme for the application.

Chapter 10, Performance, helps the developer to monitor and improve the performance of the qooxdoo application.

Chapter 11, Miscellaneous, covers a few miscellaneous topics that complete your understanding of qooxdoo.

Appendix, Pop Quiz Answers, contains the answers to all the pop quiz questions for all the chapters.

References: It contains the references used in this book.

What you need for this book

qooxdoo is completely based on object-oriented JavaScript. So, what you should be well versed in is just JavaScript. If you know the object-oriented concepts and have worked with any object-oriented language, such as Java, it will really help you to understand the qooxdoo programming concepts pretty quickly. Even if you haven't worked with any of the object-oriented languages, it is okay; you can learn the object-oriented concepts with qooxdoo.

Even though it is web development, you don't need to know HTML, DOM, CSS, and so on. qooxdoo generates HTML in runtime from the JavaScript code that you have written.

Who this book is for

This book is intended for the client-side developers who design and develop Internet web applications and enterprise web applications. If you want to start developing RIA in qooxdoo, this book would be of great help to jump start your development. If you are already developing qooxdoo applications, this book will help you to go through the qooxdoo framework quickly to improve your contribution to your project.

This book helps the beginners in qooxdoo to easily set up the development environment and explains the concepts in an order that can easily be grasped by beginners.

This book also provides an idea for the architects and lead developers to know about qooxdoo and evaluate the framework.

This book is also intended for the desktop application developers who want to move into RIA development and develop rich Internet applications and rich enterprise web applications.

Conventions

In this book, you will find several headings appearing frequently.

To give clear instructions of how to complete a procedure or task, we use:

Time for action - heading

Action 1Action 2Action 3

Instructions often need some extra explanation so that they make sense, so they are followed with:

What just happened?

This heading explains the working of tasks or instructions that you have just completed.

You will also find some other learning aids in the book, including:

Pop quiz

These are short multiple-choice questions intended to help you test your own understanding.

You will also 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: "Besides regular classes, it offers abstract, static, or singleton classes."

A block of code is set as follows:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

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

E:\>python ActivePython 2.7.1.3 (ActiveState Software Inc.) based on Python 2.7.1 (r271:86832, Feb 7 2011, 11:30:38) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>>

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 the text like this: "Click on the Add Feed menu in the toolbar and add any feed that you want to put into the feed reader."

Note

Warnings or important notes appear in a box like this.

Tip

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 send an e-mail to<[email protected]>, and mention the book title via the subject of your message.

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.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the files e-mailed directly to you.

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 the text or the 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 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 errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. 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. What is qooxdoo?

This chapter introduces the qooxdoo framework to you, explains the architecture, explores the framework features, briefs you about the GUI widget library, and provides an overall understanding about the qooxdoo framework. It takes you through an application developed in qooxdoo and also explains the application that we are going to develop throughout this book.

In this chapter, we'll cover the following:

A feel of an RIA developed in qooxdooArchitecture of the qooxdoo SDKqooxdoo framework featuresEvent-based Rich UI ProgrammingGUI LibraryThe application to be developed in this book—Team TwitterWhat you should know and what you don't need to know

By the end of this chapter, you will have an understanding of the qooxdoo RIA framework and the programming languages or technologies required to develop an application in qooxdoo.

Let's begin to understand qooxdoo.

A feel of an RIA developed in qooxdoo

Before anything, let's get a feel for an application developed in qooxdoo. This will give a rough idea about the things that you can develop, depending on the features in that application. You can do more than that with qooxdoo. The following screenshot will give you an overview of the feed reader application:

Time for action - play with the feed reader application

Go to the qooxdoo demo feed reader URL (http://demo.qooxdoo.org/current/feedreader/), play with the feed reader application, and feel the qooxdoo application. Perform all the operations available in the application; observe the AJAX behavior, desktop-like features, and so on. Compare the behavior of this application with any typical web application. You can perform the following operations:

Adding a feed to the feed reader

Click on the Add Feed menu in the toolbar and add any feed that you want to put into the feed reader. Let's add the feed to the Google Open Source Blog. Enter Google Open Source Blog in the Title field and http://feeds.feedburner.com/GoogleOpenSourceBlog in the URL field. Click on the Add button. This will add a feed to the User Feeds section:

Note

You must have observed that the add feed action displayed a modal dialog box without disturbing the existing content, and on add action, it just added a feed under the User Feeds section. It did not reload the entire page displayed in the browser. That is the beauty of AJAX applications.

Checking the feeds

Clicking on the RSS feed nodes on the tree panel will load the feeds on the right-hand side panel. Once you click on a particular feed post on the top pane in the right-hand side panel, it will load the details of that particular feed post on the bottom of the right-hand side panel. Go to User Feeds | Google Open Source Blog and check the Google Open Source Blog feed.

If you observe closely, it just loads the required data on the respective content area without disturbing user context or without reloading the entire page (as shown in the following screenshot). This is done through AJAX. In AJAX applications, the application just sends and receives the required data and updates only the impacted portion in the GUI. This helps to retain the user context, improves performance because of less transfer of data between client and server, and improves the usability of the GUI:

Try the following actions, too:

ReloadPreferencesRemove feed

What just happened?

You played with a Rich Internet Application (RIA) developed in qooxdoo. Let's have a look at the key aspects provided by an RIA developed in qooxdoo.

User context

AJAX-based RIA does not reload the whole page every time; instead it just loads the required data in the respective content area. This is the main differentiating aspect in RIA. It holds the user context all the time, thus the user experience is very much appreciated by the users. RIA applications do not open multiple browser windows, as it is done in the traditional web application using window.open(). Instead, it uses the modal dialog and avoids the floating browser windows. RIA applications do not wipe out the whole page and reload the new page, as it is done in traditional web applications; instead, they retain the user context, send and receive only the necessary data, and update only the changed or impacted portion of the screen. qooxdoo is an RIA framework based on AJAX.

Desktop characteristics

RIA provides rich features developed through the off-the-shelf widgets provided by RIA frameworks such as qooxdoo. Because of this, RIA provides rich user experience. You have seen the toolbar, split-pane, modal dialog, and so on in the feed reader application. There are many more widgets provided by qooxdoo for various purposes that you'll come to know about in the coming chapters.

GUI library

qooxdoo provides a wide range of widgets in the GUI library, which helps you to develop your application pretty quickly with all the rich features. For example, qooxdoo provides the Tree widget that does not come with the plain HTML, it supports column sorting on the table and the remote data model for the table. There are many more widgets with very nice features that are readily available for you. You don't have to spend time to develop these things on your own in HTML and struggle between multiple browser implementations. Instead, just focus on your application's functionalities.

Architecture of qooxdoo SDK

Architecture of the qooxdoo SDK is pretty neatly done to hide the modules that include internal parts such as HTML rendering, multiple browser handling, and so on in different layers and provide the GUI toolkit on top of all the layers.

Let's explore the architecture of the qooxdoo framework to know more about the framework capability:

Core layer

qooxdoo is an object-oriented framework and its working is based on event programming. All the core framework modules are in this layer. You don't have to worry about this until you contribute to the qooxdoo framework.

Browser Abstraction layer

This layer abstracts the document-object model, browser-based events, and so on. This layer is also an internal layer; you don't have to worry about this until you contribute to the qooxdoo framework.

Low-Level layer

This layer contains all the modules that work over the Browser Abstraction layer to achieve actual things on the browser. It contains the modules to render the HTML, select the CSS based on the themes, to animate things, and so on. In addition to these, it has a module called Parts, which helps to divide your application into multiple parts and load only the necessary parts required at any point of time to improve the performance. You need to know only about the Parts module in this layer; the rest of the modules are internal to the qooxdoo implementation.

GUI Toolkit layer

This layer is exposed to the users. You should know all of the modules in this layer. It has a separate module for core UI classes. The widgets and layouts are developed over the core UI. qooxdoo provides a wide range of layouts and widgets for you. Once you know all the layouts provided by the qooxdoo framework, it will be easy to pick the right layout for your needs. It provides a full-blown set of widgets. You can learn the basic widgets first and the other widgets as and when you need to use them. The qooxdoo framework separates the style part into a separate module called Themes, which allows you to change the look and feel of your application without touching the application logic code. This is based on JavaScript, not CSS. The qooxdoo framework supports keyboard navigation, focus handling, tab handling, and drag-and-drop functionalities.

Data Binding

This functionality is available across multiple layers. Basically, this provides a way to attach the data source to the UI widget. The data could be fetched from a file, web server, or web service, and the store will fetch the data from any of these sources and attach that to the data model of the UI widget. The controller will make sure that the data is displayed in the view part of the widget. One of the data sources can be YQL API or REST API from twitter.

Internationalization

This functionality is also available across multiple layers. qooxdoo supports the internationalization of the application, so that you can localize your application to support locale information for virtually every country in the world. You need to prepare your application code to read from the locale files, and as you translate the texts to multiple locales, your application will work as per the locale that is chosen in the application.

qooxdoo framework features

qooxdoo is an entirely object-oriented framework based on JavaScript. This framework is properly organized on the basis of namespaces. It supports most of the modern browsers, provides utilities to generate documentation based on javadocs such as comments, and also supports themes and internationalization. In this section, you will learn about all these features.

Let's check all the features provided by the qooxdoo framework. This will improve your knowledge on qooxdoo and help you further understand the qooxdoo framework.

Language

The qooxdoo application runs in most of the modern web browsers, including:
Internet Explorer 6+Firefox 2+Opera 9+Safari 3.0+Chrome 2+
No plugins (ActiveX, Java, Flash, or Silverlight) are required. It is completely based on JavaScript.Non-critical modifications of the native JavaScript objects to allow for easy integration with other libraries and custom code.Cross-browser JavaScript 1.6 (string/array generics).

Object-orientation

Framework is fully class-basedFramework uses namespaces. It avoids the conflicts in global variablesBesides regular classes, it offers abstract, static, or singleton classesConstructor and destructor supportMultiple access specifiers—public, protected, and privateSingle inheritance and full polymorphismJava-like interfacesRuby-like mixinsSo-called dynamic properties, a very convenient and powerful way to have optimized setter and getter methods generated from simple configuration

Programming

Purely client-side JavaScriptNo need to know HTML, DOM, or CSSComplete support for event-based programmingDevelopment of qooxdoo applications fully supported on all platforms; for example, Windows, Linux, all flavors of Unix, and Mac OS XQuick start for easy evaluation of the framework without the need to install any softwareSkeletons are pre-configured for full-featured custom applicationsMany sample applications and examplesDesigned for high performanceFramework has no issue of memory leakAids in developing memory-leak free user applicationsExtensive logging capabilities (for example, different log appenders and Firebug support)Straightforward debugging (for example, object introspection and benchmarking)Browser history management, that is, browser back/forward button, bookmarksCookiesGeneric JavaScript pretty printer/code formatter for unified code style

Internationalization

Built-in internationalization (i18n) and localization (l10n) supportSupport for all languages and locales, at least on this planetBased on the comprehensive Common Language Data Repository (CLDR)Internally using the mature GNU gettext toolsWell-known translation file format (.po)Support by professional, free translation tools (PO editors) on all platforms

API reference

Extended javadoc-like source code commentsFull API reference for both framework and custom applicationsOnline (http://api.qooxdoo.org/) and offline API viewer applications

Testing

Integrated unit testing framework (test runner)Integrated functional testing framework (simulator)

Deployment

Generation of a self-contained and easily-deployable build versionComplexity of the build process hidden behind user-friendly commandsJavaScript compression (removal of whitespaces, and so on)Automatic dependency resolution of JavaScript classes; no need for manual require() statements or tweaking a custom buildAutomatic linking of JavaScript classes (JS linker)Copying of required static resources like images or other external files into a self-contained buildString extraction (tremendous performance improvement for IE6)Shortening and obfuscating local variables and/or private membersOptional browser-specific variant for each supported browser (For example, Firefox-only build)Generation of build versions depending on user-defined variants, which allows for different products from the same code baseRemoval of debug statements within the application code before deployment

Migration

Support for easy migration of custom applications from one framework release to anotherMigration in the qooxdoo framework is painless as it is technically easy to carry outFully integrated into the regular build systemAll non-ambiguous changes are done automatically for maximum convenience and to avoid manual find/replace errorsAll ambiguous or semantic changes that require some developer decision are put into a comprehensive checklist

Alternative programming models

In addition to the JavaScript programming model, you can also develop qooxdoo applications using one of the following alternative programming models or development platforms. Some are not quite stable, some are not active, and some are pretty new. This book focuses only on the JavaScript programming model, which is the built-in development model of the qooxdoo framework.

Java/Eclipse: Eclipse Rich Ajax Platform (RAP); for more information, see http://eclipse.org/rapJava: qooxdoo Web Toolkit (QWT); for more information, see http://qooxdoo.org/contrib/project/qwtQxWT: JSNI wrapper for the qooxdoo JavaScript library; for more information, see http://www.ufacekit.org/index.php?cat=02_qooxdoo&page=01_QxWTLISP (qooxlisp): LISP programming for web applications; for more information, see https://github.com/kennytilton/qooxlisp/wiki/XML: XML-based GUI description; for more information, see http://qxtransformer.org/

The list of alternative programming models is growing. You can check the updated list at http://qooxdoo.org/documentation/general/development_platforms

Event-based rich UI programming

qooxdoo provides complete support for event-based programming. If you have already programmed in QT or Java Swing, you'll find qooxdoo very similar. qooxdoo separates out the view widgets, model classes, and the controllers. Listeners observe the widget all the time and fire the right event based on the action. The action could be a click, a key entry, a selection of an item, mouse over the widget, change of the value in a table cell, and so on. An example of event-based programming is shown in the following diagram:

For example, you can add a listener for the Button widget to perform something on the click of a button. You can even set a command, which will be called on the execute action of the button-click event. qooxdoo provides lots of events for various widgets. For example, the List widget has many events such as changeSelection, addItem, removeItem, and so on.

GUI widget library

qooxdoo is on par with the desktop GUI toolkits such as QT, Java Swing, and so on. It provides a whole lot of off-the-shelf widgets for the GUI development. The good thing with the qooxdoo framework is the demo browser application, where you can see the behavior of each widget even without setting up the qooxdoo environment.

Similar to the feed reader application, demo browser is another application that comes with the qooxdoo framework. You can use this application to see the behavior of different widgets and select the widget that you want to use in your application. This application demonstrates various widgets, and it displays the widgets under neat categorizations such as widget, layout, UI, and so on.

In addition to the demo browser application, the qooxdoo framework provides another application called playground. As the playground application is linked with the demo browser, you can select the widget that you want to use in the demo browser, take that widget to the playground, change the code, run it, and see the behavior.

This makes it easy to select the widget in the demo browser; try it in the playground before actually trying it in your application. You can access the online version of these applications for the current qooxdoo version. You can also set these applications locally in your network if you download the qooxdoo framework. We will explore the online version of these applications in this section.

Time for action - checking the demo browser and the playground applications

Let's check the supporting tools that qooxdoo provides to explore all the widgets in the GUI Toolkit.

Demo browser

The demo browser allows you to browse through all the widgets provided by the qooxdoo framework. Double-click the tree nodes in the left panel to see the behavior on the right panel.

Go to the URL (http://demo.qooxdoo.org/current/demobrowser/#) and browse through all the widgets shown in the demo. The demo browser application is shown in the following screenshot:

Playground

You can change the sample code and play in the playground environment provided by the qooxdoo framework. Run it immediately, and see the results. Even without setting the qooxdoo development environment, you can do some coding in the playground environment and try it. Either you can play with one of the samples in the playground environment or select one of the widgets in the demo browser, take it to the playground, and play with it.

Go to the URL http://demo.qooxdoo.org/1.3/playground/# and play with the widgets. The qooxdoo playground application is shown in the following screenshot:

What just happened?

You have browsed the demo and played in the playground of the qooxdoo framework. These are the pretty cool features offered by the qooxdoo framework that allow you to explore the widgets provided by the qooxdoo framework. As qooxdoo provides a lot of widgets for different purposes, it is a nice idea to browse the demo and play in the playground environment once in a while to know more about all these widgets. Another option is to carry out this activity whenever you are looking for a widget for use in your application.

Application to be developed in this book—Team Twitter

To try out the qooxdoo framework, we will develop an application across this book as we learn the framework. In this section, we'll define the high-level functional requirements of the application that we are going to develop in this book.

The Team Twitter application allows the members of the team to read the tweets written by the fellow team mates and tweet to the team. It supports tagging and filtering based on team members.

Time for action - checking the Team Twitter application

Let's define some functional requirements for the Team Twitter application.

Reading team tweets

You can read all the tweets of a team in a reverse chronological order, search the tweets for any specific keyword, or navigate through the tweets by the tags. In addition to this, you can also filter the tweets by the team members. By default, tweets from all team members are displayed:

Logging in to the Team Twitter application

To tweet in a team, one should log in to the application. If he or she is not already part of the team, they can join the team.

Tweeting to the team

One can tweet a text or video. One can tag the tweet to categorize it and all the tweets are displayed in reverse chronological order.

What just happened?

We have seen the high-level functional requirements of the Team Twitter application. We'll develop this application across the book as we learn more about the qooxdoo framework. In this book, all code related to the user interface development of the team twitter application will be explained in detail, but the server-side and the database part of the code will not be explained, as it is not in the scope of this book. The code for the entire application can be downloaded from the site.

What you should know and what you don't need to know

qooxdoo is completely based on object-oriented JavaScript. So, what you should know is just JavaScript. If you know the object-oriented concepts and have worked with any object-oriented language such as Java, it will really help you to understand the qooxdoo programming concepts pretty quickly. Even if you haven't worked with any object-oriented language, it is okay. You can learn the object-oriented concepts with qooxdoo.

Even though it is a web development application, you don't need to know HTML, DOM, CSS, and so on. qooxdoo generates the HTML at runtime from the JavaScript code that you have written.

Pop quiz

qooxdoo is a

a. Browser-independent JavaScript framework

b. Framework that supports object-oriented programming

c. Event-based programming

d. All of the above

qooxdoo works on most of the web browsers

a. Yes

b. No

I need to install the following on the client machine to run the qooxdoo application in a web browser

a. ActiveX

b. Java plugins

c. Flash

d. Silverlight

e. None of the above

The following are possible with qooxdoo programming

a. Code re-use through object-oriented programming

b. Modularize the application

c. Namespace and access control of the member variables

d. All of the above

I can do the following with qooxdoo

a. Develop an application, allow my country members to see it in their language, and show it to the world in their language

b. Support personalization of the web application in qooxdoo

c. Pull data from multiple data source and bind it to the widget

d. All of the above

Playground allows you to

a. Just go through the widget behavior

b. Edit, run immediately, and see the widget behavior

Summary

We learned a lot in this chapter about the qooxdoo framework. Specifically, we:

Had a feel of RIA, developed in qooxdooGot to know the layers in the qooxdoo architecture and the layers or modules that we need to learn for GUI developmentGot an idea about the various features provided by the qooxdoo framework. This broadens the understanding of the qooxdoo frameworkWent through the widgets (if not all, as many as we could), with the help of the demo browser and the playground utilities provided by the qooxdoo frameworkDefined the functional requirements for the application that we are going to develop in this book

We also discussed the things we should know and the things we don't need to know. Now that we've got an overview of qooxdoo, we're ready to say "hello" to the qooxdoo world.

Chapter 2. Say Hello to the qooxdoo World!

This chapter explains how to set up the environment for qooxdoo client application development, how to create a client application, and how to build and run the application. It also explains about the format of the data that is passed between client and server, the transport protocol, and the various servers supported by the qooxdoo framework.

In this chapter, you'll read about the following:

Installing qooxdoo tools (Python/Cygwin)Installing qooxdoo SDKCreating a simple applicationPassing the data to the server using JavaScript Object Notation (JSON)Communicating with the server using Remote Procedure Call (RPC)RPC serversIntegrating with the Java server

By the end of this chapter, the user will have the development environment for Rich Internet Applications (RIAs) based on qooxdoo. The user will also have an understanding of how the end-to-end communication takes place from client to server.

Now, let's step into the qooxdoo world to say hello.

Installing qooxdoo tools

qooxdoo provides a lot of tools to perform many activities such as creating an application, building the code, optimizing the code, generating documentation, and so on. All these tools are written in Python. So, the Python environment is required to run these tools. You don't have to know programming in Python to develop an application in qooxdoo.

Time for action - installing qooxdoo tools

For Windows OS, you can install Python from python.org, ActivePython from ActiveState, or the Python package with Cygwin. Python, from python.org, needs additional manual configuration. But the default installation of ActivePython works just fine. So, you have two options now. Either go with ActivePython if you like the Windows development environment or go with Cygwin and include the Python package if you want a Unix-like development environment. It is recommended to use ActivePython because it is simple and works well. The following sections discuss the installations for both these options.

Installing ActivePython

Go to the ActiveState website (http://www.activestate.com/activepython/downloads), download the latest version of ActivePython (we used ActivePython 2.7.1 while writing this book), and install the program. The following steps will guide you through the ActivePython installation:

Click on the Next button (see the following screenshot) to start the ActivePython installation:The following screenshot shows the End-User License Agreement. Read and agree to the license terms and click on the Next button:The following screenshot displays the list of features that are installed through this installer. Click on the Next button:Now, the installer is ready to install the features of ActivePython. Click on the Install button (see the following screenshot):Once the installer has completed the ActivePython installation, you will see something similar to the following screenshot. Click on the Finish button:To verify the ActivePython installation, open the command prompt and check the Python setup. Type python on the console to see whether it takes you to the Python environment. You will see the following output on your console:
E:\>python ActivePython 2.7.1.3 (ActiveState Software Inc.) based on Python 2.7.1 (r271:86832, Feb 7 2011, 11:30:38) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>>

Installing Cygwin

Go to the Cygwin website (http://www.cygwin.com/setup.exe), download the Cygwin setup file, and install Cygwin.

Note

Cygwin is not required with the recent qooxdoo versions, as qooxdoo completely moved the dependency to Python only. You can use Cygwin with the Python package if you wish. However for the development in Windows OS, it is recommended to go with ActivePython installation as it is simple, does not require any configuration, and it works well. If you are going with ActivePython, you can skip installing Cygwin.

Run setup.exe to install Cygwin. The following steps will guide you through the Cygwin installation:

Click on the Next button to start installing Cygwin:The following screenshot displays the options to choose a download source for the Cygwin packages. Choose the Install from Internet option and click on the Next button. Make sure that you are connected to the Internet.The following screen allows you to select the root directory for the Cygwin installation. The default value is C:\cygwin. If you want to install Cygwin in a different location, enter that location for the root directory. You can also specify whether you want to set up Cygwin for all users or only for the logged-in user. Select All Users and click on the Next button:The next screen allows you to select the Local Package Directory to store the repository (see the following screenshot). Cygwin does not blow this directory away after installation. Rather, it keeps the installation files in order to remember your download choices, so that when you upgrade, you do not have to go through the tedious package selection process again. The packages can be reused later when you want to install Cygwin on another machine by selecting this directory content as a local directory in step 2 and selecting the option Install from Local Directory in step 2 to avoid downloading the packages from Internet. So, a non-temporary directory is recommended. Click on the Next button:The following screen allows you to provide details about your Internet connection. If your internet connection is not using any proxy settings, select Direct Connection option. If your internet connection is using any proxy settings, select Use HTTP/FTP Proxy and provide the Proxy Host and Port details. Click on the Next button:The following screen allows you to choose a download site. Select the download site as http://sourceware.mirrors.tds.net (scroll down to see it in the list). Click on the Next button: