Hi Chris,

I have struggled with this pattern myself. Ultimately I ended up using an
eventing pattern to decouple the modal from the page components that need to
be refreshed. I rolled my own event dispatch mechanism in Wicket 1.4 using
event-specific interfaces and IVisitors that find all components that
implement the interface. Wicket 1.5 has some baked in support for such a
pattern which probably requires less boilerplate [1]. In any case, before
closing the modal your ok button submit handler simply fires off the event.

Hope that helps!

Dan

[1]
https://cwiki.apache.org/WICKET/migration-to-wicket-15.html#MigrationtoWicket1.5-Intercomponentevents

On Fri, Sep 23, 2011 at 8:48 AM, Chris Merrill <ch...@webperformance.com>wrote:

> In my short time with Wicket, I've found that whenever something seems
> really
> hard, I'm probably doing it wrong :>  I'm hoping this is such a case.
>
>
> We have a number of components that are used on multiple pages. They are
> pretty
> simple - typically a couple of form field linked together for data entry.
>
> Sometimes we want one of those to appear in a ModalWindow, coupled with
> Ok/Cancel
> buttons and then update part of the page when the user accepts a change.
> I am able to make this work, but it is pretty cumbersome. I first have to
> put the component into a panel with the ok and cancel buttons.  The panel
> has to
> know about the part of the page that needs to be refreshed. And it has to
> know
> about the component embedded within it, in order to pass the selection back
> to the page. This has to be done for each component we want inside a modal
> ok/cancel
> window.
>
> I found one article on a reusable ModalWindow pattern:
>
> http://stuq.nl/weblog/2008-06-05/wicket-how-to-write-a-reusable-modal-window-popup
> that helped a bit. My next step was to try to put the ok/cancel buttons
> into
> my ModalWindow subclass, but I failed pretty miserably.  I've done some
> more digging
> and now think I know how to make this work, but it seems like it will be
> more than
> a little convoluted.
>
>
> Am I going about this all wrong?
>
>
>
> --
> ------------------------------------------------------------------------ -
> Chris Merrill                           |  Web Performance, Inc.
> ch...@webperformance.com                |  http://webperformance.com
> 919-433-1762                            |  919-845-7601
>
> Web Performance: Website Load Testing Software & Services
> ------------------------------------------------------------------------ -
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to