When the tab changes, I would like to rerender a seam button based on the new tab selected. However, in the ontabchange event, the current tab is always the old tab not the new one. How can I access the new tab?
<rich:tabPanel id="myTabPanel" valueChangeListener="#{myPage.changeTab}" selectedTab="#{myPage.tab}" switchType="ajax">
<a4j:support event="ontabchange" reRender="edit"/>
<rich:tab id="tabInfo" label="info">
Info section
</rich:tab>
<rich:tab id="tabPreferences" label="Preferences">
Preferences section
</rich:tab>
</rich:tabPanel>
<s:button id="edit" value="Edit" view="edit.xhtml" disabled="#{not myPage.isEditable()}"/>
@Name ("myPage")
@Scope (ScopeType.CONVERSATION)
public class MyPage implements Serializable {
private String tab;
public String getTab() {
return tab;
}
public void setTab(String tab) {
this.tab = tab;
}
public void changeTab(ValueChangeEvent e) {
setTab((String) e.getNewValue());
}
public boolean isEditable() {
// These tabs have view and edit page combined
if (tab.equals("tabInfo")) {
return false;
}
return true;
}
}