Hi Pedro,
That was my first instinct, to override isEnabled(), but it turns out that it is isLinkEnabled() that gets called, in the onComponentTag() method (ie when rendering).

So, no joy there.

Any other suggestions, anyone?

Dan


On 19/04/2010 20:41, Pedro Santos wrote:
Hi, you can override the isEnable method and implement your rule, like:

new BookmarkablePageLink
{
      boolean isEnabled() {
            return form.getState() == allowedState;
        }
}

or you can add the link higher in the component hierarchy, don't as an form child.

On Mon, Apr 19, 2010 at 1:45 PM, Dan Haywood <[email protected] <mailto:[email protected]>> wrote:

    I have a FormComponentPanel (called EntityLink) that holds an
    image, a hyperlink (a BookmarkablePageLink) and a hidden text
    field holding the serializable value of the reference.

    Initially I want the form is in read-only mode and so I have
    disabled all of its form components.  However, I'd like the link
    to be enabled.

    Looking at the source code, Wicket calls isLinkEnabled() to
    determine how to render the link; this in turn calls
    isEnabledInHierarchy().  My problem is the latter is (correctly
    returning false) but I want the former to return true.  Both
    methods are final, however.

    I'm obviously tackling this incorrectly - so what would be the
    Wicket way?

    Thanks
    Dan


-- Dan Haywood
    consultant, mentor, developer, author
    agile, ddd, oo, java, .net, sybase
    MA, MBCS, CITP, CEng
    /mail: /[email protected]
    <mailto:[email protected]>
    /phone: /+44 (0)7961 144286
    /book: /Domain Driven Design using Naked Objects
    <http://pragprog.com/titles/dhnako>
    /blog: /http://danhaywood.com
    /linked in: /http://uk.linkedin.com/in/dkhaywood
    /twitter: /http://twitter.com/dkhaywood
    /sybase: /http://sybtraining.co.uk



    ---------------------------------------------------------------------
    To unsubscribe, e-mail: [email protected]
    <mailto:[email protected]>
    For additional commands, e-mail: [email protected]
    <mailto:[email protected]>




--
Pedro Henrique Oliveira dos Santos
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to