private void saveDescendantState(UIComponent component, FacesContext context) {
Map<String, SavedState> saved = (Map<String, SavedState>) getStateHelper().get(PropertyKeys.saved);
if(component instanceof EditableValueHolder) {
EditableValueHolder input = (EditableValueHolder) component;
SavedState state = null;
String clientId = component.getClientId(context);
if(saved == null) {
state = new SavedState();
getStateHelper().put(PropertyKeys.saved, clientId, state);
}
if(state == null) {
state = saved.get(clientId);
if(state == null) {
state = new SavedState();
getStateHelper().put(PropertyKeys.saved, clientId, state);
}
}
state.setValue(input.getLocalValue());
state.setValid(input.isValid());
state.setSubmittedValue(input.getSubmittedValue());
state.setLocalValueSet(input.isLocalValueSet());
}
for(UIComponent uiComponent : component.getChildren()) {
saveDescendantState(uiComponent, context);
}