You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sk...@apache.org on 2008/10/27 10:49:08 UTC

svn commit: r708119 - /myfaces/orchestra/trunk/flow/src/main/java/org/apache/myfaces/orchestra/flow/FlowHandler.java

Author: skitching
Date: Mon Oct 27 02:49:07 2008
New Revision: 708119

URL: http://svn.apache.org/viewvc?rev=708119&view=rev
Log:
Add support for new "viewId" property of a FlowCall, ie where the view to call is specified directly rather than in a JSF navigation-case.

Modified:
    myfaces/orchestra/trunk/flow/src/main/java/org/apache/myfaces/orchestra/flow/FlowHandler.java

Modified: myfaces/orchestra/trunk/flow/src/main/java/org/apache/myfaces/orchestra/flow/FlowHandler.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/flow/src/main/java/org/apache/myfaces/orchestra/flow/FlowHandler.java?rev=708119&r1=708118&r2=708119&view=diff
==============================================================================
--- myfaces/orchestra/trunk/flow/src/main/java/org/apache/myfaces/orchestra/flow/FlowHandler.java (original)
+++ myfaces/orchestra/trunk/flow/src/main/java/org/apache/myfaces/orchestra/flow/FlowHandler.java Mon Oct 27 02:49:07 2008
@@ -464,10 +464,36 @@
             // Store the flowInfo in the child context
             child.setAttribute("flowInfo", flowInfo);
 
-            // And let normal navigation occur. Hopefully the new page will be the entry-point
-            // for a flow, in which case we finish setting up the FlowInfo object then redirect
-            // to the flow entry point; see FlowViewHander.createView. If something goes wrong,
-            // then FlowViewHandler.createView will clean up.
+            String newViewId = flowCall.getViewId();
+            if (newViewId != null)
+            {
+                // The flowcall has directly specified a view to render.
+                ViewHolder viewHolder = new ViewHolder();
+                ViewHandler viewHandler = facesContext.getApplication().getViewHandler();
+                boolean isNewFlow = doNewFlowEntry(facesContext, viewHandler, viewHolder, flowInfo, newViewId);
+                if (isNewFlow == false)
+                {
+                    throw new OrchestraException("viewId specified in flowCall is not a flow entry point");
+                }
+                
+                if (viewHolder.root == null)
+                {
+                    redirectTo(facesContext, newViewId, flowInfo);
+                }
+                else
+                {
+                    // this is a modal flow; we need to re-render the current view, ie do a 
+                    // null navigation.
+                    return null;
+                }
+            }
+            else
+            {
+                // And let normal navigation occur. Hopefully the new page will be the entry-point
+                // for a flow, in which case we finish setting up the FlowInfo object then redirect
+                // to the flow entry point; see FlowViewHander.createView. If something goes wrong,
+                // then FlowViewHandler.createView will clean up.
+            }
         }
         
         return outcome;