Hi Andrea, this is the code (a bit pseudo-like...) I am quite sure it is not the way it should be and full of wicket anti-patterns. But still exists since my first wicket experiences 2 years ago. ;-)
This panel gets rendered via RefreshingView about 30 times. public ElementPanel(String id, IModel<? extends ElementState> elementState){ super(id, elementState); container = new WebMarkupContainer("innerElementContainer", elementState){ private static final long serialVersionUID = 1L; @Override protected void onConfigure() { super.onConfigure(); ElementState s = (ElementState)getDefaultModelObject(); if(s instanceof DefaultState){ container.addOrReplace(new DefaultStatePanel(REPLACE_CONTAINER_ID, s)); }else if(s instanceof SpecialState){ container.addOrReplace(new SpecialStatePanel(REPLACE_CONTAINER_ID, s)); }else if(s instanceof AnotherSpecialState){ container.addOrReplace(new AnotherSpecialStatePanel(REPLACE_CONTAINER_ID, s)); ... }else{ String error = "No panel registered for class "+getDefaultModelObject().getClass().getSimpleName(); container.addOrReplace(new Label(REPLACE_CONTAINER_ID, error)); error(error); } } add(container); } Patrick Am 07.10.2014 19:42, schrieb Andrea Del Bene: > Hi, > > could you post the code you use inside onConfigure to addOrReplace inner > container? Maybe you could avoid detaching/attaching overriding method > detachModels in your inner containers. >> 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 >> >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org >