What type is the component state?
He he good question, for V3.2.2 it is:
protected DataComponentState componentState; // protected TreeState componentState;
import org.ajax4jsf.model.DataComponentState; @Name("treeController") @Scope(ScopeType.CONVERSATION) public class TreeController { protected DataComponentState componentState; // protected TreeState componentState; public DataComponentState getComponentState() { return componentState; } public void setComponentState(DataComponentState componentState) { this.componentState = componentState; } }
Two things:
1) I had to deploy the Richfaces jars in the .ear instead of the .war
2) All the state saving is done by Richfaces in calls to getComponentState, which returns a reference to the ComponentState object. setComponentState is only called once, during initialization. This was a source of confusion to me while debugging.
Francisco Peredo wrote on Dec 17, 2008 17:36:
Sadly, right now, it is impossible to control the expanded/collapsed state of the tree nodes from the bean model (but if could please vote for RF-4129 I'll be really nice of you)
You can do this in Richfaces V3.2.2 using the adviseNodeOpened attribute. See example here