Handling OK and Cancel button in af:dialog using popup in Oracle ADF by dialogListener

Requirement – We are displaying a popup message to user and on selecting on OK and CANCEl by user , writing custom code inside bean

Solution – You can have af:popup component in the page .Inside the popup , drag drop af:dialog component. You can call the pop up programmatic using my
another post of popup

For the dialog , you need to have some dialog listener. write it like

<af:dialog title="handling Ok and cancel event}"
           type="okCancel"
           dialogListener="#{techartifact.headerManage.dialogListener1}"
           id="d1">

The method of dialogListener1 can be written as below.Write inside a headerManage bean.

public void dialogListener1(DialogEvent dialogEvent)
  {
    if (dialogEvent.getOutcome() == DialogEvent.Outcome.ok)
    {
     // write your custom code for ok event
    } else
    {
      // write your custom code for cancel event
   } 
  }

Happy coding with techartifact….

Refreshing child node in the tree in ADF

Requirement – To refresh the tree child node. Executing the top level view object instance alone is not enough. This is because when you expand a parent node, if the
framework identifies any existing query collection for the row filter supplied by the parent row, the existing query collection cache will be reused for displaying
child nodes. To refresh specific child nodes, you will have to find the appropriate child row set and refresh it by calling the executeQuery() method.

For example. We have displaying country in tree node. In Child node we are displaying the states. For we will taking out the country id and fetch the row on basis of countryID and get the rowset
and call executeQuery() method and it will refresh the child node as well.

Below is the code.

public void refreshChildStates(Number CountryId) {
//Gets the VO used for parent node
ViewObjectImpl vo = getCountry();
//Read the row using Key CountryId
Row[] countryRow= vo.findByKey(new Key(new Object[] { CountryId}), 1);
RowSet childRows =
(RowSet)stateRow[0].getAttribute("States")';
childRows.executeQuery();
}

Happy coding with Techartifact…