You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by nunofaria11 <nu...@gmail.com> on 2012/05/15 19:57:42 UTC

Changing values by reference in child components... is it possible?

Hi everyone,

I am fairly new to Wicket, and probably my question has more to do with Java
than with Wicket, but still I'd like to get some feedback if thats ok.

Lets say that I have a Panel "B" inside a Panel "A"; panel B receives a
parameter from A

PanelA(id)            { ... add(new PanelB("B", someVar)) ... }

PanelB(id, someV) { ... someV = anotherValue ... }

what is the best way to communicate to A that the value was changed in B.

I though of using the following: Ajax and AtomicReferences.
Does anyone have any opinion?

Thanks


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Changing-values-by-reference-in-child-components-is-it-possible-tp4635008.html
Sent from the Users forum 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: Changing values by reference in child components... is it possible?

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

The suggested usage of a IModel is just like using
java.util.concurrent.atomic.AtomicReference.

On Wed, May 16, 2012 at 10:38 AM, nunofaria11 <nu...@gmail.com> wrote:
> Great, Thanks for your reply.
>
> I've looked into it but I didn't find any practical examples of this
> specific case.
> Can you point me some links or some code on how the model is used outside
> and inside the panel.
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Changing-values-by-reference-in-child-components-is-it-possible-tp4635008p4641021.html
> Sent from the Users forum 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
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

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


Re: Changing values by reference in child components... is it possible?

Posted by nunofaria11 <nu...@gmail.com>.
Actually I was able to do it. It turned out to be pretty simple; very much
like the pseudocode Sven posted.
Thanks

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Changing-values-by-reference-in-child-components-is-it-possible-tp4635008p4641422.html
Sent from the Users forum 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: Changing values by reference in child components... is it possible?

Posted by nunofaria11 <nu...@gmail.com>.
Great, Thanks for your reply.

I've looked into it but I didn't find any practical examples of this
specific case.
Can you point me some links or some code on how the model is used outside
and inside the panel.


--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/Changing-values-by-reference-in-child-components-is-it-possible-tp4635008p4641021.html
Sent from the Users forum 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: Changing values by reference in child components... is it possible?

Posted by Sven Meier <sv...@meiers.net>.
Use Wicket's models:

PanelA(id) { ... add(new PanelB("B", someVarModel)) ... }

PanelB(id, someVarModel) { ... someVarModel.setObject(anotherValue) ... }
  

Sven


On 05/15/2012 07:57 PM, nunofaria11 wrote:
> Hi everyone,
>
> I am fairly new to Wicket, and probably my question has more to do with Java
> than with Wicket, but still I'd like to get some feedback if thats ok.
>
> Lets say that I have a Panel "B" inside a Panel "A"; panel B receives a
> parameter from A
>
> PanelA(id)            { ... add(new PanelB("B", someVar)) ... }
>
> PanelB(id, someV) { ... someV = anotherValue ... }
>
> what is the best way to communicate to A that the value was changed in B.
>
> I though of using the following: Ajax and AtomicReferences.
> Does anyone have any opinion?
>
> Thanks
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/Changing-values-by-reference-in-child-components-is-it-possible-tp4635008.html
> Sent from the Users forum 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