Ok, to answer my own question, it seems that ExternalLink does not have the ability to be disabled like Link.

Regards,
Sebastiaan

Sebastiaan van Erk wrote:
I have the following code:

final ExternalLink link = new ExternalLink("link", model.bind("website")) {
        @Override
        public boolean isEnabled() {
            return Strings.isEmpty((String) getModelObject());
        }
    };
    // some more code to add the body of the link
    // like link.add(new Label(...))

    add(link);

However, the link gets rendered enabled no matter what. I put a breakpoint on the line with the "return" in the "isEnabled" method, but it never gets hit... The breakpoint where I do add(link) does get hit though.

Anybody know what I'm doing wrong?

Regards,
Sebastiaan


Martijn Dashorst wrote:
On 9/8/07, Sebastiaan van Erk <[EMAIL PROTECTED]> wrote:
DateLabel component, however I cannot find it in my version of wicket.

Add wicket-extensions to your project.

Second question that I have is the following. I want to display a label
with a link around it (a href), but the link should only be active if
the href is not empty or null. Thus if there is anything in it, the link
should be active, otherwise not. The href is a property of a model
object (which can change on form submit, so choosing between a fragment
with the link and a fragment without the link at construction time would
not work).

new Link("foo", model) {
    @override boolean isenabled() { Foo foo = getModelObject(); return
foo.getUrl() != null; }
}

Should do the trick?

Martijn

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to