[Ajax/TabbedPanel] Issue deleting all tabs + ajax-update
Hi, The TabbedPanel internaly uses a Loop to render the tab-components. During a normla GET request the Loop.onPopulate() method ensures that all the loop-childs are removed before adding them again to support a possible change of teh underlying Integer-model. Loop.onPopulate() @Override protected final void onPopulate() { // Remove any previous loop contents removeAll(); // Get number of iterations final int iterations = getIterations(); if (iterations 0) { // Create LoopItems for each iteration for (int iteration = 0; iteration iterations; iteration++) { // Create item for loop iteration LoopItem item = newItem(iteration); // Add and populate item add(item); populateItem(item); } } } The TabbedPanel creates the following LoopItem which access the ITab-List directly. return new LoopItem(tabIndex) { private static final long serialVersionUID = 1L; @Override protected void onComponentTag(ComponentTag tag){...} @Override public boolean isVisible() { // direct access of the tab return getTabs().get(tabIndex).isVisible(); } }; The problem now is, if the tabs-list is modfied for example deleted, the onPopulate() method NEEDs to be invoked before the LoopItem.isVisible() the ensure that the old-Loop-childs (LoopItem) are deleted. This does not happen (Why?) if the TabbedPanel is added/updated in an ajax-call, resulting in ArrayIndexOufBounds-Exception in the LoopItem.isVisible() Method. (tabs.get(tabIndex)). My workaround currently is to invoke the onPopulate() manually during deletion (by beforeRender()). ((MarkupContainer)temporalTabs.get(tabs-container)).get(tabs).beforeRender(); Any Ideas, how to force the onPopulate() get called - maybe invoking modelChanged() on some component??? Thanks Jens - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: [Ajax/TabbedPanel] Issue deleting all tabs + ajax-update
You can avoid this exception making sure to remove the tab from your panel before the request cycle enter in RESPOND step. On Fri, Sep 25, 2009 at 9:05 AM, Jens Zastrow m...@jens-zastrow.de wrote: Hi, The TabbedPanel internaly uses a Loop to render the tab-components. During a normla GET request the Loop.onPopulate() method ensures that all the loop-childs are removed before adding them again to support a possible change of teh underlying Integer-model. Loop.onPopulate() @Override protected final void onPopulate() { // Remove any previous loop contents removeAll(); // Get number of iterations final int iterations = getIterations(); if (iterations 0) { // Create LoopItems for each iteration for (int iteration = 0; iteration iterations; iteration++) { // Create item for loop iteration LoopItem item = newItem(iteration); // Add and populate item add(item); populateItem(item); } } } The TabbedPanel creates the following LoopItem which access the ITab-List directly. return new LoopItem(tabIndex) { private static final long serialVersionUID = 1L; @Override protected void onComponentTag(ComponentTag tag){...} @Override public boolean isVisible() { // direct access of the tab return getTabs().get(tabIndex).isVisible(); } }; The problem now is, if the tabs-list is modfied for example deleted, the onPopulate() method NEEDs to be invoked before the LoopItem.isVisible() the ensure that the old-Loop-childs (LoopItem) are deleted. This does not happen (Why?) if the TabbedPanel is added/updated in an ajax-call, resulting in ArrayIndexOufBounds-Exception in the LoopItem.isVisible() Method. (tabs.get(tabIndex)). My workaround currently is to invoke the onPopulate() manually during deletion (by beforeRender()). ((MarkupContainer)temporalTabs.get(tabs-container)).get(tabs).beforeRender(); Any Ideas, how to force the onPopulate() get called - maybe invoking modelChanged() on some component??? Thanks Jens - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Pedro Henrique Oliveira dos Santos
Re: [Ajax/TabbedPanel] Issue deleting all tabs + ajax-update
Did you mean the the tab from the TabbedPanel or the whole TabbedPane from my page? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: [Ajax/TabbedPanel] Issue deleting all tabs + ajax-update
ok i'm a little bit confused :-( I didt want to invoke 'tabs.remove()' during a onRender(), but during the onClick() method of by AjaxFallbackLink - like in your example. Using a normal Link the TabbedPanel doesnt throw the exception. Try your example with the AjaxTabbedPane and a AjaxFallbackLink. Then in onClick() you have to add the tp the the AjaxRequestTarget, which later leads to the ArrayIndexOutOfBoundsException. Pedro Santos schrieb: -- dipl. inform jens zastrow phone | +49.152.04840108 mail | m...@jens-zastrow.de web | http://jens-zastrow.de xing | http://www.xing.com/profile/Jens_Zastrow - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: [Ajax/TabbedPanel] Issue deleting all tabs + ajax-update
I couldn't simulate, can you send the stack trace? On Fri, Sep 25, 2009 at 1:25 PM, Jens Zastrow m...@jens-zastrow.de wrote: ok i'm a little bit confused :-( I didt want to invoke 'tabs.remove()' during a onRender(), but during the onClick() method of by AjaxFallbackLink - like in your example. Using a normal Link the TabbedPanel doesnt throw the exception. Try your example with the AjaxTabbedPane and a AjaxFallbackLink. Then in onClick() you have to add the tp the the AjaxRequestTarget, which later leads to the ArrayIndexOutOfBoundsException. Pedro Santos schrieb: -- dipl. inform jens zastrow phone | +49.152.04840108 mail | m...@jens-zastrow.de web | http://jens-zastrow.de xing | http://www.xing.com/profile/Jens_Zastrow - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Pedro Henrique Oliveira dos Santos