function addChild(&$child) // dans classe noeud
{
$this->Children[] =& $child;
}
....
function &getRoot() // dans classe arbre
{
return $this->Root;
}
.....
// tests
$ctarbre = new TreeView(new Node(new TreeValue("onclick","display0" )));
$n0 =& $ctarbre->getRoot();
$n1 = new Node(new TreeValue("oncolck","display1" ));
$n2 = new Node(new TreeValue("oncolck","display2" ));
$n3 = new Node(new TreeValue("oncolck","display3" ));
$n4 = new Node(new TreeValue("oncolck","display4" ));
$n5 = new Node(new TreeValue("oncolck","display5" ));
$n6 = new Node(new TreeValue("oncolck","display6" ));
$n7 = new Node(new TreeValue("oncolck","display7" ));
$n8 = new Node(new TreeValue("oncolck","display8" ));
$n9 = new Node(new TreeValue("oncolck","display9" ));
$n0->addChild($n1) ;
$n0->addChild($n2) ;
$n0->addChild($n3) ;
$n1->addChild($n4);
$n1->addChild($n5);
$n1->addChild($n6);
$n4->addChild($n7);
$n3->addChild($n8);
$n0->addChild($n9);
$ctarbre->paintTreeView();
|