[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-1289) Conversation Propagation andTrinidad Dialogs

Chris Hane (JIRA) jira-events at lists.jboss.org
Thu May 3 10:56:30 EDT 2007


    [ http://jira.jboss.com/jira/browse/JBSEAM-1289?page=comments#action_12361326 ] 
            
Chris Hane commented on JBSEAM-1289:
------------------------------------

I have attached two files that are modified to get Trinidad dialogs working.

These files work with Seam 1.2.1patch1, MyFaces 1.x and JBoss 4.0.4.  The MyActionListener is a subclass of a MyFaces class (so changes will be needed in order to work with the Sun JSF RI).

I have also hardcoded the name of the conversation parameter id (cid) in to the MyPhaseListener.  I believe this is the 1.2.1p1 default.

There is a complete working example at:
http://sourceforge.net/project/showfiles.php?group_id=189858

See the TestApp download

The large files size is due to the included libraries.  There are only a 10 small files to look at:

 - MyActionListener
 - MyPhaseListener
 - faces-config.xml
 - 4 .xthml (index / main / main2 / chooseNumber_dlg)
 - 3 SLSB (Main, DialogManager, ChooseNumber)

Chris....

> Conversation Propagation andTrinidad Dialogs
> --------------------------------------------
>
>                 Key: JBSEAM-1289
>                 URL: http://jira.jboss.com/jira/browse/JBSEAM-1289
>             Project: JBoss Seam
>          Issue Type: Feature Request
>          Components: JSF
>    Affects Versions: 1.2.1.GA
>         Environment: JBoss 4.0.4GA
>            Reporter: Brian Smith
>         Assigned To: Pete Muir
>            Priority: Minor
>         Attachments: MyActionListener.java, MyPhaseListener.java
>
>
> Seam does not automatically support Trinidad's dialog feature in terms of propagating long running conversations to the dialog window.  
> Forum User dajevtic has provided a custom phase listener and action listener to enable propagation but it requires a specific naming convention for the dialog page.  It would be nice to enable support directly using standard Seam notation like the s:conversationPropagation tag or @Begin(join = true)
> Here are the relevant phase listener and action listener
> *Phase Listener*
> 	private static final String CONVERSATION_ID_SESSION_PARAMETER = "conversationId";
> 	
> 	private Map createParameterMapForConversationRestore(String conversationId) {
> 		Map paramterMap = new Hashtable();
> 		paramterMap.put(CONVERSATION_ID_SESSION_PARAMETER, conversationId);
> 		return paramterMap;
> 	}
> 	
> 	private void restoreConversation(Context context) {
> 		if (context.isSet(CONVERSATION_ID_SESSION_PARAMETER)) {
> 			String convId = context.get(CONVERSATION_ID_SESSION_PARAMETER).toString();
> 			Manager.instance().restoreConversation(createParameterMapForConversationRestore(convId));
> 			context.remove(CONVERSATION_ID_SESSION_PARAMETER);		
> 		}
> 	}
> 	
> 	public void afterPhase(PhaseEvent event) {
> 		try {
> 			if (event.getPhaseId().equals(PhaseId.RESTORE_VIEW)) {
> 				UIViewRoot root = event.getFacesContext().getViewRoot();
> 				if (root != null) {
> 					String viewId = root.getViewId();
> 					if ((viewId != null) && viewId.endsWith("_dlg.jspx")) {
> 						restoreConversation(Contexts.getSessionContext());
> 					}
> 				}
> 			} else {
> 				log.info("after " + event.getPhaseId());
> 			}
> 		} catch (Exception e) {
> 			log.error("Could not restore Seam conversation", e);
> 		}
> 	}
> *Action Listener*
> 	public void processAction(ActionEvent actionEvent)
> 			throws AbortProcessingException {
> 		if (actionEvent.getComponent() instanceof CoreCommandLink) {
> 			CoreCommandLink link = (CoreCommandLink)actionEvent.getComponent();
> 			if (link.isUseWindow()) {
> 				Contexts.getSessionContext().set("conversationId", Manager.instance().getCurrentConversationId());
> 			}
> 		}
> 		super.processAction(actionEvent);
> 	}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list