Check out AbstractLink#setBeforeDisabledLink() and AbstractLink#setAfterDisabledLink(). I believe you can set the markup you want to appear there. This defaults to <em>. Or just go directly to AbstractLink#disableLink() and get the behaviour you want there. I think you can also do it application wide in Application#init(). MarkupSettings I think. Regards, Matt.
On Fri, Jan 16, 2009 at 11:57 AM, Steve Swinsburg < [email protected]> wrote: > Yeah It needs to show the label and not be clickable if there is no link, > or link and the label if there is to be a link > > e.g. in Facebook, a search shows a user's name but it may or may not be > clickable depending on their privacy settings. > > > thanks, > Steve > > > > > > > > On 16 Jan 2009, at 17:54, James Carman wrote: > > Override isVisible()? Or, do you want it to show text, just not be >> clickable? >> >> On Fri, Jan 16, 2009 at 12:51 PM, Steve Swinsburg >> <[email protected]> wrote: >> >>> Hi all, >>> I have a link which, depending on certain conditions, I need unlinked (ie >>> disabled). >>> //link (if allowed, or none, just the label) >>> Link link = new Link("link") { >>> public void onClick() { >>> setResponsePage(new ViewProfile((String)getModelObject())); >>> } >>> }; >>> >>> // >>> if(isAllowed) { >>> link.setModel(new Model(someValue)); >>> } else { >>> link.setEnabled(false); >>> } >>> >>> link.add(new Label("label", labelValue)); >>> item.add(link); >>> >>> with simple markup: >>> <a href="#" wicket:id="link"><span wicket:id="label">[label]</span></a> >>> >>> The problem is that link.setEnabled(false) adds <em> tags around my link: >>> output: >>> <span><em><span>this is the label</span></em></span> >>> Is there another way of disabling a link, or removing these em tags. Or >>> even >>> adding the link dynamically and having a normal label when there is to be >>> no >>> link? >>> >>> cheers, >>> Steve >>> >>> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > -- Matthew Rollins Hanlon http://squareoftwo.org _____________________ Hanlon's Razor: "Never attribute to malice that which can be adequately explained by stupidity." http://wikipedia.org/wiki/Hanlon's_razor
