Wednesday, June 29, 2011

FYI: Swimming Servers

It seems the servers are in the process of taking a swimming lesson at their data center, hopefully they are wearing their floating devices... The center is flooded and itself is down.

Anyway the forum/svn/website/issue tracker etc. are all down for now with no definite ETA, if this continues for too long we will try to setup a contingency plan for an alternate website to host all of the material (source/resource editor etc.). For now you can use for support (make sure to tag your questions as lwuit) as well as this blog.

Monday, June 20, 2011

Dropping Support For RIM JDE 4.7

Don't panic we still support devices all the way back to JDE 4.2, however 4.7 was a special case. RIM created version 4.7 for the initial Storm device and added touch support there in an incompatible way (which is why we have a separate build for that platform). A few years ago RIM issued an update for Storm and moved all of the 4.7 users to 5.0 OS.
So if you are using a blackberry device you either have a non-touch device that might still be using OS 4.6 or older or you might have a touch device which is probably using 5.0 or newer. So 4.7 is redundant except for the fact that up until now it was our recommended JDE platform for touch devices.
This version of the JDE will no longer work with the touch port and you will need the 5.0 JDE going forward, this will allow us to use some of the new API's available in 5.0 when targeting newer devices and still keep support for older none-touch devices.

Wednesday, June 15, 2011

LWUIT's New Layout Animation Facility

I'd like to create some more demo animations and some additional animation utilities like this one and I probably will as soon as I get some time.

While the animations in this video might seem elaborate, they are really simple to achieve and work great even on feature phones. All that is really needed is one LWUIT method: Container.animateLayout(int)

To understand this I'll just explain a couple of things about LWUIT components, when we add a component to a container its generally just added but not positioned anywhere. A novice might notice the setX/Y/Width/Height methods on a component and just try to position it absolutely.
This won't work since these methods are meant for the layout manager which it implicitly invoked when a form is shown (internally in LWUIT) and the layout manager uses these methods to position the components as it sees fit.
However, if you add components to LWUIT on your own it is your responsibility to invoke revalidate (or layoutContainer) to arrange the newly added components. LWUIT doesn't "reflow" implicitly since that would be hugely expensive, imagine doing the layout calculations for every component added to the container the cost would be closer to a factorial of the original cost of adding a component.

The animateLayout() is simply a fancy form of revalidate. After changing the layout when you invoke this method it will animation the components to their new sizes and positions seamlessly.

The first example in the tipster demo shows an "interlace" effect where the components each slide from a separate direction into the screen.  This is the code I used before showing the form:

        for(int iter = 0 ; iter < c.getComponentCount() ; iter++) {
            Component current = c.getComponentAt(iter);
            if(iter % 2 == 0) {
            } else {

Lets go over this line by line:

I make sure the layout is valid so I can start from the correct component positions.

            if(iter % 2 == 0) {
            } else {
I manually position every component outside of the screen, if they are odd I place them to the right and if they are even I place them to the left.

I mark the UI as needing layout. This is crucial since I validated the UI earlier (by calling revalidate). Changing the X/Y/Width/Height doesn't trigger a validation! LWUIT doesn't know I made that change!
By calling setShouldCalcPreferredSize I'm explicitly telling LWUIT that I changed something in the UI and I want it to validate, normally this method is implicitly invoked by LWUIT.

Perform the animation over the length of a second, this might seem like much but the animation starts before the form entry transition so it isn't that much.

The other animations are even simpler than this one and all follow the same basic rules, place the components wherever you want either manually (or by changing the layout) and use animateLayout() to automatically rearrange them to the new position.

BTW we fully intended to have a new LWUIT release by now but its getting delayed due to the typical bureaucratic nonsense that is an unavoidable reality within a large corporation. We apologize it is taking so long and even more so that we do not have an ETA. Those of you following the SVN know we already have everything ready for 1.5.

Thursday, June 9, 2011

Interesting Couple Of Weeks

This post isn't about LWUIT, its about Java on the desktop and its current direction. Microsoft just introduced Windows 8, for those of you who haven't been following here is the gist:
Run's on Arm (as well as Intel obviously), Completely new touch/gesture based UI, less emphasis on Windows.

Apple also introduced Tiger (next Mac OS X), which also focuses more on full screen applications as well as eliminates the scrollbar... Mac OS X will now scroll like the iPhone and hide the scrollbar when it isn't used.
Rumors are also abundant about Apple's laptop line moving to Arm chips which they can easily do since they have a fat binary .app directory structure (which MS doesn't have).

To me these things signal a massive UI convergence trend where the mobile UI takes the lead. Up until now mobile UI's were influenced by desktop paradigms and now we finally see the reverse coming on in full force.

Where does this leave Java developers?

Swing hasn't been moving forward for quite a while now & Java FX isn't even in production and already it seems behind the curve on these sort of features. I'd love to say that LWUIT can take over but right now we still don't have many of the features necessary to write full scale desktop apps...
However, I would say that this is a great time to be a mobile developer since an upheaval is on its way and it seems that we are leading the pack.

This sort of convergence also means a huge migration to the cloud, when using multiple mobile devices its just impossible to sync them in any other way. Even those reluctant about privacy and security would probably shift to the cloud to remain competitive.

Monday, June 6, 2011

LWUIT Timeline Tutorial Video Part One

This one required tremendous amounts of work to make and I still didn't finish. Since its quite a long video I have some doubts on whether people will have the energy to watch it all the way through and follow up to part two.
This actually goes most of the way in creating the theme for the t-zone demo (which is now in the LWUIT SVN), if I do the second part it will continue from where I left off all the way to creating the actual code backing this.

BTW I uploaded a new binary of the resource editor today, this new version includes theme templates based both on this theme and on the Tipster demo theme. Check them out and please improve your UI designs accordingly ;-)

Wednesday, June 1, 2011

Martin Is On Fire: New LWUIT Tipster Demo

Martin (our designer) has finally come through with two professionally designed demos in a row, showing off the difference a proper designer makes when building such applications. He cranked the designs for these ridiculously fast and once I had the designs in place it reduced allot of the doubt of designing. Overall I got the design yesterday morning and now the video is on youtube... I will commit the code to SVN in a few hours (hopefully).
I already committed the code for Martin's previous t-zone demo which I've been showing around a bit and getting allot of surprised reactions from people. It just goes to show you how far the effect of a good UI designer can take your UI regardless of the technology you are using.

We are trying to get a release up to speed so I don't have the time to do the tutorials but I would like to get detailed step by step "how to" tutorials explaining exactly how I implemented both applications.