protected function displayNode(
        SwatTreeFlydownNode $node,
        $level = 0,
        $selected = false
    ) {
        $children = $node->getChildren();
        $flydown_option = $node->getOption();

        if (
            $level == 1 &&
            count($children) > 0 &&
            end($flydown_option->value) === null &&
            !($flydown_option instanceof SwatFlydownDivider)
        ) {
            $optgroup_tag = new SwatHtmlTag('optgroup');
            $optgroup_tag->label = $flydown_option->title;
            $optgroup_tag->open();
            foreach ($node->getChildren() as $child_node) {
                $this->displayNode($child_node, $level + 1, $selected);
            }

            $optgroup_tag->close();
        } else {
            $option_tag = new SwatHtmlTag('option');

            if ($this->serialize_values) {
                $salt = $this->getForm()->getSalt();
                $option_tag->value = SwatString::signedSerialize(
                    $flydown_option->value,
                    $salt
                );
            } else {
                $option_tag->value = (string) $flydown_option->values;
            }

            if ($flydown_option instanceof SwatFlydownDivider) {
                $option_tag->disabled = 'disabled';
                $option_tag->class = 'swat-flydown-option-divider';
            } else {
                $option_tag->removeAttribute('disabled');
                $option_tag->removeAttribute('class');
            }

            if (
                $this->path === $flydown_option->value &&
                $selected === false &&
                !($flydown_option instanceof SwatFlydownDivider)
            ) {
                $option_tag->selected = 'selected';
                $selected = true;
            } else {
                $option_tag->removeAttribute('selected');
            }

            $option_tag->setContent($flydown_option->title);
            $option_tag->display();

            foreach ($children as $child_node) {
                $this->displayNode($child_node, $level + 1, $selected);
            }
        }
    }