protected function getNextDirection()
    {
        switch ($this->direction) {
            case self::ORDER_BY_DIR_NONE:
                return self::ORDER_BY_DIR_ASCENDING;

            case self::ORDER_BY_DIR_ASCENDING:
                return self::ORDER_BY_DIR_DESCENDING;

            case self::ORDER_BY_DIR_DESCENDING:
            default:
                if ($this->view->default_orderby_column === null) {
                    // tri-state
                    return self::ORDER_BY_DIR_NONE;
                }

                // bi-state
                return self::ORDER_BY_DIR_ASCENDING;
        }
    }