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]

Reply via email to