void (@NotNull final RadComponent component, int index) { if (myComponents.contains(component)) { throw new IllegalArgumentException("component is already added: " + component); } final RadComponent[] oldChildren = myComponents.toArray(RadComponent.EMPTY_ARRAY); // Remove from old parent final RadContainer oldParent = component.getParent(); if (oldParent != null) { oldParent.removeComponent(component); } // Attach to new parent myComponents.add(index, component); component.setParent(this); myLayoutManager.addComponentToContainer(this, component, index); final RadComponent[] newChildren = myComponents.toArray(RadComponent.EMPTY_ARRAY); firePropertyChanged(PROP_CHILDREN, oldChildren, newChildren); }