Thanks for the answer, I will try your example. I'm a little afraid to upgrade to gwt 2.0, because I have a lot of pages developed with 1.7 ... and the idea of rewrite a lot of code now...
Cheers Ale On Jan 8, 3:06 pm, DaveC <[email protected]> wrote: > I use ClientBundle (and CssResource) (I'm using GWT 2 by the way...) > e.g. > > public interface RichToolTipClientBundle extends ClientBundle { > > @Source("resources/css/rich-tooltip.css") > public RichToolTipCssResource getCss(); > > @Source("resources/img/logo.png") > public ImageResource getLogo(); > > @Source("resources/img/tooltip-top-left.png") > @ImageOptions(repeatStyle = RepeatStyle.None) > public ImageResource tooltipTopLeft(); > > public interface RichToolTipCssResource extends CssResource { > > @ClassName("tooltip") > String getToolTipStyleName(); > > } > > } > > public class RichToolTipResources { > > private static RichToolTipClientBundle INSTANCE; > > public static final RichToolTipClientBundle getBundle() { > > if (INSTANCE == null) { > > INSTANCE = GWT.create(RichToolTipClientBundle.class); > > INSTANCE.getCss().ensureInjected(); > > // or StyleInjector.inject(INSTANCE.getCss().getText(), > true); > } > return INSTANCE; > } > > } > > In your css... > > @sprite .tooltip { > gwt-image: 'tooltipTopLeft'; > > } > > then: > > public ToolTip extends Composite { > > // injects the css... > private RichToolTipClientBundle resources = > RichToolTipResources.getBundle(); > > public ToolTip() { > FlowPanel panel = new FlowPanel(); > initWidget(panel); > addStyleName(resources.getCss().getToolTipStyleName()); > > Image img = new Image(resources.getLogo()); > panel.add(img); > } > > } > > Using these methods makes use of the GWT compiler and all it clever > optimisation such as inlining the images using data-uris when > supported... which help make the page load faster. > > Hope this helps, > > Cheers, > Dave > > On Jan 8, 9:03 am, ale <[email protected]> wrote: > > > > > Hi, > > I can not decide where put some image in a application, image like > > logo, icon for button, ecc. > > > Is better put it in css or use the ImageBundle and > > AbstractImagePrototype? > > > I prefer the solution that make the load of the page faster. > > > Thanks! > > > Bye > > Alessandro
-- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
