protected function updateSize()
    {
        $sizeY = abs($this->startY);
        $sizeX = 0;
        foreach ($this->elements as $idx => $element) {
            $sizeY += $element->getHeight() + $this->margin;

            if (abs($element->getX()) + $element->getWidth() > $sizeX) {
                $sizeX = abs($element->getX()) + $element->getWidth();
            }
        }

        $this->setSize($sizeX, $sizeY);
    }