you can use setEnabled just fine.
But not in the render phase. That should be done in the onclick or something like that.

johan


On 3/16/06, Gili <[EMAIL PROTECTED]> wrote:

        Playing devil's advocate here: so what's the point/benefit of
preventing a call to setEnabled() if one can override isEnabled and
"modify the hierarchy" beyind Wicket's back anyway?

        I personally prefer explicit calls to setEnabled() from onRender() than
subclassing because it allows me to know upfront exactly where its value
is being changed (plus you don't have to recalculate the value if it
hasn't been changed).

Gili

Eelco Hillenius wrote:
> Just override isEnabled. That's why it's not final.
>
> Eelco
>
>
> On 3/15/06, David Leangen <[EMAIL PROTECTED]> wrote:
>> This approach used to work for me under 1.1, but no longer in 1.2.
>>
>> I have a BookmarkablePageLink that I want to disable when its target is
>> a subclass of a given page.
>>
>> I used to do something like this:
>>
>>   protected void onRender( final MarkupStream markupStream )
>>   {
>>       setEnabled( ! m_parentClass.isAssignableFrom(
>>                        getPage().getClass() ) );
>>       super.onRender( markupStream );
>>   }
>>
>>
>> But this now throws an exception:
>>
>> wicket.WicketRuntimeException: Cannot modify component hierarchy during
>> render phase
>>      at wicket.Page.checkHierarchyChange (Page.java:1001)
>>      at wicket.Page.componentStateChanging(Page.java:934)
>>      at wicket.Component.addStateChange(Component.java:2118)
>>      at wicket.Component.setEnabled(Component.java :1732)
>>
>> ...
>>
>>
>> How should I go about creating the same effect? Where should I set the link's enabled value based on the above criterion?
>>
>>
>> Thanks!
>> Dave
>>
>>
>>
>>
>>
>> -------------------------------------------------------
>> This SF.Net email is sponsored by xPML, a groundbreaking scripting language
>> that extends applications into web and mobile media. Attend the live webcast
>> and join the prime developer group breaking into this new coding territory!
>> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
>> _______________________________________________
>> Wicket-user mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting language
> that extends applications into web and mobile media. Attend the live webcast
> and join the prime developer group breaking into this new coding territory!
> http://sel.as-us.falkag.net/sel?cmd=k&kid0944&bid$1720&dat1642
> _______________________________________________
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>

--
http://www.desktopbeautifier.com/


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to