-
1. Re: Seam Conversation & Multiple Windows
lvdberg Jun 8, 2009 4:36 PM (in response to holgerprause)Hi Holger,
If I understand your question well you want to use different windows for the same session. This is supported
out-of-the-box
without anyy effort from your side. When you use the s:link tag the conversation is automatically added and used in your new window.You can also have multiple converations and switch fom one to the other.The way to use this is explained very well in the documentation. The seam distribution has a complete range of simple and more complex examples which you could use to
cut-and-paste
your application together.You could also use the Seam in Action book from Manning. This book goes in more detail in how to do this.
Good luck!
Leo
-
2. Re: Seam Conversation & Multiple Windows
holgerprause Jun 8, 2009 4:57 PM (in response to holgerprause)Hi well i failed again explaining my issue.
Well what works out of the box is using different (browser)windows for the same session.
Well what i want to do is using different _pop-up_ windows for the same session.
That means instead having multiple browser windows/tabs i want to have multiple popup-windows in the same browser window.
From my point of view its the same like having multiple browser windows - only the presentation is different.
The problem i run into with this approach is that i dont know which conversation belongs to which popup window(and reacting on action from that popup-window becourse they all belong to the same browser window / conversation).
So i thought i need "named" conversation and to associate them with my popup window.
But too much is unclear to me right now.I just want to know if my idea could be realized with seam
"You can also have multiple converations and switch fom one to the other.The way to use this is explained very well in the documentation."
Well thx for your advise ill take a look into seam workspace management.
-
3. Re: Seam Conversation & Multiple Windows
lvdberg Jun 8, 2009 5:08 PM (in response to holgerprause)Ok,
now I get your point, I think it should work perfectly because all pop-ups originate from the same session. The only problem I see is if you want to use the same component in the different windows. In that case you should define different roles for each component.
I have repeated this simple butr very effective trick a number of times. Put simple logging in create and destroy methods. In this way you can
see
what is happening under the hood. Seam is veryaggresive
in its management of instances and it deletes an out-of-scope component in a sec. Logging helps detecting this behaviour.Success,
Leo
-
4. Re: Seam Conversation & Multiple Windows
holgerprause Jun 8, 2009 5:41 PM (in response to holgerprause)Hi, thx for your time and your reponse.
now I get your point, I think it should work perfectly because all pop-ups originate from the same session.I think that too.
The only problem I see is if you want to use the same component in the different windowsI get around this with a custom form renderer.
The
only
problem i got is - like i already said , giving each window an own conversation and associating with it.@In @Out Person person .. .. .. @Begin public String loadPerson(person_id) { person = myDataBase.find(Person.class, person_id); } public void debugCurrentPerson() { log.info("current person: "+person); }
now from my view(in a popup window) <a4j:commandLink action="#{MyBean.debugCurrentPerson}" -> i have 2 popup window -> if i click on this link from 2 popup windows - both actions outputs the same username(the last loadded person) but it should be 2 different persons , 1 for each popup(conversation).
I think that becourse both objects were loaded from the same browser window and are associated with the same conversation?
That where i have understanding problems.Do i need to tell my a4j:commandLink explicitly which conversation to use and how to do this?
Thx very much
-
5. Re: Seam Conversation & Multiple Windows
lvdberg Jun 8, 2009 6:02 PM (in response to holgerprause)Holger,
you should give the component a conversation scope and be sure that there are different conversations attached to each popup. Seam should give each windoww its own instance of the component.
Leo
-
6. Re: Seam Conversation & Multiple Windows
holgerprause Jun 8, 2009 6:14 PM (in response to holgerprause)Hi
and be sure that there are different conversations attached to each popupThats my big problem becourse i dont know how to do this.All my object seems to be in the same conversation.
Can u give me some hint or (pseudo) code how to archiev this(or some hint where to read about this)?
Seam should give each windoww its own instance of the component.That would be wonderfull!
thx very much
-
7. Re: Seam Conversation & Multiple Windows
lvdberg Jun 8, 2009 6:21 PM (in response to holgerprause)On your component: @Scope(ScopeType.CONVERSATION) and @Begin(nested=true)
You can do the same from a page definition or directly in the s:link -tag.
Leo
-
8. Re: Seam Conversation & Multiple Windows
holgerprause Jun 8, 2009 6:41 PM (in response to holgerprause)Ill give it a try- thx for helping me understanding conversations.
Its good to know that what i am trying to do is possible and supported(theoretically) by seam. -
9. Re: Seam Conversation & Multiple Windows
holgerprause Jun 8, 2009 7:35 PM (in response to holgerprause)Thx Leo!
Hi - well i think i understood it now - what i have achieved1) open multiple popupwindow(its an overlay) on the page
2) start a conversation for every popupwindow
3) switch between conversations with seam workspace management (only for testing and understanding)Now theres only 1 thing to do :
How do i tell my a4j:commandLink which conversation he should use?(not the current one - remember we have multiple popup-windows opened at this time and every one has its own conversation - which is just great)
Speaking more general i need to tell my my jsf action what conversation to use(the one which was started for this popup-window and in which the command link is).Can u give me hint on this or where to find information on this.
Thx very much until here, you really helped me a lot. -
10. Re: Seam Conversation & Multiple Windows
lvdberg Jun 8, 2009 8:22 PM (in response to holgerprause)Hi Holger,
You can switch between conversations (workspaces), and use a select bos to switch between the available ones.
I've have a prototype somewhere, but I am not at the office right now, so i can't look it up. But it should be explained in the documentation.
Leo
-
11. Re: Seam Conversation & Multiple Windows
gonorrhea Jun 9, 2009 6:15 AM (in response to holgerprause)popups in Seam are usually rich:modalPanel components and thus you can't show more than one popup simultaneously.
See my recent thread about multiple modalPanel forms and submissions and persistence, etc. It gets complicated when you have multiple forms in one LRC that are updateable/insertable...
-
12. Re: Seam Conversation & Multiple Windows
holgerprause Jun 9, 2009 11:08 AM (in response to holgerprause)Hi
rich:modalPanel components and thus you can't show more than one popup simultaneously.Becourse of that i wrote my own popup component and it works pretty well.
Now i want to have multiple of that popups and associate them with a conversation.It works with multiple forms etc(got a custom form and vie renderer) only missing thing is telling my commandLink
in which conversation they are so they dont take the last active. -
13. Re: Seam Conversation & Multiple Windows
holgerprause Jun 11, 2009 4:56 PM (in response to holgerprause)
only missing thing is telling my commandLink in which conversation they arejust put <s:conversationId /> on the a4j:commandLink.
All fine now - thx for your help and suggestions - helped me finding this solution
-
14. Re: Seam Conversation & Multiple Windows
zaquas Oct 7, 2010 3:02 AM (in response to holgerprause)Hi Holger, nice post!
I've the same problem, unfortunately I do not know how you did it to start different conversations for different windows, can you give me some snippet of code?
Thanks in advance.