if (FacesUtils.hasValueBindingOrValueExpression(this, Attributes.STATE)) {
final FacesContext facesContext = FacesContext.getCurrentInstance();
TreeState state = (TreeState)
FacesUtils.getValueFromValueBindingOrValueExpression(facesContext, this, Attributes.STATE);
if (state == null) {
state = new TreeState(new ExpandedState(2), new MarkedState());
FacesUtils.setValueOfBindingOrExpression(facesContext, state, this, Attributes.STATE);
}
return state;
} else {
state = new TreeState(new ExpandedState(2), new MarkedState());
return state;
}
}
}