code: private static void eraseParent(UIComponent component) {
  
          UIComponent parent = component.getParent();
          if (parent == null) {
              return;
          }
          if (parent.getChildCount() > 0) {
              List children = parent.getChildren();
              int index = children.indexOf(component);
              if (index >= 0) {
                  children.remove(index);
                  return;
              }
          }
          if (parent.getFacetCount() > 0) {
              Map facets = parent.getFacets();
              Iterator entries = facets.entrySet().iterator();
              while (entries.hasNext()) {
                  Map.Entry entry = (Map.Entry) entries.next();
                  //noinspection ObjectEquality
                  if (entry.getValue() == component) {
                      entries.remove();
                      return;
                  }
              }
          }
  
          // Throw an exception for the "cannot happen" case
          throw new IllegalStateException("Parent was not null, " +
                  "but this component not related");
  
      }
docs: <p>If the specified {@link UIComponent} has a non-null parent,
  remove it as a child or facet (as appropriate) of that parent.
  As a result, the <code>parent</code> property will always be
  <code>null</code> when this method returns.</p>
  
  @param component {@link UIComponent} to have any parent erased