OpenLaszlo 4.0.5 Released!

Last week saw the release of OpenLaszlo 4.0.5. That point release number may not sound terribly exciting, but this is actually a pretty significant new version.

Firstly, 4.0.5 is the first multi-runtime version of OpenLaszlo which is recommended for Flash-based deployment. That means that if you’ve been working on a 3.x release, you can stop now and upgrade.

DHTML compilation works of course, as it did before, but you may still run into issues. So if you’re developing an application that you plan to roll out in the next couple of months, the OpenLaszlo development team recommends you plan deploy to Flash.

The other exciting feature of OpenLaszlo 4.0.5 is explicit replicators. Until now, replication in OpenLaszlo has been implicit, meaning that to replicate a view you give it a datapath that matches more than one node:

<view name="row" datapath="ds:/root/nodes/">
<text datapath="@value" />
</view>

Implicit replication makes for terse demos, but it can be awkward in a couple of circumstances. Accessing the replication manager – the class that manages the replicated clones – is done via the token assigned to the original view (row). This has historically been very confusing for developers new to OpenLaszlo. Secondly, it’s tricky (and hacky) to force replication to happen if there is no data present at init time. This is typically true for data loaded over HTTP.

Both of these problems are addressed using explicit replication. The above example would instead be written as follows:

<replicator name="row" dataset="ds" xpath="root/nodes">
<view>
<text text="$path{'@value'}" />
</view>
</replicator>

OK, so there’s a couple more lines of code, but firstly you have a direct reference to the replicator (row), and you get exactly what you expect (the replicator). And the replicator is guaranteed to be there – regardless of how many nodes there are in the ds dataset.

It’s worth mentioning that one one of the main reasons replicators were added was to support Webtop 1.2 (which also came out last week).

Finally, there’s one more change that makes me very happy: OpenLaszlo 4.0.5 recommends using the old LZX Reference, and links to it. OpenLaszlo 4.0 introduced a new format for the document that LZX developers interact with the most. This new format had some serious problems: the index and categorization of classes was difficult to follow. Inherited properties were not displayed on reference pages. Many live examples were missing. Before I troll on too long, I should disclose that I am biased towards the old format, since I designed it. The new format is still in the package, but it’s listed as beta.

So if you’re working on OpenLaszlo 3.4, it’s time to switch to 4.0.5. Download here.

Naked AIR

In my last post, I talked about the reality of packaging OpenLaszlo applications into AIR applications. It is pretty exciting that you can successfully package OpenLaszlo apps and install them on a desktop, and have that application function – i.e. make HTTP requests, execute JavaScript and load media. However my first experiment (the OpenLaszlo Weather demo app) didn’t really delve into any AIR APIs, such as being a chromeless application or working offline.

The next logical step was to make a chromeless application. From an end-user’s perspective, that means the application is not wrapped in the operating system’s standard window. Packaging an application without chrome is actually quite easy with AIR. What’s tricky from an OpenLaszlo developer’s perspective is to supply close and minimize buttons and enable dragging. All these actions require the developer to call AIR APIs that are not available to OpenLaszlo today. They execute in a different version of JavaScript from that which is present in OpenLaszlo 4.0. So you can’t call them directly; you have to create a bridge to them. I chose the Flex 3beta1 environment as a bridge, although I think you could use Flash CS3 to create the simple interface that is needed.

Just to make sure that the application was not lame, I threw in a dataset and had it connect to an HTTP service, do some replication, and load some media.

Anyway, here is a screenshot of my application:

Chromeless Screenshot

The screenshot is not very exciting, because you don’t see the rest of my desktop, so I’d highly encourage you to download the chromeless OpenLaszlo AIR application pictured above and install it yourself. Note that you must have the AIR runtime installed to install and run my application.

OpenLaszlo… Into Thin AIR

I’ve been hearing a lot about Adobe AIR (Adobe Integrated Runtime; formerly known as Apollo), so I decided to give it a try.

“What!” you say, “Isn’t Adobe AIR a product that threatens OpenLaszlo – the lifeblood of the company (Laszlo Systems) you work for?”

Actually, no. It turns out that Adobe AIR plays quite nicely with OpenLaszlo. You can take an OpenLaszlo application, and compile it to a .air installer. Your application can continue to function, just like it did via a browser. Only now, instead of having to fire up a web browser, the user can start the OpenLaszlo application from their operating system. There’s no download time involved. Here’s a shot of the OpenLaszlo Weather application running on my desktop:

Screenshot of OpenLaszlo in AIR

Here’s the OpenLaszlo AIR installer for the OpenLaszlo Weather application. To install this application on your desktop, you’ll need to download and install the AIR runtime. Note that the installer is zipped for portability.
I’ll post more detailed steps on how to create your own OpenLaszlo AIR applications soon.