public void remove(int index, boolean destroy) {
AComponent removedComponent = children.remove(index);
if (removedComponent != null) {
removedComponent.setParent(null);
removedComponent.onParentChangedEvent().fireEvent(new ParentChangedEventArgs(null, removedComponent));
if (destroy) {
removedComponent.destroy();
}
}
parent.onChildRemoved(removedComponent, index);