public function setViewSelector(
        SwatView $view,
        SwatViewSelector $selector = null
    ) {
        if ($view === null) {
            $selector = null;
        } else {
            if ($selector === null) {
                $selector = $view->getFirstDescendant('SwatViewSelector');
            }

            if ($selector === null) {
                throw new SwatException(
                    'No selector was specified and view does not have a ' .
                        'selector'
                );
            }
        }

        $this->view = $view;
        $this->selector = $selector;
    }