Hi,

It is a bad practice to keep references from one page to another.
Keeping reference means that serializing any of the pages will serialize
the other too.
For that reason there is PageReference class. You could use it to keep a
"weak" reference to another page. It keeps just the page id, so it is very
lightweight.
For your use case you need something like: send(openerPageRef.get(),
broadcast, payload).
See
https://github.com/apache/wicket/blob/09cdfbd3c635ded0c13be8b5bc45c84201331af1/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalWindowPage.java#L56
for example of using PageReference.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Fri, Feb 12, 2016 at 12:12 AM, Aaron J. Garcia <agar...@rentec.com>
wrote:

> Hi Everyone,
>
> ModalWindow has a "setPageCreator()" method, to set the page that you want
> to display inside of the ModalWindow.
>
> I've never used Wicket's event infrastructure, but I decided to use it
> today
> to pass a message from the content of my ModalWindow back to the
> ModalWindow
> itself.
>
> Apparently, even if you use an event sink at the session or application
> level, the event only broadcasts to components of the page that the event
> originated from... A lot of Google searching took me to a post on the
> mailing list that described that behavior, and let me to the below
> workaround.
>
> I ended up using getSession().getPageManager().getPage(int id...) on my
> content page to retrieve the page that contained the modal window.  Using
> that as the event sink (instead of getSession() or Application.get()),
> allowed the ModalWindow to consume my event...
>
> Is it at all possible for one of the following "enhancements" to be made:
>
> 1) When inside of a ModalWindow, getPage().getParent() returns null.  Is
> there a reason for this?  It would be *awesome* if getPage().getParent()
> could return the ModalWindow that created the page.
>
> 2) I guess if 1) occurred, then events would properly propagate to the
> ModalWindow when using a session or application level sink.
>
> Thanks for your feedback.
>
> Regards,
> Aaron J. Garcia
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to