
function dataInfo(){
	this.name='';
	this.firstname='';
	this.children=[]; // contient la liste du dataInfo
	this.parent=null; // pointe vers le dataInfo parent
	this.level = 0; // profondeur dans la hierarchie ( = nombre d'ancètre en fait)
	this.index = 0; // index de l'objet dans le tableau gDataList. utile pour getParentIndex
	this.nextSibling; // si le dataInfo est un fils, indique son frère suivant dans la liste des fils du parent
}

var gDataList = []; // liste de tous les dataInfo

/*
lors de l'initialisation de ce tableau, on veillera à bien remplir correctement
toutes les proprietes de chaque dataInfo
*/


var theview =  {
	rowCount:0, // y mettre le nombre d'element gDataList.length
	selection:null,
	treebox:null,
	widget:null,

	getCellText  : function (  row , col) {
		if(col.id=='nom')
			return gDataList[row].name;
		else
			return gDataList[row].firstname;
	},
	getCellValue  : function (  row , col )  {return '';},
	getImageSrc  : function (  row , col )  {return '';},
	getLevel  : function (  row )  {
		return gDataList[row].level;
	},

	getParentIndex  : function (  row ){
		if(gDataList[row].parent)
			return gDataList[row].parent.index;
		else
			return 0;
	},

	getProgressMode  : function (  row , col )   {},
	getCellProperties  : function (  row , col , properties ) { },
	getColumnProperties  : function ( col , properties ){},
	getRowProperties  : function (  row , properties ){ },
	hasNextSibling  : function (  row , afterIndex ){
		return (gDataList[row].nextSibling != null);
	},
	isContainer  : function (  row )    {
		return (gDataList[row].children.length > 0);
	},
	isContainerEmpty  : function (  row )  {
		return (gDataList[row].children.length > 0);
	},
	isContainerOpen  : function (  row )  {
		return true;
	},

	isEditable  : function (  row , col )  {return false;},
	isSeparator  : function (  row )    {return false;},
	isSorted  : function ( )    {return false;},
	performAction  : function ( action )    {},
	performActionOnCell  : function ( action ,  row , col )   {},
	performActionOnRow  : function (  action ,  row )   {},
	selectionChanged  : function ( )    {},
	setCellText  : function (  row , col , value )    {},
	setTree  : function ( tree )    { this.treebox = tree;},
	toggleOpenState  : function (  row ) { },
	canDrop : function ( row , orientation ) { return false;},
	drop  : function (  row ,  orientation ) {},
	cycleCell  : function (  row , col ) {},
	cycleHeader  : function ( col ) {}
}



function load(){
	theview.rowCount= gDataList.length;
	//alert(theview.rowCount);
	document.getElementById("thetree").view = theview;
}


