Wednesday, June 24, 2009

LWUIT RTL support announced at Java Tech Day



Last Monday in the Sun Java Tech Day 2009 (A mini-JavaOne held in Israel) I announced together with the LWUIT team the new support for RTL (Right-to-Left) languages in LWUIT.

LWUIT is a UI toolkit from Sun for the JavaME platform. JavaME suffered for quite a while from lack of a reasonable UI framework. The basic components it provides are well... very basic... And also not very portable across devices, which made developers to adopt other solutions such as developing their own UI frameworks internally or use other frameworks such as J2ME Polish.

And then came LWUIT which was announced a year ago in the JavaOne conference. It offers an entirely different mobile coding experience, and gives developers complete control over the UI. In fact it is resembles Swing a lot and gives the mobile developer tools which he/she never dreamt of... (except nightmares...)

Moreover, it is open sourced, and unlike other JavaME UI solutions it is free to use for any purpose, including commercial. And let's not forget one more fact that seperates it from other solutions, it is not a 3rd party add-on, it comes from the "source" itself, the developer of the JavaME platform, Sun.

I have been engaged with LWUIT for the past year in my capacity as a consultant - helping companies figuring out if it's worth migrating to, building a UI architectures over LWUIT, designing it and even "getting my hands dirty" sometimes and coding... I have to say that my experience shows that this is a truly robust framework, and a real breakthrough for the JavaME world. Like everything else it has its issues and bugs, but overall it is definitely what we all needed a long time ago...

One of the things LWUIT was missing was proper support for right-to-left languages such as Hebrew and Arabic. This of course doesn't bother everyone, but here in our local market in Israel, it is certainly something the LWUIT team was asked about.

So, Telmap, a mobile mapping and navigation company, which is one of my clients picked up the glove, and sponsosred a full project for adding RTL support to LWUIT. The project was done by myself and after a few months of work - it is here, and will be contributed back to the LWUIT community later this year.

The support is full and thorough and includes the following:

* Components - All the basic components LWUIT offers (Label, Button, RadioButton, CheckBox, ComboBox, TextArea etc.) support the RTL mode and are rendered accodinglty (i.e. in checkbox the box would be to the right of the text).

* Padding/Margin/Alignement reversal - A main concept of the solution is enabling seamless and easy "porting" of an English/LTR application to a Hebrew/RTL one. So, when the RTL flag is turned on, LEFT becomes RIGHT and vice versa. Why? Because if you had an app with a list of bullets that had a left padding of 10 pixels, it would make sense that the hebrew version of this app will feature these bullets in the right side of the screen, and with a padding of 10 from the *right* side and not left padding. So instead of having to provide different values to your English and Hebrew version, everything is reversed and transparent to the developer.

* Layouts - All layouts support RTL and components added are added from right to left when applicable. For example in a horizontal BoxLayout everything will be aligned to the right, in a GridLayout of 3x3, the first component you add will be in the top right, the second one in the top-middle, third in the top-left and so on. This of course includes right-to-left focus traversal. BTW - In BorderLayout WEST becomes EAST and vice versa.

* Bitmap Fonts - One of the problems when using RTL languages, is what happens when it is mixed together with LTR text and/or numbers, the text direction of each segment can be different, which makes things difficult. When drawing such mixed text in system fonts, usually the handsets marketed in the relevant markets already support a bidirectional (BiDi) algorithm that fixes this, but for bitmap fonts, we have to do it on our own - so a BiDi algorithm was added and is applied when a special flag in LookAndFeel is activated.

* Text input - TextField also supports bidirectional text input, including placing the cursor where it should be (Not very easy in mixed LTR/RTL texts...).

* Horizontal List - Supports now RTL in all of its modes, all items are added from right to left.

* Misc - A lot of other behaviours were modified when the RTL flag is turned on, such as reversing the ticker direction in Labels, reversing the horizontal slide direction, the vertical scrollbar is always on the left side etc.

That's about it, I'll update here when the code is officially contributed back to the LWUIT source base and can be downloaded. For other LWUIT updates check Shai's LWUIT blog and to download it and start working you can go to LWUIT's homepage or simply download the new JavaME SDK 3.0 which includes LWUIT.

Sunday, June 7, 2009

The power of MobileMonday

Back a year ago, we had our first MobileMonday Tel Aviv event. If you're in the mobile business you probably know what MobileMonday (MoMo) is, but in case you have been living in a cave, it's an international non-profit organization that has presence in 70+ cities around the world. The main activity of MoMo is holding monthly events in Mondays, the events usually include sessions on a certain theme inside the mobile world, and a lot of networking.

It has been around since 2000 in Finland where it originated from but became a worldwide phenomenon starting at 2004 and it is still growing rapidly these days.

I saw MoMo events while I was travelling in Europe and the US and thought to myself that this is something we simply have to import to Israel, which is not only rich in web 2.0 startups, but also in mobile startups, as well as several mobile "Giants" such as Comverse and Amdocs. Also, you can hear so much Hebrew at the Mobile World Congress in Barcelona, that it should be titled as an official congress language...

And the funny thing is, I used to meet my Israeli colleagues from the mobile space - in Barcelona... There was simply no other format for us to meet here... So I decided to act up and after receiving the Finnish MoMo's blessing, I started forming MobileMonday Tel Aviv. It snowballed quite fast: My call for volunteers to join the organizing team was answered with some great people - and after we had a team, I went on to recruit sponsors - which also proved as quite an easy task. Some already heard of MoMo, others didn't hear but liked the idea - and then we had a liftoff...

Since then we had already 9 successful events, most with around 120-150 attendees, and tomorrow we celebrate our first anniversary and tenth event.

Another important thing is that I got to know some great people, founders and organizers of other MoMo chapters around the world. The MoMo community is very diverse, people joined this family each for his own reason, and managing it each with their own style - but in the end we all have in common enthusiasm for everything mobile, for people and events and also for staying connected both in the local and global levels.

This community is a great driver of the industry, and I am very glad to be a part of it, so if you're in town - come and celebrate with us (event details). Long live MobileMonday!