for (int i = components.length - 1; i >= 0; i--) {
Component component = (Component) components[i];
remove(component);
// remove any state listeners that are still registered
if (component instanceof ComponentImpl) {
ComponentImpl si = (ComponentImpl) component;
si.removeStateListeners();
}
}
}