code: protected void insert(Widget child, Element container, int beforeIndex, boolean domInsert) {
  
          // Validate index; adjust if the widget is already a child of this panel.
          beforeIndex = adjustIndex(child, beforeIndex);
  
          // Detach new child.
          child.removeFromParent();
  
          // Logical attach.
          getChildren().insert(child, beforeIndex);
  
          // Physical attach.
          if (domInsert) {
              DOM.insertChild(container, child.getElement(), beforeIndex);
          } else {
              DOM.appendChild(container, child.getElement());
          }
  
          // Adopt.
          adopt(child);
      }
docs: Insert a new child Widget into this Panel at a specified index, attaching
  its Element to the specified container Element. The child Element will
  either be attached to the container at the same index, or simply appended
  to the container, depending on the value of <code>domInsert</code>.
  
  @param child the child Widget to be added
  @param container the Element within which <code>child</code> will be
  contained
  @param beforeIndex the index before which <code>child</code> will be
  inserted
  @param domInsert if <code>true</code>, insert <code>child</code> into
  <code>container</code> at <code>beforeIndex</code>; otherwise
  append <code>child</code> to the end of <code>container</code>.