You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Mazzanti Luca <ha...@hotmail.com> on 2008/02/18 11:23:28 UTC

comunication between panels

i have a question: how can i comunicate between panels in wicket?

my application contains a frameset of 2 pages, each of these has a
tabbedPanel containing many panels:
----------------structure--------------

                         APP
       PAGE1                         PAG2
panel panel panel        panel panel panel

---------------------------------------

what is a good solution?
MY solution is to:

1)extends WicketSession and implements get/set methods to retrieve insances
of these panels
2)use it:

   Panel donald = ( (MySession) panel.getSession() ).getPanel('donaldduck');

so i can retrieve insance of foo panel everywhere and use its public
methods.

IS A CORRECT SOLUTION?
and then... PUTTING PANELS INSTANCES IN SESSION is a bad implementation
about MEMORY AND wicket SERIALIZATION ?

There is a BEST SOLUTION? that i don't know
Thanks.

-- 
View this message in context: http://www.nabble.com/comunication-between-panels-tp15542127p15542127.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: comunication between panels

Posted by Ayodeji Aladejebi <al...@gmail.com>.
Panel A puts the state information in the session during Link.onClick()

Panel B uses Session.getSession() to retrieve the state information during
render()

this simple technique is what i use and its very efficient.


On 2/18/08, Ayodeji Aladejebi <al...@gmail.com> wrote:
>
> panels in session is a bad idea.
>
> Why not just keep the panel state information in the session and then let
> them just pull it from there when they instantiate?
>
>
> By the way, what are you trying to achieve with your panels cuz it is a
> bad idea to be stuffing up panels in your session when you can simply keep
> the state information the panels need there.
>
> If you instantiate a new Panel, the new Panel can call
> getSession().getInformationStateId(), pass that informationState to an
> IModel and then the Panel has whatever it needs
>
>
>
> On 2/18/08, Martijn Dashorst <ma...@gmail.com> wrote:
> >
> > WHY ARE YOU SHOUTING?
> >
> > Martijn
> >
> > On 2/18/08, Mazzanti Luca <ha...@hotmail.com> wrote:
> > >
> > > i have a question: how can i comunicate between panels in wicket?
> > >
> > > my application contains a frameset of 2 pages, each of these has a
> > > tabbedPanel containing many panels:
> > > ----------------structure--------------
> > >
> > >                          APP
> > >        PAGE1                         PAG2
> > > panel panel panel        panel panel panel
> > >
> > > ---------------------------------------
> > >
> > > what is a good solution?
> > > MY solution is to:
> > >
> > > 1)extends WicketSession and implements get/set methods to retrieve
> > insances
> > > of these panels
> > > 2)use it:
> > >
> > >    Panel donald = ( (MySession) panel.getSession()
> > ).getPanel('donaldduck');
> > >
> > > so i can retrieve insance of foo panel everywhere and use its public
> > > methods.
> > >
> > > IS A CORRECT SOLUTION?
> > > and then... PUTTING PANELS INSTANCES IN SESSION is a bad
> > implementation
> > > about MEMORY AND wicket SERIALIZATION ?
> > >
> > > There is a BEST SOLUTION? that i don't know
> > > Thanks.
> > >
> > > --
> > > View this message in context:
> > http://www.nabble.com/comunication-between-panels-tp15542127p15542127.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
> > >
> > >
> >
> >
> > --
> > Buy Wicket in Action: http://manning.com/dashorst
> > Apache Wicket 1.3.1 is released
> > Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.1
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
>
> --
> Aladejebi Ayodeji A.,
> DabarObjects Solutions
> Phone: +234 9 481 7 156
> Mobile: +234 803 589 1780
> Email: deji@dabarobjects.com
> Web: www.dabarobjects.com
> Blog: blog.dabarobjects.com
>
> Participate, Collaborate, Innovate
> Join Community:
> http://www.cowblock.net/
>
> Get A Free Blog:
> http://blogs.cowblock.net/




-- 
Aladejebi Ayodeji A.,
DabarObjects Solutions
Phone: +234 9 481 7 156
Mobile: +234 803 589 1780
Email: deji@dabarobjects.com
Web: www.dabarobjects.com
Blog: blog.dabarobjects.com

Participate, Collaborate, Innovate
Join Community:
http://www.cowblock.net/

Get A Free Blog:
http://blogs.cowblock.net/

Re: comunication between panels

Posted by Ayodeji Aladejebi <al...@gmail.com>.
panels in session is a bad idea.

Why not just keep the panel state information in the session and then let
them just pull it from there when they instantiate?


By the way, what are you trying to achieve with your panels cuz it is a bad
idea to be stuffing up panels in your session when you can simply keep the
state information the panels need there.

If you instantiate a new Panel, the new Panel can call
getSession().getInformationStateId(), pass that informationState to an
IModel and then the Panel has whatever it needs



On 2/18/08, Martijn Dashorst <ma...@gmail.com> wrote:
>
> WHY ARE YOU SHOUTING?
>
> Martijn
>
> On 2/18/08, Mazzanti Luca <ha...@hotmail.com> wrote:
> >
> > i have a question: how can i comunicate between panels in wicket?
> >
> > my application contains a frameset of 2 pages, each of these has a
> > tabbedPanel containing many panels:
> > ----------------structure--------------
> >
> >                          APP
> >        PAGE1                         PAG2
> > panel panel panel        panel panel panel
> >
> > ---------------------------------------
> >
> > what is a good solution?
> > MY solution is to:
> >
> > 1)extends WicketSession and implements get/set methods to retrieve
> insances
> > of these panels
> > 2)use it:
> >
> >    Panel donald = ( (MySession) panel.getSession()
> ).getPanel('donaldduck');
> >
> > so i can retrieve insance of foo panel everywhere and use its public
> > methods.
> >
> > IS A CORRECT SOLUTION?
> > and then... PUTTING PANELS INSTANCES IN SESSION is a bad implementation
> > about MEMORY AND wicket SERIALIZATION ?
> >
> > There is a BEST SOLUTION? that i don't know
> > Thanks.
> >
> > --
> > View this message in context:
> http://www.nabble.com/comunication-between-panels-tp15542127p15542127.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
> >
> >
>
>
> --
> Buy Wicket in Action: http://manning.com/dashorst
> Apache Wicket 1.3.1 is released
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.1
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Aladejebi Ayodeji A.,
DabarObjects Solutions
Phone: +234 9 481 7 156
Mobile: +234 803 589 1780
Email: deji@dabarobjects.com
Web: www.dabarobjects.com
Blog: blog.dabarobjects.com

Participate, Collaborate, Innovate
Join Community:
http://www.cowblock.net/

Get A Free Blog:
http://blogs.cowblock.net/

Re: comunication between panels

Posted by Martijn Dashorst <ma...@gmail.com>.
WHY ARE YOU SHOUTING?

Martijn

On 2/18/08, Mazzanti Luca <ha...@hotmail.com> wrote:
>
> i have a question: how can i comunicate between panels in wicket?
>
> my application contains a frameset of 2 pages, each of these has a
> tabbedPanel containing many panels:
> ----------------structure--------------
>
>                          APP
>        PAGE1                         PAG2
> panel panel panel        panel panel panel
>
> ---------------------------------------
>
> what is a good solution?
> MY solution is to:
>
> 1)extends WicketSession and implements get/set methods to retrieve insances
> of these panels
> 2)use it:
>
>    Panel donald = ( (MySession) panel.getSession() ).getPanel('donaldduck');
>
> so i can retrieve insance of foo panel everywhere and use its public
> methods.
>
> IS A CORRECT SOLUTION?
> and then... PUTTING PANELS INSTANCES IN SESSION is a bad implementation
> about MEMORY AND wicket SERIALIZATION ?
>
> There is a BEST SOLUTION? that i don't know
> Thanks.
>
> --
> View this message in context: http://www.nabble.com/comunication-between-panels-tp15542127p15542127.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
>
>


-- 
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.1 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.1

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


Re: comunication between panels

Posted by Thomas Lutz <ma...@gmx.at>.
Mazzanti Luca schrieb:
> i don't understand your phrase: 'why are you shouting'
> please repeate. 
>   
writing uppercase -> shouting

have a look at http://www.dtcc.edu/cs/rfc1855.html and search for 
shouting...

regards,
tom

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


Re: comunication between panels

Posted by Timo Rantalaiho <Ti...@ri.fi>.
On Mon, 18 Feb 2008, Mazzanti Luca wrote:
> on the left i have a page containg a wicket tree. on the right another page
> containing a panel.
> on click of a node in the tree, i need to send the object in the node to the
> panel ( called panel2 ) in the other page, and reload panel with new
> informations.
> 
> how can i do?
> onNodeClick i call my sessision, i retrieve the instance ( that i put into
> at panel2 initialization ) of panel2 and with it i call its method
> setItem(), then i reload it.

But what if you just share the tree instance between the two 
pages? 

Best wishes,
Timo

-- 
Timo Rantalaiho           
Reaktor Innovations Oy    <URL: http://www.ri.fi/ >

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


Re: comunication between panels

Posted by Mazzanti Luca <ha...@hotmail.com>.
thanks to all !
-- 
View this message in context: http://www.nabble.com/comunication-between-panels-tp15542127p15560363.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: comunication between panels

Posted by Martijn Dashorst <ma...@gmail.com>.
On 2/18/08, Mazzanti Luca <ha...@hotmail.com> wrote:
>
> i don't understand your phrase: 'why are you shouting'
> please repeate.

http://www.google.com/search?hl=en&client=safari&rls=en&q=using+uppercase+in+email+message&btnG=Search

-- 
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.1 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.1

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


Re: comunication between panels

Posted by Mazzanti Luca <ha...@hotmail.com>.
i don't understand your phrase: 'why are you shouting'
please repeate. 

sorry i don' have a very large vocaboulary. But please help me solving this.

the situation is:

on the left i have a page containg a wicket tree. on the right another page
containing a panel.
on click of a node in the tree, i need to send the object in the node to the
panel ( called panel2 ) in the other page, and reload panel with new
informations.

how can i do?
onNodeClick i call my sessision, i retrieve the instance ( that i put into
at panel2 initialization ) of panel2 and with it i call its method
setItem(), then i reload it.

it's correct? i m currently reading about 'Generic inter-component event
mechanism'
at https://issues.apache.org/jira/browse/WICKET-1312
-- 
View this message in context: http://www.nabble.com/comunication-between-panels-tp15542127p15542912.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: comunication between panels

Posted by Edward Yakop <ed...@gmail.com>.
On Feb 18, 2008 7:13 PM, Timo Rantalaiho <Ti...@ri.fi> wrote:
> On Mon, 18 Feb 2008, Mazzanti Luca wrote:
> > i have a question: how can i comunicate between panels in wicket?
>
> The normal Wicket way is to share models, pass references etc,
> but it has its limitations.
>
> You can find an example of a push-type mechanism here
>
>   https://issues.apache.org/jira/browse/WICKET-1312
>
> though it is done with just one page in mind.

This would be very cool if can be moved to 1.3.x release  as well.
This way, it would be possible to address
AjaxRequestTarget#addComponent in a more elegant way.

Regards,
Edward Yakop

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


Re: comunication between panels

Posted by Matthijs Wensveen <m....@func.nl>.
Timo Rantalaiho wrote:
> On Mon, 18 Feb 2008, Mazzanti Luca wrote:
>   
>> i have a question: how can i comunicate between panels in wicket?
>>     
>
> The normal Wicket way is to share models, pass references etc, 
> but it has its limitations. 
>
> You can find an example of a push-type mechanism here
>
>   https://issues.apache.org/jira/browse/WICKET-1312
>
> though it is done with just one page in mind.

This patch is almost what I want, cool!

A question though: When sharing models between components, or using 
PropertyModels on a shared model, I would like to have onModelChanged 
events when something in that model changes. That way Components that 
use the model could use the onModelChanged method to add themselves to 
the AjaxRequestTarget (using AjaxRequestTarget.get() or 
(RequestCycle.get().getRequestTarget() instanceof AjaxRequestTarget) in 
wicket-1.2.x). Unfortunalety onModelChanged is only called when a model 
or model object is explicitly set on a component.
Is there a way to make this more transparent? I was thinking along the 
lines of adding PropertyChangeSupport to all my model objects, but that 
would be very laborious. An aspect-oriented solution might do the trick too.
Any ideas?

Matthijs.

-- 
Matthijs Wensveen
Func. Internet Integration
W http://www.func.nl
T +31 20 4230000
F +31 20 4223500 


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


Re: comunication between panels

Posted by Timo Rantalaiho <Ti...@ri.fi>.
On Mon, 18 Feb 2008, Mazzanti Luca wrote:
> i have a question: how can i comunicate between panels in wicket?

The normal Wicket way is to share models, pass references etc, 
but it has its limitations. 

You can find an example of a push-type mechanism here

  https://issues.apache.org/jira/browse/WICKET-1312

though it is done with just one page in mind.

> MY solution is to:
> 
> 1)extends WicketSession and implements get/set methods to retrieve insances
> of these panels
> 2)use it:
> 
>    Panel donald = ( (MySession) panel.getSession() ).getPanel('donaldduck');

This seems strage to me, I wouldn't put Components to Session.

You might want to step back to think about what it is that 
you want to achieve, and maybe post here about the more 
general issue. Maybe there is a better solution for your 
real case than the panels of different pages communicating 
between each other.

> There is a BEST SOLUTION? that i don't know

No :)

  http://www.satisfice.com/blog/archives/27

_Best_ wishes,
Timo

-- 
Timo Rantalaiho           
Reaktor Innovations Oy    <URL: http://www.ri.fi/ >

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


Re: comunication between panels

Posted by Timo Rantalaiho <Ti...@ri.fi>.
On Mon, 18 Feb 2008, Mazzanti Luca wrote:
> ok i store in session only objects that contain the state of the page, and i
> pass it to the model of the page.

Wicket components (including Page) are stateful, you don't 
need to do that by yourself. To keep the state you just need
to use the same page instance.

> and for a treePanel, if i don't want to reload every time the tree, i can
> put the tree-model in the IModel of panel and at panel instantiation time
> retrieve the tree-model from session where i store it?

Them same here, just use the same Panel instance and its 
state will be stored transparently by Wicket.

Best wishes,
Timo

-- 
Timo Rantalaiho           
Reaktor Innovations Oy    <URL: http://www.ri.fi/ >

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


Re: comunication between panels

Posted by Mazzanti Luca <ha...@hotmail.com>.
ok i store in session only objects that contain the state of the page, and i
pass it to the model of the page.

what about PageState? i must watch WebPage source to find where is used and
i modify it to load only data that i really need or there's yet an
implementation of this that i can use?

and for a treePanel, if i don't want to reload every time the tree, i can
put the tree-model in the IModel of panel and at panel instantiation time
retrieve the tree-model from session where i store it?


-- 
View this message in context: http://www.nabble.com/comunication-between-panels-tp15542127p15543837.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