Hi,
I figured that train is not my problem the fact that i want to use
navigation rules that do not excist already is a bigger problem. I
found ways to acces the navigation rules from the runtime
configuration, but these cannot be modified (i also do not really want
them to change here because this will influence navigation for all
users). Is there a way to modify the navigation rules such that
changes only apply to one session?
Thanks,
Jeroen Weijers
On Thu, Jul 24, 2008 at 5:03 PM, Jeroen Weijers
<[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have a train which uses navigation rules to navigate through pages
> from page1.jspx to page7.jspx, these all work fine (the rules and
> beans that are used to create this train are registered in
> faces-config.xml). At page 5 I want to present some information from a
> collection, for each of these items I want page 5 to be displayed once
> with the contents of the element. Unfortunately I am currently not
> able to do so, maybe there is a way to create navigation rules once I
> know how many pages I will have to present (I have this information
> available right before the first page of the train is loaded, so I can
> alter the navigation model).
>
> I tried to alter the model containing the page and the action leading
> to them at runtime, so that page 5 is loaded for example two times,
> but it never goes to page 5 for the second time (and I can also not go
> to page 6 or 7), basicly I am stuck at page 5 (I can go back).
>
> Does anyone know how I can do this. The collection is available in a
> session bean, and currently I try to modify the model from this
> session bean with the following code:
>
> FacesContext facesContext =
> FacesContext.getCurrentInstance();
> ExpressionFactory exp =
> facesContext.getApplication().getExpressionFactory();
> ValueExpression valueExpression =
> exp.createValueExpression(facesContext.getELContext(), "#{TrainBCS}",
> ProcessMenuModel.class);
> ProcessMenuModel menu = (ProcessMenuModel)
> valueExpression.getValue(facesContext.getELContext());
> ChildPropertyTreeModel train = (ChildPropertyTreeModel)
> menu.getWrappedData();
> ArrayList<NavigationItem> items =
> (ArrayList<NavigationItem>)train.getWrappedData();
> NavigationItem nav;
> int ces;
> ces = something.getItem().getCollection().size();
>
> for(int teller = 1; teller < ces; teller++)
> {
> nav = new NavigationItem();
> nav.setLabel("Page 5." + (teller +1));
> nav.setViewId("page5.jspx");
> nav.setOutcome("nav.page5");
> items.add(4 + teller, nav);
>
> }
>
> TrainBCS is the model of type
> org.apache.myfaces.trinidad.model.ProcessMenuModel.
>
> If it has to be a real subtrain that is fine for me, but if it can be
> integrated in the real train (as I tried here) I prefer this.
>
> Thanks,
>
> Jeroen Weijers
>