Just create a new PrivateAsset and return it public IAssert getAssert(int percentComplete) { IResourceResolver = getPage().getEngine().getResourceResolver(); ClasspathResourceLocation imageFolder = new ClasspathResourceLocation(resolver, "path to images");
return new PrivateAsset(imageFolder.getRelativeResource(String.valueOf(percentComplete)+"/gif")); } not the most efficent example but you should get the idea. Geoff On 3/24/06, Mike Snare <[EMAIL PROTECTED]> wrote: > Sorry. I wasn't clear. > > There are 101 of these assets used by my component (one progress bar > image for each of the possible progress percents between 0 and 100, > inclusive). > > I'd really rather not have to clutter the jwc file with 101 asset > element statements. I have a method in the component that is called > via ognl from the jwc file, passing in an object from which I can > retrieve the percent complete. The method returns an IAsset that is > used in an Image component. > > -Mike > > On 3/24/06, Jesse Kuhnert <[EMAIL PROTECTED]> wrote: > > Yeah it is. You can use the <asset> xml spec method, or the asset > > annotation. They resolve relatively to your component/page/whatever. > > > > On 3/24/06, Mike Snare <[EMAIL PROTECTED]> wrote: > > > > > > Is there a service/utility that can be used by a page/component to > > > retrieve an asset by relative path? > > > > > > I've got it working using the following code: > > > > > > private IAsset getPrivateAsset(String relativePath) { > > > > > > String path = "/path/to/my/class/" + relativePath; > > > > > > // resolver is a DefaultClassResolver > > > // the asset service is injected > > > return new PrivateAsset(new ClasspathResource(resolver, path), > > > getAssetService(), this.getLocation()); > > > } > > > > > > But it smells like a hack. > > > > > > Thanks, > > > -Mike > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > -- > > Jesse Kuhnert > > Tacos/Tapestry, team member/developer > > > > Open source based consulting work centered around > > dojo/tapestry/tacos/hivemind. http://opennotion.com > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- The Spindle guy. http://spindle.sf.net Blog: http://jroller.com/page/glongman Other interests: http://www.squidoo.com/spaceelevator/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]