add class name to element in uibinder xml file
Asked Answered
I

2

18

The following replaces any current css class names. It appears to call setStyleName.

<g:DecoratorPanel styleName="{style.myCssClass}">

What I really want to do is add a class name, like calling addStyleName.

Is it possible to do what I'm attempting?

Irritated answered 14/12, 2009 at 5:1 Comment(0)
M
29

Use addStyleNames in such situations, like this:

<g:DecoratorPanel addStyleNames="{style.myCssClass}">

It's a little trick I picked up on the GWT's Google Group - too bad it's not (?) mentioned in the official documentation.

PS: I'm actually missing a really comprehensive documentation for UiBinder. I grepped the GWT sources for addStyleNames and found this file: WidgetBasedUi.ui.xml - it seems to contain some interesting use cases for UiBinder, including the one with addStyleNames.
If someone knows any other good/secret references for UiBinder, please share :)

Michiko answered 16/12, 2009 at 12:31 Comment(2)
I was close. I tried that, but missed the pluralization of the function name(addStyleName instead of addStyleNames).Irritated
The documentation at code.google.com/webtoolkit/doc/latest/… is fairly complete, and mentions the attribute. It is however more of a guide than a reference manual.Leprosy
C
3

Yes addStyleNames is the solution. And it is actually mentioned in the documentation: UiObject. See section "Use in UiBinder Templates".

Caius answered 12/1, 2010 at 21:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.