@Override
  protected void doDecode(FacesContext context, UIComponent component) {
    super.doDecode(context, component);

    UITab tab = (UITab) component;
    UITabPanel panel = tab.getPane();

    Map<String, String> requestParameterMap = context.getExternalContext().getRequestParameterMap();

    if (AjaxRendererUtils.isAjaxRequest(context)
        && tab.getSwitchTypeOrDefault().equals(UISwitchablePanel.AJAX_METHOD)
        && requestParameterMap.get(tab.getClientId(context)) != null) {

      // add toggle panel itself to rendered list of components
      AjaxRendererUtils.addRegionByName(context, panel, panel.getId());
      AjaxRendererUtils.addRegionsFromComponent(tab, context);

      AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
      Set<String> toProcess = ajaxContext.getAjaxAreasToProcess();
      if (toProcess == null) {
        toProcess = new HashSet<String>(1);
        ajaxContext.setAjaxAreasToProcess(toProcess);
      }
      toProcess.add(panel.getClientId(context));

      ajaxContext.addAreasToProcessFromComponent(context, tab);
    }
  }
  public String disableTab() {
    UITabPanel tabPanel = (UITabPanel) getTabPanel();
    Object value = tabPanel.getValue();
    if (value != null && value.equals(disabledTabName)) {
      List tabNames = getTabNames();
      int idx = tabNames.indexOf(value);

      int i = idx + 1;
      if (i >= tabNames.size()) {

        if (!tabNames.isEmpty()) {
          tabPanel.setValue(tabNames.get(0));
        }

      } else {
        tabPanel.setValue(tabNames.get(i));
      }
    }

    return null;
  }