Flex on Java
eBook - ePub

Flex on Java

Bernerd Allmon, Jeremy Anderson

Share book
  1. 264 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Flex on Java

Bernerd Allmon, Jeremy Anderson

Book details
Book preview
Table of contents
Citations

About This Book

Unlike many Flex books that presume readers want to develop applications from scratch, Flex on Java is for developers in the real world-where Flex is one more technology being added to existing systems developed in Java, and where integration is the key indicator of success.Written for Java developers beginning to use Flex, Flex on Java shows how to use Flex alongside existing Java applications, and how to integrate Flex using familiar server-side technologies such as Spring, EJBs, JMS, and more. The authors, both Agile development experts, focus on Agile and test-driven development to enable readers to redesign applications that deliver more value and with zero defects. Throughout the book, readers will apply these techniques to refactoring a single application into a rich internet application using Flex and the BlazeDS framework. Purchase of the print book comes with an offer of a free PDF, ePub, and Kindle eBook from Manning. Also available is all code from the book.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Flex on Java an online PDF/ePUB?
Yes, you can access Flex on Java by Bernerd Allmon, Jeremy Anderson in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming in Java. We have over one million books available in our catalogue for you to explore.

Information

Publisher
Manning
Year
2010
ISBN
9781638354314

Part 1. Laying the foundation

Part 1 lays the foundation of Flex on Java by touring Flex, Java, and other supporting technologies that you will use throughout the book.
In these first four chapters, you will build a sample Java web application to use with numerous code examples throughout the book. The Java web application is built using a service-oriented architecture (SOA).
After making a whirlwind tour of Flex (chapter 1), your first step (chapter 2) is to create a Java application that will expose web services you will later use to connect to them from a Flex client.
In chapter 3, you will create a Flex application and words like AppFuse, Flex Mojos, and FNA enter your vocabulary.
The focus of chapter 4 is to continue building the client-side application and you will begin building a Flex client that will connect to the Java web services that you will choose to expose.

Chapter 1. Some Flex with your Java?

This chapter covers
  • A brief history of Java and Flex
  • A whirlwind tour of Flex
  • MXML and ActionScript
In 1995, Sun introduced the first Java platform and gave birth to the applet which allowed Java applications to run inside the browser with rich functionality and all the benefits of the Java framework, including connecting to the server side. The applet became hugely popular for a couple of years before its popularity waned mainly because of problems surrounding the browser plugin.
Macromedia embraced the idea of having a dedicated runtime environment for the browser, like the Java applet, and in 1997 released the Flash Player. Adobe has since taken over the rights to the Macromedia suite of products and helped to evolve what is now the Flex framework and development API.
Building features in an applet from scratch or even with other rich implementations can be expensive compared to the simplicity of using the Flex framework. Figure 1.1 displays a simple Java applet data grid next to a Flex data grid. The Flex data grid right out of the box not only looks better than the applet, it’s much more functional with much less code overhead. The Flex DataGrid and AdvancedDataGrid components provide built-in support for tasks such as sorting, dragging columns, row highlighting, data nesting, and styling.
Figure 1.1. Comparing a Java applet DataGrid (left) to a Flex Advanced DataGrid
The Flash runtime provides lightweight graphics and animation capabilities in manageable file sizes, making the player hugely successful across OSs and browser platforms. The Flash runtime allows for rich applications to have true stateful experiences and a high level of security.
Note
A stateful experience with Flex means that the client (Flex) will manage or remember everything it needs to without having to: submit to the server side, update and manage a session or request through HTTP, and refresh the client side with updated data after a submit with data from the session or request.
In general, Java developers have successfully leveraged the principles of object-oriented programming (OOP) to build extremely stable, testable, and extensible applications. Flex has become a rich internet application (RIA) solution for Java developers because it not only bridges the gap between a solid server side and a great UI, it is also built on top of OOP principles such as encapsulation, inheritance, and polymorphism.
These advantages benefit other technologies besides pure Java, as you’ll see in chapter 11, when we demonstrate Flex integration with Grails, one of the hottest web development platforms. We’ll build a simple contact management system and learn how to get rolling with Groovy and Grails development. Integrating Flex with Grails is in many respects easier than integrating Flex with Java.
Flex development is now bolstered by many of the benefits of Java-like frameworks for performing unit testing, functional testing, and continuous integration. The combination of Java and the Flex Software Development Kit (SDK) allows developers new to the business to start building applications immediately.
A thriving Flex open source community can offer Java developers GUI components as simple and as complex as required. Most of these custom components extend stock Flex objects found in the Flex SDK. Adobe made Flex 3 open source, and it now has numerous community resources. The Flex SDK with Adobe’s built-in charting components is still commercial.
We have chosen Flex 4 with Java because of the duality of a rich and stateful client in conjunction with a powerful server side. Also, Java is broadly used in the mainstream and is the existing server-side platform for many Flex migration projects. Although there are alternative ways for doing RIA development, Flex will most likely prove to be the superior RIA framework because of the simplicity and testability it provides to developers. We’re now ready to discuss some of Flex framework features.

1.1. A whirlwind tour of Flex

It’s time to take a peek at the components we’ll use throughout this book. We won’t go into too much detail about the components as that is beyond the scope of this book. Instead, we’ll focus on the usage of components and framework in real-world development.

1.1.1. MXML and ActionScript

At the heart of every Flex application you’ll find a combination of MXML files (XML files with the .mxml extension) and ActionScript classes. These two components are the basic building blocks of the Flex framework. The Flex compiler takes these files and creates a small web format (SWF) file, which is executed in the Flash Player.
MXML
MXML is an XML-based markup language similar to HTML/XHTML. The MXML syntax, used to declaratively define your application, has numerous tags for common UI objects, such as text input fields, radio buttons, and drop-down lists. It also has many UI components and layout components that are common in rich client development, such as menu bars, tabbed panels, data grids, and navigational trees. In addition, it’s possible to build custom components that extend existing ones or produce something completely different like the flow visualization chart. Figure 1.2, which was made with Degrafa, shows this function.
Figure 1.2. Flow visualization chart
In chapter 8 we’ll be covering the Degrafa drawing API for Flex to create a pie chart for a sample application.
ActionScript
ActionScript, and more ...

Table of contents