Thanks Jeremy I appreciate the pointer :-) Y. On 18 May 2010, at 14:26, Jeremy Thomerson wrote:
> 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 <[email protected]> > Sent: Tuesday, May 18, 2010 4:07 AM > To: [email protected] > 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 < >>> [email protected]> 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: [email protected] > For additional commands, e-mail: [email protected] > > > ______________________________________________________________________ > This email has been scanned by the MessageLabs Email Security System. > For more information please visit http://www.messagelabs.com/email > ______________________________________________________________________ --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
