title: RichFaces tabPanel with switchType ajax and a4j:status
body: <h2>What I try to achieve</h2>
  
  <p>I've got a <code>rich:tabPanel</code> with <code>switchType="client"</code> and one of the tabs has set its <code>switchType</code> to <code>ajax</code> because loading its data is an expensive operation. When I click on this <em>Ajax Tab</em> I want its title to be changed to <em>Loading...</em> to indicate that the click has been recognized. When it has finished loading, the title should switch back to <em>Ajax Tab</em>. </p>
  
  <pre><code>[Client Tab] [Ajax Tab]
  &lt;click on 'Ajax Tab'&gt;
  [Client Tab] [Loading...]
  &lt;wait...&gt;
  [Client Tab] [Ajax Tab]
  &lt;click on 'Client Tab'&gt;
  [Client Tab] [Ajax Tab]
  </code></pre>
  
  <h2>Problem description</h2>
  
  <p>Actually, most of the described above works as expected, the only problem I have is, that when I navigate from the <em>Ajax Tab</em> to any other tab, the title of the <em>Ajax Tab</em> switches back to <em>Loading...</em>:</p>
  
  <pre><code>[Client Tab] [Ajax Tab]
  &lt;click on 'Ajax Tab'&gt;
  [Client Tab] [Loading...]
  &lt;wait...&gt;
  [Client Tab] [Ajax Tab]
  &lt;click on 'Client Tab'&gt;
  [Client Tab] [Loading...]
  </code></pre>
  
  <h3>Research</h3>
  
  <p>I've found an issue in <a href="https://issues.jboss.org/browse/RF-3201" rel="noreferrer">RichFaces' JIRA</a> but this issue is fixed since version 3.2.1. Furthermore I've googled for a few hours but wasn't able to find any similar problems.</p>
  
  <h3>Environment</h3>
  
  <ul>
  <li>Tomcat 7.0.30</li>
  <li>Mojarra 2.1.12</li>
  <li>RichFaces 4.2.2.Final</li>
  </ul>
  
  <h2>Code (reduced)</h2>
  
  <h3>JSF</h3>
  
  <pre><code>&lt;ui:composition template="WEB-INF/templates/default.xhtml"&gt;
      &lt;ui:define name="content"&gt;
          &lt;h:form id="form"&gt;
              &lt;rich:tabPanel id="tabPanel" switchType="client"&gt;
                  &lt;rich:tab id="clientTab"&gt;
                      &lt;f:facet name="header"&gt;
                          &lt;h:outputText value="Client Tab" /&gt;
                      &lt;/f:facet&gt;
                      &lt;h:outputText value="Foo" /&gt;
                  &lt;/rich:tab&gt;
                  &lt;rich:tab id="ajaxTab" switchType="ajax" status="ajaxTabStatus"&gt;
                      &lt;f:facet name="header"&gt;
                          &lt;a4j:status id="ajaxTabStatus"&gt;
                              &lt;f:facet name="start"&gt;
                                  &lt;h:outputText value="Loading..." /&gt;
                              &lt;/f:facet&gt;
                              &lt;f:facet name="stop"&gt;
                                  &lt;h:outputText value="Ajax Tab" /&gt;
                              &lt;/f:facet&gt;
                          &lt;/a4j:status&gt;
                      &lt;/f:facet&gt;
                      &lt;h:outputText value="#{bean.value}" /&gt;
                  &lt;/rich:tab&gt;
              &lt;/rich:tabPanel&gt;
          &lt;/h:form&gt;
      &lt;/ui:define&gt;
  &lt;/ui:composition&gt;
  </code></pre>
  
  <h3>Backing Bean of Ajax Tab</h3>
  
  <pre><code>@ManagedBean
  @ViewScoped
  public class Bean implements Serializable {
  
      private static final long serialVersionUID = -8405248908693334970L;
  
      private String value = "noValue";
  
      private static final Logger log = LoggerFactory.getLogger(Bean.class);
  
      @PostConstruct
      public void init() {
          log.info("Init bean.");
          value = getDummyValueWithFakeDelay();
      }
  
      public String getValue() {
          log.info("Get value.");
          return value;
      }
  
      private String getDummyValueWithFakeDelay() {
          try {
              Thread.sleep(1000);
          } catch (InterruptedException ex) {
          }
  
          return DateFormat.getTimeInstance().format(new Date());
      }
  }
  </code></pre>
  
  <h2>Update 1:</h2>
  
  <p>I've found out that the identifier (i mean that one you specify like <code>&lt;rich:someTag ... status="someStatus" /&gt;</code>) of an <code>a4j:status</code> is not its <code>id</code> but its <code>name</code> attribute. So my <code>a4j:status</code> is just for <em>every</em> Ajax request on that page. Giving it a name and using this named status does not work though, because nothing at all happens now.</p>
  
  <pre><code>&lt;rich:tab id="ajaxTab" switchType="ajax" status="ajaxTabStatus"&gt;
      &lt;f:facet name="header"&gt;
          &lt;a4j:status id="ajaxTabStatus" name="ajaxTabStatus"&gt;
              &lt;f:facet name="start"&gt;
                  &lt;h:outputText value="Loading..." /&gt;
              &lt;/f:facet&gt;
              &lt;f:facet name="stop"&gt;
                  &lt;h:outputText value="Ajax Tab" /&gt;
              &lt;/f:facet&gt;
          &lt;/a4j:status&gt;
      &lt;/f:facet&gt;
      &lt;h:outputText value="#{bean.value}" /&gt;
  &lt;/rich:tab&gt;
  </code></pre>
  
  <h2>Update 2:</h2>
  
  <p>I've also found another approach, using <code>onbegin</code> and <code>oncomplete</code> attributes with some code like: </p>
  
  <pre><code>&lt;rich:tab id="ajaxTab" switchType="ajax"
      onbegin="#{rich:component('ajaxTab')}.?"
      oncomplete="#{rich:component('ajaxTab')}.?"&gt;
  </code></pre>
  
  <p>Well, as you see, I haven't found a way to manipulate the tab title yet (and I didn't find any useful documentation of what I can do with a rich:component).</p>