You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Per Newgro <pe...@gmx.ch> on 2009/02/01 10:08:21 UTC

What are the consequences on sharing panels between pages?

Hi,

i would like to share (instance reuse) a navigation panel in my page 
flow. I try to achieve that so i can keep the current state of 
navigation components. It's a clone of the windows xp sidebar in system 
controls.

But i don't know if sharing is a good idea. I will have many pages. What 
happens if i create a new page, add the navigation panel of one page to 
the next and redirect by using setResponsePage?
Will the last page be "garbage collected"? Normally java is only gc if 
no references are present to an object. Is wicket doing it similar?

Thanks 4 help
Per

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: What are the consequences on sharing panels between pages?

Posted by Matej Knopp <ma...@gmail.com>.
Either there or in your session's subclass constructor.

-Matej

On Mon, Feb 2, 2009 at 7:25 PM, Per Newgro <pe...@gmx.ch> wrote:
> Thanks Thomas and Matej,
>
> storing state in session sounds natural in your explanations. It comes into
> my mind, that i could initiate
> the instance in Application.newSession(). Is this the right place for this
> task?
> The the navigational panel could extract an initialized model instance from
> the session.
>
> Thanks alot for clearing this to me
> Per
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: What are the consequences on sharing panels between pages?

Posted by Per Newgro <pe...@gmx.ch>.
Thanks Thomas and Matej,

storing state in session sounds natural in your explanations. It comes 
into my mind, that i could initiate
the instance in Application.newSession(). Is this the right place for 
this task?
The the navigational panel could extract an initialized model instance 
from the session.

Thanks alot for clearing this to me
Per

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: What are the consequences on sharing panels between pages?

Posted by Matej Knopp <ma...@gmail.com>.
Sharing wicket components between page is a very bad idea. You are
about to open large can of very nasty worms. Just don't do it. Proper
way is to "externalize" the navigation state from your component and
store it in session. Write couple of detachable models that do that.

-Matej

On Sun, Feb 1, 2009 at 10:08 AM, Per Newgro <pe...@gmx.ch> wrote:
> Hi,
>
> i would like to share (instance reuse) a navigation panel in my page flow. I
> try to achieve that so i can keep the current state of navigation
> components. It's a clone of the windows xp sidebar in system controls.
>
> But i don't know if sharing is a good idea. I will have many pages. What
> happens if i create a new page, add the navigation panel of one page to the
> next and redirect by using setResponsePage?
> Will the last page be "garbage collected"? Normally java is only gc if no
> references are present to an object. Is wicket doing it similar?
>
> Thanks 4 help
> Per
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: What are the consequences on sharing panels between pages?

Posted by Matej Knopp <ma...@gmail.com>.
Don't use loadabledetachablemodel for this. Forget Wicket model
implementations. Just look at the IModel interface. It has 3 methods,
each of them simple to implement and you get most control of where the
object is pulled from and where it is stored.

-Matej

On Sun, Feb 1, 2009 at 7:09 PM, Per Newgro <pe...@gmx.ch> wrote:
> Hi Uwe,
>
> until now i can do everything :-). All my experiments with ldm failed so
> far. I have to store the states. But in DB? It's heavyweight for me.
> Maybe i should try a cookie based solution.
>
> Thanks for your doubts
> Cheers
> Per
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: What are the consequences on sharing panels between pages?

Posted by Thomas Mäder <th...@devotek-it.ch>.
Well, Wicket has a Session Object. You can create your own subclass and
store stuff in there (WebApplication.newSession(...). If you want to share
state between pages, it's a natural place to put the state. One question you
can ask yourself is: how many instances of that panel would I have? If the
answer is: "one per user", the state of the panel is session state. So you
have multiple copies of the panel, but they all store their state into the
session.

Thomas

On Mon, Feb 2, 2009 at 11:22 AM, Newgro <pe...@gmx.ch> wrote:

>
> Hi Thomas,
>
> can you please explain this a bit. What do you mean by "session state". How
> can i use session state in my context?
>
> Cheers
> Per
> --
> View this message in context:
> http://www.nabble.com/What-are-the-consequences-on-sharing-panels-between-pages--tp21772949p21787239.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Thomas Mäder
www.devotek-it.ch

Re: What are the consequences on sharing panels between pages?

Posted by Newgro <pe...@gmx.ch>.
Hi Thomas,

can you please explain this a bit. What do you mean by "session state". How
can i use session state in my context?

Cheers
Per
-- 
View this message in context: http://www.nabble.com/What-are-the-consequences-on-sharing-panels-between-pages--tp21772949p21787239.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: What are the consequences on sharing panels between pages?

Posted by Thomas Mäder <to...@gmail.com>.
Doesn't that sound like session state?

Thomas

On Sun, Feb 1, 2009 at 7:09 PM, Per Newgro <pe...@gmx.ch> wrote:

> Hi Uwe,
>
> until now i can do everything :-). All my experiments with ldm failed so
> far. I have to store the states. But in DB? It's heavyweight for me.
> Maybe i should try a cookie based solution.
>
> Thanks for your doubts
> Cheers
> Per
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Thomas Mäder
www.devotek-it.ch

Re: What are the consequences on sharing panels between pages?

Posted by Per Newgro <pe...@gmx.ch>.
Hi Uwe,

until now i can do everything :-). All my experiments with ldm failed so 
far. I have to store the states. But in DB? It's heavyweight for me.
Maybe i should try a cookie based solution.

Thanks for your doubts
Cheers
Per

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: What are the consequences on sharing panels between pages?

Posted by Uwe Schäfer <us...@thomas-daily.de>.
Per Newgro schrieb:

> i would like to share (instance reuse) a navigation panel in my page 
> flow. I try to achieve that so i can keep the current state of 
> navigation components. It's a clone of the windows xp sidebar in system 
> controls.

sounds awful. would not do that. being deserialized from the pagemap, 
you´ll end up with different instances if back navigation steps in, right?
couldn´t you extract your state into an appropriate object and reference 
it from both panels by using a LDM?

cu uwe

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org