GWTP (Java): Apply CSS style on div element -
i using gwtp , trying include boxcontainer
style in div element. however, not working. seems css not link? ideas? thanks
resources/thumbnail.css
.boxcontainer { width:100%; height:900px; border:0px solid #000; padding-top:20px; padding-bottom:5px; padding-right:15px; padding-left:15px; margin: 0px auto -1px auto; background: #000000; }
thumbnail.ui.xml (html template)
<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.gw.aaaa.client.presenter.dashboard.thumbnailresources"/> <div ui:field='container' class="{res.style.boxcontainer}"></div> </ui:uibinder>
thumbnailresources.java
public interface thumbnailresources extends clientbundle { public static final thumbnailresources instance = gwt.create(thumbnailresources.class); @source("resources/thumbnail.css") thumbnailstyle style(); }
thumbnailstyle.java
public interface thumbnailstyle extends cssresource { string boxcontainer(); }
you need inject styles in order referenced. use:
thumbnailresources.instance.style().ensureinjected();
only when using <ui:style>
generated cssresource
automatically injected. <ui:with>
referencing external cssresource
, need take care inject (and of course instantiate relative clientbundle
did).
Comments
Post a Comment