<?php

/**
 * Tree view
 *
 * @version DR1.4.2
 */
class Tree extends View implements IReadableView {



	protected $package = 'core-tree';
	protected $idRequired = true;



	public function expandAll() {
throw new Exception('FIXME!');
	}



	public function colapseAll() {
throw new Exception('FIXME!');
	}



	public function __toString() {
		$nodes = $this->getFamily(false);
		foreach ($nodes as $node) {
			if ($node instanceof TreeNode) {
				$nodeId = $node->getId();
				$node->treeName = $this->id;
				$node->addListener(new ClickListener(new Behaviour("Tree.setValue('{$this->id}', Tree.getNodeValue('$nodeId'))")));
				$node->addListener(new ClickListener(new Behaviour("Tree.selectNode('$nodeId')")));
			}
		}
		return parent::__toString();
	}



	/**
	 * Returns Javascript for reading widget value
	 * @since DR1.2
	 */
	public function valueReader() {
		return "Tree.getValue('{$this->id}')";
	}



	/**
	 * Returns Javascript for setting up error message
	 * @since DR1.2
	 */
	public function errorMessage($message) {
throw new Exception('FIXME!');
	}



	/**
	 * Returns Javascript for clearing error message
	 * @since DR1.2
	 */
	public function clearError() {
//throw new Exception('FIXME!');
	}



} // class Tree

?>