@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);
    }
  }
 protected boolean shouldRenderTab(UITab tab) {
   String method = tab.getSwitchTypeOrDefault();
   return (tab.isActive() || !tab.isDisabled() && UISwitchablePanel.CLIENT_METHOD.equals(method));
 }