Adds the given {@link Widget} before the given position.

This is an O(n) operation because after the widget is inserted all the
remaining cells need to have their style sheets updated to reflect
their new position.
329624
public Widget insert(Widget w, int beforeIndex) {

        FlowPanel widgetWrapper = new FlowPanel();
        widgetWrapper.getElement().setId(Document.get().createUniqueId());
        widgetWrapper.add(w);

        flow.insert(w, beforeIndex);

        JQMContext.render(widgetWrapper.getElement().getId());
        rebase();

        return widgetWrapper;
    }
1578
function addRow(gui, dom, liBefore) {
    var li = document.createElement('li');
    if (dom) li.appendChild(dom);
    if (liBefore) {
      gui.__ul.insertBefore(li, params.before);
    } else {
      gui.__ul.appendChild(li);
    }
    gui.onResize();
    return li;
  }
448339
@Override
    public void add(Widget widget) {
        if (widget instanceof HasJqmHeader) {
            setHeader((HasJqmHeader) widget);
            return;
        } else if (widget instanceof HasJqmFooter) {
            setFooter((HasJqmFooter) widget);
            return;
        } else if (widget instanceof JQMContent) {
            throw new RuntimeException("Do not add content widgets here, call createContent() instead");
        }
        getPrimaryContent().add(widget);

        // if page is already enhanced then we need to enhance the content manually
        // if (enhanced) triggerCreate();
    }
1295285
public int put(Widget widget, String name) {
		if (widget == null) return -1;
		attach(widget);
		for (int i = 0; i < content.length; ++i)
			if (content[i] == null) {
				content[i] = new Tab(widget, name);
				this.sendElement();
				return i;
			}
		throw new IndexOutOfBoundsException();
		//return -1;
	}
1141063
public void addPositionUpdateListener(@NonNull PositionUpdateListener listener) {
        listeners.add(listener);
        listenersToRemove.remove(listener);
    }
918308
public void updatePosition() {

        setPosition(CmsPositionBean.getBoundingClientRect(m_element));
        for (Widget widget : m_buttonPanel) {
            if (widget instanceof CmsInlineEntityWidget) {
                ((CmsInlineEntityWidget)widget).positionWidget();
            }
        }
    }
697843
def insert(self, index = 0, *widgets):
        """"""
        for widget in widgets:
            self._add(widget, index)
            index +=1 # as we are moving forwards
        self._sort()
754801
public void addItemAtPosition(@NonNull IDrawerItem drawerItem, int position) {
        mDrawerBuilder.getItemAdapter().add(position, drawerItem);
    }
745743
function(node, position) {
	position = position || 'before';

	if( position == 'before'  ) {
		this._node.parentNode.insertBefore(node._node, this._node);
	} else if ( position == 'after' ) {
		this._node.parentNode.insertBefore(node._node, this.next() ? this.next()._node : null);
	}
}
510275
public MainFrame put(Widget widget) {
		widget.addTo(user);
		content = widget != null ? widget.getID() : -1;
		this.sendElement();
		return this;
	}
1120957
public void setWidget (int row, int column, Widget widget, String style)
    {
        setWidget(row, column, widget);
        if (style != null) {
            getCellFormatter().setStyleName(row, column, style);
        }
    }
468538
public void moveBefore( Row item )
	{
		if( this == item )
			return;

		Element lastTrToMove = getLastLeafTR();
		Element firstChildRow = DOM.getNextSibling( m_tr );

		// remove from its current position
		Row parentItem = m_parent;
		if( parentItem == null )
			parentItem = this.treeTable.m_rootItem;
		parentItem.getChilds().remove( this );

		// insert at the selected position
		if( item == null )
		{
			// insert at the end of the current parent

			// DOM add
			Row lastLeaf = parentItem.getLastLeaf();
			Element trToInsertAfter = lastLeaf.m_tr;
			if( trToInsertAfter != null )
			{
				int after = DOM.getChildIndex( this.treeTable.m_body, trToInsertAfter );
				int before = after + 1;

				DOM.insertChild( this.treeTable.m_body, m_tr, before );
			}
			else
			{
				DOM.appendChild( this.treeTable.m_body, m_tr );
			}

			parentItem.getChilds().add( this );
		}
		else
		{
			Row newParentItem = item.m_parent;
			if( newParentItem == null )
				newParentItem = this.treeTable.m_rootItem;
			int itemPos = item.m_parent.getChilds().indexOf( item );
			newParentItem.getChilds().add( itemPos, this );
			DOM.insertBefore( this.treeTable.m_body, m_tr, item.m_tr );
		}

		// take care of the left padding
		Element firstTd = DOM.getChild( m_tr, 0 );
		firstTd.getStyle().setPaddingLeft( getLevel() * this.treeTable.treePadding, Unit.PX );

		// update child rows
		Element nextTR = DOM.getNextSibling( m_tr );
		if( firstChildRow != null && lastTrToMove != null && hasChilds() )
		{
			while( true )
			{
				Element next = DOM.getNextSibling( firstChildRow );
				DOM.insertBefore( this.treeTable.m_body, firstChildRow, nextTR );
				if( firstChildRow == lastTrToMove )
					break;
				firstChildRow = next;
			}
		}
	}
115127
public void addBottomWidget(Widget w) {

        m_content.removeStyleName(I_CmsLayoutBundle.INSTANCE.dialogCss().alertMainContent());
        m_bottomWidgets.getElement().getStyle().clearDisplay();
        m_bottomWidgets.add(w);

    }
342928
public static void lazyInsertBefore(Element newElement, Element before) {
        if (!before.parentNode.contains(newElement)) {
            before.parentNode.insertBefore(newElement, before);
        }
    }
123428
public Cell<C, T> setWidget (C widget) {
		layout.toolkit.setWidget(layout, this, widget);
		return this;
	}
617259
public void addButtonToFront(Widget w) {

        m_buttonPanel.insert(w, 0);
        if (CmsCoreProvider.get().isIe7()) {
            m_buttonPanel.getElement().getStyle().setWidth(m_buttonPanel.getWidgetCount() * 22, Unit.PX);
        }
    }
284465
public void insert( Shape w, int beforeIndex )
	{
		if( (beforeIndex < 0) || (beforeIndex > size) )
		{
			throw new IndexOutOfBoundsException();
		}

		// Realloc array if necessary (doubling).
		if( size == array.length )
		{
			Shape[] newArray = new Shape[array.length * 2];
			for( int i = 0; i < array.length; ++i )
			{
				newArray[i] = array[i];
			}
			array = newArray;
		}

		++size;

		// Move all widgets after 'beforeIndex' back a slot.
		for( int i = size - 1; i > beforeIndex; --i )
		{
			array[i] = array[i - 1];
		}

		array[beforeIndex] = w;
	}