Thanks Paul for this nice tip.

On Tue, Aug 14, 2012 at 11:04 PM, Paul Bors <p...@bors.ws> wrote:

> If you use wicket-component-expressions from com.googlecode.londonwicket
> you
> can get to the list of all the components on the page that have that
> "username" id via a regexp of "**:username", but as James mentioned
> earlier,
> the ID is not unique and your wicket component tree might have such
> multiple
> nodes (hence why wicket-component-expressions gives you a list of them).
>
> I normally know that my panel has only one such component by the ID since I
> developed it, so if I attach it to my page inside a panel with an ID like
> "myPanel" then I use "**:myPanel:**:username" and I also filter by the
> component type such as TextField.class to narrow down the search.
>
> That's not production code, is unit test and I'm assuming that's the
> context
> of your question. By using such regexp, I found myself refactoring the unit
> test code less when shuffling panels on a page.
>
> ~ Thank you,
>   Paul Bors
>
> -----Original Message-----
> From: James Eliyezar [mailto:ja...@mcruncher.com]
> Sent: Tuesday, August 14, 2012 4:12 AM
> To: users@wicket.apache.org
> Subject: Re: Is there a way to search component by its wicket ID ?
>
> Because the id is unique only within the markup container of a component.
> It need not be unique in a page. This is by design.
> For more details refer:
> https://cwiki.apache.org/WICKET/component-hierarchy.html
>
>
> On Tue, Aug 14, 2012 at 3:42 PM, arkadyz111 <azelek...@gmail.com> wrote:
>
> > But why we have to write "userForm" ? What is an idea behind of this ?
> >
> > Why get("username") is not enough ?
> >
> >
> >
> > --
> > View this message in context:
> >
>
> http://apache-wicket.1842946.n4.nabble.com/Is-there-a-way-to-search-componen
> t-by-its-wicket-ID-tp4651175p4651217.html
> > Sent from the Users forum mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
>
>
> --
> Thanks & regards
> James Selvakumar
> mcruncher.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Thanks & regards
James Selvakumar
mcruncher.com

Reply via email to