> > *1) The ButtonCell(DefaultAppearance.Resources) constructor can be > confusing, I think it should be dropped. > * > > I would prefer the option. Lets say you have a 2 styles of buttons. A blue > cancel button and a grey standard type button. With the current proposal, I > would be able to use button and just inject different styles into the class. > With your proposal, I have to extend button to be able to provide a > different style than the norm for my cancel button, and what is worse, is > that the style substitution is now buried in the .gwt.xml file. I'd much > rather do my programming in the code than in .gwt.xml files. I would > definitely like the ability to override styles without being forced to > extend the widget classes. >
I thinks there is a misunderstanding. My proposal is just to not provide the convenience constructor, so instead of: new ButtonCell(resources); You'd do: new ButtonCell(new DefaultAppearance(resources)); Making it crystal-clear that your ButtonCell is using DefaultAppearance. The convenience constructor leads you to believe you're using "resources" together with the Appearance you bound in the .gwt.xml -- which is not true: you are using DefaultAppearance no matter which <replace-with> you provided. > *3) Minor one-time style modifications are hard to make. > * > > Is that really necessary as ButtonWidget extends CellWidget which extends > Widget which gives you access to addStyleName and removeStyle name, making > it easy to add padding and margin around widgets without having to get all > Appearance.Resouce extendy. > Somehow I missed that... Which makes my point (4) kind of moot as pointed out by Stephen. 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). * > * > > Could/should we add javax.inject to the list of dependencies for GWT > allowing for DI on some of the components out of the box? > Interesting idea. -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
