You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by jchappelle <jc...@4redi.com> on 2008/10/29 22:24:12 UTC

Saving panel state

I have some reused panels that have a custom built CollapsiblePanelHeader
component in them. I would like to save the boolean value of whether it is
collapsed or not within the Session object. I had it working for a while by
using a Map in the Session with the panel's classname as the key and the
boolean value as the value. This works mostly until you have a panel that is
reused in another page. Then it will share it's state with the other panel
of the same class.

I tried to use the getPath() method but since I am constructing my
CollapsiblePanelHeader in the constructor of the Panel, the parent of the
Panel component is null therefore I am only getting back the id of the Panel
which still causes many collisions(mainly because I have a BasePage that has
a <div wicket:id="bodyPanel"/> that gets replaced by other subclasses). 

Does anyone have any ideas of how to uniquely identify reused Panel
components? If not, is there a way that I can get the full path of the Panel
by calling getPath() from within its constructor?

Any help is greatly appreciated.

Josh
-- 
View this message in context: http://www.nabble.com/Saving-panel-state-tp20236203p20236203.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: Saving panel state

Posted by Igor Vaynberg <ig...@gmail.com>.
there are two ways.

either you keep a private final String
uuid=UUID.randomUUID().toString() in your collapsable panel, or you
use a model for the boolean value whose getobject lets you delay the
need to retrieve the boolean until render time.

-igor

On Wed, Oct 29, 2008 at 2:24 PM, jchappelle <jc...@4redi.com> wrote:
>
> I have some reused panels that have a custom built CollapsiblePanelHeader
> component in them. I would like to save the boolean value of whether it is
> collapsed or not within the Session object. I had it working for a while by
> using a Map in the Session with the panel's classname as the key and the
> boolean value as the value. This works mostly until you have a panel that is
> reused in another page. Then it will share it's state with the other panel
> of the same class.
>
> I tried to use the getPath() method but since I am constructing my
> CollapsiblePanelHeader in the constructor of the Panel, the parent of the
> Panel component is null therefore I am only getting back the id of the Panel
> which still causes many collisions(mainly because I have a BasePage that has
> a <div wicket:id="bodyPanel"/> that gets replaced by other subclasses).
>
> Does anyone have any ideas of how to uniquely identify reused Panel
> components? If not, is there a way that I can get the full path of the Panel
> by calling getPath() from within its constructor?
>
> Any help is greatly appreciated.
>
> Josh
> --
> View this message in context: http://www.nabble.com/Saving-panel-state-tp20236203p20236203.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
>
>

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