final protected function addCompositeWidget(SwatWidget $widget, $key)
    {
        if (array_key_exists($key, $this->composite_widgets)) {
            throw new SwatDuplicateIdException(
                sprintf(
                    "A composite widget with the key '%s' already exists in this " .
                        "widget.",
                    $key
                ),
                0,
                $key
            );
        }

        if ($widget->parent !== null) {
            throw new SwatException(
                'Cannot add a composite widget that already has a parent.'
            );
        }

        $this->composite_widgets[$key] = $widget;
        $widget->parent = $this;
    }