On Sat, Feb 26, 2011 at 4:35 PM, Jeff Larsen <larse...@gmail.com> wrote: > > Sorry, that is far better, but there still is a problem. With that way of > doing things is then you've lost your ability to use the .gwt.xml file to > swap out the Appearance as you're now using a new instead of a GWT.create.
There are still two constructors: - The default (empty) constructor uses GWT.create() - A constructor accepting an Appearance. This appearance can be instantiate with new, if you want to inject a Resources manually, or with GWT.create if you're happy with the Appearance's default resource. > Now, addStyleName is very limited since you can only style the wrapping > <div>. It's good enough to add blank padding, but it wont let you make the > internal part of the button wider or taller... Unless you use CSS type > selectors but, as Stephen points out, this makes the app dependent on a > specific widget style, and the app breaks as soon as this widget DOM > structure changes. (So you can't easily upgrade to newer styles.) > In fact, I almost wish CellWidgets did not have a addStyleName given that > it's really not that useful. I would rather have a slightly richer set of > semantic styling methods in Appearance and having ways to access them from > ButtonWidget (and UiBinder). > > All true, I guess if I'm looking to alter the height/width of a cell > widget's internals or its internal structure I would expect to extend the > bundle. If I'm just looking to do things like set the float, padding/margine > addStyleName is the perfect tool. Maybe there is a better way for dealing > with boilerplate code, maybe with UiBinder as the hook. I'm not sure I'm > still a little foggy on the best practices when dealing with CssResources > especially with UiBinder. > Another option would be an enhancement GEP to make it codegen that > boilerplate for you. Admittedly it doesn't get rid of the code smell, but it > does save your fingers some work. Ok, I think we're on the same page... I guess what I'd like is the ability to both add semantic styling methods to Appearance (a-la setFlatLeft, setFlatRight, setInnerWidth...) and to access these methods from UiBinder. (Also: GEP?) -- http://groups.google.com/group/Google-Web-Toolkit-Contributors