Thursday, July 16, 2009

LWUIT 1.2 Released Further Details

Chen announced yesterday the LWUIT 1.2 release on the mailing list/forum, I'll try to go into further details on the announcements highlights regarding whats new. This is mostly targeted at people who don't follow SVN closely:

  • New Styling concept - first announced here, this new feature revolutionizes the way LWUIT treats styles. Rather than have a single style object per component we can have 2 or more styles and the component can replace them in runtime based on state (this is very similar to CSS e.g. hover selector).
    All components now have a selected/unselected style to represent focus, this essentially deprecates fg/bgSelection attributes instead allowing you to customize every style attribute for selection state (e.g. bgImage, transparency, border etc.).
  • New LWUIT Designer (formerly Resource Editor) - I've spent allot of time working on this particular feature, one of the coolest things is that if you have Java 6 installed you will see an orange button here & you can just click it to launch the LWUIT Designer using Java Web Start.
    The LWUIT designer supports the new styles concept allowing your designer far greater power in determining the theme for LWUIT applications. We also updated the resource file format (more on that later) which allows us to export the resource file into an Ant task structure (frequently requested feature that was previously impossible).
    We also offer lots of great usability features such as Copy & Paste for theme entries, simpler image border editing, easier to use preview etc.
  • Support for setUIID - this was technically impossible in previous releases of LWUIT but newer changes allowed Chen to implement this revolutionary feature. You can now easily make TextArea or button have a label style rather than start manipulating borders, this works better with the theming support as well.
  • Background Painter Features - Style now includes more elaborate image scaling, tiling, centering as well as gradient backgrounds (Radial, Linear etc.). These are supported by the LWUIT designer and by the standard LWUIT background painter, allowing a designer more power without code changes.
    This also allows reducing resource sizes since no images are required for some very elaborate themes! E.g. the theme created here is 7kb with the bitmap font and 622 BYTES without it!
  • Scrolling in LWUIT with components greater than screen size has always been a problem, this is now fixed in with a rather complex recursive algorithm. This is still not the non-focus based scrolling we would expect in the future but it does simplify some common use cases.
  • SVGImage is now deprecated, instead we can integrate SVG's directly into LWUIT via the SVGImplementionFactory by calling SVGImplementionFactory.init() before the first Display.init() call.
    This would allow Image.createSVG to "just work" on devices with JSR 226 support. Since the SVG related code is entirely within the SVGImplementation it wouldn't appear in versions of LWUIT that don't include the SVGImplementionFactory.
    We intend to offer full SVG support in the LWUIT Designer soon, this will also allow fallback images so devices without SVG support will see an "auto generated" PNG file.
  • Fonts have been rewritten to include more information in the resource file and allow us to load a font by name. This will allow truetype fonts when supported by the native platform e.g. in MIDP 3 or JSR 287.
  • The Ant task used to create theme now uses the same code base as the LWUIT designer and follows a somewhat modified syntax. I'll try to blog about this more in the future, the advantage is that we would be able to track changes more easily to both.
    This allowed us to find quite a few bugs in both tools so its a great feature at that.
  • New Calendar component is redesigned to use component/container hierarchy rather than custom painting. This solved allow of issues we had with the calendar such as proper touch phone support.
  • The LWUIT distribution includes a PDF with a specification of the resource file format used by the LWUIT Designer/ant task.
    This is an important step in formalizing the file for future versions and for corporate uses that might need such information. We are considering the option of providing a desktop based resource file generation API, I will hopefully post about this in the future soliciting feedback.

Besides the above LWUIT looks & feels better and faster than ever with every version, we shrunk code size in some use cases and try to provide more power to developers. The full list of changes is too big to mention e.g. one of the last things to make it into the release was the often requested "minimize" feature...

Wednesday, July 15, 2009

LWUIT Designer Help & Tutorial

This post serves as a destination for LWUIT Designer help and reference, it will be updated with additional videos and clarifications as time goes by. Feel free to use the comments to ask for specific clarifications regarding the tool and its usage, we will try to fill up this post with more text and explanations as time goes by.

Bellow you can see a new HD tutorial for some of the features in the current tool.

Monday, July 13, 2009

Controling Selectors

LWUIT has much simpler style selectors than CSS mostly for simplicity, normally they are enough for the common use cases. However, we sometimes want provide more specific styles for some components.
Up until now LWUIT's only solution here was to derive the component and override getUIID(), this requirement is practically from the very beginning it it was high time to replace it. Chen recently committed a setUIID(String) method that allows us great customization power without creating too many small classes just to change UIID. (Adding the set UIID method was much harder than you would expect since it required changing style behavior to lazy rather than eager instantiation which was not technically possible in older versions of LWUIT).

Yesterday I needed to do a multi-line label so I used our common approach of using a TextArea and removing the border... Then I thought... Why?
I just used:
multilineLabel.setUIID("Label");

Which would allow it to work perfectly with themeing and live theme changes... While the upcoming drop would certainly include some amazing features... setUIID is probably a killer feature for this release.

Tuesday, July 7, 2009

Redesign Your Resources

Allot has changed in the LWUIT Designer in the last few months, the changes might not be immediately obvious in the new drop at first glance but those who have been using the tool for quite a while should look forward to one of the strongest releases yet.
A public beta of the LWUIT Designer now be tested via Java Web Start by clicking here, we intend to update the JWS version more regularly than we do the LWUIT released in the future. This in itself is a huge improvement since it will allow the LWUIT designer to track current LWUIT development closely.

So what is new? Too much to mention but I'll try to give out some highlights.

We now have a new resource file format (which is documented within our drops docs directory), this will require modification to existing resource files and recreation of fonts however the benefits are huge!

  • Export to Ant script - includes generating the files representing the entries within the resource file. This was often requested, however impossible with the previous file format.
  • The code of the Ant task (ResourceBuilder) is now unified with the resource editor increasing portability and reducing potential bugs in both. In fact we found quite a few bugs in both as a result...
  • When adding images to the resource editor they won't be reencoded as PNG anymore, this will allow you to shrink your images with existing tools or even use JPEG's.
  • A major animation bug was fixed, this should now reduce the size of animated GIF's considerably (they should be added again to see the difference).
  • The Selected/Unselected/Pressed styles allow simplified and far more powerful themeing of LWUIT code.
  • Gradient background support allows for very powerful UI's without much overhead.
  • Memory overhead estimate provides some ballpark figure regarding the amount of RAM a given theme should occupy for the current screen.
  • Fonts are now far more elaborate and easier to manipulate. They should work better on additional platforms as well and you can disable bitmap fonts on a specific platform by using a boolean flag in Font.
  • Image alignment and background type behavior allow further background customization.

For the next drop we plan to add SVG support that will allow keeping a bitmap fallback for every image thus provide full portability for devices with weak/problematic SVG support with a single binary.

Monday, June 29, 2009

Chat Demo Source Code Now Live

Despite working hard on a new drop I found a couple of minutes to publish the code from JavaOne into the LWUIT incubator. The code is in the SVN there and you can just check it out from SVN using your standard java.net user name and password.

This code demonstrates several things which I hope to get into more in future posts if I have the time... However for now check out the presentation that Chen and myself gave at JavaOne, slightly modified in terms of themes.

Wednesday, June 24, 2009

BiDi In LWUIT The Full Story

Ofir just published the full details and a video of bidi in LWUIT.
Head over to his post to read all the fine details in his post covering the subject.
And thanks again to Telmap for this often requested contribution.

Tuesday, June 23, 2009

Talk With LWUIT - Our JavaOne Demo

Our JavaOne demo is now finally up on youtube in the video to your right. You can also try the live version by going with your phone to http://lwuitchat.appspot.com/ however the demo might not work for all devices since we have some network related bugs we just can't track down.

I will try to publish the source code some time next week to allow you to review how exactly we did that. We would also like to place the slides for the presentation so you guys can follow the path of the application creation outlined in the presentation...

In other news we attended the local Java tech day the other day where Ofir Leitner had a cool demo for the Java tech day of the bidi stuff he has developed sponsored by Telmap. He showed off lots of things so I will try not to "steal" his announcement, the cool thing is that Telmap is contributing the code back to LWUIT and we will integrate it as part of LWUIT.