2

I would like to obtain a CSS-like string from code and add it to the current widget style.

SmartGWT have a setStyleName attribute, which work with CSS present on the stylesheet only, but no set Style or anything similar I can think of. How can I achieve this?

javaNoober
  • 1,338
  • 2
  • 17
  • 43

1 Answers1

1

If I understand your question correctly, you should be able to use {widget}.getElement().getStyle() to obtain a com.google.gwt.dom.client.Style object that you can manipulate. But you need to give it individual “parsed” CSS properties.

If you just have a chunk of CSS as a string you can add it to your document with com.google.gwt.dom.user.StyleInjector, then add the needed classes to the widgets that need them.

bogdanb
  • 448
  • 3
  • 10
  • I'll have a look at StyleInjector, was hoping there was a way to do it directly with SmartGWT. They have methods to modify bg colors and stuff but nothing that would allow me to set a css radial gradient on runtime – javaNoober Dec 14 '11 at 21:42