navigator.resetLastElement();
}
public void processAdvisors(FacesContext context, TreeRowKey rowKey) throws IOException {
TreeState componentState = (TreeState) tree.getComponentState();
TreeStateAdvisor stateAdvisor = (TreeStateAdvisor)tree.getStateAdvisor();
if (null == stateAdvisor) {
if (null == methodBindingAdvisor) {
methodBindingAdvisor = new TreeStateAdvisor() {
public Boolean adviseNodeOpened(UITree tree) {
MethodBinding adviseNodeOpened = tree.getAdviseNodeOpened();
if (null != adviseNodeOpened) {
return (Boolean) adviseNodeOpened.invoke(FacesContext.getCurrentInstance(), new Object[] {tree});
}
return null;
}
public Boolean adviseNodeSelected(UITree tree) {
MethodBinding adviseNodeSelected = tree.getAdviseNodeSelected();
if (null != adviseNodeSelected) {
return (Boolean) adviseNodeSelected.invoke(FacesContext.getCurrentInstance(), new Object [] {tree});
}
return null;
}
};
}
stateAdvisor = methodBindingAdvisor;
}
Boolean adviseOpened = stateAdvisor.adviseNodeOpened(tree);
if (null != adviseOpened) {
if (adviseOpened.booleanValue()) {
if (!componentState.isExpanded(rowKey)) {
componentState.expandNode(tree, rowKey);
}
}
else {
if (componentState.isExpanded(rowKey)) {
componentState.collapseNode(tree, rowKey);
}
}
}
Boolean adviseSelected = stateAdvisor.adviseNodeSelected(tree);
if (null != adviseSelected) {
if (adviseSelected.booleanValue()) {
if (!componentState.isSelected(rowKey)) {
componentState.setSelected(rowKey);
}