protected function validateRow(SwatTableViewRow $row)
    {
        if ($row instanceof SwatTableViewInputRow) {
            if ($this->has_input_row) {
                throw new SwatException(
                    'Only one input row may be added to a table-view.'
                );
            } else {
                $this->has_input_row = true;
            }
        }

        if ($row->id !== null) {
            if (array_key_exists($row->id, $this->rows_by_id)) {
                throw new SwatDuplicateIdException(
                    "A row with the id '{$row->id}' already exists " .
                        'in this table-view.',
                    0,
                    $row->id
                );
            }
        }
    }