Programmatic Navigation in JSF/ADF | Techartifact

Requirement-How to programmatically navigate to next jsf page in taskflow.

Solution-

Following code show the sample code for navigating one jsf to another using code.

FacesContext context = FacesContext.getCurrentInstance();
context.getApplication().getNavigationHandler().handleNavigation(context,null,"controlflowcase");

Package: javax.faces.application.NavigationHandler

public abstract void handleNavigation(FacesContext context, String fromAction, String outcome)

Perform navigation processing based on the state information in the specified FacesContext,plus the outcome string returned by an executed application action.
Parameters:
context – The FacesContext for the current request.
fromAction – The action binding expression that was evaluated to retrieve the specified outcome,or null if the outcome was acquired by some other means.
outcome – The logical outcome returned by a previous invoked application action (which may be null)

happy coding with techartifact . 🙂

Programmatically showing the Popup in ADF | Techartifact

Requirment – To display popup in adf programmatic.

You have to display the popup on click of some button. Drag drop the af:popup in the page and bind the popup in the managed bean like screenshot

On the button , write a method on the action event.

   public void ShowPopup(ActionEvent actionEvent) {
             RichPopup.PopupHints hints = new RichPopup.PopupHints();
             this.getPopUp().show(hints);

    }

If you want to hide the popup..you can write like this

  public void HidePopup(ActionEvent actionEvent) {
             RichPopup.PopupHints hints = new RichPopup.PopupHints();
             this.getPopUp().hide();

    }
   

Creating new row of view object in ADF | Techartifact

Requirment – Creating new rows through the view object

Solution-Create a new view row by calling createRow() on the view object as shown in the following code snippet:

/**The createEmployee is a custom method defined in application
* module implementation class.
*/


public void createEmployee () {
//Get the view object
ViewObject employee= findViewObject("EmployeeVO");
// Create a row and fill in the columns.
Row row = employee.createRow();
row.setAttribute("Name", "Vinay");
row.setAttribute("EmpId", 1);
//Insert row in to the default row set
employee.insertRow(row);
}


You can also use createAndInitRow(AttributeList initVals) on the view object to create a new view row. This API allows you to initialize the row with an attribute list.