Wednesday, August 21, 2013

Change css properties of a cssresource at runtime

Hi EveryBody!
I need some help in a particular situation using GWT CssResource.

I'm working on a project on which a d'ont have the right to change an existing CSS file without any gwt tag. This Css file defines background for some classes to refer an image URL. I'm using GWT CSSResource an ClientBundle to load all my image a compilation time. Is there a way to change at execution time the backgroung property defines in the CSS to gwt-image  to set image to my images define in ClientBundle?

Exemple : 

--------------------------------------------------------------------------------------------- CSS File
.styleButton {
background: url("image/button.png");
width: 630x;
height: 330px;
margin: 2px;
}

.otherStyle{
background: url("image/other.png");
width: 630px;
height: 360px;
margin: 2px;
}

----------------------------------------------------------------------------------------- CSS Resource
public interface MyCss extends CssResource {

String styleButton();

String otherStyle();

}

------------------------------------------------------------------------------------ Client Bundle
public static final VoltaireResource INSTANCE = GWT.create(VoltaireResource.class);

@Source("myCss.css")
MyCss  myCss();

@Source("button.png")
ImageResource buttonImage();

      @Source("other.png")
ImageResource otherImage();
}

I want to do something like this 
myCss.styleButton().setStyleProperty("gwt-image",  buttonImage().getUrl() )

Thanks

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment