It is easily achievable. The trick to remember - GWT loads images from the
classpath. So here's how the system would work -

Module A would contain the interfaces MyCss1, MyCss2 *AND* the interface
MyImages. It would also contain the actual image MyPic.png, it could be an
empty or default image for all you care. *BUT* when you are creating
moduleA.jar, *do not* include the actual image MyPic.png in it.

Module B, which is your image provider, will just export a jar file
containing the images in the appropriate package structure. It can be a
simple GWT module that just extends Module A, so that you can get compile
time errors if there are any missing images that are required.

Module C, which is the final, compilable application, will use ModuleA.jar
and a specific implementation of ModuleB.jar. The MyImages interface comes
from Module A, but the actual images are coming from module B. But your
application doesn't know or care, it is just inheriting a bunch of gwt
modules.

Does that make sense?

--Sri

P.S. I presumed you don't want the images from module b to be swappable at
run-time. GWT doesn't allow you to do that.


On 23 April 2010 14:01, Stefan Bachert <[email protected]> wrote:

> Hi,
>
> This is a question for the real professionals of gwt
>
> I have 3 modules.
>
> Architectural view
>
> a) an Interface defining a .css which uses @sprite on image which
> aren't supplied by the module itself
> b) an Implementation which supplies the images
> c) an Application which works against a). Different implementation
> should be easily exchangable
>
>
> Technical View
>
> a1) interface MyCss1 extends CssResource
>    my1.css:
>    @sprite lala {gwt-image:"myPic")
> a2) interface MyCss2 extends CssResource
>    my2.css:
>    @sprite lulu {gwt-image:"myPic")
>
> b) interface MyImages extends ClientBundle {
>       @Source("MyPic.png")
>       ImageResoure myPic();
>    }
>
> c) interface MyBundle extends MyImages {
>      @Source ("my1.css")
>      MyCss1 css1;
>      @Source ("my2.css")
>      MyCss2 css2;
>    }
>
> You can see, that the technical implementation violates the intended
> architectural view.
>
> 1) In a) some kind of interface should be used to define which images
> b) needs to supply. I don't know how to do this
>
> 2) "my?.css" lives in a) but GWT expects it in c). At the moment I
> just copy it from a) to c). But this is ugly.
>
> Any qualified hints are welcome
>
> Stefan Bachert
> http://gwtworld.de
>
> --
> 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]<google-web-toolkit%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>

-- 
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.

Reply via email to