Re-order UI Componets using managed bean in Oracle ADF

Requirement – Re ordering of UI component using java code. Seems to be little tricky.

Solutions – Well , yes you can achieve that.For example, you are working on UI design in which you need to display two table inside panelGroupLayout.

Table 1
Table 2

Now you want on some condition , it should be like

Table 2
Table 1

public void yourCustomMethod() {

        FacesContext facesContext = FacesContext.getCurrentInstance();
        UIViewRoot root = facesContext.getViewRoot();
        RichTable table1 = (RichTable)root.findComponent("table1");
        RichTable table2 = (RichTable)root.findComponent("table2");
        RichPanelGroupLayout pgl1 = (RichPanelGroupLayout)root.findComponent("pgl1");

        MoveChildComponentChange change = new MoveChildComponentChange(table2,pgl1,table1);

For more understanding read this –

Author – Ankit Gupta

Happy Coding with Techartifact …..

Master Detail iterations using tree component by managed bean

Requirement – Making sort of master detail iteration by selecting tree node and refresh another table in same page.

Solutions- This application is based on default HR schema. Using country view we are making an tree. When we select any of county node in tree, all location respective to countries will display to right side.Note- we don’t have any view link between both VO.

Drag drop countries VO as tree.

We have a view criteria in locationVO and we drag drop locationVO on to the page as table.
On country tree we have selecionListener , which return selected the current row of tree.Code is as below –

    public void selectionListener(SelectionEvent selectionEvent) {
        // Add event code here...
        invokeMethodExpression("#{bindings.CountriesView1_1.treeModel.makeCurrent}", Object.class, SelectionEvent.class, selectionEvent);
        RichTree tree = (RichTree)selectionEvent.getSource();
           TreeModel model = (TreeModel)tree.getValue();      
           //get selected nodes
           RowKeySet rowKeySet = selectionEvent.getAddedSet();
        Iterator rksIterator = rowKeySet.iterator();
        //Validating for single select only. Need to check for multiselect
        while (rksIterator.hasNext()) {
            List key = (List);
            JUCtrlHierBinding treeBinding = null;
            CollectionModel collectionModel = (CollectionModel)tree.getValue();
            treeBinding = (JUCtrlHierBinding)collectionModel.getWrappedData();            
            JUCtrlHierNodeBinding nodeBinding = null;
            nodeBinding = treeBinding.findNodeByKeyPath(key);
            Row rw = nodeBinding.getRow();
            String country = (String)rw.getAttribute("CountryId");
            Map pageFlowScope = ADFContext.getCurrent().getPageFlowScope();
             pageFlowScope.put("countryId", country);
            BindingContainer bindings = getBindings();
         OperationBinding ob1 = bindings.getOperationBinding("executeSearchVo");
           ob1.getParamsMap().put("country", country);
           Object result = ob1.execute();
           if (!ob1.getErrors().isEmpty()){
              List errorList = ob1.getErrors();
               System.out.println("ERROR IN VC EXECUTION");
            //g Capture and handle Error

In the above method we are calling a custom appModuleImpl method and passing parameter to viewCriteria to location VO.We are also doing PPR programmaticly.

custom method of executing view Criteria –

    public void executeSearchVo(String country) {
        System.out.println("hello ob1"+ country);
    ViewObjectImpl traineeVO = this.getLocationsView1(); //relaventVO
    traineeVO.setNamedWhereClauseParam("country", country); //bindVariable name and pass value


    traineeVO.executeQuery(); //executeVO with Criteria


That’s it. Now when you run the application it will look like as below –

You can download the sample application in below link.


you are done. Happy coding with Vinay Kumar in Techartifact.

Executing AmImpl method in managed bean in Oracle ADF | Techartifact

Requirement – Executing AmImpl method in managed bean in Oracle ADF

We can execute the AmImpl method in managed bean using following method.We can get the bindings object.

        BindingContainer bindings = getBindings();
        int checkListID =  ((BigDecimal)valueChangeEvent.getNewValue()).intValue();
       OperationBinding refreshChecklist = bindings.getOperationBinding("checklistQuery");//checklistQuery is method name in Applicationmoduleimpl file
        refreshChecklist.getParamsMap().put("checklistId", checkListID);  // checklistId is parameter for that method.

happy coding with techartifact