You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Dan Haywood <dk...@gmail.com> on 2010/04/19 18:45:10 UTC
how to make a BookmarkablePageLink enabled when its parent component
is disabled?
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: /dan@haywood-associates.co.uk <ma...@haywood-associates.co.uk>
/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
Re: how to make a BookmarkablePageLink enabled when its parent component
is disabled?
Posted by Dan Haywood <dk...@gmail.com>.
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 <dkhaywood@gmail.com
> <ma...@gmail.com>> 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: /dan@haywood-associates.co.uk
> <ma...@haywood-associates.co.uk>
> /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: users-unsubscribe@wicket.apache.org
> <ma...@wicket.apache.org>
> For additional commands, e-mail: users-help@wicket.apache.org
> <ma...@wicket.apache.org>
>
>
>
>
> --
> Pedro Henrique Oliveira dos Santos
Re: how to make a BookmarkablePageLink enabled when its parent
component is disabled?
Posted by Pedro Santos <pe...@gmail.com>.
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 <dk...@gmail.com> 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: *
> dan@haywood-associates.co.uk *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: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
--
Pedro Henrique Oliveira dos Santos