On Thursday, February 10, 2011 11:26:34 PM UTC+1, Nick Apperley wrote: > > I am interested in finding out how people do CSS styling with GWT. > After making an attempt to go though the Client Bundle route CSS is > not being applied to all the UI Binder templates. Google have > deprecated the method of referring to CSS via the link tag in a HTML > page. Previously I used this method for CSS styling which works, but > decided to go with the recommended way (current practice) to do CSS > styling in GWT. > > What is puzzling with UI Binder is that all the GWT widgets don't have > a natural mapping to CSS with properties like class and id. In other > words one cannot style the widgets without adding a style via a method > call. Surely there is a more straightforward way to do this.
You can use styleName="" in your ui.xml as an equivalent to setStyleName (bean-like setter, like all other attributes), and there's a special addStyleNames="" attribute too, taking a space- or comma-separated list of style names (and will generate code that calls addStyleName with each value) See "Use in UiBinder Templates" in the javadoc http://google-web-toolkit.googlecode.com/svn/javadoc/2.1/com/google/gwt/user/client/ui/UIObject.html > The id > property does exist but conflicts with the ui:field property which > isn't ideal when you need to customize a widget in a Java class. It > seems as though id is the same as ui:field. > Styling using an #id has no advantage over using a .className, and is very fragile in code (it's too easy to add a widget twice and break the ID uniqueness). > All documentation on Client Bundle is not entirely clear on how it > maps to classes and ids in CSS. -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
