public function display()
    {
        $options = $this->getOptions();

        if (!$this->visible || $options === null) {
            return;
        }

        SwatWidget::display();

        // add a hidden field so we can check if this list was submitted on
        // the process step
        $this->getForm()->addHiddenField($this->id . '_submitted', 1);

        if (count($options) === 1) {
            // get first and only element
            $this->displaySingle(current($options));
            return;
        }

        $ul_tag = new SwatHtmlTag('ul');
        $ul_tag->id = $this->id;
        $ul_tag->class = $this->getCSSClassString();
        $ul_tag->open();

        $li_tag = new SwatHtmlTag('li');
        $index = 0;

        foreach ($options as $option) {
            // add option-specific CSS classes from option metadata
            $classes = $this->getOptionMetadata($option, 'classes');
            if (is_array($classes)) {
                $li_tag->class = implode(' ', $classes);
            } elseif ($classes) {
                $li_tag->class = strval($classes);
            } else {
                $li_tag->removeAttribute('class');
            }

            $sensitive = $this->getOptionMetadata($option, 'sensitive');
            if ($sensitive === false || !$this->isSensitive()) {
                if ($li_tag->class === null) {
                    $li_tag->class = 'swat-insensitive';
                } else {
                    $li_tag->class .= ' swat-insensitive';
                }
            }

            if ($option instanceof SwatFlydownDivider) {
                if ($li_tag->class === null) {
                    $li_tag->class = 'swat-radio-list-divider-li';
                } else {
                    $li_tag->class .= ' swat-radio-list-divider-li';
                }
            }

            $li_tag->id = $this->id . '_li_' . (string) $index;
            $li_tag->open();

            if ($option instanceof SwatFlydownDivider) {
                $this->displayDivider($option, $index);
            } else {
                $this->displayOption($option, $index);
                $this->displayOptionLabel($option, $index);
            }

            $li_tag->close();
            $index++;
        }

        $ul_tag->close();
    }