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 …..