public function display()
    {
        if (!$this->visible) {
            return;
        }

        SwatWidget::display();

        // default header level is h2
        $level = 2;
        $ancestor = $this->parent;

        // get appropriate header level, limit to h6
        while ($ancestor !== null && $level < 6) {
            if ($ancestor instanceof SwatFrame) {
                $level++;
            }

            $ancestor = $ancestor->parent;
        }

        $header_tag = new SwatHtmlTag('h' . $level);
        $header_tag->class = 'swat-frame-title';

        $control_div = $this->getControlDivTag();
        $span_tag = $this->getSpanTag();
        $input_tag = $this->getInputTag();
        $container_div = $this->getContainerDivTag();
        $container_div->class .= ' swat-frame-contents';
        $animate_div = $this->getAnimateDivTag();

        $control_div->open();

        $header_tag->open();
        $span_tag->display();
        $header_tag->close();

        $input_tag->display();

        $animate_div->open();
        echo '<div>';
        $container_div->open();
        $this->displayChildren();
        $container_div->close();
        echo '</div>';
        $animate_div->close();

        Swat::displayInlineJavaScript($this->getInlineJavascript());

        $control_div->close();
    }