protected function displayBar()
    {
        // ensure length is in cascading style-sheet units
        $dimension_pattern = '/([0-9]+(%|p[xtc]|e[mx]|in|[cm]m|)|auto)/';
        if (preg_match($dimension_pattern, $this->length) === 0) {
            throw new SwatException(
                sprintf(
                    '$length must be specified in ' .
                        'cascading style-sheet units. Value was: %s',
                    $this->length
                )
            );
        }

        $bar_div_tag = new SwatHtmlTag('div');
        $bar_div_tag->id = "{$this->id}_bar";
        $bar_div_tag->class = 'swat-progress-bar-bar';

        $full_div_tag = new SwatHtmlTag('div');
        $full_div_tag->id = "{$this->id}_full";
        $full_div_tag->class = 'swat-progress-bar-full';
        $full_div_tag->setContent('');

        $empty_div_tag = new SwatHtmlTag('div');
        $empty_div_tag->id = "{$this->id}_empty";
        $empty_div_tag->class = 'swat-progress-bar-empty';
        $empty_div_tag->setContent('');

        $full_length = min(100, round($this->value * 100, 4));
        $full_length = sprintf('%s%%', $full_length);

        $empty_length = max(0, round(100 - $this->value * 100, 4));
        $empty_length = sprintf('%s%%', $empty_length);

        switch ($this->orientation) {
            case self::ORIENTATION_LEFT_TO_RIGHT:
            default:
                $bar_div_tag->class .= ' swat-progress-bar-left-to-right';
                $bar_div_tag->style = sprintf('width: %s;', $this->length);
                $full_div_tag->style = sprintf('width: %s;', $full_length);
                $empty_div_tag->style = sprintf('width: %s;', $empty_length);
                break;

            case self::ORIENTATION_RIGHT_TO_LEFT:
                $bar_div_tag->class .= ' swat-progress-bar-right-to-left';
                $bar_div_tag->style = sprintf('width: %s;', $this->length);
                $full_div_tag->style = sprintf('width: %s;', $full_length);
                $empty_div_tag->style = sprintf('width: %s;', $empty_length);
                break;

            case self::ORIENTATION_BOTTOM_TO_TOP:
                $bar_div_tag->class .= ' swat-progress-bar-bottom-to-top';
                $bar_div_tag->style = sprintf('height: %s;', $this->length);
                $full_div_tag->style = sprintf(
                    'height: %s; top: %s;',
                    $full_length,
                    $empty_length
                );

                $empty_div_tag->style = sprintf(
                    'height: %s; top: -%s;',
                    $empty_length,
                    $full_length
                );

                break;

            case self::ORIENTATION_TOP_TO_BOTTOM:
                $bar_div_tag->class .= ' swat-progress-bar-top-to-bottom';
                $bar_div_tag->style = sprintf('height: %s;', $this->length);
                $full_div_tag->style = sprintf('height: %s;', $full_length);
                $empty_div_tag->style = sprintf('height: %s;', $empty_length);
                break;
        }

        $bar_div_tag->open();
        $full_div_tag->display();
        $empty_div_tag->display();
        $bar_div_tag->close();
    }