Just to come back to your original question (as I was intrigued & dug into
it), the reason why Wicket didn't find the properties as expected is that
the ResourceModel is relative to the component, so it was looking for
properties such as:
vacancyForm.hrContactPanel.nameLabel.nameLabel=HR Contact:
While that would have worked, a better solution would be to replace the
ResourceModel call by a "new StringResourceModel("nameLabel", this, null)",
where the 'this' would then be the parent ContactPanel.
Having said that, in my opinion the even better solution is the
<wicket:message> one you did find...
/Gwyn
On Thu, Jun 12, 2008 at 6:53 AM, Peter Eriksson <[EMAIL PROTECTED]> wrote:
> Thanks Timo for your very helpful suggestion!
>
> Best Regards,
> /Peter
>
> 2008/6/11 Timo Rantalaiho <[EMAIL PROTECTED]>:
>
> > On Wed, 11 Jun 2008, Peter Eriksson wrote:
> > > I will answer my own post, just in case somebody else is looking for a
> > > solution to the same problem. I have found two ways to get the resource
> > > loading to do exactly what I want (There are probably a lot more out
> > there):
> >
> > Thanks for posting that, and cool that you found it out!
> >
> > > add(new Label("nameLabel", new StringResourceModel("nameLabel",
> > > this, null)));
> > > add(new Label("name"));
> >
> > These Label pairs smell like a custom component to me, e.g.
> >
> > public class LabeledText extends WebMarkupContainer {
> > public LabeledText(String textId, MarkupContainer parent) {
> > super(textId + "Container");
> > String labelId = textId + "Label";
> > add(new Label(labelId, new StringResourceModel(labelId, parent,
> > null)));
> > add(new Label(textId);
> > }
> > }
> >
> > Then in ContactPanel constructor you do
> >
> > add(new LabeledText("userName", this));
> > add(new LabeledText("phone", this));
> > add(new LabeledText("email", this));
> >
> > and change the markup accordingly (to something like
> > <wicket:panel>
> > <table>
> > <tr wicket:id="nameContainer">
> > <td><span wicket:id="nameLabel"></span></td>
> > <td><span wicket:id="name"></span></td>
> > </tr>
> > ...
> > )
> >
> > Best wishes,
> > Timo
> >
> > --
> > Timo Rantalaiho
> > Reaktor Innovations Oy <URL: http://www.ri.fi/ >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>