Archive for September, 2006

Grey Line

There has been another discussion on the mailing list why using components for itemrenders and itemeditors is challenging – and how to deal with it. The case in point was DateField with mask as ItemEditor – and usual synchronization with the itemRenderer labelFunction and things

Basically when you use a renderer as an editor, there is no reason to deal with labelFunction as you have at your disposal a powerful control with a built-in mask. It is more expensive to use tons of heavy controls as ItemRenderers. And if you do, you might be OK because in my opinion you get a better looking UI with just a little performace degradation.

In most cases we are using ItemRenderers as ItemEditors and have a single point of customization for controls.

Here is the rub – you can not declare properties needed for these controls on the DataGridColumn tag.

There is no trivial out of the box way to add properties to MXML . You have to use mx:Component in order to “embed” them into the class. This approach is very limiting and does not lend itself easily to data driven programming.

An alternative it to create a class factory. I do not have a trivial factory to share with you, and the factory we use would take too much space and time to go over, but here is (very ugly and untested) version of the factory implementation:
………..

rendererIsEditor=”true” />
itemRenderer=”{new WrappedClassFactory(com.theriabook.controls.DateField,
{
dateFormat:locale.getDateFormat()}}”
/>

public class WrappedClassFactory extends ClassFactory {
public function WrappedClassFactory (cls:Class, props:Object) {
super();
this.properties = props;
}}
This should work and allow you to add as many properties to the itemRenderer as you need.

Warning: This approach is addictive. It may change the way you code. If you are in application and not software development and have team of junior programmers it might cause project delivery delays. On contrary, if you are in software development and have experienced team, it can benefit you greatly.
Here is a screenshot from Chapter 11 of our upcoming book on Flex – BOTH controls on the left and right are datagrids showing the same data. The “expando” property contains serialized additional render attributes, styles, runtime property and styles (ie calculated on the data change), etc.

Enjoy.

Comments (4)

 

Grey Line

Looks like I am done with scheduling Max’06 conference sessions. The only big question remains – whats about MAXUP sessions and how in the world are you suppose to mix it with the rest of the conference? Here is my idea for MAXUP session – do a breakdown by categories in bigger chunks. For example, application developers have “matching” blind spot on Tuesday afternoon – it would be great time for application developers to get together for targeted presentations.
I am sure the other topics would have their preferred time.
Here are the sessions I plan to visit – see you there.

Adobe Logo

Tuesday, Oct 24

7:00 AM – 8:00 AM Breakfast (BRKFST-1)
Location: To Be Determined
8:30 AM – 10:00 AM General Session (GS100A-1)
Location: To Be Determined
10:30 AM – 12:00 PM LiveCycle Core Products, SDK’s and API’s (LT301H-1)
Location: To Be Determined
11:30 AM – 1:30 PM Lunch (LUNCHA-1)
Location: To Be Determined
12:30 PM – 1:30 PM Flex Under the Hood: A Tour through the Flex Architecture (RI303W-1)
Location: To Be Determined
1:45 PM – 2:45 PM Increasing Efficiency and Quality with Flex Automation (RI308W-1)
Location: To Be Determined
3:00 PM – 4:00 PM Real-time and Collaborative Apps with Flex Data Services and Flash Media Server (RI302W-1)
Location: To Be Determined
4:15 PM – 5:15 PM Advanced Apollo Application Development (RI202W-1)
Location: To Be Determined

Wednesday, Oct 25

7:00 AM – 8:00 AM Breakfast (BRKFST-2)
Location: To Be Determined
8:30 AM – 10:00 AM General Session (GS100A-2)
Location: To Be Determined
10:30 AM – 11:30 AM Techniques for Delivering Modular Flex Applications (RI306W-1)
Location: To Be Determined
11:30 AM – 1:30 PM Lunch (LUNCHA-2)
Location: To Be Determined
12:30 PM – 1:30 PM Solution for Intelligent Dynamic Document Generation and Presentation (VS107W-1)
Location: To Be Determined
1:45 PM – 2:45 PM Building an Enterprise Reporting Framework Using Adobe Flex (VS108W-2) PRESENTING
Location: To Be Determined
4:15 PM – 5:15 PM Building Custom Components (RI305W-2)
Location: To Be Determined
7:30 PM – 10:00 PM Welcome Reception (RECPTN-2)
Location: To Be Determined

Thursday, Oct 26

7:00 AM – 8:00 AM Breakfast (BRKFST-3)
Location: To Be Determined
8:30 AM – 10:00 AM General Session (GS100A-3)
Location: To Be Determined
10:30 AM – 11:30 AM Flex Best Practices: Applying Design Patterns and Architecture (RI304W-1)
Location: To Be Determined
10:45 AM – 12:30 PM Partner General Session (GS200A-1)
Location: To Be Determined
11:30 AM – 1:30 PM Lunch (LUNCHA-3)
Location: To Be Determined
12:30 PM – 1:30 PM Improving ActionScript 3 Performance (WD207W-2)
Location: To Be Determined
1:45 PM – 2:45 PM Building an Enterprise Reporting Framework Using Adobe Flex (VS108W-2) PRESENTING
Location: To Be Determined
3:00 PM – 4:00 PM Design Patterns in ActionScript 3 (WD306W-2)
Location: To Be Determined

Comments

 

Grey Line

While a large Flex application is loaded, the user may experience unpleasant delays, which can be used productively to logon to this application. Besides, it’ll give the user perception that your application loads faster.

I recently had a chance to use Ted Patrick’s (Adobe) sample to mitigate the load time of the application. While Ted is displaying a splash screen while the application is loaded and initialized in the background, I wanted to use a very dull logon window to keep the user occupied with a bit more useful stuff. Here are 3 challenges you would face with that task:

1. The logon screen has to be very lightweight – under 10K – so it may not be based on the Flex framework

2. The application may not remove logon window on load as the user has to login first.

3. If the user completes his/her login but the application did not finish its load, the standard progress bar has to appear.

Confronted with all these problems I timidly thought of writing a small HTML/JavaScript dialog and calling it from Flex, but overcame those thoughts and did the only right thing to do – called for help from Konstantin – our Flex AND Flash developer and he has created LightweightPreloader.zip

Inside of this zip file you’ll find a simple login window with a typical user and password fields over a plain screen that sends the login info to the server and expects some XML back. It also includes Ant build files and support classes. After you are done deploying you should get a small (<6K) SWF login window (4K accounts for buttons and the window background, the rest is actual code).

The lesson learned: there is a large class of tasks that can only be solved using native Flash APIs and coding techniques. In the last year I came across at least 6 cases when the native Flash code was the only reasonable way to go. I believe it is time for Flex and Flash developers to start working on common shared libraries covering the "non-visual" domain.

For additional info on what's happening while the Flex application is loaded, refer to this article.

Comments (3)

 

Grey Line

We are finishing writing our book on RIA with Flex and Java , and the last chapter is called “Integration with External Applications”. It’s sixty five pages of some advanced read. After writing this chapter one of us suggested that it would be easier to re-write Excel from scratch. It’s not straightforward coding, but the results are good. After covering some basics about ExternalInterface and how it enables bi-directional communications between JavaScript inside HTML page and embedded Flex application, this chapter leads you through jungles of Flash technologies such as External API and LocalConnection as well as through maze of Microsoft old timers like ADODB and OWC. We have been coding in VBA, JavaScript, XSLT, not to mention the ActionScript, of course.
We’ve also provided the code for a more complex example of integration with external applications, namely Microsoft Excel. These days the data entry or analytical applications with no Excel integration are simply hard to find. Be that saving of data in native Excel format or CSV, accepting data entered in Excel or dynamically creating Excel Charts based on the database queries – we see it everywhere. Microsoft Excel is one of the most popular business ever .

This solution involves two ActiveX objects embedded in an HTML page with instant as well as on demand data synchronization between the objects. One of these ActiveX objects is the Flash Player control, executing Flex application. The second ActiveX is a Spreadsheet from Microsoft Office Web Components (OWC). You may think about Spreadsheet as of miniature Microsoft Excel application running inside the HTML page.

Disclaimer: This particular sample works under IE in Windows XP, but has some issues on Windows 2000. I’m sure, if you are still running Window 98 you may face some issues as well, which we’ll be happy to fix for our customers.


Meanwhile try to make changes in the left (Flex) and right (Excel) spreadsheets and the data should be replicated back and forth. We’d appreciate any suggestions/critique of this application.

An application like this opens the door to some interesting project ideas, because  we also know how to generate and execute formulas on the fly, provide proper reporting and printing, and more. But that’s later. Let’s finish the book first.

Comments (2)

 

Grey Line

This is the video of our presentation at a recent Flex Seminar in New York City. There were about 150 people of various technical background in the audience. The person in black is Yakov Fain and the guy in white is Victor Rasputnis. Last week we re-ran this presentation at New York’s Java user’s group .

Comments

 

Grey Line

Tonight my colleague Victor and I were presenting were presenting Adobe Flex to the one of the largest and most active Java Users Group in the world: New York’s Java SIG. This is one of the toughest audiences to talk to for a couple of reasons:

1. People are very technical : these are Java developers with many years of experience.

2. This is New York – they’ve seen it all. Frank Greco, the leader of this JUG usually invites well known speakers in the Java community – see for yourself. Tonight’s meeting was held at Google’s NYC site and more than 100 armed and dangerous Java developers came to listen to the next big thing.

First, I spent 50 minutes or so showing different live sample business applications that would retrieve data from various servers using POJOs, JSP, HTTPServices, displayed charts, etc. I was targeting mainly Wall Street crowd. Then, Victor spendt another 30 minutes showing our components that automatically generate Flex and Java code and a really useful reporting component that we call FlexBI.
Our presentation was well received: no standing ovations just applauds, but now I know that I should have done it differently. My main message was that using Flex 2 is easier (read less expensive) than similar development in Swing. The rich Internet application that I demoed, would have taken three times longer to do in Swing. But after the presentaiton one developer stopped by saying, “I can do everything you did in Java Swing”. I repeated again that it’s cheaper, but he was not too convinced. Then I realized that he’s looking not so much for business applications, but for a cool stuff. So I ran an application that connected to Flickr downloaded photos with a fancy scroller and zooming, and he was immediately impressed.

The bottom line: people are looking for a cool looking things. Next time I’ll start with 15 min foreplay showing flashy multi-media applications. And when the audience will be impressed, I’ll go down to the dry details like data binding XNL parsing and integration with Java.

The other person asked me if Flash is applicable for his heart research programs. I showed him a chart component that look similar to Google Finance, and he agreed that the same way he could display data points with some useful data about the heart.

Here’s another typical question: we are using a no-name framework and can produce similar screens. This was an easy one: there are lots and lots of semi-professional tools or frameworks, but Adobe Flex 2 ia a well designed and well documented plaftorm that offers the entire stack of solutions required by modern RIA.

Another thing I’ve noticed is a silent resistence hanging in the air: “I can do everything in Java”. Adobe technical evangelists will need to work hard to break this ice in the eyes of Java developers.

One more observation, Java developers are used to having  of large amounts of the boilerplate code generated for them by IDEs and other build automation tools. It’s hard to impress them with compact and elegant Flex samples. And, to be honest,  when it comes to real worl applicatoins, you still need to write code regardless of what programming language you are using.  My message “size matters – the smaller the better” was well recieved by other audiences, but this time it was like “So what?”.

In general, it was a well spent evening, and in three month I’ll repeat this presentation at Princeton JUG , but I’ll make it more Flashy as is required for all normal people such as Java developers.

Adobe is very strict about about certifying their instructors, and they have a special program called “Train the Trainer” after which you have to conduct a standup lesson to get certified.  After delivering a couple of more presentations like today’s , I’m planning to start a class called “Train Adobe Flex Evangelist”.

Comments (1)

 

Grey Line

Java on the desktop today

A discussion on the future of Java on desktop is going on right now at JavaLobby .
A anonymous poster (rba1988) asks the following question:

“I was just wondering what you people think of the future of Java standalone/desktop applications. What’re your opinions on this? Do you think people will continue developing pure Java applications that you won’t find on web pages but on the desktop. Or do you think that Java programming are really meant for applet development and not for application development?”

The readers of this respected online forum are actively participating in this discussion and, as usual they try to protect their ten year old pet called Java. Some say that Java is improving on the desktop and has good opportunities there. The reason is simple and prosaic: Java Swing puts bread on their tables. They do not want changes. They do not want to learn another language or tool. They can do everything with Java Swing.

C’mon guys, get real. IMO, Java Swing will slowly but surely go away: first, from the Web applications arena, and in several years from the desktop. Sun Microsystems has been treating Java on the desktop as Cinderella way too long. Now Sun is way behind. So who’s way ahead? Adobe with Flex 2 on the Web and Apollo on desktop and Microsoft with their WPF/E.

Swing is very very powerful tool, but it’s very expensive. I’m talking about real-world applications not mortgage calculators. You do not pay for a Java license, but you pay high salaries to people who develop in Swing. They write tons and tons of code. In addition to this, IDEs generate tons and tons of boilerplate code. Someone has to read and understand all this.

What about deployment? HelloWorld with one text field and a button won’t run on your PC unless you’ve installed the JRE that weighs 16MB (Sun is trying to make it lighgter for the Web ).

Yesterday, I was creating an application for my client in Flex 2 that runs in Flash Player 9. All of a sudden, some big shot came in and a quick demo was required. No, the big shot can’t stop by my desk and wants to see this Web application in action on his laptop in his office. No problem, because I was not using Swing. I was using Flex 2, so I copied a couple of files to a webapps directory under Tomcat, and emailed him the link. He clicked on the link, and a message “Flash Player 9 is required. Do you want to install it?” poped on his laptop, he pressed OK and 5 seconds later, he was working with my application, which was working with Java messaging feed on the server side. Do not trust me? Click on this link (it’s not my yesterday’s application but is similar to that) http://samples.faratasystems.com/porfolio/PortfolioRpcDemo.html

It should be up and running within seconds. By the way, this entire application including quote generation (random numbers by a POJO), charts, RSS read and links to Yahoo financial news is less than 300 lines of code.

Adobe or Microsoft?

The next question is, who is going to take a lead in the RIA area: Adobe or Microsoft? Let’s talk about penetration of new software. Do you know which OS I am using at work? Windows 2000 professional. Let me check my calendar…Yep, it’s 2006.
There is no other software in the world that has such a high penetration rate as Flash Player. As per Adobe within a year something like 80% of people upgrade Flash Player to newer version (the numbers might be slightly off). Within three months 50% of user will switch to Flash Player 9. Do you know which JRE version is used for most of the applications at my current client’s site? You got it, 1.4.2. It’s been two years after release of Java 1.5.

I bet on Flash GUI talking to Java on the server. Today you can create Flash applications using Adobe Flex,plain ActionScript coding or Open Laszlo. Next year, Adobe Apollo will let you create full featured desktop applications that integrate HTML, Flash, JavaScript and Acrobat aith a full access to your file system.

Competition: Microsoft WPF/E and C# combo. On the side note, Java Swing beats C# on the GUI side. My friend is working for a company that has decided to replace their Swing GUI with C# in their financial trading application. They can’t get the same performance they had before… Anyway, it won’t be easy for Microsoft to catch up with Adobe , but hey, it’s Microsoft. Gotta respect them.
AJAX won’t become a mainstream on the business applications landscape. It’ll find its limited use in consumer facing applications like Amazon, Yahoo, Google and major online retailers.

A happy Java ending
I love Java…one the server side where it belongs. Well, there is one more area for Java: mobile devices. More and more people believe that their cell phones are not just telephones that should be used for dialing phone numbers, but also cook breakfast in the morning. Java is a leader in the mobile space and I do not see any danger there. Flash Lite is way too young, and is making its first baby steps at this moment.

Comments (2)

 

Grey Line

Christophe Coenraets, a senior Flex Evangelist from Adobe has published a blog showing a number of sample Flex applications that communicate with Java on the server side. And yes, Christophe knows Java. His blog “30-minutes Flex test-drive for Java Developers” is a recommended read for Java developers and architects who are ready to consider anything else besides Java Swing or AJAX for creation of their Rich Internet Applications.

Also, there will be a couple of free Flex-for-Java presentations for software developers who work in New York City or in New Jersey:

On September 13, myself and Victor Rasputnis of Farata Systems will present at Java users group in New York City at Google’s offices. Register today if interested, there is only a hundred seats available on the first-come-first-serve basis.

On December 5, I’ll be presenting at Princeton JUG on the same subject.

Comments