Martijn Dashorst wrote:
> Heh... it sounds like a misuse of behavior ;-)
> 
> What are you trying to achieve with setEnabled(false)?

disable the component.

we have a form that represents an entity. based on the state of the entity, we 
want some fields to be disabled. so the page adds all components as enabled and 
we want the behavior to set the enabled flag according to the state (business 
logic)

what i don't understand is how setEnabled modifies the component hierarchy.

> 
> Martijn
> 
> 
> On 8/1/06, Nili Adoram <[EMAIL PROTECTED]> wrote:
>> Hi all,
>> I have added the following behavior to all page components:
>> ..
>> public void onComponentTag(Component component, ComponentTag tag) {
>>     if (...)
>>             component.setEnabled(false);
>>     }
>>
>> However, when the page is rendered, the following exception is thrown
>> (see forward).
>> This looks like a misbehavior of the IBehavior!
>>
>> Thanks
>> Nili
>>
>> WicketMessage: Cannot modify component hierarchy during render phase
>>
>> Root cause:
>>
>> wicket.WicketRuntimeException: Cannot modify component hierarchy during
>> render phase
>> at wicket.Page.checkHierarchyChange(Page.java:1040)
>> at wicket.Page.componentStateChanging(Page.java:957)
>> at wicket.Component.addStateChange(Component.java:2273)
>> at wicket.Component.setEnabled(Component.java:1845)
>> at
>> com.qlusters.qrm.web.wicket.behavior.DisableBehavior.onComponentTag(DisableBehavior.java:42)
>> at wicket.Component.renderComponentTag(Component.java:2703)
>> at wicket.Component.renderComponent(Component.java:1666)
>> at wicket.markup.html.WebComponent.onRender(WebComponent.java:61)
>> at wicket.Component.render(Component.java:1511)
>> at wicket.MarkupContainer.renderNext(MarkupContainer.java:1332)
>> at wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:980)
>> at wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:915)
>> at wicket.markup.html.form.Form.onComponentTagBody(Form.java:776)
>> at wicket.Component.renderComponent(Component.java:1675)
>> at wicket.MarkupContainer.onRender(MarkupContainer.java:925)
>> at wicket.markup.html.form.Form.onRender(Form.java:847)
>> at wicket.Component.render(Component.java:1511)
>> at wicket.MarkupContainer.renderNext(MarkupContainer.java:1332)
>> at wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:980)
>> at wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:915)
>> at wicket.Component.renderComponent(Component.java:1675)
>> at wicket.MarkupContainer.onRender(MarkupContainer.java:925)
>> at wicket.Component.render(Component.java:1511)
>> at wicket.Component.render(Component.java:1477)
>> at wicket.MarkupContainer.autoAdd(MarkupContainer.java:196)
>> at
>> wicket.markup.resolver.MarkupInheritanceResolver.resolve(MarkupInheritanceResolver.java:66)
>> at wicket.MarkupContainer.renderNext(MarkupContainer.java:1359)
>> at wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:980)
>> at wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:915)
>> at wicket.Component.renderComponent(Component.java:1675)
>> at wicket.MarkupContainer.onRender(MarkupContainer.java:925)
>> at wicket.Component.render(Component.java:1511)
>> at wicket.Component.render(Component.java:1477)
>> at wicket.MarkupContainer.autoAdd(MarkupContainer.java:196)
>> at
>> wicket.markup.resolver.MarkupInheritanceResolver.resolve(MarkupInheritanceResolver.java:73)
>> at wicket.MarkupContainer.renderNext(MarkupContainer.java:1359)
>> at wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:980)
>> at wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:915)
>> at wicket.Component.renderComponent(Component.java:1675)
>> at wicket.MarkupContainer.onRender(MarkupContainer.java:925)
>> at wicket.Component.render(Component.java:1511)
>> at wicket.MarkupContainer.renderNext(MarkupContainer.java:1332)
>> at wicket.MarkupContainer.renderAll(MarkupContainer.java:942)
>> at wicket.Page.onRender(Page.java:867)
>>
>>
>> -------------------------------------------------------------------------
>> Take Surveys. Earn Cash. Influence the Future of IT
>> Join SourceForge.net's Techsay panel and you'll get the chance to share your
>> opinions on IT & business topics through brief surveys -- and earn cash
>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>> _______________________________________________
>> Wicket-user mailing list
>> Wicket-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/wicket-user
>>
> 
> 


-- 
===================================
Ittay Dror, 
Chief architect, openQRM group leader, 
R&D, Qlusters Inc.
[EMAIL PROTECTED]
+972-3-6081994 Fax: +972-3-6081841

http://www.openQRM.org
- Keeps your Data-Center Up and Running

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to