wfaler wrote:
Hi,
Is it possible to change the default html-template file loaded for a class
programmatically (for instance, changing from a classpath file, to a file in
another file-directory)?
For instance, if I want to change the underlying html-template on the fly,
but keeping the same component hierarchy?

Regards
Wille
Hi Wille,

You can implement IResourceStreamLocator and set an instance of that on your application: myApplication.getResouceSettings().setResourceStreamLocator(myResourceStreamLocator);

You can then return an IResourceStream from any source you might have (another directory, a database, anything) A nifty trick (I think) is to use the locator that is already set on the application to fall back to when your locator can't find the requested resource, but that is up to you and your requirements.

When you don't want to set a IResourceStreamLocator globally, but just for a component, you can have that component implement IMarkupResourceStreamProvider (and preferably also IMarkupCacheKeyProvider). This way you can return a desired IResourceStream based on some model property if you like.

Be careful that you do add the required components to your hierarchy. This is especially true when you generate markup dynamically. Also, take a look at the custom template / resource loading examples at: http://wicketstuff.org/wicket13/customresourceloading/

BTW, does anyone know what the purpose of application.getResourceSettings().getResourceFinder() is?

Regards,
Matthijs

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to