private static boolean canFlatten(final RadComponent c) {
    if (!(c instanceof RadContainer container)) {
      return false;
    }
    if (c.getParent() instanceof RadRootContainer) {
      return false;
    }
    if (container.getLayoutManager().isGrid() && container.getParent().getLayoutManager().isGrid()) {
      return true;
    }
    if (container.getComponentCount() <= 1) {
      return true;
    }
    return false;
  }
private static boolean canFlatten(final RadComponent c)