Inheriting module resources (images, css etc)

17 views
Skip to first unread message

manstis

unread,
Mar 9, 2012, 12:14:17 PM3/9/12
to Google Web Toolkit
Hi,

What is the best practice for inheriting resources?

We've been separating resources from code, much like this:-

Module A
--------
org.test.modulea.client.widgets
->class MyWidget extends Composite {

private MyResources resources = GWT.create( MyResources.class );

public static interface MyResources extends ClientBundle {

@Source("../resources/images/anImage.png")
ImageResource anImage();

}

} etc

org.test.modulea.client.resources.images
-> anImage.png

Module B
--------
<inherits name="org.test.modulea.ModuleA"/>

However we are finding we need to duplicate the client.resources
package in ModuleB as well.

From what I have read and understand I believe this is caused by the
relative "source" URI being prefixed with ModuleB's name and hence
they are being looked for in org.test.moduleb.client.resources.images.
Looking at Google's examples images appear to always be in the same
package as the code needing them with no use of "@Source". This I
suspect removes the URI issue.

I'd love to hear what is thought as best practice and how to avoid the
re-use problem we have.

Thanks for reading,

Mike
Reply all
Reply to author
Forward
0 new messages