public function setFromStock($stock_id, $overwrite_properties = true)
    {
        switch ($stock_id) {
            case 'submit':
                $title = Swat::_('Submit');
                $class = 'swat-button-submit';
                break;

            case 'create':
                $title = Swat::_('Create');
                $class = 'swat-button-create';
                break;

            case 'add':
                $title = Swat::_('Add');
                $class = 'swat-button-add';
                break;

            case 'apply':
                $title = Swat::_('Apply');
                $class = 'swat-button-apply';
                break;

            case 'delete':
                $title = Swat::_('Delete');
                $class = 'swat-button-delete';
                break;

            case 'cancel':
                $title = Swat::_('Cancel');
                $class = 'swat-button-cancel';
                break;

            default:
                throw new SwatUndefinedStockTypeException(
                    "Stock type with id of '{$stock_id}' not found.",
                    0,
                    $stock_id
                );
        }

        if ($overwrite_properties || $this->title === null) {
            $this->title = $title;
        }

        $this->stock_class = $class;
    }