I think you might have over-complicated your design.
Your use-case is quite simple, you have user input that filters the
display. It might be that there are a lot of panels to be updated but then
again it should be simple to update the parent which in turn delegates that
responsibility to the children.

Take a quick look over how Decebal implemented his Wicket-Dashboards as in
his project the entire dashboard is refreshed when adding a new panel which
in turn can be quite complicated.

His code and examples are at:
https://github.com/decebals/wicket-dashboard

Study his design and see how much of that you can apply to your page.

Otherwise I suggest you get rid of the addOrReplace() and move that logic
into your onBeforeRender() methods for those panels to update themself.

On Tue, Oct 7, 2014 at 12:43 PM, Patrick Davids <
patrick.dav...@nubologic.com> wrote:

> Hi Paul,
> thanx for replying.
>
> Oh, I use Ajax very heavily in this case. Thats why I said: "the panel
> works quite good for ajax rendering and refreshing use-cases"
>
> Hmm... ok... I think I missed some details. I try to explain.
>
> My page contains two sections seperated from each other.
> A kind of data-entry and a kind of displaying the results.
>
> The section which displays the results is a quite complicated panel,
> having an RefreshingView for about 30 (I will name them) sub-panels.
>
> These sub-panels addOrReplace() an inner container while rendering itself.
> And the replacement depends on my model object type.
>
> So, my sub-panel class has a hugh knowledge about how to render the
> results.
>
> On entering some data on the data-entry section I refresh the whole
> panel in the display section with all its sub-panels using Ajax. And
> this works great.
> Some of the sub-panels also rerender/refresh own there own, by listening
> to events etc pepe. All this behaviours are working very well.
>
> The only disadvantage is, using addOrReplace(), I have a heavy
> detaching/attaching situation and a performance problem.
>
> So, the best solution for now would be, keeping my panel implementation
> as it is, but just having my models detached only once, not for iteration.
>
> And here I dont have any idea how to solve that... :-/
>
> thanx and kind regards
> Patrick
>
> Am 07.10.2014 17:52, schrieb Paul Bors:
> > Why not use Ajax?
> >
> > addOrReplace() is really for when you need the full request cycle and
> have
> > the page rendered on the server side. With Ajax you get your target for
> > which you can add all the components you want to refresh on the page.
> >
> > Given the day and age we live in, I don't think there is a need to even
> > worry about browsers that do not support Ajax. Than again, that depends
> on
> > your product's requirements.
> >
> > Otherwise, you can keep on using addOrReplace() but stop using instaceof
> > and start using Generics.
> > If you need an example code-snippet of that let me know and I'll dig some
> > out for you.
> >
> > On Tue, Oct 7, 2014 at 9:51 AM, Patrick Davids <
> patrick.dav...@nubologic.com
> >> wrote:
> >
> >> Hi all,
> >> I have a panel, which renders a inner markupcontainer (different panels
> >> for different ways of displaying my model object) depending on its model
> >> objects type.
> >>
> >> I do this by addOrReplace() the inner panel in an onConfigure() having
> >> an "if instanceof"; and it also iterates over a list...
> >>
> >> I'm not sure, if it is a good solution (I dont like the instanceof
> >> approach), but the panel works quite good for ajax rendering and
> >> refreshing use-cases.
> >>
> >> But, the addOrReplace() has one big disadvantage.
> >> It forces to detach the model on each iteration, so on each iteration I
> >> get a database access to retrieve it again.
> >>
> >> Is there anyway to keep the model attached until the entire request
> >> cycle is finished?
> >>
> >>
> >> Or should I try to find complete other solution for this kind of "high
> >> dynamic iterating panel"?
> >> Is it better to use e.g. Fragments to display a model object in
> >> different ways depending on its state?
> >>
> >> Please give some inspirations... I ran out of ideas. Help!
> >>
> >> kind regards :-)
> >> Patrick
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >>
> >>
> >
>

Reply via email to