The fact that you want to bind a component in two places and complain that you can't, is a code smell: you should extract that component to a panel or fragment and reuse the panel (/fragment).
Martijn On Fri, Dec 12, 2008 at 1:32 PM, Martijn Dashorst <[email protected]> wrote: > ieuw > > On Fri, Dec 12, 2008 at 1:30 PM, Bruno Cesar Borges > <[email protected]> wrote: >> Martijn, it is possible to create nodes inside a DOM tree refering to >> another DOM node. What if it was possible to do the same with Wicket? >> >> <div wicket:id="myPanel"> >> <span wicket:id="foo">label</span> >> <span wicket:ref="foo">again</span> >> </div> >> >> <span wicket:ref="myPanel.foo">again but outside panel!</span> >> >> Regards, >> Bruno >> >> -----Original Message----- >> From: Martijn Dashorst [mailto:[email protected]] >> Sent: Friday, December 12, 2008 5:18 AM >> To: [email protected] >> Subject: Re: how to reuse a label in the same page? >> >> >> Nope, wicket:id is a 1-1 mapping at the same dom tree level. You can >> reuse id's at different levels or in different branches of the dom >> tree, but not as siblings. >> >> <a href="#" wicket:id="foo"><span wicket:id="foo"></span></a> works >> but another >> <a href="#" wicket:id="foo">....</a> will fail (and rightfully so) >> >> Martijn >> >> On Fri, Dec 12, 2008 at 6:20 AM, Jeremy Thomerson >> <[email protected]> wrote: >>> I'm pretty sure that you can just add it once in Java and multiple times in >>> the HTML, although I've never pondered the (potential) side-effects of >>> this. Give it a shot and let us know how it works for you. With something >>> as stateless / simple as a BookmarkablePageLink, there probably couldn't be >>> much in the way of side-effects, although with very complex, stateful >>> components, I could see that maybe there would be an issue... (maybe??) >>> -- >>> Jeremy Thomerson >>> http://www.wickettraining.com >>> >>> >>> On Thu, Dec 11, 2008 at 3:29 PM, novotny <[email protected]> wrote: >>> >>>> >>>> >>>> Basically I need two of the same links on the page, and it looks like I >>>> have >>>> to do this which just seems kinda lame... >>>> >>>> add(new BookmarkablePageLink<String>("personaldetails", >>>> PersonalDetailsPage.class)); >>>> add(new BookmarkablePageLink<String>("personaldetails2", >>>> PersonalDetailsPage.class)); >>>> >>>> .... >>>> >>>> Click Here >>>> Profile page >>>> >>>> >>>> >>>> >>>> >>>> >>>> >>>> jWeekend wrote: >>>> > >>>> > Jason, >>>> > >>>> > What are you trying to achieve? >>>> > >>>> > Here are some ideas that may give the desired effect, depending on what >>>> > that is ... >>>> > >>>> > 1 - Make a model for your data and give that to all the Label instances >>>> as >>>> > required, (but each with their unique id and separate markup). >>>> > 2 - Use a repeater (like a ListView) to render several labels (no >>>> > repetition of Java code or markup). >>>> > 3 - Write a method that takes a model (or just a String) and an id, that >>>> > returns an appropriately configured Label instance (saves on repeating >>>> > Java code - still need markup per component and your own unique ids). >>>> > >>>> > Regards - Cemal >>>> > http://www.jWeekend.co.uk <http://www.jweekend.co.uk/> jWeekend >>>> > >>>> > >>>> > >>>> > novotny wrote: >>>> >> >>>> >> >>>> >> I have a simple label "hello" and I want to display it twice in the same >>>> >> page, but wicket complains the wicket:id needs to be unique in my >>>> >> page.... what do I need to do, is there an alias or something? >>>> >> >>>> >> Thanks, Jason >>>> >> >>>> > >>>> > >>>> >>>> -- >>>> View this message in context: >>>> http://www.nabble.com/how-to-reuse-a-label-in-the-same-page--tp20964351p20964551.html >>>> Sent from the Wicket - User mailing list archive at Nabble.com. >>>> >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: [email protected] >>>> For additional commands, e-mail: [email protected] >>>> >>>> >>> >> >> >> >> -- >> Become a Wicket expert, learn from the best: http://wicketinaction.com >> Apache Wicket 1.3.4 is released >> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3. >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> *************************************************************************************************** >> "Atenção: Esta mensagem foi enviada para uso exclusivo do(s) >> destinatários(s) acima identificado(s), >> podendo conter informações e/ou documentos confidencias/privilegiados e seu >> sigilo é protegido por >> lei. Caso você tenha recebido por engano, por favor, informe o remetente e >> apague-a de seu sistema. >> Notificamos que é proibido por lei a sua retenção, disseminação, >> distribuição, cópia ou uso sem >> expressa autorização do remetente. Opiniões pessoais do remetente não >> refletem, necessariamente, >> o ponto de vista da CETIP, o qual é divulgado somente por pessoas >> autorizadas." >> >> >> "Warning: This message was sent for exclusive use of the addressees above >> identified, possibly >> containing information and or privileged/confidential documents whose >> content is protected by law. >> In case you have mistakenly received it, please notify the sender and delete >> it from your system. >> Be noticed that the law forbids the retention, dissemination, distribution, >> copy or use without >> express authorization from the sender. Personal opinions of the sender do >> not necessarily reflect >> CETIP's point of view, which is only divulged by authorized personnel." >> *************************************************************************************************** >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > > > > -- > Become a Wicket expert, learn from the best: http://wicketinaction.com > Apache Wicket 1.3.4 is released > Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3. > -- Become a Wicket expert, learn from the best: http://wicketinaction.com Apache Wicket 1.3.4 is released Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
