UiBinder differences between styleName and addStyleNames

1,906 views
Skip to first unread message

djd

unread,
Nov 23, 2009, 9:25:16 AM11/23/09
to Google Web Toolkit
Hi,
I have discovered that UiBinderGenerator has a (quite) strange
behavior while setting/adding Css styles.
Here is an example:

<ui:UiBinder
xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui' >

<ui:style type="com.app.client.LogoDisplay.MyStyle"
src="LogoDisplay.css" />
<g:VerticalPanel styleName="{style.basic}"
addStyleNames="{style.common}"/>
</ui:UiBinder>

In LogoDisplay.css I obviously have the two styles (.basic
and .common). I also declared a custom CssResource (in LogoDisplay)
that binds with that Css file. The weird thing is styleName is
actually invoked using a setter (setStyleName) while addStyleNames are
invoked repeteadly using addStyleName, so it virtually same thing, but
the last style is not added (.common). I have also tried to use
addStyleNames="common" but it seems that I don't have the Css file
injected (and I would need to manually do that) and this does not work
either.

Can you help me? I'm sorry if the answer is extremely trivial, but I
was unable to find a solution for this problem (adding 2 or more
styles on a widget) - preferably I don't want to inject the Css (I
plan to have a lot of Css files, I don't want to inject all of them).

djd

unread,
Nov 24, 2009, 6:09:59 PM11/24/09
to Google Web Toolkit
Nobody has ANY idea? Any input would be greatly appreciated

uwfrog

unread,
Nov 24, 2009, 11:52:11 PM11/24/09
to Google Web Toolkit
try this:

<ui:style type="com.app.client.LogoDisplay.MyStyle"
                src="LogoDisplay.css" />
<g:VerticalPanel styleName="{style.basic} {style.common}"/>

Hope it helps.
Reply all
Reply to author
Forward
0 new messages