protected void insert(Widget child, int beforeIndex) {
// Validate index; adjust if the widget is already a child of this
// panel.
beforeIndex = adjustIndex(child, beforeIndex);
if (!fireCancellableEvent(new BeforeAddEvent(child, beforeIndex))) {
return;
}
// Detach new child.
child.removeFromParent();