public void removeComponent(RADVisualComponent<?> radComp, int index) {
    // first store constraints in the meta component
    LayoutConstraints<?> constr = layoutDelegate.getConstraints(index);
    if (constr != null) {
      radComp.setLayoutConstraints(layoutDelegate.getClass(), constr);
    }
    // remove the component from layout
    layoutDelegate.removeComponent(index);
    // remove the component instance from the primary container instance
    if (!layoutDelegate.removeComponentFromContainer(
        getPrimaryContainer(),
        getPrimaryContainerDelegate(),
        (Component)
            radComp
                .getBeanInstance())) { // layout delegate does not support removing individual
                                       // components,
      // so we clear the container and add the remaining components again
      layoutDelegate.clearContainer(getPrimaryContainer(), getPrimaryContainerDelegate());

      RADVisualComponent<?>[] radComps = radContainer.getSubComponents();
      if (radComps.length > 1) {
        // we rely on that radcomp was not removed from the model yet
        Component[] comps = new Component[radComps.length - 1];
        for (int i = 0; i < radComps.length; i++) {
          if (i != index) {
            Component comp = (Component) radComps[i].getBeanInstance();
            comps[i < index ? i : i - 1] = comp;
          }
        }
        layoutDelegate.addComponentsToContainer(
            getPrimaryContainer(), getPrimaryContainerDelegate(), comps, 0);
      }
    }
  }