gwt - ui:with, style not showing up -
i share css across multiple widgets using .
i can see css class name obfuscated class definition not showing when inspect element in firefox / chrome. here're codes. can suggest missing? thanks.
style.css
.namespan { color: #3e6d8e; background-color: #e0eaf1;}
resources.java
public interface resources extends clientbundle { @source("style.css") style style(); public interface style extends cssresource { string namespan(); } }
uibinder.ui.xml
<ui:uibinder xmlns:ui='urn:ui:com.google.gwt.uibinder' xmlns:g='urn:import:com.google.gwt.user.client.ui'> <ui:with field='res' type='com.my.app.widgets.logoname.resources'/> <g:htmlpanel> <div> hello there <g:inlinelabel ui:field='namespan' stylename="res.style.namespan">kevin</g:inlinelabel> </div> </g:htmlpanel> </ui:uibinder>
uibinder.class
public class uibinder extends composite { private static uibinderuibinder uibinder = gwt.create(uibinderuibinder.class); interface uibinderuibinder extends uibinder<widget, uibinder> {} @uifield(provided = true) final resources res; // style doesn't show no matter provided=true declared or not. public uibinder(resources res) { res = gwt.create(resources.class); initwidget(uibinder.createandbindui(this)); }
you have use res.style().ensureinjected()
Comments
Post a Comment