Thursday, July 29, 2010

ADF UI Shell: Updating Title of the Current Tab

Sometimes you may wish to update the current tab title after some actions like saving a new record. You can do so through the following code inside your backing bean:
    public void updateCurrentTabTitle(String title) {
        TabContext tabContext = TabContext.getCurrentInstance();
        int currentTabIndex = tabContext.getSelectedTabIndex();
        Tab tab = tabContext.getTabs().get(currentTabIndex);
        tab.setTitle(title);
        //force refresh
        tabContext.setSelectedTabIndex(currentTabIndex);
    }
Be sure that you have defined a "tabContext" input parameter in your task flow definition so you can access the TabContext object.

1 comment:

  1. It solved a big trouble for me, very useful, thank you so much for sharing (Y)

    ReplyDelete