Hi
You can do what you want creating a custom ViewHandler and overriding
createView(...) method like this:
@Override
public UIViewRoot createView(FacesContext context, String viewId)
{
UIViewRoot root = super.createView(context, viewId);
if (root != null)
{
FlowHandler flowHandler =
context.getApplication().getFlowHandler();
if (flowHandler.isActive(context, "", "flow1") &&
!viewId.startsWith("/flow1/"))
{
Flow flow = flowHandler.getFlow(context, "", "flow1");
flowHandler.transition(context, flow, null, null, viewId);
}
}
return root;
}
The code just check when the flow is active and if the view belongs to the
flow. If the navigation goes out of the flow it send a trasition ending the
flow.
Really this topic is being discussed under the EG, see:
https://java.net/jira/browse/JAVASERVERFACES_SPEC_PUBLIC-1253
Let's see what happen.
regards,
Leonardo Uribe
2014/1/18 Gerhard Petracek <[email protected]>
> hi geoffrey,
>
> just fyi (in addition to the answer from michael):
> that's one of the major use-cases we had for codi/deltaspike
> (grouped-)conversations.
> you can use a listener (or an observer for PreViewConfigNavigateEvent +
> custom view-config meta-data) which
> just calls (WindowContext#closeConversations in case of codi or
> GroupedConversationManager#closeConversations in case of deltaspike).
>
> regards,
> gerhard
>
> http://www.irian.at
>
> Your JSF/JavaEE powerhouse -
> JavaEE Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces
>
>
>
> 2014/1/18 Michael Kurz <[email protected]>
>
> > Hi,
> >
> > as far as I know, this is currently not possible. JSF won't let you
> > navigate to something that is not defined as a node in the current flow.
> I
> > quickly talked to Ed Burns about this some time ago and he more or less
> > confirmed that this is the case.
> >
> > Regards
> > Michael
> >
> > Am 17.01.2014 02:10, schrieb Geoffrey Longo:
> >
> > I have an application that consists of a dropdown menu bar with many
> menu
> >> items. Each menu item will initiate a new faces flow. This is working
> >> correctly, however, once I am inside a flow, I would like any click on a
> >> menu item to exit the current flow, and then start a new one. There are
> >> dozens of menu items in the application, so I was wondering if there is
> any
> >> way to have the current flow automatically exit when a menu item is
> clicked
> >> without having to define a flow-return for each menu item?
> >>
> >> Thanks,
> >> Geoff
> >>
> >>
>