Hi Igor, Jeremy, Martin, Steve, Thanks a lot for your reply. In my page, the link text will also be empty if the link is not necessary to show. I changed a little bit of my code and set visible of link component to false. The code looks better now.
--Simon However, I have another concern. On Wed, Mar 18, 2009 at 11:19 PM, Steve Swinsburg < [email protected]> wrote: > If you still need the link text to appear, but not be linked, then you can > do: > link.isEnabled(false); > > This will surround the link with an <em> tag instead of the <a> tag. If you > don't want any tag to be substituted, have this in your Application class: > > getMarkupSettings().setDefaultBeforeDisabledLink(null); > getMarkupSettings().setDefaultAfterDisabledLink(null); > > or where null can be another type of tag. > > cheers, > Steve > > > > On 18 Mar 2009, at 04:46, Martin Makundi wrote: > > And you can use the following to optionally hide any surrounding html > markup: > > <wicket:enclosure child="yourLink"> > XXX > </wicket:enclosure> > > 2009/3/18 Jeremy Thomerson <[email protected]>: > > For any component, simply override isVisible. > > > Jeremy Thomerson > > http://www.wickettraining.com > > -- sent from a wireless device > > > > -----Original Message----- > > From: gaoxm <[email protected]> > > Sent: Tuesday, March 17, 2009 8:19 PM > > To: [email protected] > > Subject: optional link > > > Hello everyone, > > > I am working on a page which needs a feature of optional link. for example, > > I have a html file as shown blew: > > > <div wicket:id="profile"> > > <a wicket:id="residenceCityLink"> > > <span wicket:id="residenceCItyLabel"> > > </a> > > </div> > > > What I want is: if a user's profile has a valid residence city field, I > will > > show the city link and label. > > Otherwise, I don't show anything here. > > > I don't know if there is any better method to implement the optional link. > > So far I am checking the field and add an invisible link if the residence > > city is not saved. > > > if (profile.getResidenceCity() == null) { > > PageLink cityLink = new PageLink("residenceCityLink", DummyPage.class); > > cityLink.setVisible(false); > > add(cityLink); > > ... ... > > } else { > > PageLink cityLink = getCityPage(profile.getResidenceCity()); > > add(cityLink); > > ... ... > > } > > > There are many such kinds of links in my page. > > Please advise me if you know any better way to do this. Thanks. > > > --Simon > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [email protected] > > For additional commands, e-mail: [email protected] > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > >
