I am having issues combining the state of a tab panel with backing
bean managed selected tab. I want to be able to change the selected
tab from outside the tabbed pane. The problem I am running into is
that the tabbed pane sets the local value of the disclosed attribute
when the user clicks a tab. Once that is set, my EL expressions are no
longer used.

Example:

<tr:commandLink id="aLink" value="A">
  <t:updateActionListener property="#{bean.tab}" value="A" />
</tr:commandLink>
<tr:commandLink id="bLink" value="B">
  <t:updateActionListener property="#{bean.tab}" value="B" />
</tr:commandLink>

<tr:panelTabbed id="mytabs">
  <tr:showDetailItem disclosed="#{bean.tab eq 'A'}"
    disclosureListener="#{bean.tabASelected}">
    A
  </tr:showDetailItem>
  <tr:showDetailItem disclosed="#{bean.tab eq 'B'}"
    disclosureListener="#{bean.tabBSelected}">
    B
  </tr:showDetailItem>
</tr:panelTabbed>

public class Bean {
  private String tab = "A";
  public String getTab() { return this.tab; }
  public void setTab(String tab) { this.tab = tab; }
  public void tabASelected(DisclosureEvent evt) {
    if (evt.isExpanded) { this.tab = "A"; }
  }
  public void tabBSelected(DisclosureEvent evt) {
    if (evt.isExpanded) { this.tab = "B"; }
  }
}

Is there a way, without extending tr:showDetailItem to prevent the
tabbed panel from programmatically setting the disclosed property of
the tab, and letting my code using the disclosureListener properties
handle the selection?

Thanks,
Andrew

Reply via email to