Tuesday, July 28, 2009

I Found A Bug In LWUIT

Submitting issues to LWUIT is pretty easy but we still get a flood of duplicates and questions in the mailing list so I would like to just clarify this "how to" to hopefully improve the signal to noise ration of LWUIT.

First off there is a public issue tracker available for all to search, vote and submit at https://lwuit.dev.java.net/issues/ please use it to make sure the issue you have wasn't reported. If you think you found an issue in LWUIT follow these steps to submit:

  1. Make sure the issue was not reported, use Google search with the word LWUIT and a description of the issue, this often finds relevant discussions.
    Make sure to include relevant discussions with your post so we have an indication that you followed this step, this means we will treat your issue as more thoroughly researched.
  2. Make sure the issue occurs in current SVN, we don't accept issues for older versions of LWUIT.
  3. Reproduce the issue with minimal code, the more code we need to debug the longer it will take to resolve. If you can trace the issue yourself by going into LWUIT's code this would be even faster.
  4. If there is a stack trace related to the issue make sure to include it.
  5. Produce screenshots or even a video of the issue, I find tools like Jing to be very helpful. Its also very useful since it can annotate the issue and provide us a visual explanation even if your English isn't the very best.
  6. Apply for an Observer role for the lwuit project, you need to create a user at java.net and then request a project Observer role. I repeat *Observer* all other role requests are automatically denied and the constant developer requests are just plain annoying... Observer seriously... Just read the introduction at lwuit incubator if you want to contribute.
  7. Submit your issues and use the attachment feature to attach screenshots, video explanations (not too big), concise source examples etc.
    Don't submit too much information either, try to be concise and visual so we can understand your issue properly.

FYI the gradient colors are unrelated to LWUIT and relate mostly to the number of colors supported by the device...

Thursday, July 23, 2009

iFeud - The Dangers Of Mobile Application Development

The Daily Show With Jon StewartMon - Thurs 11p / 10c
Daily Show
Full Episodes
Political HumorJoke of the Day
Normally I try to keep this blog focused on LWUIT, but this daily show segment about the fart application legal battle is just hilarious.
Future LWUIT fart application developers should probably watch this video with interest ;-)

Sunday, July 19, 2009

Book Club

Biswajit, who I mentioned in this blog before as the author of java.net articles has been writing a LWUIT book for quite some time, this effort is finally turning into a product.

Both Chen and myself are thrilled to see this book coming out, I would love to have a copy but I'm also concerned I will read the descriptions and inadvertently "quote" when writing about LWUIT myself.

This is the first LWUIT book coming out, we are aware of at least one other book coming out at some point in the future (neither book is authored/co-authored by Chen or myself).

Hopefully Biswajit's book will sell well, prompting more LWUIT books in the future...

Roy Ben Hayuns office is right across the hall from us at Sun's SIDC offices. There is probably no one who knows more about Symbian/Java than Roy.
This book came out a while ago but I was just waiting for a "books" post to post about it.

Symbian as a platform has many issues and abilities, unlike most native platforms Symbian allows you to do almost everything from within Java and that gives you a huge edge when targeting leading mobile smartphones.

Wednesday, July 15, 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...

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:

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.