public function setTree($tree)
    {
        if ($tree instanceof SwatDataTreeNode) {
            $tree = SwatTreeFlydownNode::convertFromDataTree($tree);
        } elseif (!($tree instanceof SwatTreeFlydownNode)) {
            throw new SwatInvalidClassException(
                'Tree must be an intance of ' .
                    'either SwatDataTreeNode or SwatTreeFlydownNode.',
                0,
                $tree
            );
        }

        $this->tree = $tree;
    }