[ 
https://issues.apache.org/jira/browse/WICKET-1637?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12614669#action_12614669
 ] 

Peter Ertl commented on WICKET-1637:
------------------------------------

@johan: However in the past you could not 'reuse' the popup if you mixed calls 
of setContent() and setPageCreator(). Could you elaborate a little more why 
this fix will break your code?

The problem in the past was:


  popup use #1 : popup.setContent(content1)

    internal state:   pageCreator = null, content = content1
    
      -> content1 will be shown


  popup use #2:   popup.setPageCreator(pc1)

    internal state:  pageCreator = pc1, content = content1

      -> content1 will still be shown (but pc1 was expected!)


popup.setContent(null) doesn't work ... you need to call 
popup.setContent(popup.empty)

however 'empty' is a private field in ModalWindow and can not be accessed.

so what's wrong with alternating the popup source by mutually exclusive calls 
of setContent() and setPageCreator() ?


> ModalWindow can not be "reused"
> -------------------------------
>
>                 Key: WICKET-1637
>                 URL: https://issues.apache.org/jira/browse/WICKET-1637
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>            Reporter: Peter Ertl
>            Assignee: Matej Knopp
>         Attachments: wicket-1637-modal-window-reuse.patch
>
>
> ModalWindow's methods setContent(Component) and setPageCreator() are not 
> properly implemented. You should be able to call setContent() and 
> setPageCreator() in sequence (or vice versa).  However this will not work:
> I use one general purpose ModalWindow in my page to display several types of 
> popups in it (of type 'component' and 'page')
> <body>
>   <div wicket:id="popup"></div>
>   ...
> </body>
> some of these popups use setPageCreator() others use setContent().
> however, once you use setContent(Component) you cannot use setPageCreator() 
> anymore, because ModalWindow keeps the custom component / page creator stored 
> and does not reset these properties as required.
> fix is attached (very simple, contains only two new lines :)

-- 
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