[ 
https://issues.apache.org/jira/browse/WICKET-1579?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Igor Vaynberg resolved WICKET-1579.
-----------------------------------

    Resolution: Won't Fix
      Assignee: Igor Vaynberg

enclosures are not supported with ajax

> Enclosure is checking determineVisibility instead of isVisible on child 
> component
> ---------------------------------------------------------------------------------
>
>                 Key: WICKET-1579
>                 URL: https://issues.apache.org/jira/browse/WICKET-1579
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.3
>            Reporter: Rahul Pilani
>            Assignee: Igor Vaynberg
>
> This problem is happening when Ajax requests are being used to update the 
> visibility of child component of the Enclosure. 
> Say originally we have an enclosure whose child component is not visible.
> the following code will run and set visibilityAllowed on all the components 
> under the enclosure to false.
> onComponentTagBody - Line 188-198 from Enclosure.java
> <code>
> DirectChildTagIterator it = new DirectChildTagIterator(markupStream, openTag);
>               MarkupContainer controllerParent = getEnclosureParent();
>               while (it.hasNext())
>               {
>                       ComponentTag t = (ComponentTag)it.next();
>                       Component child = controllerParent.get(t.getId());
>                       if (child != null)
>                       {
>                               child.setVisibilityAllowed(isVisible());
>                       }
>               }
> </code>
> Then when an Ajax request sets the child component to visible, 
> this is the code that checks the Enclosure's visibility:
> onComponentTagBody -  Line 185 in Enclosure.java
> <code>
>               setVisible(controller.determineVisibility());
> </code>
> which calls the component's determineVisibility() method to determine if the 
> component is visibile. But, determineVisiblity not only checks isVisible(), 
> but other states as well, including isVisibilityAllowed()
> determineVisibility , Line 4194 in Component.java
> <code>
> public final boolean determineVisibility()
>       {
>               return isVisible() && isRenderAllowed() && 
> isVisibilityAllowed();
>       }
> </code>
> Since the setVisibilityAllowed was set by the enclosure earlier, the 
> determineVisibility method is going to return false no matter what the state 
> of isVisible is, hence the Enclosure will never render.
> Instead of calling determineVisibility, the enclosure should just call 
> isVisible to determine whether it should render itself or not.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to