6

I have the need to apply many separated CSS classes into 1 element in UiBinder in GWT, but don't know how to do it.

In my TestView.ui.xml, i have

<g:Button  text="Log Out"  ui:field="logoutButton" addStyleNames="{style.gwt-Button}" addStyleNames="{style.paddedRight}" />

but it generated run-time error.

Then I tried

<g:Button  text="Log Out"  ui:field="logoutButton" addStyleNames="{style.gwt-Button style.paddedRight}" />

This time I got compile time error.

So, How to addStyleNames "Multiple css classes" into 1 element in UiBinder in GWT?

No info found on internet.

Tum
  • 3,614
  • 5
  • 38
  • 63

2 Answers2

14

I Think you have to specify each style name in addStyleNames property in a separate bracket pair.

Something like this:

<g:Button  text="Log Out"  ui:field="logoutButton" addStyleNames="{style.gwt-Button} {style.paddedRight}" />
zaerymoghaddam
  • 3,037
  • 1
  • 27
  • 33
0

The docs example here uses single inverted commas.

<g:PushButton addStyleNames='{style.pretty} {style.hot}'>Push my hot button!</g:PushButton> 

Double inverted commas don't work in my app (GWT 2.6)

timmacp
  • 191
  • 1
  • 13