You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by zoran <je...@gmail.com> on 2010/08/03 23:12:56 UTC

How to send a Java object to the ModalWindow

Hi,

I used the approach described in
http://stuq.nl/weblog/2008-06-05/wicket-how-to-write-a-reusable-modal-window-popup
to create a ModalWindow panel with the input form. Everything works fine,
but I need to send a Java object instance to the panel before calling
selectModalWindow.show(target), so the panel can use the information to set
some form values and change the object after the form submit.

Can you suggest me how to make this?

Zoran
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-send-a-Java-object-to-the-ModalWindow-tp2312589p2312589.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: How to send a Java object to the ModalWindow

Posted by Iamuser <su...@gmail.com>.
Hello,

I know this is a long overdue thread, but could you please explain how you
did it?

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-send-a-Java-object-to-the-ModalWindow-tp2312589p4675862.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: How to send a Java object to the ModalWindow

Posted by zoran <je...@gmail.com>.
Thanks Martin,

>modalwindowcontent.setpropervalue(xx); 
That's what I have tried first, but for some reason it didn't worked than so
I started to work on some other more complex solution. 
Now I turned again to this simple idea and it works.

Zoran
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-send-a-Java-object-to-the-ModalWindow-tp2312589p2313867.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: How to send a Java object to the ModalWindow

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Hi!

> I'm using dynamic objects. In the first way based on the some event (e.g.
> tree node selection) I want to setup this MagicObject in home page, and then
> to show panel. Between these two there should be a call of getMagicObject()
> from the panel.
> How can I set this happen in appropriate moment?

I don't understand what you mean with appropriate moment if you do it
sequentially assuming there is only one thread operating.

> In the third example, I'm not sure how I can send a Model to the Panel. Can
> you give me some small example?

I can give you an example, but currently I don't exactly understand
your use-case. What is your use case?

Is the modal panel on home page? In that case home page is the one
that opens the modal panel so you can pass (set/constructor
argument/override getter) anything when you open the modal panel and
when you close the modal panel you can get the result if you need it.
If  it is a longer term data you can store it into the session.

A modal panel can be treated same way as any other wicket component,
label for example. How to pass model to label? Simply
new Label("wicket-id", dynamicModel);

For modal window it is the same. You create the modal window panel
when you open it. If you want to create the panel before opening it
then you must pass it a dynamicModel whose value is correct when it is
opened (it is set somewhere) or you must appropriately set it in the
open-event. What is the open event? Yes, it is when you call
modalWindow.show(); so you can then call
modalwindowcontent.setpropervalue(xx);

I hope this helps ;) If you give an exact use case I can answer more precisely.

**
Martin

>
> Thanks
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-send-a-Java-object-to-the-ModalWindow-tp2312589p2312657.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


Re: How to send a Java object to the ModalWindow

Posted by zoran <je...@gmail.com>.
Hi Martin,

I'm using dynamic objects. In the first way based on the some event (e.g.
tree node selection) I want to setup this MagicObject in home page, and then
to show panel. Between these two there should be a call of getMagicObject()
from the panel. 
How can I set this happen in appropriate moment?

In the third example, I'm not sure how I can send a Model to the Panel. Can
you give me some small example?

Thanks 
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-send-a-Java-object-to-the-ModalWindow-tp2312589p2312657.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: How to send a Java object to the ModalWindow

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
There are many ways. This is one way:

modalWindow.setContent(new MyPanel(modalWindow.getContentId()) {
   @Override
   public MagicObject getMagicObject() {
       return magicObject;
   }
});


Also you can just pass your java object as parameter to myPanel or if
it is dynamic you can wrap it into a Model.

**
Martin

2010/8/4 zoran <je...@gmail.com>:
>
> Hi,
>
> I used the approach described in
> http://stuq.nl/weblog/2008-06-05/wicket-how-to-write-a-reusable-modal-window-popup
> to create a ModalWindow panel with the input form. Everything works fine,
> but I need to send a Java object instance to the panel before calling
> selectModalWindow.show(target), so the panel can use the information to set
> some form values and change the object after the form submit.
>
> Can you suggest me how to make this?
>
> Zoran
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-to-send-a-Java-object-to-the-ModalWindow-tp2312589p2312589.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