I'd suggest modifying the class rather than the ID in case you end up doing something with ajax later.
Jeremy Thomerson http://www.wickettraining.com -- sent from a wireless device -----Original Message----- From: Ioannis Mavroukakis <imavrouka...@gameaccount.com> Sent: Tuesday, May 18, 2010 4:07 AM To: users@wicket.apache.org Subject: Re: Changing css class based on page In fact it was a lot simpler than I thought, this works like a charm. private Link pageLink(final String id, final Class clazz) { final BookmarkablePageLink link = new BookmarkablePageLink(id, clazz); link.add(new AttributeModifier("id", true, new AbstractReadOnlyModel<String>() { @Override public String getObject() { return AbstractBasePage.this.getClass().equals(clazz) ? "current" : ""; } })); return link; } On 17 May 2010, at 22:40, Ioannis Mavroukakis wrote: > Thanks Jeremy that's great help as that's the route I considered initially > going down, trying to make it reusable is the next step.. > > Y. > On 17 May 2010, at 22:28, Jeremy Thomerson wrote: > >> link1.add(new AttributeModifier("class", true, new >> AbstractReadOnlyModel<String>() { >> public String getObject() { >> return AbstractBasePage.this.getClass().equals(LinkOnePageClass.class) ? >> "selectedPage" : "notSelectedPage"; >> } >> }); >> >> There's probably a way to make that more reusable - but that should get you >> started. >> >> -- >> Jeremy Thomerson >> http://www.wickettraining.com >> >> >> >> On Mon, May 17, 2010 at 4:24 PM, Ioannis Mavroukakis < >> imavrouka...@gameaccount.com> wrote: >> >>> Hey guys got a newbish question I cannot get my head around, and I would >>> appreciate any help. >>> >>> I've got an AbstractBasePage template using markup inheritance. It very >>> simply has some BookmarkablePageLink's which are common >>> across all pages. What I want to do, is have a different css class for the >>> active link (i.e. the one whose page you are on) and another for the >>> inactive ones >>> and I cannot for the life of me figure out what's the best way to do it --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org