[
https://issues.apache.org/jira/browse/WICKET-3808?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13052540#comment-13052540
]
Mishelle Bonq commented on WICKET-3808:
---------------------------------------
I tried the approach when we pass to a modalPage as parameters:
1 PageReference for access to a model of modalWindow
2 modalWindow instance for possibility to close the modalWindow
* As action, occurs on click link in modalPage it looks like:
void onLinkClick(PageReference homePageReference, ModalWindow
modalWindow) {
HomePage homePage = (HomePage) homePageReference.getPage();
homePage.getModalWindow().setCallback(homePage.getCallback());
modalWindow.close(target);
}
If we follow this way, then everything works fine: when onclick event happens,
we ask for the homePage (using an old id) and set the callback to the homePage
instance with an old id. It marks as touched and serializes later. Then, when
we call "modalWindow.close(target)" we refers to another instance of homePage,
for that instance we set a new id and mark it as touched and serialize too.
But it seems a little bit strange to use such an approach. The fact that we
must use only this approach may be confusing. If I look at this code it seems
really strange to me that we set callback to the modalWindow in one way, and
then close the same modalWindow in another way(of course, it's not the same
modalWindow, but it's not obvious).
> Data, passed from ModalPage to ModalWindow, is not accessible in
> WindowClosedCallback
> -------------------------------------------------------------------------------------
>
> Key: WICKET-3808
> URL: https://issues.apache.org/jira/browse/WICKET-3808
> Project: Wicket
> Issue Type: Bug
> Components: wicket-core, wicket-extensions
> Affects Versions: 1.5-RC4
> Environment: Win 7, FF
> Reporter: Mishelle Bonq
> Attachments: project-2.rar, project.rar
>
>
> Because of changes of pages processing an unacceptable behavior was detected.
> During such a processing in case if we try to pass some data from page on
> opened modal window to a modal window (which is an element of background
> page). The quickstart project was made to show this wrong behavior.
> Steps to reproduce:
> 1. Run quickstart project. Open HomePage. You'll see a link "Show
> ModalWindow". Click it. As an action on this click a new PageCreator is set
> for ModalWindow, which creates a new instance of ModalPage & pass a callback
> to this instance. Inside the callback the visibility of hidden element from
> HomePage is changed (The text "Hello, World!" became visible).
>
> 2. So, a ModalWindow will be shown with a ModalPage as content. In ModalPage
> you'll see another link "Close ModalWindow and show hidden text on HomePage".
> Click this link.
> This click must leads to setting the callback (which we've already passed in
> step 1 to ModalPage instance) to ModalWindow & close this ModalWindow.
> Closing ModalWindow happens in a correct way. But we don't see the hidden
> text. The reason of this behavior is: when we set the callback from ModalPage
> to ModalWindow (element of HomePage) the numericId of HomePage is changed and
> this page is serialized with another id. During ModalWindow closing
> WindowClosedCallback is called. In this WindowClosedCallback we are trying to
> call our callback, which had to be set from ModalPage. But script, which
> handles WindowClosedCallback from browser, references to a HomePage with old
> numericId & of cource without set callback.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira