Home > Business > How-to Navigate In Bounded Task Flows

How-to Navigate In Bounded Task Flows

A visit subject on OTN is of how to programmaticallynavigate inside of restrained charge flows. The use box often is to perform navigationin form of a non-action event, similar to for instance a worth change event.

Three options we am wakeful of that developers can use to performnavigation in restrained charge flows. It is critical however to be unwavering notto free-for-all the ADF coordinator framework.

A coordinator not only navigates between pages – or views asit is referred to in ADFc – but it moreover keeps follow of states, that isespecially critical if restrained charge flows are used. The 3 options tonavigate in restrained charge flows are

    Replacingthe stream perspective port’s viewId

    Queuean action on a order component

    Inthe box of a region, reserve an eventuality on the zone component

The initial of thelisted options is to change the displayed viewId for a perspective port. A viewport in ADFc refers to the area displaying a view. This may be a region, or thebrowser window. The subsequent to ethics next changes the viewId is to currentview port

ControllerContextccontext = ControllerContext.getInstance();//set the viewId – the name of the perspective wake up to //go to – to displayString viewId = “EmployeesView”;ccontext.getCurrentViewPort().setViewId(viewId);

Be wakeful that this draw close however bypasses the JSFlifecycle. So you must be ensure – when using it – that not submitted datagets submitted before varying the viewId as all changes are getting dismissedwhen varying the viewId. So be unwavering when using this ethics dash in thecontext of an eventuality that is invoked by a part having its immediateproperty set to true. Another limitation of this answer is that you can onlynavigate to ocular targets. You cannot navigate to way or routeractivities. If you must be have a non-viewable targets addressed then a ofthe subsequent to options will work for you.

The second choice to programmatically perform navigation is to reserve an action eventuality on anavigation part that is displayed or dark (displayed = “false”*not* rendered=”false”) on the view.

privatevoid navigateByQueueAction() {   FacesContext fctx = FacesContext.getCurrentInstance();   UIViewRoot base = fctx.getViewRoot();   //client Id of symbol includes namingcontainer similar to id of region.    RichCommandButton symbol =            (RichCommandButton)root.findComponent(“r1:cb3″);   ActionEvent actionEvent = newActionEvent(button);   actionEvent.queue();}

The order symbol that the action eventuality is queued for hasthe navigation box tangible in its action property. If you wish t be flexible,then you conclude furious card navigation manners to the actions you wish to accessprogrammatically. The order symbol would be tangible as dark and deed as aproxy. If you follow a coding pattern in that furious card navigation manners areconstructed similar to WCRule, then all aim manage cases becomepredictable. E.g. to navigate to the “browseEmployees” perspective activity,developers would know that the furious card navigation rule is”browseEmployeesWCRule”.

The third choice is if you do not similar to the thought of adding a substitute order part on views,though you could try a order symbol in a page template to not have to increase iton all pages. In this box you reserve the action eventuality on the zone containingthe restrained charge flow. As you guessed, this choice is not existing for taskflows that are not displayed in a region.

Privatevoid navUsingQueueAction(ActionEvent actionEvent) { // the charge upsurge is contained in aregion, so let’s go and find it  UIComponent  comp = actionEvent.getComponent();          while(!(comp instanceof RichRegion)){      comp = comp.getParent();     }

  RichRegion rr = ((RichRegion) comp);           rr.queueActionEventInRegion(       createMethodExpressionFromString(“browseEmployeesWCRule”),     null, null, false, 0,0,PhaseId.INVOKE_APPLICATION);                }

The ethics on top of queues the furious card eventuality on the region,which means there is no need for you to increase dark order components to theviews to deed as a proxy. Instead you can – safely – pretence that there exists aninstance of Rich Region on the page that you can find from the part thatneeds to summon navigation. The queueActionEventInRegion way has thefollowing signature, so you comprehend the API

publicvoid queueActionEventInRegion(     javax.el.MethodExpressionactionExpression,     javax.el.MethodExpression launchListenerMethodExpression,     javax.el.MethodExpression returnListenerMethodExpression,     java.lang.Boolean useWindow,     java.lang.Integer windowWidth,     java.lang.Integer windowHeight,     javax.faces.event.PhaseId phaseId)

The small supporter way “createMethodExpressionFromString”used in the sample, is listed below

privateMethodExpression createMethodExpressionFromString(String s){    FacesContext fctx = FacesContext.getCurrentInstance();    ELContext elctx =fctx.getELContext();    ExpressionFactory exprFactory =          fctx.getApplication().getExpressionFactory();    MethodExpression methodExpr =exprFactory.createMethodExpression(                    elctx,                                  s,

                   null,                    new Class[]{});      lapse methodExpr; }

Using choice 2and 3 obviously has the ADFc coordinator conducting the navigation, ensuring allstate is recorded and information is getting submitted to refurbish the model. Option 1is if you take caring of vital model updates or ensure the refurbish model phaseis processed.

Quick Restore (version 1.0) [cd-rom & 3.5 Quick Restore (version 1.0) [cd-rom & 3.5" Diskette]








Share and Enjoy :

  • Print
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Yahoo! Buzz
  • Twitter
  • Google Bookmarks
  • Add to favorites
  • Google Buzz
  • Live
  • MySpace
  • Orkut
  • PDF
  • RSS

Related Articles

No related posts were found, so here's a consolation prize: ActiveVideo Networks Showcases CloudTV.

Recent Posts

   
Categories: Business Tags:

  1. No comments yet.