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.

No comments:

Post a Comment