Em Tue, 17 Nov 2009 13:46:12 -0200, Everton Agner <[email protected]> escreveu:

To begin with... I am learning Tapestry from 1 month ago.

Welcome to the Tapestry world! :)

@Inject
@Property
@Path("context:/layout/images/brazil.png")
private Asset flagBrazil;

You're doing it in a way more complex that it needs to be. All you need to do is to refer to your asset and the Tapestry automatically searches for the localized version. Example:

@Inject
@Property
@Path("context:/layout/images/flag.png")
private Asset flag;

If the current locale is pt_BR, Tapestry will try to find /layout/images/flag_pt_BR.png in your context. If it's found, it will be used. ;)

So... The first thing I'm having problems with is to retrieve in Runtime the information stored on the AppModule class (contributeApplicationDefaults method). There is a way I can do this?

Suppose you need to know the value of the tapestry.production-mode symbol. You can inject it in your component or page class:

@Inject
@Symbol("tapestry.production-mode")
private boolean productionMode;

The second problem I'm having is to retrieve the Assets (the images) in a Dynamic way (knowing the Locale name and if it's the enabled/disabled image)... I've read about AssetFactory, but didn't find any good example related.

You don't need to use AssetFactory to do that. Just name the assets appropriately. ;)

--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and instructor Owner, software architect and developer, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to