add the link as if they do have a proper city set, and override its visible to return false if they dont.
-igor On Tue, Mar 17, 2009 at 6:19 PM, gaoxm <[email protected]> wrote: > 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]
