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

        parent::display();

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

        echo '<span class="swat-date-entry-span">';

        foreach ($this->getDatePartOrder() as $datepart) {
            if ($datepart == 'd' && $this->display_parts & self::DAY) {
                $day_flydown = $this->getCompositeWidget('day_flydown');

                if ($day_flydown->value === null && $this->value !== null) {
                    $day_flydown->value = $this->value->getDay();
                }

                $day_flydown->display();
            } elseif ($datepart == 'm' && $this->display_parts & self::MONTH) {
                $month_flydown = $this->getCompositeWidget('month_flydown');

                if ($month_flydown->value === null && $this->value !== null) {
                    $month_flydown->value = $this->value->getMonth();
                }

                $month_flydown->display();
            } elseif ($datepart == 'y' && $this->display_parts & self::YEAR) {
                $year_flydown = $this->getCompositeWidget('year_flydown');

                if ($year_flydown->value === null && $this->value !== null) {
                    $year_flydown->value = $this->value->getYear();
                }

                $year_flydown->display();
            }
        }

        echo '</span>';

        if ($this->display_parts & self::CALENDAR) {
            $calendar = $this->getCompositeWidget('calendar');
            $calendar->display();
        }

        if ($this->display_parts & self::TIME) {
            $time_entry = $this->getCompositeWidget('time_entry');

            // if we aren't using the current date then we won't use the
            // current time
            if (!$this->use_current_date) {
                $time_entry->use_current_time = false;
            }

            echo ' ';
            if ($time_entry->value === null && $this->value !== null) {
                $time_entry->value = $this->value;
            }

            $time_entry->display();
        }

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

        $div_tag->close();
    }