On Wed, Aug 4, 2010 at 6:10 AM, Moocar <anthony.mar...@gmail.com> wrote:
> I'm trying to generate a bunch of ClientBundles with the associated
> images in the same directory. I can't figure out how to write the
> image files to the same directory as the java files generated with
> GeneratorContext.tryCreate(...).

UiBinder has approximately the same problem when it generates CSS
based on ui:style elements.  The solution to this is to use
ResourceGeneratorUtil.addNamedFile().  This allows you to map a
(temporary) file into the @Source namespace.  Usually you'd do
something like

File f = makeMyImageFile();
f.deleteOnExit();
ResourceGeneratorUtil.addNamedFile("/mycompany/image.png");

// In your generated source
@Source("/mycompany/image.png")
ImageResource resource();


http://google-web-toolkit.googlecode.com/svn/javadoc/2.0/com/google/gwt/resources/ext/ResourceGeneratorUtil.html#addNamedFile(java.lang.String,
java.io.File)

-- 
Bob Vawter
Google Web Toolkit Team

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to