This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.
So, just to make sure I understand what you want, you need some kind of widget on the page which tracks and displays where the user has been in the application, in case they want to go back.
As for the widget itself, you'll likely need to implement it yourself with whatever other framework you're using with SWF (like JSF, or Spring MVC).
On the SWF side, you'll need to define your flow so that each page where the breadcrumbs might display have transitions to the other view states reachable by the breadcrumbs widget. This is not a trivial thing. It would help if you limited the scope of your breadcrumbs to a common use case or flow.
For example, you might have a logical flow involving 5 distinctive screens, where screen 1 proceeds to screen 2 etc. in order. You may want breadcrumbs available so the user knows he is in a process involving a number of steps, complete with the names of the steps, and the ability to go back to any previous step (or just the last step, depending on your implementation). This wouldn't be too hard to support with Spring Web Flow. You'll just need to add the appropriate transitions on your view-states, or a mix of global transitions and flow inheritance, if your view-states are in separate subflows.
In any case, this will be much easier to implement than, say, universal breadcrumb support for all pages throughout your app, since at that point you're essentially allowing free browsing to almost any other page, which defeats the purpose of using Spring Web Flow. If this is your goal, then you may want to skip SWF, since it's not the right tool for the job.
We have complex subflows and view state in those subflows. We want users to know that they are at a perticular step and there are other steps to follow - to finish a single transaction.
Meaning when they are in step 1 - we want to let them know that the Flow involves 5 Steps and the details of those steps (name of the step)
Now those steps, which are view state, are in different subflows.
I am not sure how we would use some global-transition, flow inheritance to dynamically construct a breadcrumb trail.
I have not been using SWF for the last year or so, so I won't be able to help you much with this.
Here's the thing. That breadcrumb listener in the article is likely not going to give you what you want. All it does is take each and every view-state and keep appending it while you're within a conversation, doing just a little cleanup when you reach the same view-state again. It won't show you the states you have yet to reach. It won't take care of fixing state for you if you require some kind of cleanup or logic in response to jumping back to previous states in the breadcrumbs list. So it's good at what it does in simple circumstances, but it is still limited in some ways. Especially across subflows, as you can't simply jump to a view-state in a different subflow, and even if you COULD, you would likely be skipping important actions and action-states that would lead to incorrect application behavior.
Others may be able to give you better, more magical solutions which might be able to programatically jump you instantly to the previous states you want.
The solutions I'm thinking of aren't really giving you any shortcuts. It's still navigating to your previous breadcrumbs via the same transitions and end-states and subflow-states that you use for regular flow navigation. You'll need a custom object to keep track of the possible states (likely hard-coded, per your requirements) and the current state, and expose methods to change which one is current, calling them at the appropriate points (usually on-entry) of the view-states corresponding with each step/breadcrumb. You'll need a ui component to include on each page to display the information in that breadcrumbs object in the way you wish, styling the previous, current, and future steps. Keep in mind, for this custom object, when I say "states" I'm not talking about SWF states. I'm talking about the logical named states (or steps) of the five steps you in your widget. So when I say that it keeps track of possible states and current state and has the ability to change the state, I'm really talking about the different steps in your breadcrumbs. You could implement this with a list of strings and an index to the selected state/step.
That takes care of display for your breadcrumbs. I wasn't clear if you needed just display of the breadcrumbs, or the ability to jump back to previous states. If you need that ability to navigate back, then it's still a manual solution. You WILL need to provide the appropriate transitions and end-states and such to get you from where you are to where you are trying to go. It's just a matter of defining your transitions in a consistent way, and if necessary using flow-inheritance (usually pairing global-transitions with end-states, according to the names of the breadcrumb transitions) to provide functionality without having to repeat yourself in each flow where you need it.
For example, if you had a flow, and you had 5 subflows which each contained the view-states associated with the steps you want in your breadcrumbs, then (after you created your custom breadcrumbs object, and hooked it up so it displays correctly in each of those states), you would need to implement your breadcrumbs navigation. If subflow 1 is your first step, then there are no navigation options you will need. Subflow 2 will need a way to transition to an end-state, and from there (the subflow-state) transition back to subflow 1. Subflow 3 will need similar ways for it to end and transition to either subflow 1 or 2. Subflow 4 will have to have a way to transition to its previous three subflow-siblings. And finally subflow 5 has to have transitions in place to jump to subflows 1 through 4. You will need to decide upon the names of each of these 4 transitions (the ones that will hit steps 1 through 4 respectively).
Then maybe you'll create a few flows designed for inheritance. You'd start with a flow that only has a global-transition and an end-state, each named for the transition that is supposed to hit the first step in your breadcrumbs. This is the flow that will be used as the parent-flow of subflow 2, so that when the transition is triggered within the second step of the breadcrumbs, it will pop (end) the current subflow. Then you just add the transition from subflow-state 2 to subflow-state 1.
You would do the same for your next subflow-state, but create an additional flow to handle the transition to your second step. And then it's your choice whether to have your flow associated with subflow 2 inherit BOTH of those parent flows (allowing transitioning to step 1 or 2), or make that second flow (the one that transitions to step 2) inherit the flow that handles the global transition to step 1.
And you'd continue on in the same manner. When you're finished, you've got "stacking" flows of global transitions and end-states, allowing your fifth flow to transition back to ANY of the previous steps, and your fourth to transition back to the previous 3 steps, and so on.
So yeah. Nothing magic. Just dealing with the plumbing of the transitions to allow you to get to where you want in a consistent way without repeating yourself.
Last edited by InverseFalcon; Mar 15th, 2012, 02:04 AM.
Reason: Clarifying my use of "state" in the breadcrumbs widget