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

        if ($this->getMessageCount() === 0) {
            return;
        }

        parent::display();

        $wrapper_div = new SwatHtmlTag('div');
        $wrapper_div->id = $this->id;
        $wrapper_div->class = $this->getCSSClassString();
        $wrapper_div->open();

        $has_dismiss_link = false;

        $message_count = count($this->display_messages);

        $count = 1;
        foreach ($this->display_messages as $key => $message) {
            if (in_array($key, $this->dismissable_messages)) {
                $has_dismiss_link = true;
            }

            $first = $count === 1;
            $last = $count === $message_count;

            $this->displayMessage($key, $message, $first, $last);

            $count++;
        }

        $wrapper_div->close();

        if ($has_dismiss_link) {
            Swat::displayInlineJavaScript($this->getInlineJavaScript());
        }
    }