code: protected void doAdopt(Widget w) {
      Widget parent = w.getParent();
      boolean mustBePhysicallyReattach = false;
  
      if (parent == null) {
        if (RootPanel.isInDetachList(w)) {
          RootPanel.detachNow(w);
        }
      } else if (parent instanceof HTMLPanel) {
        WidgetsUtils.doLogicalDetachFromHtmlPanel(w);
      } else {
        // the widget will be physically detach
        w.removeFromParent();
        mustBePhysicallyReattach = true;
      }
  
      getChildren().add(w);
  
      if (mustBePhysicallyReattach) {
        DOM.appendChild(getElement(), w.getElement());
      }
  
      adopt(w);
    }
docs: Adopt the {@link Widget widet} <code>w</code>. if the current parent of the
  widget is an {@link HTMLPanel} or is null, the widget will not detach
  physically in order to maintain the html structure. If the parent is an
  other widget, it will be physically detach and reattach to this panel.
  
  @param w