On Mon, Jan 10, 2011 at 2:19 PM, Henrique Boregio <[email protected]>wrote:

> Hello, I am working on a notifications systems and want to generate
> notifications like the following:
> "UserX has asked you a question on item ItemY"
> Where UserX is a link to the user’s profile page. And ItemY is a link
> to the item’s page.
>
> Currently I am doing the following (pseudo-code):
>
> Java Source Code:
> Link userProfile Link= new Link(…)…
> Label notificationText = new Label(“ has asked you a question on ítem “);
> Link itemProfileLink = new Link(…)…
>
> add(userProfileLink);
> add(notificationText);
> add(itemProfileLink);
>
> HTML code:
> <a href=”#” wicket:id=”userProfileLink”></a>
> <span wicket:id=”notificationText”></span>
> <a href=”#” wicket:id=”itemProfileLink”></a>
>
> This works perfectly fine but it seems a bit like a waste of resources
> creating 3 new objects for such a simple task. Am I missing some
> feature un Wicket which allows this sort of behaviour?
>
It doesn't look like a waste.
Your statement sounds like <a>text</a><span>other text</span><a>last
text</a> is a waste of markup ;-)

If you use the same set of components in other places then you can make a
custom Panel and reuse it several times:
add(new UserLinkPanel("id"));

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

Reply via email to