private LayoutConstraints<?>[] removeLayoutDelegate(boolean extractConstraints) {
    int componentCount = layoutDelegate.getComponentCount();
    LayoutConstraints<?>[] constraints = null;

    if (componentCount > 0) {
      RADVisualComponent<?>[] radComps = radContainer.getSubComponents();
      if (radComps.length
          == componentCount) { // robustness: might be called after failed layout initialization
        if (extractConstraints) {
          constraints = new LayoutConstraints<?>[componentCount];
        }

        for (int i = 0; i < componentCount; i++) {
          LayoutConstraints<?> constr = layoutDelegate.getConstraints(i);
          if (extractConstraints) {
            constraints[i] = constr;
          }
          if (constr != null) {
            radComps[i].setLayoutConstraints(layoutDelegate.getClass(), constr);
          }
        }
      }
    }
    layoutDelegate.removeAll();
    layoutDelegate.clearContainer(getPrimaryContainer(), getPrimaryContainerDelegate());
    layoutDelegate = null;
    return constraints;
  }
 public void removeAll() {
   // first store constraints in meta components
   RADVisualComponent<?>[] components = radContainer.getSubComponents();
   for (int i = 0; i < components.length; i++) {
     LayoutConstraints<?> constr = layoutDelegate.getConstraints(i);
     if (constr != null) {
       components[i].setLayoutConstraints(layoutDelegate.getClass(), constr);
     }
   }
   // remove components from layout
   layoutDelegate.removeAll();
   // clear the primary container instance
   layoutDelegate.clearContainer(getPrimaryContainer(), getPrimaryContainerDelegate());
 }