Hi,

So just to confirm:
Say you have an entity House, you'll have

House.class
House.properties

1) where in the properties file you have a key "Label" with a value?
2) and in wicket you say getString("House.Label"), or new ResourceModel("House.Label")?

If this is the case, write a custom string resource loader, which takes the first part of the resource key, and checks if there is a matching entity with associated property file. Then use the other parts of the property key for the actual lookup in the property file.

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 27-10-2012 18:24, schreef Dieter Tremel:
For every JPA entity class I have a associated properties file in a
package called resources under the package of the entity classes.
In the files the display label, title, description of the entity and
it's attributes are given for internationalization. The keys in the
files are not necessarily different for different classes, each class
uses a "Label" key for it's display label.

I tried to include this in the wicket resource mechanism by adding a
ResourceLoader that uses a BundleStringResourceLoader for each entity
class, which is used when a component or it's ancestor implement a
EntityClassHolder Interface and can give an entity class.

But this does not work, since the String Resources are cached for the
first hit entity class, and the cache gives the reply for all other
entity classes. So my idea was not sufficient :-(

Of course I can write my own mechanism of getting the strings from the
properties encapsulated in a model. But wickets resource handling is so
sophisticated, that I suppose there is a more elegant way, I do not see.

How would you implement resource loading fore files associated to entity
classes, not to component hierarchy?

Thank You
Dieter Tremel


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org


Reply via email to