List behaviors = getBehaviors();
if (behaviors != null)
{
for (Iterator i = behaviors.iterator(); i.hasNext();)
{
IBehavior behavior = (IBehavior)i.next();
// Always detach models, 'accepted' or not. Otherwise, if they
// are accepted during render, but not here - something can go
// undetached, and calling isEnabled can also lead to nasty side
// effects. See for instance Timo's comment on
// http://issues.apache.org/jira/browse/WICKET-673
behavior.detach(this);
if (behavior.isTemporary())
{
removeBehavior(behavior);
}
}
}