// We could conceivably be HTML over some other protocol!
if (getRequestCycle() instanceof WebRequestCycle)
{
// The persistence manager responsible to persist and retrieve
// FormComponent data
final IValuePersister persister = getValuePersister();
// Search for FormComponent children. Ignore all other
visitFormComponentsPostOrder(new FormComponent.AbstractVisitor()
{
@Override
public void onFormComponent(final FormComponent<?> formComponent)
{
if (formComponent.isVisibleInHierarchy())
{
// If persistence is switched on for that FormComponent
// ...
if (formComponent.isPersistent())
{
// Save component's data (e.g. in a cookie)
persister.save(formComponent);
}
else
{
// Remove component's data (e.g. cookie)
persister.clear(formComponent);
}
}
}
});
}